use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoJavaGeneratorTest method checkAPIStatusPropertiesInFunctionBlock.
/*
* -----Below test cases are specific to API related files-------
*/
/*
* Test case for checking whether the functionblock related java file has the status properties
* both primitive and object with the setters and getters
*
*/
@Test
public void checkAPIStatusPropertiesInFunctionBlock() throws Exception {
IGenerationResult generationResult = eclipseHonoJavaGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "StatusPropertiesFunctionBlock", ".java");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/StatusPropertiesFunctionBlock.java").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFile)), new String(generatedfile.getContent(), "utf-8"));
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoJavaGeneratorTest method checkAPIConfigPropertiesInFunctionBlock.
/*
* Test case for checking whether the functionblock related java file has the config properties
* both primitive and object with the setters and getters
*
*/
@Test
public void checkAPIConfigPropertiesInFunctionBlock() throws Exception {
IGenerationResult generationResult = eclipseHonoJavaGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "ConfigPropertiesFunctionBlock", ".java");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/ConfigPropertiesFunctionBlock.java").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFile)), new String(generatedfile.getContent(), "utf-8"));
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method testAPIFunctionBlockWithEvents.
/*
* Test case for checking whether the events specified in the functionblock is not reflected in
* the generated files. This is because we currently do not support events.
*
*/
@Test
public void testAPIFunctionBlockWithEvents() throws Exception {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "eventsAndOperationsFunctionBlock", ".py");
assertEquals(false, new String(generatedfile.getContent(), "utf-8").contains("testEvent"));
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method testAPIFunctionBlockWithOperations.
/*
* Test case for checking whether the operations specified in the functionblock is not reflected
* in the generated files. This is because we currently do not support events.
*
*/
@Test
public void testAPIFunctionBlockWithOperations() throws Exception {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "eventsAndOperationsFunctionBlock", ".py");
assertEquals(false, new String(generatedfile.getContent(), "utf-8").contains("testOperation"));
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method testConnectorGeneratedMQTTClient.
/*
* -----Below test cases are specific to Connector related files-------
*/
/*
* Test case for checking whether the MQTT client generated contains the models which are listed
* in the information model
*
*/
@Test
public void testConnectorGeneratedMQTTClient() throws GeneratorException, IOException, URISyntaxException {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedFileHonoMqttClient = zipFileReader(generationResult, "DittoSerializer", ".py");
File defaultFileHonoMqttClient = new File(getClass().getClassLoader().getResource("defaultFileFormat/DittoSerializer.py").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFileHonoMqttClient)), new String(generatedFileHonoMqttClient.getContent(), "utf-8"));
}
Aggregations