Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
cec7af95
Commit
cec7af95
authored
Feb 26, 2018
by
Alexander David Hellwig
Browse files
Added Test for distributed component with a struct
parent
0577810a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/middleware/DistributedTargetGenerator.java
View file @
cec7af95
...
...
@@ -24,6 +24,12 @@ public class DistributedTargetGenerator extends CMakeGenerator {
//this.add(rosMsgImpl,"rosmsg/");
}
@Override
public
void
setGenerationTargetPath
(
String
path
)
{
super
.
setGenerationTargetPath
(
path
);
rosMsgImpl
.
setGenerationTargetPath
(
generationTargetPath
+
(
generationTargetPath
.
endsWith
(
"/"
)
?
""
:
"/"
)
+
"rosMsg/"
);
}
@Override
public
List
<
File
>
generate
(
ExpandedComponentInstanceSymbol
componentInstanceSymbol
,
TaggingResolver
taggingResolver
)
throws
IOException
{
Map
<
PortSymbol
,
RosConnectionSymbol
>
resolvedTags
=
TagHelper
.
resolveTags
(
taggingResolver
,
componentInstanceSymbol
);
...
...
@@ -59,6 +65,7 @@ public class DistributedTargetGenerator extends CMakeGenerator {
}
files
.
addAll
(
cmakeListsGenerator
.
generate
(
componentInstanceSymbol
,
taggingResolver
));
files
.
addAll
(
rosMsgImpl
.
generate
(
componentInstanceSymbol
,
taggingResolver
));
return
files
;
}
...
...
src/test/java/de/monticore/lang/monticar/generator/middleware/GenerationTest.java
View file @
cec7af95
...
...
@@ -10,6 +10,7 @@ import de.monticore.lang.monticar.generator.middleware.impls.DummyMiddlewareSymb
import
de.monticore.lang.monticar.generator.middleware.impls.RosCppGenImpl
;
import
de.monticore.lang.monticar.generator.roscpp.helper.TagHelper
;
import
de.monticore.lang.tagging._symboltable.TaggingResolver
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
java.io.File
;
...
...
@@ -98,6 +99,27 @@ public class GenerationTest extends AbstractSymtabTest {
distributedTargetGenerator
.
generate
(
componentInstanceSymbol
,
taggingResolver
);
}
//TODO: implement feature
@Ignore
@Test
public
void
testDistributedStructTargetGenerator
()
throws
IOException
{
TaggingResolver
taggingResolver
=
createSymTabAndTaggingResolver
(
"src/test/resources/"
);
RosToEmamTagSchema
.
registerTagTypes
(
taggingResolver
);
ExpandedComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"tests.dist.distWithStructComp"
,
ExpandedComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
TagHelper
.
resolveTags
(
taggingResolver
,
componentInstanceSymbol
);
DistributedTargetGenerator
distributedTargetGenerator
=
new
DistributedTargetGenerator
();
distributedTargetGenerator
.
setGenerationTargetPath
(
"./target/generated-sources-cmake/distributedStruct/src/"
);
distributedTargetGenerator
.
add
(
new
CPPGenImpl
(),
"cpp"
);
distributedTargetGenerator
.
add
(
new
RosCppGenImpl
(),
"roscpp"
);
distributedTargetGenerator
.
generate
(
componentInstanceSymbol
,
taggingResolver
);
}
@Test
public
void
testMutliMwGenerateAll
()
throws
IOException
{
testMutliMw
(
"allMw"
,
true
,
true
);
...
...
src/test/resources/tests/dist/DistWithStructComp.emam
0 → 100644
View file @
cec7af95
package
tests
.
dist
;
import
tests
.
struct
.
Position
;
component
DistWithStructComp
{
port
out
Position
resOut
;
component
SubComp1
{
ports
out
Position
out1
,
out
Position
out2
;
implementation
Math
{
out1
.
longitude
=
out1
.
longitude
+
1
;
out1
.
latitude
=
out1
.
latitude
-
1
;
out2
.
longitude
=
out2
.
longitude
+
10
;
out2
.
latitude
=
out2
.
latitude
-
10
;
}
}
component
SubComp2
{
ports
in
Position
in1
,
in
Position
in2
,
out
Position
resOut
;
implementation
Math
{
resOut
.
longitude
=
in1
.
longitude
+
in2
.
longitude
;
resOut
.
latitude
=
in1
.
latitude
+
in2
.
latitude
;
}
}
instance
SubComp1
sub1
;
instance
SubComp2
sub2
;
connect
sub1
.
out1
->
sub2
.
in1
;
connect
sub1
.
out2
->
sub2
.
in2
;
connect
sub2
.
resOut
->
resOut
;
}
\ No newline at end of file
src/test/resources/tests/dist/StructDist.tag
0 → 100644
View file @
cec7af95
package
tests
.
dist
;
conforms
to
de
.
monticore
.
lang
.
monticar
.
generator
.
roscpp
.
RosToEmamTagSchema
;
tags
StructDist
{
tag
distWithStructComp
.
sub1
.
out1
with
RosConnection
;
tag
distWithStructComp
.
sub1
.
out2
with
RosConnection
;
tag
distWithStructComp
.
sub2
.
in1
with
RosConnection
;
tag
distWithStructComp
.
sub2
.
in2
with
RosConnection
;
tag
distWithStructComp
.
sub2
.
resOut
with
RosConnection
;
tag
distWithStructComp
.
resOut
with
RosConnection
;
}
\ No newline at end of file
src/test/resources/tests/struct/Position.struct
0 → 100644
View file @
cec7af95
package
tests
.
struct
;
struct
Position
{
Q
longitude
;
Q
latitude
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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