@Test public void testResolveMacroDefaultValue() { ProductInstallatorSdcImpl installator = new ProductInstallatorSdcImpl(); com.telefonica.euro_iaas.sdc.model.Attribute att = new com.telefonica.euro_iaas.sdc.model.Attribute("key", "default", "desc", "IP"); com.telefonica.euro_iaas.sdc.model.Attribute newAtt = installator.resolveAttributeTypeValue(att, tierInstance, environmentInstance); assertEquals("default", newAtt.getValue()); }
public com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue( com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance, EnvironmentInstance environmentInstance) { com.telefonica.euro_iaas.sdc.model.Attribute newAtt = new com.telefonica.euro_iaas.sdc.model.Attribute(); newAtt.setDescription(attribute.getDescription()); newAtt.setKey(attribute.getKey()); newAtt.setType(attribute.getType()); newAtt.setValue(attribute.getValue()); if (attribute.getValue().contains("(") && attribute.getValue().contains(")")) { String name = extractTierNameFromMacro(attribute); String compoundName; if (TYPE_IP.equals(attribute.getType())) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, 1, environmentInstance.getVdc()); for (TierInstance ti : environmentInstance.getTierInstances()) { if (ti.getName().equals(compoundName)) { newAtt.setValue(ti.getVM().getIp()); } } } else if (TYPE_IPALL.equals(attribute.getType())) { String ips = ""; for (TierInstance ti : environmentInstance.getTierInstances()) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, ti.getNumberReplica(), environmentInstance.getVdc()); if (ti.getName().equals(compoundName)) { ips = ips + ti.getVM().getIp() + ","; } } ips = ips.substring(0, ips.length() - 1); newAtt.setValue(ips); } else { newAtt.setValue(attribute.getValue()); } } return newAtt; }
ProductInstallatorSdcImpl implements ProductInstallator { public com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue( com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance, EnvironmentInstance environmentInstance) { com.telefonica.euro_iaas.sdc.model.Attribute newAtt = new com.telefonica.euro_iaas.sdc.model.Attribute(); newAtt.setDescription(attribute.getDescription()); newAtt.setKey(attribute.getKey()); newAtt.setType(attribute.getType()); newAtt.setValue(attribute.getValue()); if (attribute.getValue().contains("(") && attribute.getValue().contains(")")) { String name = extractTierNameFromMacro(attribute); String compoundName; if (TYPE_IP.equals(attribute.getType())) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, 1, environmentInstance.getVdc()); for (TierInstance ti : environmentInstance.getTierInstances()) { if (ti.getName().equals(compoundName)) { newAtt.setValue(ti.getVM().getIp()); } } } else if (TYPE_IPALL.equals(attribute.getType())) { String ips = ""; for (TierInstance ti : environmentInstance.getTierInstances()) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, ti.getNumberReplica(), environmentInstance.getVdc()); if (ti.getName().equals(compoundName)) { ips = ips + ti.getVM().getIp() + ","; } } ips = ips.substring(0, ips.length() - 1); newAtt.setValue(ips); } else { newAtt.setValue(attribute.getValue()); } } return newAtt; } }
ProductInstallatorSdcImpl implements ProductInstallator { public com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue( com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance, EnvironmentInstance environmentInstance) { com.telefonica.euro_iaas.sdc.model.Attribute newAtt = new com.telefonica.euro_iaas.sdc.model.Attribute(); newAtt.setDescription(attribute.getDescription()); newAtt.setKey(attribute.getKey()); newAtt.setType(attribute.getType()); newAtt.setValue(attribute.getValue()); if (attribute.getValue().contains("(") && attribute.getValue().contains(")")) { String name = extractTierNameFromMacro(attribute); String compoundName; if (TYPE_IP.equals(attribute.getType())) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, 1, environmentInstance.getVdc()); for (TierInstance ti : environmentInstance.getTierInstances()) { if (ti.getName().equals(compoundName)) { newAtt.setValue(ti.getVM().getIp()); } } } else if (TYPE_IPALL.equals(attribute.getType())) { String ips = ""; for (TierInstance ti : environmentInstance.getTierInstances()) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, ti.getNumberReplica(), environmentInstance.getVdc()); if (ti.getName().equals(compoundName)) { ips = ips + ti.getVM().getIp() + ","; } } ips = ips.substring(0, ips.length() - 1); newAtt.setValue(ips); } else { newAtt.setValue(attribute.getValue()); } } return newAtt; }  }
ProductInstallatorSdcImpl implements ProductInstallator { public com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue( com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance, EnvironmentInstance environmentInstance) { com.telefonica.euro_iaas.sdc.model.Attribute newAtt = new com.telefonica.euro_iaas.sdc.model.Attribute(); newAtt.setDescription(attribute.getDescription()); newAtt.setKey(attribute.getKey()); newAtt.setType(attribute.getType()); newAtt.setValue(attribute.getValue()); if (attribute.getValue().contains("(") && attribute.getValue().contains(")")) { String name = extractTierNameFromMacro(attribute); String compoundName; if (TYPE_IP.equals(attribute.getType())) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, 1, environmentInstance.getVdc()); for (TierInstance ti : environmentInstance.getTierInstances()) { if (ti.getName().equals(compoundName)) { newAtt.setValue(ti.getVM().getIp()); } } } else if (TYPE_IPALL.equals(attribute.getType())) { String ips = ""; for (TierInstance ti : environmentInstance.getTierInstances()) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, ti.getNumberReplica(), environmentInstance.getVdc()); if (ti.getName().equals(compoundName)) { ips = ips + ti.getVM().getIp() + ","; } } ips = ips.substring(0, ips.length() - 1); newAtt.setValue(ips); } else { newAtt.setValue(attribute.getValue()); } } return newAtt; }  ProductInstance install(ClaudiaData claudiaData, EnvironmentInstance environmentInstance,
            TierInstance tierInstance, ProductRelease productRelease); com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue(
            com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance,
            EnvironmentInstance environmentInstance); void installArtifact(ClaudiaData claudiaData, ProductInstance productInstance, Artifact artifact); void uninstallArtifact(ClaudiaData claudiaData, ProductInstance productInstance, Artifact artifact); void uninstall(ClaudiaData claudiaData, ProductInstance productInstance); void configure(ClaudiaData claudiaData, ProductInstance productInstance, List<Attribute> properties); void deleteNode(ClaudiaData claudiaData, String vdc, String sdcNodeName); ChefClient loadNode(ClaudiaData claudiaData, String vdc, String hostname); Attribute getAttribute(Set<Attribute> attributes, String key); void setSDCClient(SDCClient sDCClient); void setSystemPropertiesProvider(SystemPropertiesProvider systemPropertiesProvider); void setProductReleaseManager(ProductReleaseManager productReleaseManager); void setTierInstanceManager(TierInstanceManager tierInstanceManager); void setSDCUtil(SDCUtil sDCUtil); String getProductInstanceName(ClaudiaData claudiaData, ProductInstance productInstance); void setInfrastructureManager(InfrastructureManager infrastructureManager); }
