use of org.opentosca.toscana.core.parse.model.ServiceGraph in project TOSCAna by StuPro-TOSCAna.
the class GraphNormalizerTest method repositoryNormalization.
@Test
public void repositoryNormalization() {
ServiceGraph graph = new ServiceGraph(REPOSITORY, logMock());
Collection<Entity> repositories = graph.getEntity(ToscaStructure.REPOSITORIES).get().getChildren();
Entity repository = repositories.iterator().next();
Optional<Entity> url = repository.getChild("url");
assertTrue(url.isPresent());
Assert.assertEquals("http://test.repo.com/", ((ScalarEntity) url.get()).getValue());
}
use of org.opentosca.toscana.core.parse.model.ServiceGraph in project TOSCAna by StuPro-TOSCAna.
the class GraphNormalizerTest method artifactNormalization.
@Test
public void artifactNormalization() {
ServiceGraph graph = new ServiceGraph(ARTIFACT, logMock());
EntityId nodeId = ToscaStructure.NODE_TEMPLATES.descend("test-node");
Entity nodeEntity = graph.getEntityOrThrow(nodeId);
WebApplication webApplication = new TypeWrapper().wrapEntity((MappingEntity) nodeEntity, WebApplication.class);
Artifact artifact = webApplication.getArtifacts().iterator().next();
assertEquals("test-artifact", artifact.getEntityName());
assertEquals("test-artifact-file", artifact.getFilePath());
}
use of org.opentosca.toscana.core.parse.model.ServiceGraph in project TOSCAna by StuPro-TOSCAna.
the class TypeResolverTest method supportForAllWineryNodeTypes.
@Test
public void supportForAllWineryNodeTypes() {
Set<String> wineryNodeTypes = getWineryNodeTypes();
for (String nodeType : wineryNodeTypes) {
logger.info("Testing conversion of type '{}'", nodeType);
ServiceGraph graph = new ServiceGraph(logMock());
MappingEntity nodeEntity = new MappingEntity(ToscaStructure.NODE_TEMPLATES.descend("my-node"), graph);
graph.addEntity(nodeEntity);
ScalarEntity typeEntity = new ScalarEntity(nodeType, nodeEntity.getId().descend("type"), graph);
graph.addEntity(typeEntity);
BaseToscaElement node = TypeWrapper.wrapTypedElement(nodeEntity);
assertNotNull(node);
logger.info("Node Type '{}': known", nodeType);
System.out.println();
}
// successful if no exception thrown
}
use of org.opentosca.toscana.core.parse.model.ServiceGraph in project TOSCAna by StuPro-TOSCAna.
the class MapperTest method getEntity.
public static MappingEntity getEntity() {
ServiceGraph graph = new ServiceGraph(BaseTest.logMock());
MappingEntity entity = new MappingEntity(entityId, graph);
graph.addEntity(entity);
return entity;
}
use of org.opentosca.toscana.core.parse.model.ServiceGraph in project TOSCAna by StuPro-TOSCAna.
the class MapperTagLoaderIT method setUp.
@BeforeClass
public static void setUp() {
ServiceGraph graph = new ServiceGraph(logMock());
nodeEntity = new MappingEntity(entityId, graph);
graph.addEntity(nodeEntity);
}
Aggregations