Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
violethaze74
Artemis
Commits
69d60e74
Unverified
Commit
69d60e74
authored
Feb 12, 2018
by
Kev
Committed by
GitHub
Feb 12, 2018
Browse files
Merge pull request #234 from kpepper/artemis_unit_testing
Changed BamUtilsTest class to cope with connect exception.
parents
3b3a534e
858a6d9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/uk/ac/sanger/artemis/components/alignment/BamUtilsTest.java
View file @
69d60e74
...
...
@@ -25,6 +25,7 @@ import static org.junit.Assert.*;
import
org.junit.Test
;
import
java.io.File
;
import
java.net.ConnectException
;
import
java.net.URL
;
import
htsjdk.samtools.BAMIndex
;
...
...
@@ -253,11 +254,19 @@ public class BamUtilsTest {
// Check getting the index file for a BAM file with an index for FTP
// Should create local copy.
//
File
existingBamIndexFtpFile
=
BamUtils
.
getIndexFile
(
"ftp://ftp.sanger.ac.uk/pub/project/pathogens/kp11/NV.bam"
);
assertNotNull
(
existingBamIndexFtpFile
);
assertTrue
(
existingBamIndexFtpFile
.
exists
());
assertTrue
(
existingBamIndexFtpFile
.
getName
().
endsWith
(
BAMIndex
.
BAMIndexSuffix
));
assertTrue
(
existingBamIndexFtpFile
.
length
()>
0
);
try
{
File
existingBamIndexFtpFile
=
BamUtils
.
getIndexFile
(
"ftp://ftp.sanger.ac.uk/pub/project/pathogens/kp11/NV.bam"
);
assertNotNull
(
existingBamIndexFtpFile
);
assertTrue
(
existingBamIndexFtpFile
.
exists
());
assertTrue
(
existingBamIndexFtpFile
.
getName
().
endsWith
(
BAMIndex
.
BAMIndexSuffix
));
assertTrue
(
existingBamIndexFtpFile
.
length
()>
0
);
}
catch
(
ConnectException
e
)
{
System
.
err
.
println
(
"testGetIndexFileForFtpBam() : WARNING: Unable to run this test as cannot connect to Sanger FTP server"
);
e
.
printStackTrace
();
}
}
@Test
...
...
@@ -276,6 +285,11 @@ public class BamUtilsTest {
{
assertTrue
(
e
.
getMessage
().
contains
(
"Failed to find an index file"
));
}
catch
(
ConnectException
e
)
{
System
.
err
.
println
(
"testCreateIndexFileForFtpCram() : WARNING: Unable to run this test as cannot connect to Sanger FTP server"
);
e
.
printStackTrace
();
}
assertNull
(
createdCramIndexFtpFile
);
...
...
@@ -289,10 +303,18 @@ public class BamUtilsTest {
// Check getting the index file for a CRAM file with an index for FTP
// Should create local copy.
//
File
existingCramIndexFtpFile
=
BamUtils
.
getIndexFile
(
"ftp://ftp.sanger.ac.uk/pub/project/pathogens/kp11/NV.cram"
);
assertNotNull
(
existingCramIndexFtpFile
);
assertTrue
(
existingCramIndexFtpFile
.
exists
());
assertTrue
(
existingCramIndexFtpFile
.
getName
().
endsWith
(
CRAIIndex
.
CRAI_INDEX_SUFFIX
));
assertTrue
(
existingCramIndexFtpFile
.
length
()>
0
);
try
{
File
existingCramIndexFtpFile
=
BamUtils
.
getIndexFile
(
"ftp://ftp.sanger.ac.uk/pub/project/pathogens/kp11/NV.cram"
);
assertNotNull
(
existingCramIndexFtpFile
);
assertTrue
(
existingCramIndexFtpFile
.
exists
());
assertTrue
(
existingCramIndexFtpFile
.
getName
().
endsWith
(
CRAIIndex
.
CRAI_INDEX_SUFFIX
));
assertTrue
(
existingCramIndexFtpFile
.
length
()>
0
);
}
catch
(
ConnectException
e
)
{
System
.
err
.
println
(
"testGetExistingIndexFileForFtpCram() : WARNING: Unable to run this test as cannot connect to Sanger FTP server"
);
e
.
printStackTrace
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment