PaaSUtils { public static void processRelationshipTemplateProperties(PaaSRelationshipTemplate paaSRelationshipTemplate, Map<String, PaaSNodeTemplate> paaSNodeTemplates) { RelationshipTemplate template = paaSRelationshipTemplate.getTemplate(); injectPropertiesAsInputs(ToscaFunctionConstants.SELF, null, template.getProperties(), paaSRelationshipTemplate.getInterfaces(), baseName -> StringUtils.joinWith(AlienUtils.DEFAULT_PREFIX_SEPARATOR, ToscaFunctionConstants.SELF, baseName)); injectSourcePropertiesAsInputs(paaSNodeTemplates.get(paaSRelationshipTemplate.getSource()), paaSRelationshipTemplate.getInterfaces()); injectTargetPropertiesAsInputs(paaSNodeTemplates.get(template.getTarget()), paaSRelationshipTemplate.getInterfaces()); injectTargetedCapabilityProperties(paaSNodeTemplates.get(template.getTarget()), template.getTargetedCapabilityName(), paaSRelationshipTemplate.getInterfaces()); }  static PaaSNodeTemplate getMandatoryHostTemplate(final PaaSNodeTemplate paaSNodeTemplate); static PaaSNodeTemplate getHostTemplate(PaaSNodeTemplate paaSNodeTemplate); static void injectPropertiesAsOperationInputs(Map<String, PaaSNodeTemplate> nodeTemplates); static void processNodeTemplateProperties(PaaSNodeTemplate paaSTemplate); static void processRelationshipTemplateProperties(PaaSRelationshipTemplate paaSRelationshipTemplate,
            Map<String, PaaSNodeTemplate> paaSNodeTemplates); final static String CAPABILITIES; }
@Test public void injectRelationshipTemplatePropertiesAsInputs() throws Exception { Map<String, PaaSNodeTemplate> nodes = Maps.newHashMap(); PaaSNodeTemplate source = buildPaaSNodeTemplate(); nodes.put(node1, source); PaaSNodeTemplate target = buildPaaSNodeTemplate(); nodes.put(node2, target); PaaSRelationshipTemplate paaSRelationshipTemplate = buildFakePaaSRelTemplate(node1, node2, fakeCapa1); Mockito.when(source.getRelationshipTemplates()).thenReturn(Lists.newArrayList(paaSRelationshipTemplate)); PaaSUtils.processRelationshipTemplateProperties(paaSRelationshipTemplate, nodes); Operation operation = paaSRelationshipTemplate.getInterfaces().get(interface1).getOperations().get(operation1); Assert.assertNotNull(operation.getInputParameters()); Assert.assertTrue(operation.getInputParameters().containsKey(SELF + fake1)); Assert.assertTrue(operation.getInputParameters().containsKey(SELF + fake3)); Assert.assertTrue(operation.getInputParameters().containsKey(SELF + fake5)); Assert.assertTrue(operation.getInputParameters().containsKey(SELF + fake2)); Assert.assertEquals(operation.getInputParameters().get(fake1), new ScalarPropertyValue("1_from_operation")); Assert.assertTrue(operation.getInputParameters().containsKey(generateSourceInputName(fake1))); Assert.assertTrue(operation.getInputParameters().containsKey(generateSourceInputName(fake2))); Assert.assertTrue(operation.getInputParameters().containsKey(generateSourceInputName(fake3))); Assert.assertTrue(operation.getInputParameters().containsKey(generateSourceInputName(fake5))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetInputName(fake1))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetInputName(fake2))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetInputName(fake3))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetInputName(fake5))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetedCapaInputName(fakeCapa1, fake1))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetedCapaInputName(fakeCapa1, fake2))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetedCapaInputName(fakeCapa1, fake5))); Assert.assertTrue(operation.getInputParameters().containsKey(generateTargetedCapaInputName(fakeCapa1, fake3))); }