Commit d6433836 authored by Mike Grüne's avatar Mike Grüne

Add MqttGenerationTest

parent 99e4bf87
Pipeline #166861 canceled with stages
in 6 minutes and 57 seconds
package de.monticore.lang.monticar.generator.middleware;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosToEmamTagSchema;
import de.monticore.lang.monticar.generator.middleware.impls.CPPGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.MqttGenImpl;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.List;
import static org.junit.Assert.assertNotNull;
public class MqttGenerationTest extends AbstractSymtabTest {
private static final String TEST_PATH = "src/test/resources/";
private static final String OUT_BASE = "./target/generated-sources-mqtt/";
@Test
public void testMqttGeneration() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.a.compA", EMAComponentInstanceSymbol.KIND).orElse(null);
RosToEmamTagSchema.registerTagTypes(taggingResolver);
assertNotNull(componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();-
distributedTargetGenerator.setGenerationTargetPath(OUT_BASE + "compA/src");
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH),"cpp");
distributedTargetGenerator.add(new MqttGenImpl(), "mqtt");
List<File> files = distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Test
public void testBaSystem() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
RosToEmamTagSchema.registerTagTypes(taggingResolver);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("ba.system", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
String generationTargetPath = OUT_BASE + "system/src/";
distributedTargetGenerator.setGenerationTargetPath(generationTargetPath);
//distributedTargetGenerator.setGenDebug(true);
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH), "cpp");
distributedTargetGenerator.add(new MqttGenImpl(), "mqtt");
List<File> files = distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Test
public void testDistributedTargetGenerator() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
RosToEmamTagSchema.registerTagTypes(taggingResolver);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.dist.distComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath(OUT_BASE + "distributed/src/");
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH), "cpp");
distributedTargetGenerator.add(new MqttGenImpl(), "mqtt");
distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Test
public void testDistributedStructTargetGenerator() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
RosToEmamTagSchema.registerTagTypes(taggingResolver);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.dist.distWithStructComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath(OUT_BASE + "distributedStruct/src/");
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH), "cpp");
distributedTargetGenerator.add(new MqtttGenImpl(), "mqtt");
distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment