@Test public void testIsValidShouldReturnFalseWhenRequestContainsNodeCountAndStatus() { UpdateStackJson updateStackJson = new UpdateStackJson(); InstanceGroupAdjustmentJson instanceGroupAdjustmentJson = new InstanceGroupAdjustmentJson(); instanceGroupAdjustmentJson.setScalingAdjustment(4); instanceGroupAdjustmentJson.setInstanceGroup("slave_1"); updateStackJson.setStatus(StatusRequest.STARTED); updateStackJson.setInstanceGroupAdjustment(instanceGroupAdjustmentJson); boolean valid = underTest.isValid(updateStackJson, constraintValidatorContext); assertFalse(valid); }
@Test public void testIsValidShouldReturnTrueWhenNodeCountIsUpdated() { UpdateStackJson updateStackJson = new UpdateStackJson(); InstanceGroupAdjustmentJson instanceGroupAdjustmentJson = new InstanceGroupAdjustmentJson(); instanceGroupAdjustmentJson.setScalingAdjustment(12); instanceGroupAdjustmentJson.setInstanceGroup("slave_1"); updateStackJson.setInstanceGroupAdjustment(instanceGroupAdjustmentJson); updateStackJson.setStatus(null); boolean valid = underTest.isValid(updateStackJson, constraintValidatorContext); assertTrue(valid); }
@Test public void testInValidShouldReturnTrueWhenNodeCountIsLowerThanOneUpdatedAndWithClusterEvent() { UpdateStackJson updateStackJson = new UpdateStackJson(); InstanceGroupAdjustmentJson instanceGroupAdjustmentJson = new InstanceGroupAdjustmentJson(); instanceGroupAdjustmentJson.setScalingAdjustment(-1); instanceGroupAdjustmentJson.setWithClusterEvent(true); instanceGroupAdjustmentJson.setInstanceGroup("slave_1"); updateStackJson.setInstanceGroupAdjustment(instanceGroupAdjustmentJson); updateStackJson.setStatus(null); boolean valid = underTest.isValid(updateStackJson, constraintValidatorContext); assertFalse(valid); }