private void validateState(SubnetState state) { if (state.lifecycleState == null) { state.lifecycleState = LifecycleState.READY; } Utils.validateState(getStateDescription(), state); if (state.subnetCIDR != null) { new SubnetUtils(state.subnetCIDR); } }
private StorageDescription processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } StorageDescription state = op.getBody(StorageDescription.class); Utils.validateState(getStateDescription(), state); if (state.name == null) { throw new IllegalArgumentException("name is required."); } return state; }
private void validateState(SecurityGroupState state) { Utils.validateState(getStateDescription(), state); PhotonModelUtils.validateRegionId(state); if (state.regionId.isEmpty()) { throw new IllegalArgumentException("regionId required"); } if (state.resourcePoolLink.isEmpty()) { throw new IllegalArgumentException("resourcePoolLink required"); } validateRules(state.ingress); validateRules(state.egress); }
private EndpointState processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } EndpointState state = op.getBody(EndpointState.class); Utils.validateState(getStateDescription(), state); if (state.name == null) { throw new IllegalArgumentException("name is required."); } return state; }
private ResourceGroupState processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } ResourceGroupState state = op.getBody(ResourceGroupState.class); Utils.validateState(getStateDescription(), state); if (state.name == null) { throw new IllegalArgumentException("name is required."); } return state; }
private void validateState(Operation o) { ExtensibilitySubscription state = getBody(o); Utils.validateState(getStateDescription(), state); } }
private EndpointState processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } EndpointState state = op.getBody(EndpointState.class); Utils.validateState(getStateDescription(), state); if (state.name == null) { throw new IllegalArgumentException("name is required."); } return state; }
private void validateState(SecurityGroupState state) { Utils.validateState(getStateDescription(), state); PhotonModelUtils.validateRegionId(state); if (state.regionId.isEmpty()) { throw new IllegalArgumentException("regionId required"); } if (state.resourcePoolLink.isEmpty()) { throw new IllegalArgumentException("resourcePoolLink required"); } validateRules(state.ingress); validateRules(state.egress); }
private ResourceDescription processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } ResourceDescription state = op.getBody(ResourceDescription.class); Utils.validateState(getStateDescription(), state); return state; } }
private ResourceDescription processInput(Operation op) { if (!op.hasBody()) { throw (new IllegalArgumentException("body is required")); } ResourceDescription state = op.getBody(ResourceDescription.class); Utils.validateState(getStateDescription(), state); return state; } }
private void validateState(LoadBalancerDescription state) { Utils.validateState(getStateDescription(), state); AssertUtil.assertTrue((state.networkName == null) != (state.subnetLinks == null), "Either networkName or subnetLinks must be set."); validateRoutes(state.routes); }
public void validateState(NetworkState state) { Utils.validateState(getStateDescription(), state); PhotonModelUtils.validateRegionId(state); // do we have a subnet in CIDR notation // creating new SubnetUtils to validate if (state.subnetCIDR != null) { new SubnetUtils(state.subnetCIDR); } }
private void validateState(LoadBalancerState state) { Utils.validateState(getStateDescription(), state); PhotonModelUtils.validateRegionId(state); LoadBalancerDescriptionService.validateRoutes(state.routes); }
public void validateState(NetworkState state) { Utils.validateState(getStateDescription(), state); PhotonModelUtils.validateRegionId(state); // do we have a subnet in CIDR notation // creating new SubnetUtils to validate if (state.subnetCIDR != null) { new SubnetUtils(state.subnetCIDR); } }
private ElasticPlacementZoneState processInput(Operation op) { if (!op.hasBody()) { throw (new LocalizableValidationException("body is required", "compute.elastic.placement.body.required")); } ElasticPlacementZoneState state = op.getBody(ElasticPlacementZoneState.class); Utils.validateState(getStateDescription(), state); return state; }
@Override public void handlePut(Operation put) { Employee newState = getBody(put); // Checks for REQUIRED fields Utils.validateState(getStateDescription(), newState); setState(put, newState); put.complete(); logInfo("Successfully replaced via PUT: %s", newState); }
@Override public void handleCreate(Operation startPost) { Employee s = startPost.getBody(Employee.class); // Checks for REQUIRED fields Utils.validateState(getStateDescription(), s); validateManagerLink(s, this, (e) -> { if (e != null) { startPost.fail(e); return; } startPost.complete(); logInfo("Successfully created via POST: %s", s); }); }
@Test(expected = IllegalArgumentException.class) public void testValidateStateForRequiredField() { ExampleServiceState state = new ExampleServiceState(); state.id = null; state.required = null; ServiceDocumentDescription desc = buildStateDescription(ExampleServiceState.class, null); Utils.validateState(desc, state); }
@Test(expected = IllegalArgumentException.class) public void testValidateStateForRequiredField() { ExampleServiceState state = new ExampleServiceState(); state.id = null; state.required = null; ServiceDocumentDescription desc = buildStateDescription(ExampleServiceState.class, null); Utils.validateState(desc, state); }
@Test public void testValidateStateForUniqueIdentifier() { ExampleServiceState state = new ExampleServiceState(); state.id = null; state.required = "testRequiredField"; ServiceDocumentDescription desc = buildStateDescription(ExampleServiceState.class, null); Utils.validateState(desc, state); Assert.assertNotNull("Unique Identifier was not provided a default UUID", state.id); }