use of org.entando.entando.web.common.model.RestListRequest in project entando-core by entando.
the class EntityManagerControllerTest method getEntityManagers_2.
@Test
public void getEntityManagers_2() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
when(this.entityManagerService.getEntityManagers(any(RestListRequest.class))).thenReturn(new PagedMetadata<>());
ResultActions result = mockMvc.perform(get("/entityManagers").param("page", "1").param("pageSize", "4").param("filter[0].attribute", "code").param("filter[0].value", "UserProfileManager").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
RestListRequest restListReq = new RestListRequest();
restListReq.setPage(1);
restListReq.setPageSize(4);
restListReq.addFilter(new Filter("code", "UserProfileManager"));
Mockito.verify(this.entityManagerService, Mockito.times(1)).getEntityManagers(restListReq);
}
use of org.entando.entando.web.common.model.RestListRequest in project entando-core by entando.
the class EntityManagerControllerTest method getEntityManagers_1.
@Test
public void getEntityManagers_1() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
when(this.entityManagerService.getEntityManagers(any(RestListRequest.class))).thenReturn(new PagedMetadata<>());
ResultActions result = mockMvc.perform(get("/entityManagers").param("page", "1").param("pageSize", "4").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
RestListRequest restListReq = new RestListRequest();
restListReq.setPage(1);
restListReq.setPageSize(4);
Mockito.verify(this.entityManagerService, Mockito.times(1)).getEntityManagers(restListReq);
}
use of org.entando.entando.web.common.model.RestListRequest in project entando-core by entando.
the class GuiFragmentControllerTest method should_load_the_list_of_fragments.
@Test
public void should_load_the_list_of_fragments() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
when(this.guiFragmentService.getGuiFragments(any(RestListRequest.class))).thenReturn(new PagedMetadata<>());
ResultActions result = mockMvc.perform(get("/fragments").param("page", "1").param("pageSize", "4").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
RestListRequest restListReq = new RestListRequest();
restListReq.setPage(1);
restListReq.setPageSize(4);
Mockito.verify(this.guiFragmentService, Mockito.times(1)).getGuiFragments(restListReq);
}
use of org.entando.entando.web.common.model.RestListRequest in project entando-core by entando.
the class GuiFragmentControllerTest method should_load_the_list_of_fragments_2.
@Test
public void should_load_the_list_of_fragments_2() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
when(this.guiFragmentService.getGuiFragments(any(RestListRequest.class))).thenReturn(new PagedMetadata<>());
ResultActions result = mockMvc.perform(get("/fragments").param("page", "1").param("pageSize", "4").param("filter[0].attribute", "code").param("filter[0].value", "userprofile_editCurrentUser_profile").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
RestListRequest restListReq = new RestListRequest();
restListReq.setPage(1);
restListReq.setPageSize(4);
restListReq.addFilter(new Filter("code", "userprofile_editCurrentUser_profile"));
Mockito.verify(this.guiFragmentService, Mockito.times(1)).getGuiFragments(restListReq);
}
use of org.entando.entando.web.common.model.RestListRequest in project entando-core by entando.
the class PageModelControllerTest method should_load_the_list_of_pageModels_1.
@Test
public void should_load_the_list_of_pageModels_1() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
PageModelDto singleDto = new PageModelDto();
List<PageModelDto> dtos = new ArrayList<>();
dtos.add(singleDto);
PageModel model = new PageModel();
List<PageModel> models = new ArrayList<>();
models.add(model);
SearcherDaoPaginatedResult<PageModel> sdpr = new SearcherDaoPaginatedResult<>(1, models);
PagedMetadata<PageModelDto> meta = new PagedMetadata<>(new RestListRequest(), sdpr);
meta.setBody(dtos);
when(pageModelService.getPageModels(any(RestListRequest.class))).thenReturn(meta);
ResultActions result = mockMvc.perform(get("/pagemodels").header("Authorization", "Bearer " + accessToken));
System.out.println(result.andReturn().getResponse().getContentAsString());
result.andExpect(status().isOk());
RestListRequest restListReq = new RestListRequest();
Mockito.verify(pageModelService, Mockito.times(1)).getPageModels(restListReq);
}
Aggregations