Commit 8e32458f authored by René Schöne's avatar René Schöne
Browse files

Renamed MqttUpdater to MqttHandler.

parent e3e8ea60
...@@ -27,11 +27,11 @@ aspect GenerationUtils { ...@@ -27,11 +27,11 @@ aspect GenerationUtils {
aspect AttributesForMustache { aspect AttributesForMustache {
// --- MRos2Rag --- // --- MRos2Rag ---
eq MRos2Rag.getChild().mqttUpdaterAttribute() = mqttUpdaterAttribute(); eq MRos2Rag.getChild().mqttHandlerAttribute() = mqttHandlerAttribute();
eq MRos2Rag.getChild().mqttUpdaterField() = mqttUpdaterField(); eq MRos2Rag.getChild().mqttHandlerField() = mqttHandlerField();
syn String MRos2Rag.mqttUpdaterAttribute() = getRos2Rag().mqttUpdaterAttribute(); syn String MRos2Rag.mqttHandlerAttribute() = getRos2Rag().mqttHandlerAttribute();
syn String MRos2Rag.mqttUpdaterField() = getRos2Rag().mqttUpdaterField(); syn String MRos2Rag.mqttHandlerField() = getRos2Rag().mqttHandlerField();
syn String MRos2Rag.mqttSetHostMethod() = getRos2Rag().mqttSetHostMethod(); syn String MRos2Rag.mqttSetHostMethod() = getRos2Rag().mqttSetHostMethod();
syn String MRos2Rag.mqttWaitUntilReadyMethod() = getRos2Rag().mqttWaitUntilReadyMethod(); syn String MRos2Rag.mqttWaitUntilReadyMethod() = getRos2Rag().mqttWaitUntilReadyMethod();
syn String MRos2Rag.mqttCloseMethod() = getRos2Rag().mqttCloseMethod(); syn String MRos2Rag.mqttCloseMethod() = getRos2Rag().mqttCloseMethod();
...@@ -46,7 +46,7 @@ aspect AttributesForMustache { ...@@ -46,7 +46,7 @@ aspect AttributesForMustache {
eq MUpdateDefinition.getInnerMappingDefinition().resultVarPrefix() = resultVarPrefix(); eq MUpdateDefinition.getInnerMappingDefinition().resultVarPrefix() = resultVarPrefix();
eq MUpdateDefinition.getInnerMappingDefinition(int i).inputVarName() = i == 0 ? firstInputVarName() : resultVarPrefix() + getInnerMappingDefinition(i - 1).getMappingDefinition().methodName(); eq MUpdateDefinition.getInnerMappingDefinition(int i).inputVarName() = i == 0 ? firstInputVarName() : resultVarPrefix() + getInnerMappingDefinition(i - 1).getMappingDefinition().methodName();
inh String MUpdateDefinition.mqttUpdaterAttribute(); inh String MUpdateDefinition.mqttHandlerAttribute();
syn String MUpdateDefinition.connectMethod() = updateDef().connectMethod(); syn String MUpdateDefinition.connectMethod() = updateDef().connectMethod();
syn TokenComponent MUpdateDefinition.token() = updateDef().getToken(); syn TokenComponent MUpdateDefinition.token() = updateDef().getToken();
...@@ -114,8 +114,8 @@ aspect AttributesForMustache { ...@@ -114,8 +114,8 @@ aspect AttributesForMustache {
// --- MTypeComponent --- // --- MTypeComponent ---
syn String MTypeComponent.name() = getTypeComponent().getName(); syn String MTypeComponent.name() = getTypeComponent().getName();
inh String MTypeComponent.mqttUpdaterAttribute(); inh String MTypeComponent.mqttHandlerAttribute();
inh String MTypeComponent.mqttUpdaterField(); inh String MTypeComponent.mqttHandlerField();
// --- MTokenComponent --- // --- MTokenComponent ---
syn String MTokenComponent.parentTypeName() = getTokenComponent().containingTypeDecl().getName(); syn String MTokenComponent.parentTypeName() = getTokenComponent().containingTypeDecl().getName();
...@@ -216,19 +216,19 @@ aspect AspectGeneration { ...@@ -216,19 +216,19 @@ aspect AspectGeneration {
syn String DependencyDefinition.internalRelationPrefix() = "_internal_" + getID(); syn String DependencyDefinition.internalRelationPrefix() = "_internal_" + getID();
syn String DependencyDefinition.internalTokenName() = getSource().internalName(); syn String DependencyDefinition.internalTokenName() = getSource().internalName();
syn String Ros2Rag.mqttUpdaterAttribute() = "_mqttUpdater"; syn String Ros2Rag.mqttHandlerAttribute() = "_mqttHandler";
syn String Ros2Rag.mqttUpdaterField() = "_mqttUpdater"; syn String Ros2Rag.mqttHandlerField() = "_mqttHandler";
syn String Ros2Rag.mqttSetHostMethod() = "MqttSetHost"; syn String Ros2Rag.mqttSetHostMethod() = "MqttSetHost";
syn String Ros2Rag.mqttWaitUntilReadyMethod() = "MqttWaitUntilReady"; syn String Ros2Rag.mqttWaitUntilReadyMethod() = "MqttWaitUntilReady";
syn String Ros2Rag.mqttCloseMethod() = "MqttCloseConnections"; syn String Ros2Rag.mqttCloseMethod() = "MqttCloseConnections";
// naming copy attributes // naming copy attributes
// --- mqttUpdaterAttribute --- // --- mqttHandlerAttribute ---
inh String UpdateDefinition.mqttUpdaterAttribute(); inh String UpdateDefinition.mqttHandlerAttribute();
inh String MappingDefinition.mqttUpdaterAttribute(); inh String MappingDefinition.mqttHandlerAttribute();
inh String DependencyDefinition.mqttUpdaterAttribute(); inh String DependencyDefinition.mqttHandlerAttribute();
eq Ros2Rag.getChild().mqttUpdaterAttribute() = mqttUpdaterAttribute(); eq Ros2Rag.getChild().mqttHandlerAttribute() = mqttHandlerAttribute();
// --- rootNodeName --- // --- rootNodeName ---
syn String ASTNode.rootNodeName() = rootNode.getName(); syn String ASTNode.rootNodeName() = rootNode.getName();
......
...@@ -96,18 +96,18 @@ public class Compiler { ...@@ -96,18 +96,18 @@ public class Compiler {
} }
printMessage("Writing output files"); printMessage("Writing output files");
// copy MqttUpdater into outputDir // copy MqttHandler into outputDir
final String mqttUpdaterFileName = "MqttUpdater.jadd"; final String mqttHandlerFileName = "MqttHandler.jadd";
try { try {
InputStream inputStream = Compiler.class.getClassLoader().getResourceAsStream(mqttUpdaterFileName); InputStream inputStream = Compiler.class.getClassLoader().getResourceAsStream(mqttHandlerFileName);
if (inputStream == null) { if (inputStream == null) {
throw new CompilerException("Could not open " + mqttUpdaterFileName); throw new CompilerException("Could not open " + mqttHandlerFileName);
} }
Files.copy(inputStream, Files.copy(inputStream,
Paths.get(outputDir, mqttUpdaterFileName), Paths.get(outputDir, mqttHandlerFileName),
StandardCopyOption.REPLACE_EXISTING); StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) { } catch (IOException e) {
throw new CompilerException("Could not copy " + mqttUpdaterFileName, e); throw new CompilerException("Could not copy " + mqttHandlerFileName, e);
} }
writeToFile(outputDir + "/Grammar.relast", ros2Rag.getProgram().generateAbstractGrammar()); writeToFile(outputDir + "/Grammar.relast", ros2Rag.getProgram().generateAbstractGrammar());
writeToFile(outputDir + "/ROS2RAG.jadd", ros2Rag.generateAspect(optionRootNode.getValue())); writeToFile(outputDir + "/ROS2RAG.jadd", ros2Rag.generateAspect(optionRootNode.getValue()));
......
aspect MqttUpdater { aspect MqttHandler {
/** /**
* Helper class to receive updates via MQTT and use callbacks to handle those messages. * Helper class to receive updates via MQTT and use callbacks to handle those messages.
* *
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
public class MqttUpdater { public class MqttHandler {
private static final int DEFAULT_PORT = 1883; private static final int DEFAULT_PORT = 1883;
private final org.apache.logging.log4j.Logger logger; private final org.apache.logging.log4j.Logger logger;
...@@ -23,13 +23,13 @@ public class MqttUpdater { ...@@ -23,13 +23,13 @@ public class MqttUpdater {
/** Dispatch knowledge */ /** Dispatch knowledge */
private final java.util.Map<String, java.util.function.Consumer<byte[]>> callbacks; private final java.util.Map<String, java.util.function.Consumer<byte[]>> callbacks;
public MqttUpdater() { public MqttHandler() {
this("Ros2Rag"); this("Ros2Rag");
} }
public MqttUpdater(String name) { public MqttHandler(String name) {
this.name = java.util.Objects.requireNonNull(name, "Name must be set"); this.name = java.util.Objects.requireNonNull(name, "Name must be set");
this.logger = org.apache.logging.log4j.LogManager.getLogger(MqttUpdater.class); this.logger = org.apache.logging.log4j.LogManager.getLogger(MqttHandler.class);
this.callbacks = new java.util.HashMap<>(); this.callbacks = new java.util.HashMap<>();
this.readyLock = new java.util.concurrent.locks.ReentrantLock(); this.readyLock = new java.util.concurrent.locks.ReentrantLock();
this.readyCondition = readyLock.newCondition(); this.readyCondition = readyLock.newCondition();
...@@ -37,7 +37,7 @@ public class MqttUpdater { ...@@ -37,7 +37,7 @@ public class MqttUpdater {
this.qos = org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE; this.qos = org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE;
} }
public MqttUpdater dontSendWelcomeMessage() { public MqttHandler dontSendWelcomeMessage() {
this.sendWelcomeMessage = false; this.sendWelcomeMessage = false;
return this; return this;
} }
...@@ -47,7 +47,7 @@ public class MqttUpdater { ...@@ -47,7 +47,7 @@ public class MqttUpdater {
* @throws IOException if could not connect, or could not subscribe to a topic * @throws IOException if could not connect, or could not subscribe to a topic
* @return self * @return self
*/ */
public MqttUpdater setHost(String host) throws java.io.IOException { public MqttHandler setHost(String host) throws java.io.IOException {
return setHost(host, DEFAULT_PORT); return setHost(host, DEFAULT_PORT);
} }
...@@ -56,7 +56,7 @@ public class MqttUpdater { ...@@ -56,7 +56,7 @@ public class MqttUpdater {
* @throws IOException if could not connect, or could not subscribe to a topic * @throws IOException if could not connect, or could not subscribe to a topic
* @return self * @return self
*/ */
public MqttUpdater setHost(String host, int port) throws java.io.IOException { public MqttHandler setHost(String host, int port) throws java.io.IOException {
java.util.Objects.requireNonNull(host, "Host need to be set!"); java.util.Objects.requireNonNull(host, "Host need to be set!");
this.host = java.net.URI.create("tcp://" + host + ":" + port); this.host = java.net.URI.create("tcp://" + host + ":" + port);
...@@ -109,7 +109,7 @@ public class MqttUpdater { ...@@ -109,7 +109,7 @@ public class MqttUpdater {
connection.connect(new org.fusesource.mqtt.client.Callback<Void>() { connection.connect(new org.fusesource.mqtt.client.Callback<Void>() {
@Override @Override
public void onSuccess(Void value) { public void onSuccess(Void value) {
if (MqttUpdater.this.sendWelcomeMessage) { if (MqttHandler.this.sendWelcomeMessage) {
connection.publish("components", (name + " is connected").getBytes(), org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE, false, new org.fusesource.mqtt.client.Callback<Void>() { connection.publish("components", (name + " is connected").getBytes(), org.fusesource.mqtt.client.QoS.AT_LEAST_ONCE, false, new org.fusesource.mqtt.client.Callback<Void>() {
@Override @Override
public void onSuccess(Void value) { public void onSuccess(Void value) {
......
aspect MQTT { aspect MQTT {
private MqttUpdater {{rootNodeName}}.{{mqttUpdaterField}} = new MqttUpdater(); private MqttHandler {{rootNodeName}}.{{mqttHandlerField}} = new MqttHandler();
public void {{rootNodeName}}.{{mqttSetHostMethod}}(String host) throws java.io.IOException { public void {{rootNodeName}}.{{mqttSetHostMethod}}(String host) throws java.io.IOException {
{{mqttUpdaterField}}.setHost(host); {{mqttHandlerField}}.setHost(host);
} }
public void {{rootNodeName}}.{{mqttSetHostMethod}}(String host, int port) throws java.io.IOException { public void {{rootNodeName}}.{{mqttSetHostMethod}}(String host, int port) throws java.io.IOException {
{{mqttUpdaterField}}.setHost(host, port); {{mqttHandlerField}}.setHost(host, port);
} }
public boolean {{rootNodeName}}.{{mqttWaitUntilReadyMethod}}(long time, java.util.concurrent.TimeUnit unit) { public boolean {{rootNodeName}}.{{mqttWaitUntilReadyMethod}}(long time, java.util.concurrent.TimeUnit unit) {
return {{mqttUpdaterField}}.waitUntilReady(time, unit); return {{mqttHandlerField}}.waitUntilReady(time, unit);
} }
public void {{rootNodeName}}.{{mqttCloseMethod}}() { public void {{rootNodeName}}.{{mqttCloseMethod}}() {
{{mqttUpdaterField}}.close(); {{mqttHandlerField}}.close();
} }
inh MqttUpdater ASTNode.{{mqttUpdaterAttribute}}(); inh MqttHandler ASTNode.{{mqttHandlerAttribute}}();
{{#getRootTypeComponents}} {{#getRootTypeComponents}}
eq {{rootNodeName}}.get{{name}}().{{mqttUpdaterAttribute}}() = {{mqttUpdaterField}}; eq {{rootNodeName}}.get{{name}}().{{mqttHandlerAttribute}}() = {{mqttHandlerField}};
{{/getRootTypeComponents}} {{/getRootTypeComponents}}
} }
public void {{parentTypeName}}.{{connectMethod}}(String topic) { public void {{parentTypeName}}.{{connectMethod}}(String topic) {
{{mqttUpdaterAttribute}}().newConnection(topic, message -> { {{mqttHandlerAttribute}}().newConnection(topic, message -> {
{{> mappingApplication}} {{> mappingApplication}}
{{#loggingEnabledForReads}} {{#loggingEnabledForReads}}
System.out.println("[Read] " + topic + " -> {{tokenName}} = " + {{lastResult}});{{!lastResult has to be a new attribute}} System.out.println("[Read] " + topic + " -> {{tokenName}} = " + {{lastResult}});{{!lastResult has to be a new attribute}}
......
...@@ -20,5 +20,5 @@ ...@@ -20,5 +20,5 @@
{{#loggingEnabledForWrites}} {{#loggingEnabledForWrites}}
System.out.println("[Write] {{tokenName}} = " + get{{tokenName}}() + " -> " + {{writeTopic}}); System.out.println("[Write] {{tokenName}} = " + get{{tokenName}}() + " -> " + {{writeTopic}});
{{/loggingEnabledForWrites}} {{/loggingEnabledForWrites}}
{{mqttUpdaterAttribute}}().publish({{writeTopic}}, {{lastValue}}); {{mqttHandlerAttribute}}().publish({{writeTopic}}, {{lastValue}});
} }
...@@ -5,7 +5,7 @@ import com.google.protobuf.InvalidProtocolBufferException; ...@@ -5,7 +5,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
import config.Dataconfig.DataConfig; import config.Dataconfig.DataConfig;
import config.Robotconfig.RobotConfig; import config.Robotconfig.RobotConfig;
import de.tudresden.inf.st.ros2rag.starter.Util; import de.tudresden.inf.st.ros2rag.starter.Util;
import de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater; import de.tudresden.inf.st.ros2rag.starter.ast.MqttHandler;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration; import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration; import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
...@@ -37,7 +37,7 @@ public class Main { ...@@ -37,7 +37,7 @@ public class Main {
final CountDownLatch finish = new CountDownLatch(1); final CountDownLatch finish = new CountDownLatch(1);
AtomicInteger topicMaxLength = new AtomicInteger(); AtomicInteger topicMaxLength = new AtomicInteger();
MqttUpdater receiver = new MqttUpdater("receiver stub"); MqttHandler receiver = new MqttHandler("receiver stub");
Util.setMqttHost(receiver, config); Util.setMqttHost(receiver, config);
receiver.waitUntilReady(2, TimeUnit.SECONDS); receiver.waitUntilReady(2, TimeUnit.SECONDS);
receiver.newConnection(config.topics.robotConfig, this::printRobotConfig); receiver.newConnection(config.topics.robotConfig, this::printRobotConfig);
......
package de.tudresden.inf.st.ros2rag.senderstub; package de.tudresden.inf.st.ros2rag.senderstub;
import de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater; import de.tudresden.inf.st.ros2rag.starter.ast.MqttHandler;
import panda.Linkstate; import panda.Linkstate;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -23,7 +23,7 @@ public class Main { ...@@ -23,7 +23,7 @@ public class Main {
.build(); .build();
final byte[] message = pls.toByteArray(); final byte[] message = pls.toByteArray();
MqttUpdater sender = new MqttUpdater("sender stub").dontSendWelcomeMessage(); MqttHandler sender = new MqttHandler("sender stub").dontSendWelcomeMessage();
sender.setHost("localhost", 1883); sender.setHost("localhost", 1883);
sender.waitUntilReady(2, TimeUnit.SECONDS); sender.waitUntilReady(2, TimeUnit.SECONDS);
sender.publish(topic, message); sender.publish(topic, message);
......
...@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; ...@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
public class StarterMain { public class StarterMain {
private static final Logger logger = LogManager.getLogger(StarterMain.class); private static final Logger logger = LogManager.getLogger(StarterMain.class);
private MqttUpdater mainHandler; private MqttHandler mainHandler;
private Model model; private Model model;
public void run(String[] args) throws IOException, InterruptedException { public void run(String[] args) throws IOException, InterruptedException {
...@@ -82,7 +82,7 @@ public class StarterMain { ...@@ -82,7 +82,7 @@ public class StarterMain {
logger.info("To print the current model states, send a message to the topic 'model'."); logger.info("To print the current model states, send a message to the topic 'model'.");
logger.info("To exit the system cleanly, send a message to the topic 'exit', or use Ctrl+C."); logger.info("To exit the system cleanly, send a message to the topic 'exit', or use Ctrl+C.");
mainHandler = new MqttUpdater("mainHandler"); mainHandler = new MqttHandler("mainHandler");
Util.setMqttHost(mainHandler, config); Util.setMqttHost(mainHandler, config);
mainHandler.waitUntilReady(2, TimeUnit.SECONDS); mainHandler.waitUntilReady(2, TimeUnit.SECONDS);
mainHandler.newConnection("exit", bytes -> exitCondition.countDown()); mainHandler.newConnection("exit", bytes -> exitCondition.countDown());
...@@ -97,7 +97,7 @@ public class StarterMain { ...@@ -97,7 +97,7 @@ public class StarterMain {
this.close(); this.close();
} }
private void sendInitialDataConfig(MqttUpdater mainHandler, String dataConfigTopic) { private void sendInitialDataConfig(MqttHandler mainHandler, String dataConfigTopic) {
Dataconfig.DataConfig dataConfig = Dataconfig.DataConfig.newBuilder() Dataconfig.DataConfig dataConfig = Dataconfig.DataConfig.newBuilder()
.setEnablePosition(true) .setEnablePosition(true)
.setEnableOrientation(false) .setEnableOrientation(false)
......
package de.tudresden.inf.st.ros2rag.starter; package de.tudresden.inf.st.ros2rag.starter;
import de.tudresden.inf.st.ros2rag.starter.ast.Link; import de.tudresden.inf.st.ros2rag.starter.ast.Link;
import de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater; import de.tudresden.inf.st.ros2rag.starter.ast.MqttHandler;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration; import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration; import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration;
...@@ -20,7 +20,7 @@ public class Util { ...@@ -20,7 +20,7 @@ public class Util {
model.MqttSetHost(hostAndPort.host, hostAndPort.port); model.MqttSetHost(hostAndPort.host, hostAndPort.port);
} }
public static void setMqttHost(MqttUpdater handler, ActualConfiguration config) throws IOException { public static void setMqttHost(MqttHandler handler, ActualConfiguration config) throws IOException {
HostAndPort hostAndPort = split(config.server); HostAndPort hostAndPort = split(config.server);
handler.setHost(hostAndPort.host, hostAndPort.port); handler.setHost(hostAndPort.host, hostAndPort.port);
} }
......
...@@ -13,4 +13,4 @@ The following things must be done: ...@@ -13,4 +13,4 @@ The following things must be done:
- For debugging build problems, the `--verbose` flag in the preprocess-step can be helpful - For debugging build problems, the `--verbose` flag in the preprocess-step can be helpful
- Create the test case itself in `src/test/java/` in the package `org.jastadd.ros2rag.tests` and import the AST files of your defined target generation package - Create the test case itself in `src/test/java/` in the package `org.jastadd.ros2rag.tests` and import the AST files of your defined target generation package
- Extend the abstract base class `AbstractMqttTest` to have fail-fast-behaviour in case the MQTT-broker is not connected - Extend the abstract base class `AbstractMqttTest` to have fail-fast-behaviour in case the MQTT-broker is not connected
- Remember to close all used MQTT-handling objects, like MqttUpdater and the model itself after each test - Remember to close all used MQTT-handling objects, like MqttHandler and the model itself after each test
...@@ -70,7 +70,7 @@ protobuf { ...@@ -70,7 +70,7 @@ protobuf {
task preprocessExampleTest(type: JavaExec, group: 'verification') { task preprocessExampleTest(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/example/Grammar.relast', delete 'src/test/02-after-ros2rag/example/Grammar.relast',
'src/test/02-after-ros2rag/example/MqttUpdater.java', 'src/test/02-after-ros2rag/example/MqttHandler.java',
'src/test/02-after-ros2rag/example/ROS2RAG.jadd' 'src/test/02-after-ros2rag/example/ROS2RAG.jadd'
} }
...@@ -90,7 +90,7 @@ task compileExampleTest(type: RelastTest) { ...@@ -90,7 +90,7 @@ task compileExampleTest(type: RelastTest) {
grammarName = 'src/test/03-after-relast/example/example' grammarName = 'src/test/03-after-relast/example/example'
packageName = 'example.ast' packageName = 'example.ast'
moreInputFiles 'src/test/01-input/example/Test.jadd', moreInputFiles 'src/test/01-input/example/Test.jadd',
'src/test/02-after-ros2rag/example/MqttUpdater.jadd', 'src/test/02-after-ros2rag/example/MqttHandler.jadd',
'src/test/02-after-ros2rag/example/ROS2RAG.jadd' 'src/test/02-after-ros2rag/example/ROS2RAG.jadd'
} }
...@@ -101,7 +101,7 @@ compileExampleTest.dependsOn preprocessExampleTest ...@@ -101,7 +101,7 @@ compileExampleTest.dependsOn preprocessExampleTest
task preprocessDefaultOnlyReadTest(type: JavaExec, group: 'verification') { task preprocessDefaultOnlyReadTest(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/defaultOnlyRead/Grammar.relast', delete 'src/test/02-after-ros2rag/defaultOnlyRead/Grammar.relast',
'src/test/02-after-ros2rag/defaultOnlyRead/MqttUpdater.java', 'src/test/02-after-ros2rag/defaultOnlyRead/MqttHandler.java',
'src/test/02-after-ros2rag/defaultOnlyRead/ROS2RAG.jadd' 'src/test/02-after-ros2rag/defaultOnlyRead/ROS2RAG.jadd'
} }
...@@ -120,7 +120,7 @@ task compileDefaultOnlyReadTest(type: RelastTest) { ...@@ -120,7 +120,7 @@ task compileDefaultOnlyReadTest(type: RelastTest) {
relastFiles 'src/test/02-after-ros2rag/defaultOnlyRead/Grammar.relast' relastFiles 'src/test/02-after-ros2rag/defaultOnlyRead/Grammar.relast'
grammarName = 'src/test/03-after-relast/defaultOnlyRead/defaultOnlyRead' grammarName = 'src/test/03-after-relast/defaultOnlyRead/defaultOnlyRead'
packageName = 'defaultOnlyRead.ast' packageName = 'defaultOnlyRead.ast'
moreInputFiles 'src/test/02-after-ros2rag/defaultOnlyRead/MqttUpdater.jadd', moreInputFiles 'src/test/02-after-ros2rag/defaultOnlyRead/MqttHandler.jadd',
'src/test/02-after-ros2rag/defaultOnlyRead/ROS2RAG.jadd' 'src/test/02-after-ros2rag/defaultOnlyRead/ROS2RAG.jadd'
} }
...@@ -131,7 +131,7 @@ compileDefaultOnlyReadTest.dependsOn preprocessDefaultOnlyReadTest ...@@ -131,7 +131,7 @@ compileDefaultOnlyReadTest.dependsOn preprocessDefaultOnlyReadTest
task preprocessDefaultOnlyWriteTest(type: JavaExec, group: 'verification') { task preprocessDefaultOnlyWriteTest(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/defaultOnlyWrite/Grammar.relast', delete 'src/test/02-after-ros2rag/defaultOnlyWrite/Grammar.relast',
'src/test/02-after-ros2rag/defaultOnlyWrite/MqttUpdater.java', 'src/test/02-after-ros2rag/defaultOnlyWrite/MqttHandler.java',
'src/test/02-after-ros2rag/defaultOnlyWrite/ROS2RAG.jadd' 'src/test/02-after-ros2rag/defaultOnlyWrite/ROS2RAG.jadd'
} }
...@@ -151,7 +151,7 @@ task compileDefaultOnlyWriteTest(type: RelastTest) { ...@@ -151,7 +151,7 @@ task compileDefaultOnlyWriteTest(type: RelastTest) {
grammarName = 'src/test/03-after-relast/defaultOnlyWrite/defaultOnlyWrite' grammarName = 'src/test/03-after-relast/defaultOnlyWrite/defaultOnlyWrite'
packageName = 'defaultOnlyWrite.ast' packageName = 'defaultOnlyWrite.ast'
moreInputFiles 'src/test/01-input/defaultOnlyWrite/Test.jadd', moreInputFiles 'src/test/01-input/defaultOnlyWrite/Test.jadd',
'src/test/02-after-ros2rag/defaultOnlyWrite/MqttUpdater.jadd', 'src/test/02-after-ros2rag/defaultOnlyWrite/MqttHandler.jadd',
'src/test/02-after-ros2rag/defaultOnlyWrite/ROS2RAG.jadd' 'src/test/02-after-ros2rag/defaultOnlyWrite/ROS2RAG.jadd'
} }
...@@ -162,7 +162,7 @@ compileDefaultOnlyWriteTest.dependsOn preprocessDefaultOnlyWriteTest ...@@ -162,7 +162,7 @@ compileDefaultOnlyWriteTest.dependsOn preprocessDefaultOnlyWriteTest
task preprocessRead1Write2Test(type: JavaExec, group: 'verification') { task preprocessRead1Write2Test(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/read1write2/Grammar.relast', delete 'src/test/02-after-ros2rag/read1write2/Grammar.relast',
'src/test/02-after-ros2rag/read1write2/MqttUpdater.java', 'src/test/02-after-ros2rag/read1write2/MqttHandler.java',
'src/test/02-after-ros2rag/read1write2/ROS2RAG.jadd' 'src/test/02-after-ros2rag/read1write2/ROS2RAG.jadd'
} }
...@@ -182,7 +182,7 @@ task compileRead1Write2Test(type: RelastTest) { ...@@ -182,7 +182,7 @@ task compileRead1Write2Test(type: RelastTest) {
grammarName = 'src/test/03-after-relast/read1write2/read1write2' grammarName = 'src/test/03-after-relast/read1write2/read1write2'
packageName = 'read1write2.ast' packageName = 'read1write2.ast'
moreInputFiles 'src/test/01-input/read1write2/Test.jadd', moreInputFiles 'src/test/01-input/read1write2/Test.jadd',
'src/test/02-after-ros2rag/read1write2/MqttUpdater.jadd', 'src/test/02-after-ros2rag/read1write2/MqttHandler.jadd',
'src/test/02-after-ros2rag/read1write2/ROS2RAG.jadd' 'src/test/02-after-ros2rag/read1write2/ROS2RAG.jadd'
} }
...@@ -193,7 +193,7 @@ compileRead1Write2Test.dependsOn preprocessRead1Write2Test ...@@ -193,7 +193,7 @@ compileRead1Write2Test.dependsOn preprocessRead1Write2Test
task preprocessRead2Write1Test(type: JavaExec, group: 'verification') { task preprocessRead2Write1Test(type: JavaExec, group: 'verification') {
doFirst { doFirst {
delete 'src/test/02-after-ros2rag/read2write1/Grammar.relast', delete 'src/test/02-after-ros2rag/read2write1/Grammar.relast',
'src/test/02-after-ros2rag/read2write1/MqttUpdater.java', 'src/test/02-after-ros2rag/read2write1/MqttHandler.java',
'src/test/02-after-ros2rag/read2write1/ROS2RAG.jadd' 'src/test/02-after-ros2rag/read2write1/ROS2RAG.jadd'
} }
...@@ -213,7 +213,7 @@ task compileRead2Write1Test(type: RelastTest) { ...@@ -213,7 +213,7 @@ task compileRead2Write1Test(type: RelastTest) {
grammarName = 'src/test/03-after-relast/read2write1/read2write1' grammarName = 'src/test/03-after-relast/read2write1/read2write1'
packageName = 'read2write1.ast' packageName = 'read2write1.ast'
moreInputFiles 'src/test/01-input/read2write1/Test.jadd', moreInputFiles 'src/test/01-input/read2write1/Test.jadd',
'src/test/02-after-ros2rag/read2write1/MqttUpdater.jadd', 'src/test/02-after-ros2rag/read2write1/MqttHandler.jadd',
'src/test/02-after-ros2rag/read2write1/ROS2RAG.jadd' 'src/test/02-after-ros2rag/read2write1/ROS2RAG.jadd'
} }
......
package org.jastadd.ros2rag.tests; package org.jastadd.ros2rag.tests;
import defaultOnlyRead.ast.MqttUpdater; import defaultOnlyRead.ast.MqttHandler;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
...@@ -22,7 +22,7 @@ public abstract class AbstractMqttTest { ...@@ -22,7 +22,7 @@ public abstract class AbstractMqttTest {
if (!checkDone) { if (!checkDone) {
checkDone = true; checkDone = true;
try { try {
checkResult = new MqttUpdater() checkResult = new MqttHandler()
.dontSendWelcomeMessage() .dontSendWelcomeMessage()
.setHost(TestUtils.getMqttHost()) .setHost(TestUtils.getMqttHost())
.waitUntilReady(2, TimeUnit.SECONDS); .waitUntilReady(2, TimeUnit.SECONDS);
......
...@@ -2,7 +2,7 @@ package org.jastadd.ros2rag.tests; ...@@ -2,7 +2,7 @@ package org.jastadd.ros2rag.tests;
import defaultOnlyRead.ast.A; import defaultOnlyRead.ast.A;
import defaultOnlyRead.ast.BoxedTypes; import defaultOnlyRead.ast.BoxedTypes;
import defaultOnlyRead.ast.MqttUpdater; import defaultOnlyRead.ast.MqttHandler;
import defaultOnlyRead.ast.NativeTypes; import defaultOnlyRead.ast.NativeTypes;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -41,7 +41,7 @@ public class DefaultOnlyReadTest extends AbstractMqttTest { ...@@ -41,7 +41,7 @@ public class DefaultOnlyReadTest extends AbstractMqttTest {
private NativeTypes floats; private NativeTypes floats;
private NativeTypes chars; private NativeTypes chars;
private BoxedTypes allBoxed; private BoxedTypes allBoxed;
private MqttUpdater sender; private MqttHandler sender;
@AfterEach @AfterEach
public void closeConnections() { public void closeConnections() {
...@@ -80,7 +80,7 @@ public class DefaultOnlyReadTest extends AbstractMqttTest { ...@@ -80,7 +80,7 @@ public class Defa