ProductInstallatorSdcImpl implements ProductInstallator { public com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue( com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance, EnvironmentInstance environmentInstance) { com.telefonica.euro_iaas.sdc.model.Attribute newAtt = new com.telefonica.euro_iaas.sdc.model.Attribute(); newAtt.setDescription(attribute.getDescription()); newAtt.setKey(attribute.getKey()); newAtt.setType(attribute.getType()); newAtt.setValue(attribute.getValue()); if (attribute.getValue().contains("(") && attribute.getValue().contains(")")) { String name = extractTierNameFromMacro(attribute); String compoundName; if (TYPE_IP.equals(attribute.getType())) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, 1, environmentInstance.getVdc()); for (TierInstance ti : environmentInstance.getTierInstances()) { if (ti.getName().equals(compoundName)) { newAtt.setValue(ti.getVM().getIp()); } } } else if (TYPE_IPALL.equals(attribute.getType())) { String ips = ""; for (TierInstance ti : environmentInstance.getTierInstances()) { compoundName = infrastructureManager.generateVMName(environmentInstance.getBlueprintName(), name, ti.getNumberReplica(), environmentInstance.getVdc()); if (ti.getName().equals(compoundName)) { ips = ips + ti.getVM().getIp() + ","; } } ips = ips.substring(0, ips.length() - 1); newAtt.setValue(ips); } else { newAtt.setValue(attribute.getValue()); } } return newAtt; }  ProductInstance install(ClaudiaData claudiaData, EnvironmentInstance environmentInstance,
            TierInstance tierInstance, ProductRelease productRelease); com.telefonica.euro_iaas.sdc.model.Attribute resolveAttributeTypeValue(
            com.telefonica.euro_iaas.sdc.model.Attribute attribute, TierInstance tierInstance,
            EnvironmentInstance environmentInstance); void installArtifact(ClaudiaData claudiaData, ProductInstance productInstance, Artifact artifact); void uninstallArtifact(ClaudiaData claudiaData, ProductInstance productInstance, Artifact artifact); void uninstall(ClaudiaData claudiaData, ProductInstance productInstance); void configure(ClaudiaData claudiaData, ProductInstance productInstance, List<Attribute> properties); void deleteNode(ClaudiaData claudiaData, String vdc, String sdcNodeName); ChefClient loadNode(ClaudiaData claudiaData, String vdc, String hostname); Attribute getAttribute(Set<Attribute> attributes, String key); void setSDCClient(SDCClient sDCClient); void setSystemPropertiesProvider(SystemPropertiesProvider systemPropertiesProvider); void setProductReleaseManager(ProductReleaseManager productReleaseManager); void setTierInstanceManager(TierInstanceManager tierInstanceManager); void setSDCUtil(SDCUtil sDCUtil); String getProductInstanceName(ClaudiaData claudiaData, ProductInstance productInstance); void setInfrastructureManager(InfrastructureManager infrastructureManager); static final String TYPE_PLAIN; static final String TYPE_IP; static final String TYPE_IPALL; }