@Test(enabled = false) public void sendToEspapTest() throws URISyntaxException { OperationalMode modeOfOperation = globalConfiguration.getModeOfOperation(); assertEquals(modeOfOperation, OperationalMode.TEST, "This test may only be run in TEST mode"); URL resource = MainIT.class.getClassLoader().getResource("BII04_T10_EHF-v2.0_invoice.xml"); URI uri = resource.toURI(); File testFile = new File(uri); assertTrue(testFile.canRead(), "Can not locate " + testFile); String[] args = { "-f", testFile.toString(), "-r", "9946:ESPAP", "-s", WellKnownParticipant.DIFI_TEST.toString(), "-t", "true", "-u", "https://ap1.espap.pt/oxalis/as2", "-m", "AS2", "-i", "APP_1000000222" }; // Executes the outbound message sender try { Main.main(args); } catch (Exception e) { fail("Failed " + e.getMessage()); } }
@Test(enabled = true) public void sendToDifiTest() throws URISyntaxException { OperationalMode modeOfOperation = globalConfiguration.getModeOfOperation(); assertEquals(modeOfOperation, OperationalMode.TEST, "This test may only be run in TEST mode"); URL resource = MainIT.class.getClassLoader().getResource("BII04_T10_EHF-v2.0_invoice.xml"); URI uri = resource.toURI(); File testFile = new File(uri); assertTrue(testFile.canRead(), "Can not locate " + testFile); String[] args = { "-f", testFile.toString(), "-r", WellKnownParticipant.DIFI_TEST.toString(), "-s", WellKnownParticipant.U4_TEST.toString(), "-t", "true", "-e", "/tmp" // current directory }; // Executes the outbound message sender try { Main.main(args); } catch (Exception e) { fail("Failed " + e.getMessage(), e); } }
@Test public void testGetOptionParser() throws Exception { OptionParser optionParser = Main.getOptionParser(); String tmpDir = systemTempDir().toString(); OptionSet optionSet = optionParser.parse( "-f", "/tmp/dummy", "-s", "9908:976098897", "-r", "9908:810017902", "-u", "https://ap.unit4.com", "-m", "as2", "-e", tmpDir); assertTrue(optionSet.has("u")); assertTrue(optionSet.has("f")); assertTrue(optionSet.has("e")); Object e = optionSet.valueOf("e"); assertNotNull(e); assertTrue(e instanceof File); File f = (File) e; assertEquals(f, new File(tmpDir)); }
@Test public void senderAndReceiverIsOptional() throws Exception { OptionParser optionParser = Main.getOptionParser(); OptionSet optionSet = optionParser.parse("-f", "/tmp/dummy", "-u", "https://ap.unit4.com", "-m", "as2"); assertFalse(optionSet.has("-r")); assertFalse(optionSet.has("-s")); }
@Test public void testMain() throws Exception { String inputDir = testFilesFolder + fileSep + "trityper"; String inputExprs = testFilesFolder + fileSep + "Geuvadis_CEU_YRI_Expr.txt.gz"; String inputExprsAnnot = testFilesFolder + fileSep + "Geuvadis_CEU_YRI_Annot.txt"; String inputGte = testFilesFolder + fileSep + "Geuvadis_CEU_gte.txt"; System.out.println(inputDir); Main.main( "--mode", "metaqtl", "--in", inputDir, "--out", tmpOutputFolder.getAbsolutePath(), "--cis", "--perm", "10", "--inexp", inputExprs, "--inexpannot", inputExprsAnnot, "--inexpplatform", "Ensembl_v.71", "--gte", inputGte, "--skipqqplot", "--skipdotplot", "--rseed", "0"); QTLTextFile eExp = new QTLTextFile( testFilesFolder + fileSep + "TestOutput" + fileSep + "Cis-CEU-eQTLsFDR0.05.txt", QTLTextFile.R); QTLFileSorter r = new QTLFileSorter(); r.run( tmpOutputFolder.getAbsolutePath() + fileSep + "eQTLsFDR0.05.txt", tmpOutputFolder.getAbsolutePath() + fileSep + "eQTLsFDR0.05_S.txt"); QTLTextFile eActual = new QTLTextFile( tmpOutputFolder.getAbsolutePath() + fileSep + "eQTLsFDR0.05_S.txt", QTLTextFile.R); Iterator<EQTL> eExpIterator = eExp.getEQtlIterator(); Iterator<EQTL> eActualIterator = eActual.getEQtlIterator(); while (eExpIterator.hasNext() && eActualIterator.hasNext()) { assertTrue(eActualIterator.next().sameQTL(eExpIterator.next()), "eQTL not identical"); } assertFalse(eExpIterator.hasNext(), "not all expected eQTL are found"); assertFalse(eActualIterator.hasNext(), "found more eQTL than expected"); }