use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class GroupsStepDefinitions method I_update_the_group_fields.
@When("^I update the \"([^\"]*)\" group fields:$")
public void I_update_the_group_fields(String name, List<Entry> fields) throws Throwable {
Map<String, String> fieldsMap = Maps.newHashMap();
for (Entry field : fields) {
fieldsMap.put(field.getName(), field.getValue());
}
Context.getInstance().registerRestResponse(Context.getRestClientInstance().putJSon("/rest/v1/groups/" + Context.getInstance().getGroupId(name), JsonUtil.toString(fieldsMap)));
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class GroupsStepDefinitions method I_search_in_groups_for_from_with_result_size_of.
@When("^I search in groups for \"([^\"]*)\" from (\\d+) with result size of (\\d+)$")
public void I_search_in_groups_for_from_with_result_size_of(String query, int from, int size) throws Throwable {
FilteredSearchRequest request = new FilteredSearchRequest(query, from, size, null);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/groups/search", JsonUtil.toString(request)));
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class GroupsStepDefinitions method I_create_a_new_group_in_the_system_with_name_a_role_and_a_user.
@When("^I create a new group in the system with name \"([^\"]*)\" , a role \"([^\"]*)\" and a user \"([^\"]*)\"$")
public void I_create_a_new_group_in_the_system_with_name_a_role_and_a_user(String name, String role, String username) throws Throwable {
CreateGroupRequest request = new CreateGroupRequest();
request.setName(name);
request.setRoles(Sets.newHashSet(role));
request.setUsers(Sets.newHashSet(username));
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/groups/", JsonUtil.toString(request)));
String groupId = JsonUtil.read(Context.getInstance().getRestResponse(), String.class).getData();
if (groupId != null) {
Context.getInstance().registerGroupId(name, groupId);
}
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class MaintenanceStepsDefinition method updateState.
@When("^I update maintenance state, message: \"([^\"]*)\" percent: (\\d+)$")
public void updateState(String message, Integer percent) throws Throwable {
MaintenanceUpdateDTO updateDTO = new MaintenanceUpdateDTO(message, percent);
Context.getInstance().registerRestResponse(getRestClientInstance().putJSon("/rest/v1/maintenance", Context.getJsonMapper().writeValueAsString(updateDTO)));
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class LocationsDefinitionsSteps method I_set_the_value_to_the_location_meta_property_of_the_location_of_the_orchestrator.
@When("^I set the value \"([^\"]*)\" to the location meta-property \"([^\"]*)\" of the location \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void I_set_the_value_to_the_location_meta_property_of_the_location_of_the_orchestrator(String value, String metaPropertyName, String locationName, String orchestratorName) throws Throwable {
MetaPropConfiguration propertyDefinition = Context.getInstance().getConfigurationTag(metaPropertyName);
PropertyValidationRequest propertyCheckRequest = new PropertyValidationRequest(value, propertyDefinition.getId(), propertyDefinition, null);
String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
String locationId = getLocationIdFromName(orchestratorName, locationName);
String restUrl = String.format("/rest/v1/orchestrators/%s/locations/%s/properties", orchestratorId, locationId);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(propertyCheckRequest)));
}
Aggregations