Search in sources :

Example 1 with ComponentSearchRequest

use of alien4cloud.rest.component.ComponentSearchRequest in project alien4cloud by alien4cloud.

the class ApplicationStepDefinitions method I_search_for_application.

@When("^I search for \"([^\"]*)\" application$")
public void I_search_for_application(String applicationName) throws Throwable {
    ComponentSearchRequest searchRequest = new ComponentSearchRequest(null, applicationName, 0, 10, null);
    String searchResponse = getRestClientInstance().postJSon("/rest/v1/applications/search", JsonUtil.toString(searchRequest));
    Context.getInstance().registerRestResponse(searchResponse);
    RestResponse<FacetedSearchResult> response = JsonUtil.read(searchResponse, FacetedSearchResult.class);
    for (Object appAsObj : response.getData().getData()) {
        Application app = JsonUtil.readObject(JsonUtil.toString(appAsObj), Application.class);
        if (applicationName.equals(app.getName())) {
            CURRENT_APPLICATION = app;
        }
    }
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) Application(alien4cloud.model.application.Application) FacetedSearchResult(alien4cloud.dao.model.FacetedSearchResult) When(cucumber.api.java.en.When)

Example 2 with ComponentSearchRequest

use of alien4cloud.rest.component.ComponentSearchRequest in project alien4cloud by alien4cloud.

the class SearchDefinitionSteps method I_search_for_from_with_result_size_of.

@When("^I search for \"([^\"]*)\" from (\\d+) with result size of (\\d+)$")
public void I_search_for_from_with_result_size_of(String searchedComponentType, int from, int size) throws Throwable {
    ComponentSearchRequest req = new ComponentSearchRequest(QUERY_TYPES.get(searchedComponentType), null, from, size, null);
    String jSon = JsonUtil.toString(req);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/components/search", jSon));
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) When(cucumber.api.java.en.When)

Example 3 with ComponentSearchRequest

use of alien4cloud.rest.component.ComponentSearchRequest in project alien4cloud by alien4cloud.

the class SearchDefinitionSteps method I_search_for_from_with_result_size_of_and_filter_set_to.

@When("^I search for \"([^\"]*)\" from (\\d+) with result size of (\\d+) and filter \"([^\"]*)\" set to \"([^\"]*)\"$")
public void I_search_for_from_with_result_size_of_and_filter_set_to(String searchedComponentType, int from, int size, String filterName, String filterValue) throws Throwable {
    Map<String, String[]> filters = Maps.newHashMap();
    filters.put(filterName, new String[] { filterValue });
    ComponentSearchRequest req = new ComponentSearchRequest(QUERY_TYPES.get(searchedComponentType), null, from, size, filters);
    req.setType(req.getType());
    String jSon = JsonUtil.toString(req);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/components/search", jSon));
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) When(cucumber.api.java.en.When)

Example 4 with ComponentSearchRequest

use of alien4cloud.rest.component.ComponentSearchRequest in project alien4cloud by alien4cloud.

the class SearchDefinitionSteps method I_make_a_basic_search_for_from_with_result_size_of.

@When("^I make a basic \"([^\"]*)\" search for \"([^\"]*)\" from (\\d+) with result size of (\\d+)$")
public void I_make_a_basic_search_for_from_with_result_size_of(String query, String searchedComponentType, int from, int size) throws Throwable {
    // BasicSearchRequest req = new BasicSearchRequest(query, from, size);
    ComponentSearchRequest req = new ComponentSearchRequest(QUERY_TYPES.get(searchedComponentType), query, from, size, null);
    String jSon = JsonUtil.toString(req);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/components/search", jSon));
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) When(cucumber.api.java.en.When)

Example 5 with ComponentSearchRequest

use of alien4cloud.rest.component.ComponentSearchRequest in project alien4cloud by alien4cloud.

the class SearchDefinitionSteps method I_search_for_with_query_from_with_result_size_of.

@When("^I search for \"([^\"]*)\" using query \"([^\"]*)\" from (\\d+) with result size of (\\d+)$")
public void I_search_for_with_query_from_with_result_size_of(String searchedComponentType, String query, int from, int size) throws Throwable {
    ComponentSearchRequest req = new ComponentSearchRequest(QUERY_TYPES.get(searchedComponentType), query, from, size, null);
    req.setType(req.getType());
    String jSon = JsonUtil.toString(req);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/components/search", jSon));
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) When(cucumber.api.java.en.When)

Aggregations

ComponentSearchRequest (alien4cloud.rest.component.ComponentSearchRequest)5 When (cucumber.api.java.en.When)5 FacetedSearchResult (alien4cloud.dao.model.FacetedSearchResult)1 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)1 Application (alien4cloud.model.application.Application)1