Search in sources :

Example 16 with PagedMetadata

use of org.entando.entando.web.common.model.PagedMetadata in project entando-core by entando.

the class WidgetControllerTest method testGetWidgetList.

@Test
public void testGetWidgetList() throws Exception {
    UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
    String accessToken = mockOAuthInterceptor(user);
    PagedMetadata<WidgetDto> pagedDto = new PagedMetadata<>();
    when(widgetService.getWidgets(any())).thenReturn(pagedDto);
    // @formatter:off
    ResultActions result = mockMvc.perform(get("/widgets").header("Authorization", "Bearer " + accessToken));
    String response = result.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
    assertNotNull(response);
}
Also used : UserDetails(com.agiletec.aps.system.services.user.UserDetails) PagedMetadata(org.entando.entando.web.common.model.PagedMetadata) ResultActions(org.springframework.test.web.servlet.ResultActions) WidgetDto(org.entando.entando.aps.system.services.widgettype.model.WidgetDto) AbstractControllerTest(org.entando.entando.web.AbstractControllerTest) Test(org.junit.Test)

Aggregations

PagedMetadata (org.entando.entando.web.common.model.PagedMetadata)16 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)15 FieldSearchFilter (com.agiletec.aps.system.common.FieldSearchFilter)8 ArrayList (java.util.ArrayList)8 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)8 RestListRequest (org.entando.entando.web.common.model.RestListRequest)7 RestServerError (org.entando.entando.aps.system.exception.RestServerError)6 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)5 List (java.util.List)5 IDtoBuilder (org.entando.entando.aps.system.services.IDtoBuilder)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 UserDetails (com.agiletec.aps.system.services.user.UserDetails)4 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)4 Map (java.util.Map)3 ValidationConflictException (org.entando.entando.web.common.exceptions.ValidationConflictException)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Group (com.agiletec.aps.system.services.group.Group)2 GroupUtilizer (com.agiletec.aps.system.services.group.GroupUtilizer)2 IGroupManager (com.agiletec.aps.system.services.group.IGroupManager)2