Unit test fixed - Tribble codecs aren't designed to be stateless, but I was

using one as though it was.  Fixed, and debug code reverted.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4917 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-12-31 17:47:52 +00:00
parent b9cb57f4b9
commit 3fc9862964
3 changed files with 3 additions and 14 deletions

View File

@ -60,13 +60,10 @@ public class TableCodec implements ReferenceDependentFeatureCodec {
@Override
public Object readHeader(LineReader reader) {
System.out.printf(" TableCodec.readHeader:%n ");
new Exception().printStackTrace(System.out);
String line = "";
try {
while ((line = reader.readLine()) != null) {
if (line.startsWith(headerDelimiter)) {
System.out.printf(" Line w/ header delimiter: %s%n",line);
if (header.size() > 0) throw new IllegalStateException("Input table file seems to have two header lines. The second is = " + line);
String spl[] = line.split(delimiterRegex);
for (String s : spl) header.add(s);

View File

@ -237,14 +237,12 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
FeatureSource featureSource = null;
SAMSequenceDictionary sequenceDictionary = null;
FeatureCodec codec = createCodec(targetClass, name);
// Detect whether or not this source should be indexed.
boolean canBeIndexed = (storageType == RMDStorageType.FILE);
if(canBeIndexed) {
try {
Index index = loadIndex(inputFile, codec);
Index index = loadIndex(inputFile, createCodec(targetClass, name));
try { logger.info(String.format(" Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
catch (ReviewedStingException e) { }
@ -257,7 +255,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
sequenceDictionary = getSequenceDictionaryFromProperties(index);
}
featureSource = new BasicFeatureSource(inputFile.getAbsolutePath(), index, codec);
featureSource = new BasicFeatureSource(inputFile.getAbsolutePath(), index, createCodec(targetClass, name));
}
catch (TribbleException e) {
throw new UserException(e.getMessage());
@ -267,7 +265,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
}
}
else {
featureSource = BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(),codec,false);
featureSource = BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(),createCodec(targetClass, name),false);
}
return new Pair<FeatureSource,SAMSequenceDictionary>(featureSource,sequenceDictionary);

View File

@ -64,14 +64,12 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
*/
@Test
public void testNoBindings() {
System.out.printf("Starting testNoBindings%n");
Shard shard = new MockLocusShard(genomeLocParser,Collections.singletonList(genomeLocParser.createGenomeLoc("chrM",1,30)));
LocusShardDataProvider provider = new LocusShardDataProvider(shard, null, genomeLocParser, shard.getGenomeLocs().get(0), null, seq, Collections.<ReferenceOrderedDataSource>emptyList());
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",10));
Assert.assertEquals(tracker.getAllRods().size(), 0, "The tracker should not have produced any data");
System.out.printf("Ending testNoBindings%n");
}
/**
@ -79,7 +77,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
*/
@Test
public void testSingleBinding() {
System.out.printf("Starting testSingleBinding%n");
String fileName = testDir + "TabularDataTest.dat";
RMDTriplet triplet = new RMDTriplet("tableTest","Table",fileName,RMDStorageType.FILE);
ReferenceOrderedDataSource dataSource = new ReferenceOrderedDataSource(triplet,builder,seq.getSequenceDictionary(),genomeLocParser,false);
@ -95,7 +92,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
Assert.assertEquals(datum.get("COL1"),"C","datum parameter for COL1 is incorrect");
Assert.assertEquals(datum.get("COL2"),"D","datum parameter for COL2 is incorrect");
Assert.assertEquals(datum.get("COL3"),"E","datum parameter for COL3 is incorrect");
System.out.printf("Ending testSingleBinding%n");
}
/**
@ -103,7 +99,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
*/
@Test
public void testMultipleBinding() {
System.out.printf("Starting testMultipleBinding%n");
File file = new File(testDir + "TabularDataTest.dat");
RMDTriplet testTriplet1 = new RMDTriplet("tableTest1","Table",file.getAbsolutePath(),RMDStorageType.FILE);
@ -129,6 +124,5 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
Assert.assertEquals(datum2.get("COL1"),"C","datum2 parameter for COL1 is incorrect");
Assert.assertEquals(datum2.get("COL2"),"D","datum2 parameter for COL2 is incorrect");
Assert.assertEquals(datum2.get("COL3"),"E","datum2 parameter for COL3 is incorrect");
System.out.printf("Ending testMultipleBinding%n");
}
}