use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class KubernetesPluginTest method modelCheckTest.
@Test(expected = ValidationFailureException.class)
public void modelCheckTest() throws Exception {
EffectiveModel singleComputeModel = new EffectiveModelFactory().create(TestCsars.VALID_SINGLE_COMPUTE_WINDOWS_TEMPLATE, logMock());
TransformationContext context = setUpMockTransformationContext(singleComputeModel);
KubernetesLifecycle lifecycle = plugin.getInstance(context);
plugin.transform(lifecycle);
}
use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class TransformationFilesystemDao method createTransformation.
private Transformation createTransformation(Csar csar, Platform platform) {
try {
Log log = getLog(csar, platform);
EffectiveModel model = effectiveModelFactory.create(csar.getTemplate(), log);
return new TransformationImpl(csar, platform, getLog(csar, platform), model);
} catch (InvalidCsarException e) {
throw new IllegalStateException("Failed to create csar. Should not have happened - csar upload should have" + "already failed", e);
}
}
use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class BaseTest method modelMock.
/**
* @return a mocked EffectiveModel instance which returns empty sets / maps /graphs upon every call
*/
protected EffectiveModel modelMock() {
EffectiveModel model = mock(EffectiveModel.class);
when(model.getInputs()).thenReturn(new HashMap<>());
when(model.getNodeMap()).thenReturn(new HashMap<>());
when(model.getNodes()).thenReturn(new HashSet<>());
when(model.getTopology()).thenReturn(new DefaultDirectedGraph<>(RootRelationship.class));
return model;
}
use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class LinkResolverTest method resolveRequirementLink.
@Test
public void resolveRequirementLink() {
EffectiveModel model = new EffectiveModelFactory().create(REQUIREMENT, logMock());
WebServer node = (WebServer) model.getNodeMap().get("test-node1");
HostRequirement requirement = node.getHost();
assertNotNull(requirement);
Set<Compute> fulfillers = requirement.getFulfillers();
assertEquals(1, fulfillers.size());
Compute fulfiller = fulfillers.iterator().next();
assertEquals("test-node2", fulfiller.getEntityName());
}
use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class LinkResolverTest method resolveRepositoryLink.
@Test
public void resolveRepositoryLink() {
EffectiveModel model = new EffectiveModelFactory().create(REPOSITORY, logMock());
WebServer node = (WebServer) model.getNodeMap().get("test-node");
Set<Artifact> artifacts = node.getArtifacts();
Artifact artifact = artifacts.iterator().next();
assertNotNull(artifact);
Optional<Repository> repo = artifact.getRepository();
assertTrue(repo.isPresent());
assertEquals("http://test.repo.com/", repo.get().getUrl());
}
Aggregations