Search in sources :

Example 31 with GetMultipleDataResult

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

the class UserService method countAdminUser.

@SuppressWarnings("rawtypes")
public int countAdminUser() {
    Map<String, String[]> filters = new HashMap<String, String[]>();
    filters.put("roles", new String[] { Role.ADMIN.toString() });
    GetMultipleDataResult searchResult = alienUserDao.find(filters, 1);
    return (int) searchResult.getTotalResults();
}
Also used : HashMap(java.util.HashMap) GetMultipleDataResult(alien4cloud.dao.model.GetMultipleDataResult)

Example 32 with GetMultipleDataResult

use of alien4cloud.dao.model.GetMultipleDataResult 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

GetMultipleDataResult (alien4cloud.dao.model.GetMultipleDataResult)32 Test (org.junit.Test)9 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 ApiOperation (io.swagger.annotations.ApiOperation)7 HashMap (java.util.HashMap)7 NodeType (org.alien4cloud.tosca.model.types.NodeType)7 Application (alien4cloud.model.application.Application)4 User (alien4cloud.security.model.User)4 Then (cucumber.api.java.en.Then)4 Location (alien4cloud.model.orchestrators.locations.Location)3 IdsFilterBuilder (org.elasticsearch.index.query.IdsFilterBuilder)3 ApplicationEnvironmentService (alien4cloud.application.ApplicationEnvironmentService)2 IGenericSearchDAO (alien4cloud.dao.IGenericSearchDAO)2 ApplicationEnvironment (alien4cloud.model.application.ApplicationEnvironment)2 Orchestrator (alien4cloud.model.orchestrators.Orchestrator)2 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)2 Group (alien4cloud.security.model.Group)2 Arrays (java.util.Arrays)2 Resource (javax.annotation.Resource)2