ngr1.setInstanceNum(6);
ngr1.setRoles(roles1);
ngr1.setComputeOnly(defaultSoftwareManager.isComputeOnlyRoles(ngr1.getRoles()));
List<NodeGroupRead> nodeGroupRead = new LinkedList<NodeGroupRead>();
nodeGroupRead.add(ngr1);
ClusterRead cluster = new ClusterRead();
cluster.setNodeGroups(nodeGroupRead);
cluster.setVhmMinNum(-1);
cluster.setVhmMaxNum(-1);
try {
cluster.validateSetParamParameters(null, -2, null);
fail();
} catch (BddException e) {
assertEquals("Invalid value: minComputeNodeNum=-2. Value must be less than or equal to the number of compute-only nodes (6) and less than or equal to maxComputeNodeNum.", e.getMessage());
}
try {
cluster.validateSetParamParameters(null, null, -2);
fail();
} catch (BddException e) {
assertEquals("Invalid value: maxComputeNodeNum=-2. Value must be less than or equal to the number of compute-only nodes (6) and greater than or equal to minComputeNodeNum.", e.getMessage());
}
try {
cluster.validateSetParamParameters(9, null, null);
fail();
} catch (BddException e) {
assertEquals("Invalid value: targetComputeNodeNum=9. Value must be less than or equal to the number of compute-only nodes (6).", e.getMessage());
}
try {
cluster.validateSetParamParameters(null, 6, 1);
fail();
} catch (BddException e) {
assertEquals("Invalid value: minComputeNodeNum=6. Value must be less than or equal to the number of compute-only nodes (6) and less than or equal to maxComputeNodeNum (1).", e.getMessage());
}
cluster.setVhmMinNum(6);
try {
cluster.validateSetParamParameters(null, null, 5);
fail();
} catch (BddException e) {
assertEquals("Invalid value: maxComputeNodeNum=5. Value must be less than or equal to the number of compute-only nodes (6) and greater than or equal to minComputeNodeNum (6).", e.getMessage());
}
cluster.setVhmMaxNum(1);
try {
cluster.validateSetParamParameters(null, 6, null);
fail();
} catch (BddException e) {
assertEquals("Invalid value: minComputeNodeNum=6. Value must be less than or equal to the number of compute-only nodes (6) and less than or equal to maxComputeNodeNum (1).", e.getMessage());
}
//test will fail if Exception is thrown out
cluster.setVhmMinNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, null, -1));
assertEquals(true, cluster.validateSetParamParameters(null, null, 0));
assertEquals(true, cluster.validateSetParamParameters(null, null, 1));
cluster.setVhmMinNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, null, -1));
assertEquals(true, cluster.validateSetParamParameters(null, null, 0));
assertEquals(true, cluster.validateSetParamParameters(null, null, 1));
cluster.setVhmMinNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, -1, null));
cluster.setVhmMinNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, 0, null));
cluster.setVhmMinNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, 1, null));
cluster.setVhmMinNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, -1, null));
cluster.setVhmMinNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, 0, null));
cluster.setVhmMinNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, 1, null));
cluster.setVhmMaxNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, null, -1));
cluster.setVhmMaxNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, null, 0));
cluster.setVhmMaxNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, null, 1));
cluster.setVhmMaxNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, null, -1));
cluster.setVhmMaxNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, null, 0));
cluster.setVhmMaxNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, null, 1));
cluster.setVhmMaxNum(0);
assertEquals(true, cluster.validateSetParamParameters(null, -1, null));
assertEquals(true, cluster.validateSetParamParameters(null, 0, null));
//assertEquals(true, cluster.validateSetParamParameters(null, 1, null));
cluster.setVhmMaxNum(-1);
assertEquals(true, cluster.validateSetParamParameters(null, -1, null));
assertEquals(true, cluster.validateSetParamParameters(null, 0, null));
assertEquals(true, cluster.validateSetParamParameters(null, 1, null));
cluster.validateSetParamParameters(null, null, null);
cluster.validateSetParamParameters(2, null, null);
cluster.validateSetParamParameters(null, 1, 5);
}