[med-svn] [htsjdk] 01/02: Remove some more tests needing http or ftp connections

Andreas Tille tille at debian.org
Sun Jul 10 16:55:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository htsjdk.

commit 72a19ccd3cb274b8b85276481081bb8d51d106a1
Author: Andreas Tille <tille at debian.org>
Date:   Sun Jul 10 18:42:35 2016 +0200

    Remove some more tests needing http or ftp connections
---
 debian/changelog                     |   4 +
 debian/patches/13-skip_network_tests | 279 +++++++++++++++++++++++++++++++++++
 2 files changed, 283 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 34c8d40..21e3c32 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,11 @@
 htsjdk (2.5.0+dfsg.2-2) UNRELEASED; urgency=medium
 
+  [ Vincent Danjean ]
   * Tweak build-dependencies
 
+  [ Andreas Tille ]
+  * Remove some more tests needing http or ftp connections
+
  -- Vincent Danjean <vdanjean at debian.org>  Thu, 07 Jul 2016 13:54:18 +0200
 
 htsjdk (2.5.0+dfsg.2-1) unstable; urgency=medium
diff --git a/debian/patches/13-skip_network_tests b/debian/patches/13-skip_network_tests
index 2040700..fe62dcd 100644
--- a/debian/patches/13-skip_network_tests
+++ b/debian/patches/13-skip_network_tests
@@ -670,3 +670,282 @@ Last-Updated: 2015-01-06
 -    }
 -
  }
