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
languages
EmbeddedMontiArc
Commits
07e67b03
Commit
07e67b03
authored
Sep 25, 2019
by
Mike Grüne
Browse files
Added Porttypes to TaggingTest
parent
c94fdc67
Pipeline
#187389
passed with stage
in 2 minutes and 26 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/embeddedmontiarc/tagging/middleware/mqtt/MqttConnectionSymbolCreator.java
View file @
07e67b03
/**
* (c) https://github.com/MontiCore/monticore
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */
package
de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt
;
...
...
@@ -145,7 +131,7 @@ public class MqttConnectionSymbolCreator implements TagSymbolCreator {
}
Log
.
error
(
String
.
format
(
"'%s' does not match the specified regex pattern '%s'"
,
regex
,
"{topic =
(
{name},
{type}),
msgField = {msgField}}"
));
"{topic = {name}, msgField = {msgField}}"
));
return
null
;
}
...
...
src/test/java/de/monticore/lang/embeddedmontiarc/middleware/mqtt/TaggingTest.java
View file @
07e67b03
/**
* (c) https://github.com/MontiCore/monticore
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */
package
de.monticore.lang.embeddedmontiarc.middleware.mqtt
;
...
...
@@ -44,27 +30,89 @@ public class TaggingTest extends AbstractTaggingResolverTest {
EMAComponentInstanceSymbol
component
=
symtab
.<
EMAComponentInstanceSymbol
>
resolve
(
"middleware.mqtt.basicParsing"
,
EMAComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
component
);
//mqttIn
EMAPortSymbol
mqttIn
=
component
.
getPortInstance
(
"mqttIn"
).
orElse
(
null
);
assertNotNull
(
mqttIn
);
//mqttIn
Q
EMAPortSymbol
mqttIn
Q
=
component
.
getPortInstance
(
"mqttIn
Q
"
).
orElse
(
null
);
assertNotNull
(
mqttIn
Q
);
Collection
<
TagSymbol
>
tags
=
symtab
.
getTags
(
mqttIn
,
MqttConnectionSymbol
.
KIND
);
Collection
<
TagSymbol
>
tags
=
symtab
.
getTags
(
mqttIn
Q
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
MqttConnectionSymbol
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/clock"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"clock.toSec()"
);
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoQ"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"dataQ"
);
//mqttInN
EMAPortSymbol
mqttInN
=
component
.
getPortInstance
(
"mqttInN"
).
orElse
(
null
);
assertNotNull
(
mqttInN
);
tags
=
symtab
.
getTags
(
mqttInN
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoN"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"dataN"
);
//mqttInZ
EMAPortSymbol
mqttInZ
=
component
.
getPortInstance
(
"mqttInZ"
).
orElse
(
null
);
assertNotNull
(
mqttInZ
);
tags
=
symtab
.
getTags
(
mqttInZ
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoZ"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"dataZ"
);
//mqttInB
EMAPortSymbol
mqttInB
=
component
.
getPortInstance
(
"mqttInB"
).
orElse
(
null
);
assertNotNull
(
mqttInB
);
tags
=
symtab
.
getTags
(
mqttInB
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoB"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"true"
);
//mqttOutQ
EMAPortSymbol
mqttOutQ
=
component
.
getPortInstance
(
"mqttOutQ"
).
orElse
(
null
);
assertNotNull
(
mqttOutQ
);
tags
=
symtab
.
getTags
(
mqttOutQ
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoQ"
);
//mqttOutN
EMAPortSymbol
mqttOutN
=
component
.
getPortInstance
(
"mqttOutN"
).
orElse
(
null
);
assertNotNull
(
mqttOutN
);
tags
=
symtab
.
getTags
(
mqttOutN
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoN"
);
//mqttOutZ
EMAPortSymbol
mqttOutZ
=
component
.
getPortInstance
(
"mqttOutZ"
).
orElse
(
null
);
assertNotNull
(
mqttOutZ
);
tags
=
symtab
.
getTags
(
mqttOutZ
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoZ"
);
//mqttOut
EMAPortSymbol
mqttOut
=
component
.
getPortInstance
(
"mqttOut"
).
orElse
(
null
);
assertNotNull
(
mqttOut
);
//mqttOut
B
EMAPortSymbol
mqttOut
B
=
component
.
getPortInstance
(
"mqttOut
B
"
).
orElse
(
null
);
assertNotNull
(
mqttOut
B
);
tags
=
symtab
.
getTags
(
mqttOut
,
MqttConnectionSymbol
.
KIND
);
tags
=
symtab
.
getTags
(
mqttOut
B
,
MqttConnectionSymbol
.
KIND
);
assertTrue
(
tags
.
size
()
==
1
);
tag
=
(
MqttConnectionSymbol
)
tags
.
iterator
().
next
();
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echo"
);
assertEquals
(
tag
.
getMsgField
().
get
(),
"data"
);
assertEquals
(
tag
.
getTopicName
().
get
(),
"/echoB"
);
//emptyTagIn
EMAPortSymbol
emptyTagIn
=
component
.
getPortInstance
(
"emptyTagIn"
).
orElse
(
null
);
...
...
src/test/resources/middleware/mqtt/BasicParsing.ema
View file @
07e67b03
package
middleware
.
mqtt
;
component
BasicParsing
{
port
in
Q
mqttIn
;
port
in
Q
noMqttIn
;
port
in
Q
mqttIn
Q
;
port
in
Q
noMqttIn
Q
;
port
in
Q
emptyTagIn
;
port
out
Q
mqttOut
;
port
in
N
mqttInN
;
port
in
Z
mqttInZ
;
port
in
B
mqttInB
;
port
out
Q
mqttOutQ
;
port
out
Q
noMqttOut
;
port
out
N
mqttOutN
;
port
out
Z
mqttOutZ
;
port
out
B
mqttOutB
;
}
src/test/resources/middleware/mqtt/BasicParsing.tag
View file @
07e67b03
...
...
@@ -2,7 +2,13 @@ package middleware.mqtt;
conforms
to
middleware
.
mqtt
.
MqttToEmamTagSchema
;
tags
Echo
{
tag
basicParsing
.
mqttIn
with
MqttConnection
=
{
topic
=
/
clock
,
msgField
=
clock
.
toSec
()};
tag
basicParsing
.
mqttOut
with
MqttConnection
=
{
topic
=
/
echo
,
msgField
=
data
};
tag
basicParsing
.
mqttInQ
with
MqttConnection
=
{
topic
=
/
echoQ
,
msgField
=
dataQ
};
tag
basicParsing
.
mqttOutQ
with
MqttConnection
=
{
topic
=
/
echoQ
};
tag
basicParsing
.
mqttInN
with
MqttConnection
=
{
topic
=
/
echoN
,
msgField
=
dataN
};
tag
basicParsing
.
mqttOutN
with
MqttConnection
=
{
topic
=
/
echoN
};
tag
basicParsing
.
mqttInZ
with
MqttConnection
=
{
topic
=
/
echoZ
,
msgField
=
dataZ
};
tag
basicParsing
.
mqttOutZ
with
MqttConnection
=
{
topic
=
/
echoZ
};
tag
basicParsing
.
mqttInB
with
MqttConnection
=
{
topic
=
/
echoB
,
msgField
=
true
};
tag
basicParsing
.
mqttOutB
with
MqttConnection
=
{
topic
=
/
echoB
};
tag
basicParsing
.
emptyTagIn
with
MqttConnection
;
}
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