use of org.opentosca.toscana.model.capability.Capability in project TOSCAna by StuPro-TOSCAna.
the class DynamicRequirementTest method dynamicRequirementTest.
@Test
public void dynamicRequirementTest() {
EffectiveModel model = new EffectiveModelFactory().create(TestTemplates.Requirements.DYNAMIC_REQUIREMENT, logMock());
WebApplication app = (WebApplication) model.getNodes().iterator().next();
Requirement<? extends Capability, ? extends RootNode, ? extends RootRelationship> dynamicRequirement = app.getRequirements().stream().filter(r -> "dynamic-requirement".equals(r.getEntityName())).findFirst().orElseThrow(() -> new IllegalStateException("dynamic requirement should exist"));
RootRelationship relationship = dynamicRequirement.getRelationship().get();
assertEquals(ConnectsTo.class, relationship.getClass());
Capability capability = dynamicRequirement.get(dynamicRequirement.CAPABILITY);
assertEquals(EndpointCapability.class, capability.getClass());
RootNode fulfiller = dynamicRequirement.getFulfillers().iterator().next();
assertEquals(app, fulfiller);
}
Aggregations