@Test public void shouldReturnTrueWhenAllDependenciesForProductExists() { Map<String, String> productsNameMap = new HashMap<String, String>(); productsNameMap.put("tomcat-6", ""); productsNameMap.put("mysql", ""); productsNameMap.put("mongos", ""); productsNameMap.put("mongoshard", ""); productsNameMap.put("mongoconfig", ""); List<String> contextBrokerDependencies = new ArrayList<String>(2); contextBrokerDependencies.add("mongos"); contextBrokerDependencies.add("mongoshard"); contextBrokerDependencies.add("mongoconfig"); boolean result = tierResourceValidator.checkTierProductsInDependencyList(contextBrokerDependencies, productsNameMap); assertTrue(result); }
public boolean checkTierProductsInDependencyList(List<String> productDependencies, Map<String, String> dependenciesMap) { boolean exist = true; final Iterator<String> iterator = productDependencies.iterator(); while (exist && iterator.hasNext()) { String productDependency = iterator.next(); if (!dependenciesMap.containsKey(productDependency)) { exist = false; } } return exist; }
TierResourceValidatorImpl implements TierResourceValidator { public boolean checkTierProductsInDependencyList(List<String> productDependencies, Map<String, String> dependenciesMap) { boolean exist = true; final Iterator<String> iterator = productDependencies.iterator(); while (exist && iterator.hasNext()) { String productDependency = iterator.next(); if (!dependenciesMap.containsKey(productDependency)) { exist = false; } } return exist; } }
TierResourceValidatorImpl implements TierResourceValidator { public boolean checkTierProductsInDependencyList(List<String> productDependencies, Map<String, String> dependenciesMap) { boolean exist = true; final Iterator<String> iterator = productDependencies.iterator(); while (exist && iterator.hasNext()) { String productDependency = iterator.next(); if (!dependenciesMap.containsKey(productDependency)) { exist = false; } } return exist; }  }
TierResourceValidatorImpl implements TierResourceValidator { public boolean checkTierProductsInDependencyList(List<String> productDependencies, Map<String, String> dependenciesMap) { boolean exist = true; final Iterator<String> iterator = productDependencies.iterator(); while (exist && iterator.hasNext()) { String productDependency = iterator.next(); if (!dependenciesMap.containsKey(productDependency)) { exist = false; } } return exist; }  void validateCreate(ClaudiaData claudiaData, TierDto environmentDto, String vdc, String environmentName); void validateCreateAbstract(TierDto tierDto, String environmentName); void validateSecurityGroups(ClaudiaData claudiaData, TierDto tierDto); void validateUpdate(String vdc, String environmentName, String tierName, TierDto environmentDto); void validateDelete(String vdc, String environmentName, String tierName); void validateTiersDependencies(String environmentName, String vdc, Set<TierDto> tierDtoList); boolean checkTierProductsInDependencyList(List<String> productDependencies,
            Map<String, String> dependenciesMap); void setTierManager(TierManager tierManager); void setEnvironmentInstanceManager(EnvironmentInstanceManager environmentInstanceManager); void setEnvironmentManager(EnvironmentManager environmentManager); QuotaClient getQuotaClient(); void setQuotaClient(QuotaClient quotaClient); void setResourceValidator(ResourceValidator resourceValidator); void setProductValidator(ProductValidator productValidator); }
TierResourceValidatorImpl implements TierResourceValidator { public boolean checkTierProductsInDependencyList(List<String> productDependencies, Map<String, String> dependenciesMap) { boolean exist = true; final Iterator<String> iterator = productDependencies.iterator(); while (exist && iterator.hasNext()) { String productDependency = iterator.next(); if (!dependenciesMap.containsKey(productDependency)) { exist = false; } } return exist; }  void validateCreate(ClaudiaData claudiaData, TierDto environmentDto, String vdc, String environmentName); void validateCreateAbstract(TierDto tierDto, String environmentName); void validateSecurityGroups(ClaudiaData claudiaData, TierDto tierDto); void validateUpdate(String vdc, String environmentName, String tierName, TierDto environmentDto); void validateDelete(String vdc, String environmentName, String tierName); void validateTiersDependencies(String environmentName, String vdc, Set<TierDto> tierDtoList); boolean checkTierProductsInDependencyList(List<String> productDependencies,
            Map<String, String> dependenciesMap); void setTierManager(TierManager tierManager); void setEnvironmentInstanceManager(EnvironmentInstanceManager environmentInstanceManager); void setEnvironmentManager(EnvironmentManager environmentManager); QuotaClient getQuotaClient(); void setQuotaClient(QuotaClient quotaClient); void setResourceValidator(ResourceValidator resourceValidator); void setProductValidator(ProductValidator productValidator);  }