use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse in project irida by phac-nml.
the class AnalysesListingServiceTest method testGetPagedSubmissionsForAdmin.
@Test
public void testGetPagedSubmissionsForAdmin() throws IridaWorkflowNotFoundException, ExecutionManagerException {
String searchValue = "";
DataTablesParams params = new DataTablesParams(1, 10, 1, searchValue, new Sort(Sort.Direction.ASC, "id"), ImmutableMap.of());
when(analysisSubmissionService.listAllSubmissions(eq(searchValue), any(String.class), eq(null), Matchers.any(), Matchers.any())).thenReturn(AnalysesDataFactory.getPagedAnalysisSubmissions());
DataTablesResponse response = analysesListingService.getPagedSubmissions(params, Locale.US, null, null);
assertEquals("DataTables response should have a draw value of 1", 1, response.getDraw());
assertEquals("DataTables response should have a records filtered value of 150", 150, response.getRecordsFiltered());
assertEquals("DataTables response should have a records total value of 150", 150, response.getRecordsTotal());
assertTrue("Should have data value", response.getData() != null);
verify(analysisSubmissionService).listAllSubmissions(eq(searchValue), any(String.class), eq(null), Matchers.any(), Matchers.any());
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse in project irida by phac-nml.
the class ProjectsControllerTest method testGetAjaxAdminProjectsList.
@Test
public void testGetAjaxAdminProjectsList() {
when(projectService.findAllProjects(any(String.class), any(Integer.class), any(Integer.class), any(Sort.class))).thenReturn(getProjectPage());
when(sampleService.getSamplesForProject(any(Project.class))).thenReturn(TestDataFactory.constructListJoinProjectSample());
DataTablesParams params = new DataTablesParams(0, 10, 1, "", new Sort(Sort.Direction.ASC, "modifiedDate"), new HashMap<>());
DataTablesResponse response = controller.getAjaxAdminProjectsList(params);
assertEquals("Should have 10 data elements, since page size is 10", 10, response.getData().size());
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse in project irida by phac-nml.
the class ClientsControllerTest method testGetAjaxClientList.
@SuppressWarnings("unchecked")
@Test
public void testGetAjaxClientList() {
IridaClientDetails client1 = new IridaClientDetails();
client1.setId(1L);
IridaClientDetails client2 = new IridaClientDetails();
client2.setId(2L);
Page<IridaClientDetails> clientPage = new PageImpl<>(Lists.newArrayList(client1, client2));
when(clientDetailsService.search(any(Specification.class), any(PageRequest.class))).thenReturn(clientPage);
DataTablesParams params = new DataTablesParams(1, 10, 1, "", new Sort(Sort.Direction.ASC, "createdDate"), new HashMap<>());
DataTablesResponse response = controller.getAjaxClientsList(params);
List<DataTablesResponseModel> models = response.getData();
assertEquals(2, models.size());
verify(clientDetailsService).search(any(Specification.class), any(PageRequest.class));
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse in project irida by phac-nml.
the class AnalysesListingServiceTest method testGetPagedSubmissionsForProject.
@Test
public void testGetPagedSubmissionsForProject() throws IridaWorkflowNotFoundException, ExecutionManagerException {
String searchValue = "";
Project project = new Project();
DataTablesParams params = new DataTablesParams(1, 10, 1, searchValue, new Sort(Sort.Direction.ASC, "id"), ImmutableMap.of());
when(analysisSubmissionService.listSubmissionsForProject(eq(searchValue), any(String.class), eq(null), Matchers.any(), eq(project), Matchers.any())).thenReturn(AnalysesDataFactory.getPagedAnalysisSubmissions());
DataTablesResponse response = analysesListingService.getPagedSubmissions(params, Locale.US, null, project);
assertEquals("DataTables response should have a draw value of 1", 1, response.getDraw());
assertEquals("DataTables response should have a records filtered value of 150", 150, response.getRecordsFiltered());
assertEquals("DataTables response should have a records total value of 150", 150, response.getRecordsTotal());
assertTrue("Should have data value", response.getData() != null);
verify(analysisSubmissionService).listSubmissionsForProject(eq(searchValue), any(String.class), eq(null), Matchers.any(), eq(project), Matchers.any());
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.DataTablesResponse in project irida by phac-nml.
the class AnalysisControllerDataTablesTest method setup.
@Before
public void setup() throws IridaWorkflowNotFoundException, ExecutionManagerException {
// initializes controller and mocks
MockitoAnnotations.initMocks(this);
/*
Need to set up a mock for the AnalysisSubmissionService so that it return a Page of AnalysisSubmission.
*/
DataTablesParams params = new DataTablesParams(1, 10, 1, "", new Sort(Sort.Direction.ASC, "id"), ImmutableMap.of());
Page<AnalysisSubmission> page = AnalysesDataFactory.getPagedAnalysisSubmissions();
when(analysesListingService.getPagedSubmissions(Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any())).thenReturn(new DataTablesResponse(params, page, ImmutableList.of()));
mockMvc = MockMvcBuilders.standaloneSetup(analysisController).build();
}
Aggregations