+--- a/src/test/java/htsjdk/tribble/readers/TabixReaderTest.java
++++ b/src/test/java/htsjdk/tribble/readers/TabixReaderTest.java
+@@ -135,27 +135,4 @@ public class TabixReaderTest {
+ 
+     }
+ 
+-    /**
+-     * Test reading a tabix file over http
+-     *
+-     * @throws java.io.IOException
+-     */
+-    @Test
+-    public void testRemoteQuery() throws IOException {
+-        String tabixFile = "http://www.broadinstitute.org/~picard/testdata/igvdata/tabix/trioDup.vcf.gz";
+-
+-        TabixReader tabixReader = new TabixReader(tabixFile);
+-
+-        TabixIteratorLineReader lineReader = new TabixIteratorLineReader(
+-                tabixReader.query(tabixReader.chr2tid("4"), 320, 330));
+-
+-        int nRecords = 0;
+-        String nextLine;
+-        while ((nextLine = lineReader.readLine()) != null) {
+-            assertTrue(nextLine.startsWith("4"));
+-            nRecords++;
+-        }
+-        assertTrue(nRecords > 0);
+-
+-    }
+ }
+--- a/src/test/java/htsjdk/tribble/util/ftp/FTPUtilsTest.java
++++ b/src/test/java/htsjdk/tribble/util/ftp/FTPUtilsTest.java
+@@ -14,18 +14,4 @@ import static org.testng.Assert.assertTr
+ */
+ public class FTPUtilsTest {
+ 
+-    @Test
+-    public void testResourceAvailable() throws Exception {
+-
+-        URL goodUrl = new URL("ftp://ftp.broadinstitute.org/pub/igv/TEST/test.txt");
+-        assertTrue(FTPUtils.resourceAvailable(goodUrl));
+-
+-        URL nonExistentURL = new URL("ftp://ftp.broadinstitute.org/pub/igv/TEST/doesntExist");
+-        assertFalse(FTPUtils.resourceAvailable(nonExistentURL));
+-
+-        URL nonExistentServer = new URL("ftp://noSuchServer/pub/igv/TEST/doesntExist");
+-        assertFalse(FTPUtils.resourceAvailable(nonExistentServer));
+-
+-
+-    }
+ }
+--- a/src/test/java/htsjdk/tribble/util/ftp/FTPClientTest.java
++++ b/src/test/java/htsjdk/tribble/util/ftp/FTPClientTest.java
+@@ -23,225 +23,4 @@ public class FTPClientTest {
+     static byte[] expectedBytes = "abcdefghijklmnopqrstuvwxyz\n".getBytes();
+     FTPClient client;
+ 
+-    @BeforeMethod
+-    public void setUp() throws IOException {
+-        client = new FTPClient();
+-        FTPReply reply = client.connect(host);
+-        Assert.assertTrue(reply.isSuccess(), "connect");
+-    }
+-
+-    @AfterMethod
+-    public void tearDown() {
+-        System.out.println("Disconnecting");
+-        client.disconnect();
+-    }
+-
+-    @Test
+-    public void testLogin() throws Exception {
+-
+-    }
+-
+-    @Test
+-    public void testPasv() throws Exception {
+-        try {
+-            FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-            Assert.assertTrue(reply.isSuccess(), "login");
+-
+-            reply = client.pasv();
+-            Assert.assertTrue(reply.isSuccess(), "pasv");
+-        } finally {
+-            client.closeDataStream();
+-        }
+-    }
+-
+-    @Test
+-    public void testSize() throws Exception {
+-
+-        FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-        Assert.assertTrue(reply.isSuccess());
+-
+-        reply = client.binary();
+-        Assert.assertTrue(reply.isSuccess(), "binary");
+-
+-        reply = client.size(file);
+-        String val = reply.getReplyString();
+-        int size = Integer.parseInt(val);
+-        Assert.assertEquals(fileSize, size, "size");
+-    }
+-
+-    @Test
+-    public void testDownload() throws Exception {
+-        try {
+-            FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-            Assert.assertTrue(reply.isSuccess(), "login");
+-
+-            reply = client.binary();
+-            Assert.assertTrue(reply.isSuccess(), "binary");
+-
+-            reply = client.pasv();
+-            Assert.assertTrue(reply.isSuccess(), "pasv");
+-
+-            reply = client.retr(file);
+-            Assert.assertEquals(reply.getCode(), 150, "retr");
+-
+-            InputStream is = client.getDataStream();
+-            int idx = 0;
+-            int b;
+-            while ((b = is.read()) >= 0) {
+-                Assert.assertEquals(expectedBytes[idx], (byte) b,"reading from stream");
+-                idx++;
+-            }
+-
+-        } finally {
+-            client.closeDataStream();
+-            FTPReply reply = client.retr(file);
+-            System.out.println(reply.getCode());
+-            Assert.assertTrue(reply.isSuccess(), "close");
+-        }
+-    }
+-
+-    @Test
+-    public void testRest() throws Exception {
+-        try {
+-            FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-            Assert.assertTrue(reply.isSuccess(), "login");
+-
+-            reply = client.binary();
+-            Assert.assertTrue(reply.isSuccess(), "binary");
+-
+-            reply = client.pasv();
+-            Assert.assertTrue(reply.isSuccess(), "pasv");
+-
+-            final int restPosition = 5;
+-            client.setRestPosition(restPosition);
+-
+-            reply = client.retr(file);
+-            Assert.assertEquals(reply.getCode(), 150, "retr");
+-
+-            InputStream is = client.getDataStream();
+-            int idx = restPosition;
+-            int b;
+-            while ((b = is.read()) >= 0) {
+-                Assert.assertEquals(expectedBytes[idx], (byte) b, "reading from stream");
+-                idx++;
+-            }
+-
+-        } finally {
+-            client.closeDataStream();
+-            FTPReply reply = client.retr(file);
+-            System.out.println(reply.getCode());
+-            Assert.assertTrue(reply.isSuccess(), "close");
+-        }
+-    }
+-
+-    /**
+-     * Test accessing a non-existent file
+-     */
+-    @Test
+-    public void testNonExistentFile() throws Exception {
+-
+-        String host = "ftp.broadinstitute.org";
+-        String file = "/pub/igv/TEST/fileDoesntExist.txt";
+-        FTPClient client = new FTPClient();
+-
+-        FTPReply reply = client.connect(host);
+-        Assert.assertTrue(reply.isSuccess(), "connect");
+-
+-        reply = client.login("anonymous", "igv at broadinstitute.org");
+-        Assert.assertTrue(reply.isSuccess(), "login");
+-
+-        reply = client.binary();
+-        Assert.assertTrue(reply.isSuccess(), "binary");
+-
+-        reply = client.executeCommand("size " + file);
+-        Assert.assertEquals(550, reply.getCode(), "size");
+-
+-        client.disconnect();
+-    }
+-
+-    /**
+-     * Test accessing a non-existent server
+-     */
+-    @Test
+-    public void testNonExistentServer() throws Exception {
+-
+-        String host = "ftp.noSuchServer.org";
+-        String file = "/pub/igv/TEST/fileDoesntExist.txt";
+-        FTPClient client = new FTPClient();
+-
+-        FTPReply reply = null;
+-        try {
+-            reply = client.connect(host);
+-        } catch (UnknownHostException e) {
+-            // This is expected
+-        }
+-
+-        client.disconnect();
+-    }
+-
+-    @Test
+-    public void testMultiplePasv() throws Exception {
+-
+-        try {
+-            FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-            Assert.assertTrue(reply.isSuccess(), "login");
+-
+-            reply = client.pasv();
+-            Assert.assertTrue(reply.isSuccess(), "pasv 1");
+-            client.closeDataStream();
+-
+-            reply = client.pasv();
+-            Assert.assertTrue(reply.isSuccess(), "pasv 2");
+-            client.closeDataStream();
+-        }
+-        finally {
+-
+-        }
+-    }
+-
+-    @Test
+-    public void testMultipleRest() throws Exception {
+-        FTPReply reply = client.login("anonymous", "igv at broadinstitute.org");
+-        Assert.assertTrue(reply.isSuccess(), "login");
+-
+-        reply = client.binary();
+-        Assert.assertTrue(reply.isSuccess(), "binary");
+-
+-        restRetr(5, 10);
+-        restRetr(2, 10);
+-        restRetr(15, 10);
+-    }
+-
+-    private void restRetr(int restPosition, int length) throws IOException {
+-
+-        try {
+-
+-            if (client.getDataStream() == null) {
+-                FTPReply reply = client.pasv();
+-                Assert.assertTrue(reply.isSuccess(), "pasv");
+-            }
+-
+-            client.setRestPosition(restPosition);
+-
+-            FTPReply reply = client.retr(file);
+-            //assertTrue(reply.getCode() == 150);
+-
+-            InputStream is = client.getDataStream();
+-
+-            byte[] buffer = new byte[length];
+-            is.read(buffer);
+-
+-            for (int i = 0; i < length; i++) {
+-                System.out.print((char) buffer[i]);
+-                Assert.assertEquals(expectedBytes[i + restPosition], buffer[i], "reading from stream");
+-            }
+-            System.out.println();
+-        }
+-
+-        finally {
+-            client.closeDataStream();
+-            FTPReply reply = client.getReply();  // <== MUST READ THE REPLY
+-            System.out.println(reply.getReplyString());
+-        }
+-    }
+ }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htsjdk.git



More information about the debian-med-commit mailing list