use of org.eclipse.vorto.plugin.generator.IGenerationResult in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method checkAPIConfigPropertiesInFunctionBlock.
/*
* Test case for checking whether the functionblock related python file has the config properties
* both primitive and object with the setters and getters
*
*/
@Test
public void checkAPIConfigPropertiesInFunctionBlock() throws Exception {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "ConfigPropertiesFunctionBlock", ".py");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/ConfigPropertiesFunctionBlock.py").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFile)), new String(generatedfile.getContent(), "utf-8"));
}
use of org.eclipse.vorto.plugin.generator.IGenerationResult in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method checkAPIStatusPropertiesInFunctionBlock.
/*
* -----Below test cases are specific to API related files-------
*/
/*
* Test case for checking whether the functionblock related python file has the status properties
* both primitive and object with the setters and getters
*
*/
@Test
public void checkAPIStatusPropertiesInFunctionBlock() throws Exception {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "StatusPropertiesFunctionBlock", ".py");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/StatusPropertiesFunctionBlock.py").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFile)), new String(generatedfile.getContent(), "utf-8"));
}
use of org.eclipse.vorto.plugin.generator.IGenerationResult in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method testClientAppGeneratedModels.
/*
* -----Below test cases are specific to Client App related files-------
*/
/*
* Test case for checking whether the client App generated contains the models which are listed in
* the information model
*
*/
@Test
public void testClientAppGeneratedModels() throws GeneratorException, IOException, URISyntaxException {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "MySensorApp", ".py");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/MainApp.py").toURI());
assertEquals(IOUtils.toString(FileUtils.openInputStream(defaultFile)), new String(generatedfile.getContent(), "utf-8"));
}
use of org.eclipse.vorto.plugin.generator.IGenerationResult in project vorto by eclipse.
the class EclipseHonoPythonGeneratorTest method checkAPIGenerationOfEntityModel.
/*
* Test case for checking whether the entity/enum values specified in the input datatype file are
* available.
*
*/
@Test
public void checkAPIGenerationOfEntityModel() throws Exception {
IGenerationResult generationResult = pythonGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "MySensorApp", ".py");
assertEquals(true, new String(generatedfile.getContent(), "utf-8").contains("unitEnum"));
}
Aggregations