use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoArduinoGeneratorTest 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 = eclipseArduinoGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "MySensor.cpp", ".cpp");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/MySensor.cpp").toURI());
assertEquals(TestUtils.normalizeEOL(IOUtils.toString(FileUtils.openInputStream(defaultFile))), TestUtils.normalizeEOL(new String(generatedfile.getContent(), "utf-8")));
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseDittoGeneratorTest method checkAPIConfigPropertiesInFunctionBlock.
/*
* Test case for checking whether the config properties are reflected in json
*/
@Test
public void checkAPIConfigPropertiesInFunctionBlock() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("target", "jsonSchema");
IGenerationResult generationResult = eclipseDittoGenerator.generate(modelProvider("MultiplTypeIm.infomodel", "MultipleTypeFb.functionblock"), InvocationContext.simpleInvocationContext(params));
Generated generatedfile = zipFileReader(generationResult, "properties-configuration.schema", ".json");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/properties-configuration.schema.json").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 EclipseDittoGeneratorTest method checkMultipleKeywordInFunctionBlock.
/*
* Test case for checking whether the multiple keyword generates corresponding array type in json
*
*/
@Test
public void checkMultipleKeywordInFunctionBlock() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("target", "jsonSchema");
IGenerationResult generationResult = eclipseDittoGenerator.generate(modelProvider("MultiplTypeIm.infomodel", "MultipleTypeFb.functionblock"), InvocationContext.simpleInvocationContext(params));
Generated generatedfile = zipFileReader(generationResult, "properties-status.schema", ".json");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/properties-status.schema.json").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 BoschIoTSuiteGeneratorTest method generatePython.
/*
* Check if python file is generated when language is passed as python to BoschIOTSuiteGenerator
*/
@Test
public void generatePython() throws Exception {
configProperties.put("language", "python");
InvocationContext context = new InvocationContext(mappingModels, configProperties);
IGenerationResult iGenerationResult = boschIOTSuiteGenerator.generate(modelProvider(), context);
Generated generatedfile = zipFileReader(iGenerationResult, "StatusPropertiesFunctionBlock", ".py");
assertEquals("StatusPropertiesFunctionBlock.py", generatedfile.getFileName());
}
use of org.eclipse.vorto.plugin.generator.utils.Generated in project vorto by eclipse.
the class EclipseHonoArduinoGeneratorTest method checkAPIConfigPropertiesInFunctionBlock.
/*
* Test case for checking whether the functionblock related file has the config properties both
* primitive and object with the setters and getters
*
*/
@Test
public void checkAPIConfigPropertiesInFunctionBlock() throws Exception {
IGenerationResult generationResult = eclipseArduinoGenerator.generate(modelProvider(), InvocationContext.simpleInvocationContext());
Generated generatedfile = zipFileReader(generationResult, "ConfigPropertiesFunctionBlock.cpp", ".cpp");
File defaultFile = new File(getClass().getClassLoader().getResource("defaultFileFormat/ConfigPropertiesFunctionBlock.cpp").toURI());
assertEquals(TestUtils.normalizeEOL(IOUtils.toString(FileUtils.openInputStream(defaultFile))), TestUtils.normalizeEOL(new String(generatedfile.getContent(), "utf-8")));
}
Aggregations