Search in sources :

Example 96 with When

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)));
}
Also used : Entry(alien4cloud.it.Entry) When(cucumber.api.java.en.When)

Example 97 with When

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)));
}
Also used : FilteredSearchRequest(alien4cloud.rest.model.FilteredSearchRequest) When(cucumber.api.java.en.When)

Example 98 with When

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);
    }
}
Also used : CreateGroupRequest(alien4cloud.security.groups.rest.CreateGroupRequest) When(cucumber.api.java.en.When)

Example 99 with When

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)));
}
Also used : MaintenanceUpdateDTO(org.alien4cloud.server.MaintenanceUpdateDTO) When(cucumber.api.java.en.When)

Example 100 with When

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)));
}
Also used : MetaPropConfiguration(alien4cloud.model.common.MetaPropConfiguration) PropertyValidationRequest(alien4cloud.rest.internal.model.PropertyValidationRequest) When(cucumber.api.java.en.When)

Aggregations

When (cucumber.api.java.en.When)148 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)12 Application (alien4cloud.model.application.Application)10 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)6 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)6 ComponentSearchRequest (alien4cloud.rest.component.ComponentSearchRequest)5 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)5 TopologyDTO (alien4cloud.topology.TopologyDTO)4 Path (java.nio.file.Path)4 List (java.util.List)4 UiApplicationDriver (org.activityinfo.test.driver.UiApplicationDriver)4 PivotTableEditor (org.activityinfo.test.pageobject.web.reports.PivotTableEditor)4 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)4 WebElement (org.openqa.selenium.WebElement)4 MvcResult (org.springframework.test.web.servlet.MvcResult)4 NotFoundException (alien4cloud.exception.NotFoundException)3 Context (alien4cloud.it.Context)3 MetaPropConfiguration (alien4cloud.model.common.MetaPropConfiguration)3 DeployApplicationRequest (alien4cloud.rest.application.model.DeployApplicationRequest)3 UpdateDeploymentTopologyRequest (alien4cloud.rest.application.model.UpdateDeploymentTopologyRequest)3