use of org.alien4cloud.tosca.model.templates.NodeTemplate in project alien4cloud by alien4cloud.
the class FunctionEvaluatorTest method nodeGetConcatProp.
@Test
public void nodeGetConcatProp() {
FunctionEvaluatorContext context = getEvaluationContext();
NodeTemplate template = context.getTopology().getNodeTemplates().get("my_node");
PropertyValue resolved = resolveValue(context, template, template.getProperties(), template.getProperties().get("get_concat_prop"));
Assert.assertNotNull(resolved);
Assert.assertEquals(ScalarPropertyValue.class, resolved.getClass());
Assert.assertEquals("input is: scalar input value property is: scalar value", resolved.getValue());
}
use of org.alien4cloud.tosca.model.templates.NodeTemplate in project alien4cloud by alien4cloud.
the class FunctionEvaluatorTest method nodeGetInputProp.
@Test
public void nodeGetInputProp() {
FunctionEvaluatorContext context = getEvaluationContext();
NodeTemplate template = context.getTopology().getNodeTemplates().get("my_node");
PropertyValue resolved = resolveValue(context, template, template.getProperties(), template.getProperties().get("get_input_prop"));
Assert.assertNotNull(resolved);
Assert.assertEquals(ScalarPropertyValue.class, resolved.getClass());
Assert.assertEquals("scalar input value", resolved.getValue());
}
use of org.alien4cloud.tosca.model.templates.NodeTemplate in project alien4cloud by alien4cloud.
the class FunctionEvaluatorTest method nodeConcatProp.
@Test
public void nodeConcatProp() {
FunctionEvaluatorContext context = getEvaluationContext();
NodeTemplate template = context.getTopology().getNodeTemplates().get("my_node");
PropertyValue resolved = resolveValue(context, template, template.getProperties(), template.getProperties().get("concat_prop"));
Assert.assertNotNull(resolved);
Assert.assertEquals(ScalarPropertyValue.class, resolved.getClass());
Assert.assertEquals("input is: scalar input value property is: scalar value", resolved.getValue());
}
use of org.alien4cloud.tosca.model.templates.NodeTemplate in project alien4cloud by alien4cloud.
the class PaaSUtilsTest method buildFakeNodeTemplate.
private NodeTemplate buildFakeNodeTemplate(Map<String, Capability> capabilities) {
Map<String, AbstractPropertyValue> props = Maps.newHashMap();
props.put(fake1, new ScalarPropertyValue("1_from_nodeTemplate"));
props.put(fake2, null);
props.put(fake3, new ComplexPropertyValue(MapUtil.newHashMap(new String[] { "toto" }, new String[] { "tata" })));
props.put(fake5, new ScalarPropertyValue("5_from_nodeTemplate"));
NodeTemplate fakeTemplate = Mockito.mock(NodeTemplate.class);
Mockito.when(fakeTemplate.getProperties()).thenReturn(props);
Mockito.when(fakeTemplate.getCapabilities()).thenReturn(capabilities);
return fakeTemplate;
}
use of org.alien4cloud.tosca.model.templates.NodeTemplate in project alien4cloud by alien4cloud.
the class PaaSUtilsTest method buildPaaSNodeTemplate.
private PaaSNodeTemplate buildPaaSNodeTemplate() {
Map<String, Capability> capabilities = Maps.newHashMap();
capabilities.put(fakeCapa1, buildFakeCapability());
NodeTemplate nodeTemplate = buildFakeNodeTemplate(capabilities);
Map<String, Operation> operations = Maps.newHashMap();
operations.put(operation1, buildFakeOperation());
Map<String, Interface> interfaces = Maps.newHashMap();
interfaces.put(interface1, buildFakeInterface(operations));
return buildFakePaaSNodeTemplate(nodeTemplate, interfaces);
}
Aggregations