本文整理了Java中com.vmware.xenon.common.Utils.validateState()
方法的一些代码示例,展示了Utils.validateState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.validateState()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:validateState
[英]Validates state object by checking for null value fields.
[中]通过检查空值字段来验证状态对象。
代码示例来源:origin: vmware/admiral
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);
}
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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;
}
代码示例来源:origin: vmware/admiral
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);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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;
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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;
}
代码示例来源:origin: vmware/admiral
private void validateState(Operation o) {
ExtensibilitySubscription state = getBody(o);
Utils.validateState(getStateDescription(), state);
}
}
代码示例来源:origin: vmware/admiral
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;
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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);
}
代码示例来源:origin: vmware/admiral
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;
}
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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;
}
}
代码示例来源:origin: vmware/admiral
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);
}
代码示例来源:origin: vmware/admiral
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);
}
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
private void validateState(LoadBalancerState state) {
Utils.validateState(getStateDescription(), state);
PhotonModelUtils.validateRegionId(state);
LoadBalancerDescriptionService.validateRoutes(state.routes);
}
代码示例来源:origin: com.vmware.photon.controller/photon-model
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);
}
}
代码示例来源:origin: vmware/admiral
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;
}
代码示例来源:origin: vmware/xenon
@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);
}
代码示例来源:origin: vmware/xenon
@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);
});
}
代码示例来源:origin: vmware/xenon
@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);
}
代码示例来源:origin: com.vmware.xenon/xenon-common
@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);
}
代码示例来源:origin: vmware/xenon
@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);
}
内容来源于网络,如有侵权,请联系作者删除!