Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
43fdb3de
Commit
43fdb3de
authored
Dec 09, 2011
by
Daniel Ratiu
Browse files
Major refactorings of tests. We are reaching soon the yellow status.
refs 311
parent
6798d6d8
Changes
29
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/ComponentTestModelBase.java
View file @
43fdb3de
...
...
@@ -22,7 +22,7 @@ import org.fortiss.af3.component.model.ComponentArchitecture;
import
org.fortiss.af3.component.utils.ComponentModelElementFactory
;
import
org.fortiss.af3.project.model.execution.ExecutionConfiguration
;
import
test.org.fortiss.af3.expression.ExpressionTestModelBase
;
import
test.org.fortiss.af3.expression.
model.
ExpressionTestModelBase
;
/**
* Base class for component tests.
...
...
@@ -30,7 +30,7 @@ import test.org.fortiss.af3.expression.ExpressionTestModelBase;
* @author ratiu
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
RED Hash:
* @ConQAT.Rating
YELLOW Hash: 0F3F5EB8694223419A5B4269290D0166
*/
public
class
ComponentTestModelBase
extends
ExpressionTestModelBase
{
...
...
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/model/CounterTestModel.java
View file @
43fdb3de
...
...
@@ -42,24 +42,24 @@ import test.org.fortiss.af3.component.ComponentTestModelBase;
* @author ratiu
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
RED Hash:
* @ConQAT.Rating
YELLOW Hash: DAB413721838ABAADAE4478BD1D86EE4
*/
public
class
CounterTestModel
extends
ComponentTestModelBase
{
/** The Counter component. */
p
rotected
Component
counterComponent
;
p
ublic
Component
counterComponent
;
/** The input port of Counter component. */
p
rotected
InputPort
inputPort
;
p
ublic
InputPort
inputPort
;
/** The feedback input port of Counter component. */
p
rotected
InputPort
feedbackInputPort
;
p
ublic
InputPort
feedbackInputPort
;
/** The feedback channel. */
p
rotected
Channel
feedbackChannel
;
p
ublic
Channel
feedbackChannel
;
/** The output port of Counter component. */
p
rotected
OutputPort
outputPort
;
p
ublic
OutputPort
outputPort
;
/** Executable component. */
protected
ExecutableComponent
<?>
executable
;
...
...
@@ -74,21 +74,6 @@ public class CounterTestModel extends ComponentTestModelBase {
createCounterComponent
();
}
/** Returns the counter test component. */
public
Component
getCounterComponent
()
{
return
counterComponent
;
}
/** Returns the output port. */
public
OutputPort
getOutputPort
()
{
return
outputPort
;
}
/** Returns the input port. */
public
InputPort
getInputPort
()
{
return
inputPort
;
}
/** Creates the counter component. */
private
void
createCounterComponent
()
{
counterComponent
=
createComponent
(
"Counter"
,
"Counter"
);
...
...
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/model/OneBitHalfAdderTestModel.java
View file @
43fdb3de
...
...
@@ -37,7 +37,7 @@ import test.org.fortiss.af3.component.ComponentTestModelBase;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating
RED Hash:
* @ConQAT.Rating
YELLOW Hash: 425CCDECB973F27D08CACDF64BE264F4
*/
public
class
OneBitHalfAdderTestModel
extends
ComponentTestModelBase
{
...
...
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/model/package.html
0 → 100644
View file @
43fdb3de
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: 2AE07908CA65C5FFDFE18A59636AFB22
-->
<body>
This package contains test-models.
</body>
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/package.html
0 → 100644
View file @
43fdb3de
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: DC2B72A8A7F1A0B0AF33BAF2AC81B657
-->
<body>
Base package for component tests.
</body>
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/simulator/ComponentSimulatorTestBase.java
View file @
43fdb3de
...
...
@@ -17,18 +17,17 @@ $Id$
+--------------------------------------------------------------------------*/
package
test.org.fortiss.af3.component.simulator
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
ModelElementUtils
.
findReferencedElement
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
TransformationUtils
.
createTransformedObjectFor
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
fail
;
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.af3.component.simulator.ExecutableComponent
;
import
org.fortiss.af3.project.extension.data.ExecutionConfigTransformationContext
;
import
org.fortiss.af3.project.model.execution.ExecutionConfiguration
;
import
org.fortiss.tooling.kernel.extension.exception.ChainTransformationFailedException
;
import
org.fortiss.tooling.kernel.utils.ModelElementUtils
;
import
org.fortiss.tooling.kernel.utils.TransformationUtils
;
import
test.org.fortiss.af3.
testbase.I
TestModel
;
import
test.org.fortiss.af3.
component.Component
TestModel
Base
;
import
test.org.fortiss.af3.testbase.SimulatorTestBase
;
/**
...
...
@@ -37,41 +36,50 @@ import test.org.fortiss.af3.testbase.SimulatorTestBase;
* @author ratiu
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
RED Hash:
* @ConQAT.Rating
YELLOW Hash: 87C0601B9E172DE2016C434C7F819828
*/
public
abstract
class
ComponentSimulatorTestBase
extends
SimulatorTestBase
{
public
abstract
class
ComponentSimulatorTestBase
<
T
extends
ComponentTestModelBase
,
S
extends
ExecutableComponent
<?>>
extends
SimulatorTestBase
<
T
>
{
/** The composite simulator. */
protected
ExecutableComponent
<?>
topSimulator
;
/** The current simulator. */
protected
S
currentSimulator
;
/** Constructor. */
public
ComponentSimulatorTestBase
(
ITestModel
testModel
)
{
public
ComponentSimulatorTestBase
(
T
testModel
)
{
super
(
testModel
);
}
/** Returns the {@link ExecutionConfiguration} used to start the simulator. */
public
abstract
ExecutionConfiguration
getExecutionConfiguration
();
/**
* Assigns the value of {@link #currentSimulator}. Can be overwritten by
* descendants.
*/
@SuppressWarnings
(
"unchecked"
)
protected
void
computeCurrentSimulator
()
{
currentSimulator
=
(
S
)
topSimulator
.
getSubElements
().
get
(
0
);
}
/**
* Initializes the simulator using the configuration returned by
* {@link #getExecutionConfiguration()}. Sub-classes may override, but must
* call super implementation first.
* Initializes the simulator using the execution configuration. Sub-classes
* may override, but must call super implementation first.
*/
@Override
protected
void
setupSimulator
()
{
EObject
source
=
ModelElementUtils
.
findReferencedElement
(
getExecutionConfiguration
());
EObject
source
=
findReferencedElement
(
testModel
.
executionConfiguration
);
assertNotNull
(
source
);
try
{
topSimulator
=
TransformationUtils
.
createTransformedObjectFor
(
source
,
ExecutableComponent
.
class
,
topSimulator
=
createTransformedObjectFor
(
source
,
ExecutableComponent
.
class
,
new
ExecutionConfigTransformationContext
(
getE
xecutionConfiguration
()
));
testModel
.
e
xecutionConfiguration
));
assertNotNull
(
topSimulator
);
topSimulator
.
initialize
();
computeCurrentSimulator
();
}
catch
(
ChainTransformationFailedException
ctfe
)
{
fail
(
ctfe
.
getMessage
());
}
...
...
@@ -84,5 +92,6 @@ public abstract class ComponentSimulatorTestBase extends SimulatorTestBase {
@Override
protected
void
disposeSimulator
()
{
topSimulator
=
null
;
currentSimulator
=
null
;
}
}
\ No newline at end of file
org.fortiss.af3.component/trunk/test-src/test/org/fortiss/af3/component/simulator/package.html
0 → 100644
View file @
43fdb3de
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: B67C1D3A940416ACF2E1589F39A2BF8A
-->
<body>
This package contains base classes for the simulator test-cases.
</body>
org.fortiss.af3.expression/trunk/META-INF/MANIFEST.MF
View file @
43fdb3de
...
...
@@ -35,4 +35,5 @@ Export-Package: org.fortiss.af3.expression,
org.fortiss.af3.expression.model.types.util,
org.fortiss.af3.expression.model.util,
org.fortiss.af3.expression.utils,
test.org.fortiss.af3.expression
test.org.fortiss.af3.expression,
test.org.fortiss.af3.expression.model
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/AllTests.java
View file @
43fdb3de
...
...
@@ -36,10 +36,16 @@ import test.org.fortiss.af3.expression.parser.TypeSystemParserTest;
* @version $Rev$
* @ConQAT.Rating RED Hash: 9BD23339E200E66A46797052A68864F4
*/
// @formatter:off
@RunWith
(
Suite
.
class
)
@SuiteClasses
({
ConstraintCheckerTest
.
class
,
EvaluatorTest
.
class
,
EvaluatorTest3_Arith_NoVal_Vars
.
class
,
EvaluatorTest5_Strict
.
class
,
ParserEvaluatorTest
.
class
,
TypeSystemParserTest
.
class
})
@SuiteClasses
({
ConstraintCheckerTest
.
class
,
EvaluatorTest
.
class
,
EvaluatorTest3_Arith_NoVal_Vars
.
class
,
EvaluatorTest5_Strict
.
class
,
ParserEvaluatorTest
.
class
,
TypeSystemParserTest
.
class
})
public
class
AllTests
{
// empty class: collection of test cases
}
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/constraint/ConstraintCheckerTest.java
View file @
43fdb3de
...
...
@@ -31,7 +31,7 @@ import org.junit.Before;
import
org.junit.Test
;
/**
*
Junit t
est for constraint checkers
of microAF3
.
*
T
est for constraint checkers.
*
* @author hoelzlf
* @author $Author$
...
...
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/constraint/package.html
0 → 100644
View file @
43fdb3de
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: 2AE07908CA65C5FFDFE18A59636AFB22
-->
<body>
This package contains tests for the constraint checker.
</body>
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/evaluator/EvaluatorTest.java
View file @
43fdb3de
...
...
@@ -35,6 +35,7 @@ import org.fortiss.af3.project.model.typesystem.ITerm;
import
org.junit.Before
;
import
org.junit.Test
;
import
test.org.fortiss.af3.expression.evaluator.EvaluatorTest.TestModel
;
import
test.org.fortiss.af3.testbase.ModelTestBase
;
/**
...
...
@@ -45,7 +46,7 @@ import test.org.fortiss.af3.testbase.ModelTestBase;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
class
EvaluatorTest
extends
ModelTestBase
{
public
class
EvaluatorTest
extends
ModelTestBase
<
TestModel
>
{
/** Constructor. */
public
EvaluatorTest
()
{
...
...
@@ -55,18 +56,17 @@ public class EvaluatorTest extends ModelTestBase {
/** Testing the evaluate function. */
@Test
public
void
testComparison
()
{
TestModel
tm
=
(
TestModel
)
testModel
;
Var
accelerate
=
VarStaticImpl
.
create
(
"Accelerate"
);
t
m
.
context
.
setValue
(
accelerate
,
new
IntValue
(
10
));
t
estModel
.
context
.
setValue
(
accelerate
,
new
IntValue
(
10
));
assertEquals
(
BoolValue
.
TRUE
,
t
m
.
evaluator
.
evaluate
(
tm
.
comparisonExpression
,
t
m
.
context
));
assertEquals
(
BoolValue
.
TRUE
,
testModel
.
evaluator
.
evaluate
(
t
estModel
.
comparisonExpression
,
t
estModel
.
context
));
}
/** Testing the equality function. */
@Test
public
void
testEquality
()
{
TestModel
tm
=
(
TestModel
)
testModel
;
TestModel
tm
=
testModel
;
Var
accelerate
=
VarStaticImpl
.
create
(
"Accelerate"
);
tm
.
context
.
setValue
(
accelerate
,
new
IntValue
(
10
));
...
...
@@ -91,7 +91,7 @@ public class EvaluatorTest extends ModelTestBase {
*/
@Test
public
void
testRevealingBug194
()
{
TestModel
tm
=
(
TestModel
)
testModel
;
TestModel
tm
=
testModel
;
Var
accelerate
=
VarStaticImpl
.
create
(
"Accelerate"
);
tm
.
context
.
setValue
(
accelerate
,
NoVal
.
NOVAL
);
...
...
@@ -103,7 +103,7 @@ public class EvaluatorTest extends ModelTestBase {
}
/** Test model. */
pr
ivate
static
class
TestModel
extends
EvaluatorTestModelBase
{
pr
otected
static
class
TestModel
extends
EvaluatorTestModelBase
{
/** Accelerate > 0 */
public
FunctionCall
comparisonExpression
;
...
...
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/evaluator/EvaluatorTestModelBase.java
View file @
43fdb3de
...
...
@@ -29,7 +29,7 @@ import org.junit.After;
import
org.junit.Before
;
import
org.junit.Test
;
import
test.org.fortiss.af3.expression.ExpressionTestModelBase
;
import
test.org.fortiss.af3.expression.
model.
ExpressionTestModelBase
;
/**
* Test base implementation for expressions.
...
...
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/ExpressionTestModelBase.java
→
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/
model/
ExpressionTestModelBase.java
View file @
43fdb3de
...
...
@@ -15,16 +15,22 @@ $Id$
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
test.org.fortiss.af3.expression
;
package
test.org.fortiss.af3.expression
.model
;
import
org.fortiss.af3.expression.language.Compiler
;
import
org.fortiss.af3.expression.language.evaluation.EnumerationValue
;
import
org.fortiss.af3.expression.model.DataDictionary
;
import
org.fortiss.af3.expression.model.definitions.Enumeration
;
import
org.fortiss.af3.expression.model.definitions.EnumerationMember
;
import
org.fortiss.af3.expression.model.terms.FunctionCall
;
import
org.fortiss.af3.expression.utils.DataDictionaryUtils
;
import
org.fortiss.af3.expression.utils.ExpressionModelElementFactory
;
import
org.fortiss.af3.project.model.typesystem.ITypeSystem
;
import
test.org.fortiss.af3.project.ProjectTestModelBase
;
/**
*
Test b
ase implementation for
expression
s.
*
B
ase implementation for
test model
s.
*
* @author trachtenherz
* @author hoelzl
...
...
@@ -42,4 +48,19 @@ public abstract class ExpressionTestModelBase extends ProjectTestModelBase {
protected
ITypeSystem
setupTypeSystem
()
{
return
ExpressionModelElementFactory
.
createMicroTypesystem
();
}
/** creates an EnumValue from the given String */
protected
EnumerationValue
createEnumValue
(
int
enumID
,
int
enumMemberID
)
{
DataDictionary
dd
=
DataDictionaryUtils
.
findDataDictionary
(
project
,
"Data Dictionary"
);
Enumeration
enumeration
=
(
Enumeration
)
dd
.
getTypeDefinitions
(
enumID
);
EnumerationMember
enumMember
=
enumeration
.
getMembers
(
enumMemberID
);
FunctionCall
functionCall
=
(
FunctionCall
)
compiler
.
compileTerm
(
enumMember
.
getName
()
+
"()"
);
return
new
EnumerationValue
(
functionCall
,
enumMember
);
}
}
\ No newline at end of file
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/package.html
0 → 100644
View file @
43fdb3de
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: 2AE07908CA65C5FFDFE18A59636AFB22
-->
<body>
Base package for expression tests.
</body>
org.fortiss.af3.expression/trunk/test-src/test/org/fortiss/af3/expression/parser/TypeSystemParserTest.java
View file @
43fdb3de
...
...
@@ -24,7 +24,7 @@ import org.fortiss.af3.project.model.typesystem.ITerm;
import
org.junit.Assert
;
import
org.junit.Test
;
import
test.org.fortiss.af3.expression.ExpressionTestModelBase
;
import
test.org.fortiss.af3.expression.
model.
ExpressionTestModelBase
;
/**
* Tests for the type system parser.
...
...
org.fortiss.af3.project/trunk/test-src/test/org/fortiss/af3/testbase/GeneratorTestBase.java
View file @
43fdb3de
...
...
@@ -28,10 +28,11 @@ import org.junit.Before;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
abstract
class
GeneratorTestBase
extends
ModelTestBase
{
public
abstract
class
GeneratorTestBase
<
T
extends
ITestModel
>
extends
ModelTestBase
<
T
>
{
/** Constructor. */
public
GeneratorTestBase
(
ITestModel
testModel
)
{
public
GeneratorTestBase
(
T
testModel
)
{
super
(
testModel
);
}
...
...
org.fortiss.af3.project/trunk/test-src/test/org/fortiss/af3/testbase/ModelTestBase.java
View file @
43fdb3de
...
...
@@ -30,13 +30,13 @@ import org.junit.Before;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
abstract
class
ModelTestBase
extends
TestBase
{
public
abstract
class
ModelTestBase
<
T
extends
ITestModel
>
extends
TestBase
{
/** Stores the test model. */
protected
final
ITestModel
testModel
;
protected
final
T
testModel
;
/** Constructor. */
public
ModelTestBase
(
ITestModel
testModel
)
{
public
ModelTestBase
(
T
testModel
)
{
Assert
.
assertNotNull
(
testModel
);
this
.
testModel
=
testModel
;
}
...
...
org.fortiss.af3.project/trunk/test-src/test/org/fortiss/af3/testbase/SimulatorTestBase.java
View file @
43fdb3de
...
...
@@ -28,10 +28,11 @@ import org.junit.Before;
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public
abstract
class
SimulatorTestBase
extends
ModelTestBase
{
public
abstract
class
SimulatorTestBase
<
T
extends
ITestModel
>
extends
ModelTestBase
<
T
>
{
/** Constructor. */
public
SimulatorTestBase
(
ITestModel
testModel
)
{
public
SimulatorTestBase
(
T
testModel
)
{
super
(
testModel
);
}
...
...
org.fortiss.af3.state.ui/trunk/src/org/fortiss/af3/state/ui/examplewizard/SimpleTrafficLightsExampleWizard.java
View file @
43fdb3de
...
...
@@ -43,7 +43,7 @@ import org.fortiss.tooling.kernel.utils.EMFResourceUtils;
* @author becker
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating
RED Hash:
* @ConQAT.Rating
YELLOW Hash: B5346BDAF1939D5DFBDB1BDC5A004FA4
*/
public
final
class
SimpleTrafficLightsExampleWizard
extends
Wizard
implements
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment