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;
}
}
}
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));
}
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));
}
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));
}
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));
}
Aggregations