@Test public void testDeployVMNoFIWARE() throws Exception { Tier tier = new Tier("name", new Integer(1), new Integer(1), new Integer(1), null, "flavour", "image", "icono", "keypair", "floatingip", "payload"); TierInstance tierInstance = new TierInstance(); tierInstance.setTier(tier); when(propertiesProvider.getProperty(any(String.class))).thenReturn("1"); List<String> ips = new ArrayList(); ips.add("IP"); String hostname = claudiaData.getService() + "-" + tier.getName() + "-" + 1; String fqn = claudiaData.getOrg().replace("_", ".") + ".customers." + claudiaData.getVdc() + ".services." + claudiaData.getService() + ".vees." + tier.getName() + ".replicas." + 1; VM vm = new VM(); vm.setFqn(fqn); vm.setHostname(hostname); when( claudiaClient.getIP(any(ClaudiaData.class), any(String.class), Matchers.anyInt(), any(VM.class), anyString())).thenReturn(ips); Mockito.doNothing().when(claudiaClient) .deployVM(any(ClaudiaData.class), any(TierInstance.class), Matchers.anyInt(), any(VM.class)); manager.deployVM(claudiaData, tierInstance, 1, vm); assertEquals(vm.getDomain(), ""); assertEquals(vm.getHostname(), hostname); assertEquals(vm.getIp(), "IP"); }
public void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm) throws InfrastructureException { log.info("Deploy VM for tier " + tierInstance.getTier().getName() + " with networks " + tierInstance.getNetworkInstances().size() + " and public ip " + tierInstance.getTier().getFloatingip()); claudiaClient.deployVM(claudiaData, tierInstance, replica, vm); List<String> ips = claudiaClient.getIP(claudiaData, tierInstance.getTier().getName(), replica, vm, tierInstance .getTier().getRegion()); if (ips != null) { for (String ip : ips) { log.info("Ip " + ip); } } else { log.warn("ips null"); } log.info("VM "); vm.setIp(ips.get(0)); }
InfrastructureManagerClaudiaImpl implements InfrastructureManager { public void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm) throws InfrastructureException { log.info("Deploy VM for tier " + tierInstance.getTier().getName() + " with networks " + tierInstance.getNetworkInstances().size() + " and public ip " + tierInstance.getTier().getFloatingip()); claudiaClient.deployVM(claudiaData, tierInstance, replica, vm); List<String> ips = claudiaClient.getIP(claudiaData, tierInstance.getTier().getName(), replica, vm, tierInstance .getTier().getRegion()); if (ips != null) { for (String ip : ips) { log.info("Ip " + ip); } } else { log.warn("ips null"); } log.info("VM "); vm.setIp(ips.get(0)); } }
InfrastructureManagerClaudiaImpl implements InfrastructureManager { public void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm) throws InfrastructureException { log.info("Deploy VM for tier " + tierInstance.getTier().getName() + " with networks " + tierInstance.getNetworkInstances().size() + " and public ip " + tierInstance.getTier().getFloatingip()); claudiaClient.deployVM(claudiaData, tierInstance, replica, vm); List<String> ips = claudiaClient.getIP(claudiaData, tierInstance.getTier().getName(), replica, vm, tierInstance .getTier().getRegion()); if (ips != null) { for (String ip : ips) { log.info("Ip " + ip); } } else { log.warn("ips null"); } log.info("VM "); vm.setIp(ips.get(0)); }  }
InfrastructureManagerClaudiaImpl implements InfrastructureManager { public void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm) throws InfrastructureException { log.info("Deploy VM for tier " + tierInstance.getTier().getName() + " with networks " + tierInstance.getNetworkInstances().size() + " and public ip " + tierInstance.getTier().getFloatingip()); claudiaClient.deployVM(claudiaData, tierInstance, replica, vm); List<String> ips = claudiaClient.getIP(claudiaData, tierInstance.getTier().getName(), replica, vm, tierInstance .getTier().getRegion()); if (ips != null) { for (String ip : ips) { log.info("Ip " + ip); } } else { log.warn("ips null"); } log.info("VM "); vm.setIp(ips.get(0)); }  @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); }
InfrastructureManagerClaudiaImpl implements InfrastructureManager { public void deployVM(ClaudiaData claudiaData, TierInstance tierInstance, int replica, VM vm) throws InfrastructureException { log.info("Deploy VM for tier " + tierInstance.getTier().getName() + " with networks " + tierInstance.getNetworkInstances().size() + " and public ip " + tierInstance.getTier().getFloatingip()); claudiaClient.deployVM(claudiaData, tierInstance, replica, vm); List<String> ips = claudiaClient.getIP(claudiaData, tierInstance.getTier().getName(), replica, vm, tierInstance .getTier().getRegion()); if (ips != null) { for (String ip : ips) { log.info("Ip " + ip); } } else { log.warn("ips null"); } log.info("VM "); vm.setIp(ips.get(0)); }  @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);  }