use of alien4cloud.rest.service.model.NodeInstanceDTO in project alien4cloud by alien4cloud.
the class ServiceStepDefinitions method iSetThePropertyToForTheService.
@And("^I set the property \"([^\"]*)\" to \"([^\"]*)\" for the service \"([^\"]*)\"$")
public void iSetThePropertyToForTheService(String propertyName, String propertyValue, String serviceName) throws Throwable {
String serviceId = Context.getInstance().getServiceId(serviceName);
PatchServiceResourceRequest request = new PatchServiceResourceRequest();
NodeInstanceDTO nodeInstance = new NodeInstanceDTO();
nodeInstance.setProperties(Maps.newHashMap());
nodeInstance.getProperties().put(propertyName, new ScalarPropertyValue(propertyValue));
request.setNodeInstance(nodeInstance);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().patchJSon("/rest/v1/services/" + serviceId, JsonUtil.toString(request)));
}
use of alien4cloud.rest.service.model.NodeInstanceDTO in project alien4cloud by alien4cloud.
the class ServiceStepDefinitions method iStartTheService.
@And("^I (successfully\\s)?start the service \"([^\"]*)\"$")
public void iStartTheService(String successfully, String serviceName) throws Throwable {
String serviceId = Context.getInstance().getServiceId(serviceName);
PatchServiceResourceRequest request = new PatchServiceResourceRequest();
NodeInstanceDTO nodeInstance = new NodeInstanceDTO();
nodeInstance.setAttributeValues(Maps.newHashMap());
nodeInstance.getAttributeValues().put("state", "started");
request.setNodeInstance(nodeInstance);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().patchJSon("/rest/v1/services/" + serviceId, JsonUtil.toString(request)));
CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Aggregations