Search in sources :

Example 21 with FacetedSearchResult

use of alien4cloud.dao.model.FacetedSearchResult in project alien4cloud by alien4cloud.

the class SearchDefinitionSteps method The_response_should_contains_elements_from_various_types.

@Then("^The response should contains (\\d+) elements from various types.$")
public void The_response_should_contains_elements_from_various_types(int expectedSize) throws Throwable {
    RestResponse<FacetedSearchResult> restResponse = JsonUtil.read(Context.getInstance().getRestResponse(), FacetedSearchResult.class);
    FacetedSearchResult searchResp = restResponse.getData();
    assertNotNull(searchResp);
    assertNotNull(searchResp.getTypes());
    assertNotNull(searchResp.getData());
    assertEquals(expectedSize, searchResp.getTypes().length);
    assertEquals(expectedSize, searchResp.getData().length);
    // check various types in result
    ArrayList<String> resultTypes = new ArrayList<>(Arrays.asList(searchResp.getTypes()));
    for (String indexedType : indexedComponentTypes.values()) {
        assertTrue(" Result Types should contains  " + indexedType + ".", resultTypes.contains(indexedType));
    }
}
Also used : ArrayList(java.util.ArrayList) FacetedSearchResult(alien4cloud.dao.model.FacetedSearchResult) Then(cucumber.api.java.en.Then)

Example 22 with FacetedSearchResult

use of alien4cloud.dao.model.FacetedSearchResult in project alien4cloud by alien4cloud.

the class UsersDefinitionsSteps method there_should_be_users_in_the_response.

@Then("^there should be (\\d+) users in the response$")
public void there_should_be_users_in_the_response(int expectedSize) throws Throwable {
    RestResponse<FacetedSearchResult> restResponse = JsonUtil.read(Context.getInstance().takeRestResponse(), FacetedSearchResult.class);
    GetMultipleDataResult searchResp = restResponse.getData();
    assertNotNull(searchResp);
    assertNotNull(searchResp.getTypes());
    assertNotNull(searchResp.getData());
    assertEquals(expectedSize, searchResp.getTypes().length);
    assertEquals(expectedSize, searchResp.getData().length);
}
Also used : GetMultipleDataResult(alien4cloud.dao.model.GetMultipleDataResult) FacetedSearchResult(alien4cloud.dao.model.FacetedSearchResult) Then(cucumber.api.java.en.Then)

Aggregations

FacetedSearchResult (alien4cloud.dao.model.FacetedSearchResult)22 Then (cucumber.api.java.en.Then)6 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)5 NodeType (org.alien4cloud.tosca.model.types.NodeType)5 Application (alien4cloud.model.application.Application)3 HashMap (java.util.HashMap)3 SneakyThrows (lombok.SneakyThrows)3 FacetedSearchFacet (alien4cloud.dao.model.FacetedSearchFacet)2 GetMultipleDataResult (alien4cloud.dao.model.GetMultipleDataResult)2 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)2 Deployment (alien4cloud.model.deployment.Deployment)2 Given (cucumber.api.java.en.Given)2 ApiOperation (io.swagger.annotations.ApiOperation)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 Function (java.util.function.Function)2 CapabilityDefinition (org.alien4cloud.tosca.model.definitions.CapabilityDefinition)2 SearchResponse (org.elasticsearch.action.search.SearchResponse)2 FilterBuilder (org.elasticsearch.index.query.FilterBuilder)2