InfrastructureManagerClaudiaImpl implements InfrastructureManager { public String generateVMName(String service, String tierName, int numReplica, String vdc) { int lengthVdc = vdc.length(); String name = service + "-" + tierName + "-" + numReplica + "-"; if (lengthVdc > 6) { name += vdc.substring(lengthVdc - 6); } else { name += vdc; } return name; }  @Async TierInstance cloneTemplate(String templateName); List<VM> createEnvironment(EnvironmentInstance envInstance, String ovf, ClaudiaData claudiaData); EnvironmentInstance createInfrasctuctureEnvironmentInstance(EnvironmentInstance environmentInstance,
            Set<Tier> tiers, ClaudiaData claudiaData); String generateVMName(String service, String tierName, int numReplica, String vdc); @Async Template createTemplate(TierInstance tierInstance); void deleteEnvironment(ClaudiaData claudiaData, EnvironmentInstance envInstance); @Override void deleteNetworksInTierInstance(ClaudiaData claudiaData, TierInstance tierInstance); void deleteVMReplica(ClaudiaData claudiaData, TierInstance tierInstance); void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm); String ImageScalability(ClaudiaData claudiaData, TierInstance tierInstance); void deployNetworks(ClaudiaData data, TierInstance tierInstance); void setClaudiaClient(ClaudiaClient claudiaClient); void setClaudiaResponseAnalyser(ClaudiaResponseAnalyser claudiaResponseAnalyser); void setEnvironmentInstanceDao(EnvironmentInstanceDao environmentInstanceDao); void setSystemPropertiesProvider(SystemPropertiesProvider systemPropertiesProvider); void setTierInstanceManager(TierInstanceManager tierInstanceManager); String StartStopScalability(ClaudiaData claudiaData, boolean b); void setNetworkInstanceManager(NetworkInstanceManager networkInstanceManager); void setNetworkManager(NetworkManager networkManager); void setTierManager(TierManager tierManager); String getFederatedRange(ClaudiaData data, String region); void federatedNetworks(ClaudiaData data, EnvironmentInstance environmentInstance);  }
@Test public void shouldGenerateValidTierInstanceName() { String name = manager.generateVMName("bpName", "tierName", 1, "00000000000000vdc"); assertNotNull(name); assertEquals("bpName-tierName-1-000vdc", name); }
@Test public void shouldGenerateValidTierInstanceNameWithShortVdc() { String name = manager.generateVMName("bpName", "tierName", 1, "vdc"); assertNotNull(name); assertEquals("bpName-tierName-1-vdc", name); }