for (NodeGroupCreate nodeGroup : cluster.getNodeGroups()) {
boolean instancePerHost = false;
boolean strictAssociated = false;
String referToGroup = null;
PlacementPolicy placement = nodeGroup.getPlacementPolicies();
if (placement != null && placement.getInstancePerHost() != null) {
instancePerHost = true;
}
if (placement != null && placement.getGroupAssociations() != null
&& placement.getGroupAssociations().size() > 0) {
GroupAssociation association =
placement.getGroupAssociations().get(0);
if (GroupAssociationType.STRICT.equals(association.getType())) {
strictAssociated = true;
referToGroup = association.getReference();
}
}
int count = 0;
Map<String, Integer> usage = hostMapByGroup.get(nodeGroup.getName());
// this node group does not have any existed nodes
if (usage == null)
continue;
for (String host : usage.keySet()) {
count += usage.get(host);
// instance_per_host validation
if (instancePerHost)
Assert.assertTrue(
placement.getInstancePerHost().equals(usage.get(host)),
"should follow instance_per_host policy");
// strict association policy validation
if (strictAssociated) {
Assert.assertTrue(