@Test public void getStudiesSampleDescriptions() throws Exception { mockMvc.perform(get("/sampledescriptions")) .andExpect(content().contentType("text/tsv")) .andExpect(status().isOk()); verify(studySampleDescriptionsDownloadService, times(1)).generateStudySampleDescriptions(); verify(studySampleDescriptionsDownloadService, times(1)).createDownloadFile(Matchers.any(OutputStream.class), Matchers.anyCollection()); }
@RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) public void getStudiesSampleDescriptions(HttpServletResponse response) { Collection<StudySampleDescription> studySampleDescriptions = studySampleDescriptionsDownloadService.generateStudySampleDescriptions(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String now = dateFormat.format(date); String fileName = "GWASAncestry".concat("-").concat(now).concat(".tsv"); response.setContentType("text/tsv"); response.setHeader("Content-Disposition", "attachement; filename=" + fileName); try { studySampleDescriptionsDownloadService.createDownloadFile(response.getOutputStream(), studySampleDescriptions); } catch (IOException e) { getLog().error("Cannot create ancestry download file"); e.printStackTrace(); } }
StudySampleDesciptionsController { @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) public void getStudiesSampleDescriptions(HttpServletResponse response) { Collection<StudySampleDescription> studySampleDescriptions = studySampleDescriptionsDownloadService.generateStudySampleDescriptions(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String now = dateFormat.format(date); String fileName = "GWASAncestry".concat("-").concat(now).concat(".tsv"); response.setContentType("text/tsv"); response.setHeader("Content-Disposition", "attachement; filename=" + fileName); try { studySampleDescriptionsDownloadService.createDownloadFile(response.getOutputStream(), studySampleDescriptions); } catch (IOException e) { getLog().error("Cannot create ancestry download file"); e.printStackTrace(); } } }
StudySampleDesciptionsController { @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) public void getStudiesSampleDescriptions(HttpServletResponse response) { Collection<StudySampleDescription> studySampleDescriptions = studySampleDescriptionsDownloadService.generateStudySampleDescriptions(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String now = dateFormat.format(date); String fileName = "GWASAncestry".concat("-").concat(now).concat(".tsv"); response.setContentType("text/tsv"); response.setHeader("Content-Disposition", "attachement; filename=" + fileName); try { studySampleDescriptionsDownloadService.createDownloadFile(response.getOutputStream(), studySampleDescriptions); } catch (IOException e) { getLog().error("Cannot create ancestry download file"); e.printStackTrace(); } } @Autowired  StudySampleDesciptionsController(StudySampleDescriptionsDownloadService studySampleDescriptionsDownloadService); }
StudySampleDesciptionsController { @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) public void getStudiesSampleDescriptions(HttpServletResponse response) { Collection<StudySampleDescription> studySampleDescriptions = studySampleDescriptionsDownloadService.generateStudySampleDescriptions(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String now = dateFormat.format(date); String fileName = "GWASAncestry".concat("-").concat(now).concat(".tsv"); response.setContentType("text/tsv"); response.setHeader("Content-Disposition", "attachement; filename=" + fileName); try { studySampleDescriptionsDownloadService.createDownloadFile(response.getOutputStream(), studySampleDescriptions); } catch (IOException e) { getLog().error("Cannot create ancestry download file"); e.printStackTrace(); } } @Autowired  StudySampleDesciptionsController(StudySampleDescriptionsDownloadService studySampleDescriptionsDownloadService); @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) void getStudiesSampleDescriptions(HttpServletResponse response); }
StudySampleDesciptionsController { @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) public void getStudiesSampleDescriptions(HttpServletResponse response) { Collection<StudySampleDescription> studySampleDescriptions = studySampleDescriptionsDownloadService.generateStudySampleDescriptions(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String now = dateFormat.format(date); String fileName = "GWASAncestry".concat("-").concat(now).concat(".tsv"); response.setContentType("text/tsv"); response.setHeader("Content-Disposition", "attachement; filename=" + fileName); try { studySampleDescriptionsDownloadService.createDownloadFile(response.getOutputStream(), studySampleDescriptions); } catch (IOException e) { getLog().error("Cannot create ancestry download file"); e.printStackTrace(); } } @Autowired  StudySampleDesciptionsController(StudySampleDescriptionsDownloadService studySampleDescriptionsDownloadService); @RequestMapping(produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET) void getStudiesSampleDescriptions(HttpServletResponse response);  }