@Test public void testConvertToPdf() { try { OdfTextDocument oDoc = uk.ac.bbsrc.tgac.miso.core.util.FormUtils.createSampleDeliveryForm( generateSamples(), testSampleDeliveryFile, false); uk.ac.bbsrc.tgac.miso.core.util.FormUtils.convertToPDF(oDoc); } catch (Exception e) { e.printStackTrace(); TestCase.fail(); } }
@Test public void testCreateSampleDeliveryForm() { try { uk.ac.bbsrc.tgac.miso.core.util.FormUtils.createSampleDeliveryForm( generateSamples(), testSampleDeliveryFile, true); } catch (Exception e) { e.printStackTrace(); TestCase.fail(); } }
@Test public void testImportSampleDeliveryForm() { try { List<Sample> samples = uk.ac.bbsrc.tgac.miso.core.util.FormUtils.importSampleDeliveryForm(testFile); int numExpected = generateSamples().size(); if (samples.size() != numExpected) { log.error("Expected samples in: " + numExpected + ". Number imported: " + samples.size()); TestCase.fail(); } else { log.info("Expected samples in: " + numExpected + ". Number imported: " + samples.size()); } } catch (Exception e) { e.printStackTrace(); TestCase.fail(); } }
public JSONObject downloadPlateInputForm(HttpSession session, JSONObject json) { if (json.has("documentFormat")) { String documentFormat = json.getString("documentFormat"); try { File f = misoFileManager.getNewFile( Plate.class, "forms", "PlateInputForm-" + LimsUtils.getCurrentDateAsString() + "." + documentFormat); FormUtils.createPlateInputSpreadsheet(f); return JSONUtils.SimpleJSONResponse("" + f.getName().hashCode()); } catch (Exception e) { e.printStackTrace(); return JSONUtils.SimpleJSONError("Failed to get plate input form: " + e.getMessage()); } } else { return JSONUtils.SimpleJSONError("Missing project ID or document format supplied."); } }
@Test public void testImportBulkInputXLS() { try { InputStream in = FormUtilsTests.class.getClassLoader().getResourceAsStream("test-bulk_input.xlsx"); LimsUtils.writeFile(in, testSampleBulkInputXlsFile); User u = new UserImpl(); u.setLoginName("testBulkImportUser"); List<Sample> samples = FormUtils.importSampleInputSpreadsheet( testSampleBulkInputXlsFile, u, new MockFormTestRequestManager(), new DefaultLibraryNamingScheme()); log.info("Imported :: " + LimsUtils.join(samples, " | ")); } catch (Exception e) { e.printStackTrace(); TestCase.fail(); } finally { testSampleBulkInputXlsFile.delete(); } }