use of org.eclipse.winery.model.tosca.Definitions in project winery by eclipse.
the class AbstractRepository method getDefinitions.
@Override
public Definitions getDefinitions(DefinitionsChildId id) {
RepositoryFileReference ref = BackendUtils.getRefOfDefinitions(id);
if (!exists(ref)) {
return BackendUtils.createWrapperDefinitionsAndInitialEmptyElement(this, id);
}
try {
InputStream is = RepositoryFactory.getRepository().newInputStream(ref);
Unmarshaller u = JAXBSupport.createUnmarshaller();
return (Definitions) u.unmarshal(is);
} catch (Exception e) {
LOGGER.error("Could not read content from file " + ref, e);
throw new IllegalStateException(e);
}
}
use of org.eclipse.winery.model.tosca.Definitions in project winery by eclipse.
the class WriterUtils method loadDefinitions.
public static Definitions loadDefinitions(Path path, String namespace, String name) {
Path filePath = getDefinitionsPath(path, namespace, name);
Reader reader = new Reader();
try {
return reader.parse(new FileInputStream(filePath.toFile()));
} catch (JAXBException | FileNotFoundException e) {
e.printStackTrace();
}
return new Definitions();
}
use of org.eclipse.winery.model.tosca.Definitions in project winery by eclipse.
the class Datatypes method testDataTypes.
@Test
public void testDataTypes() throws Exception {
String name = "data_types";
String namespace = "http://www.example.com/DataTypesTest";
TServiceTemplate serviceTemplate = readServiceTemplate(name, namespace);
Definitions definitions = convert(serviceTemplate, name, namespace);
writeXml(definitions, name, namespace);
Assert.assertNotNull(definitions);
}
use of org.eclipse.winery.model.tosca.Definitions in project winery by eclipse.
the class Datatypes method testDataTypesRecursive.
@Test
public void testDataTypesRecursive() throws Exception {
String name = "data_types-recursive";
String namespace = "http://www.example.com/DataTypesRecursive";
TServiceTemplate serviceTemplate = readServiceTemplate(name, namespace);
Definitions definitions = convert(serviceTemplate, name, namespace);
writeXml(definitions, name, namespace);
Assert.assertNotNull(definitions);
}
use of org.eclipse.winery.model.tosca.Definitions in project winery by eclipse.
the class Datatypes method testDataTypesWithImport.
@Test
public void testDataTypesWithImport() throws Exception {
String name = "data_types-with_import";
String namespace = "http://www.example.com/DataTypesWithImportTest";
TServiceTemplate serviceTemplate = readServiceTemplate(name, namespace);
Definitions definitions = convert(serviceTemplate, name, namespace);
writeXml(definitions, name, namespace);
Assert.assertNotNull(definitions);
}
Aggregations