From: pvtroshin Date: Thu, 10 Feb 2011 12:05:04 +0000 (+0000) Subject: Fixes to test cases X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3644426ec0e9e9ceb798bd426085d8d9dd8dbb56;p=jabaws.git Fixes to test cases git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3734 e3abac25-378b-4346-85de-24260fe3988d --- diff --git a/datamodel/compbio/data/sequence/ScoreManager.java b/datamodel/compbio/data/sequence/ScoreManager.java index b0305e6..f384308 100644 --- a/datamodel/compbio/data/sequence/ScoreManager.java +++ b/datamodel/compbio/data/sequence/ScoreManager.java @@ -104,6 +104,35 @@ public class ScoreManager { } writer.flush(); } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((seqScores == null) ? 0 : seqScores.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ScoreManager other = (ScoreManager) obj; + if (seqScores == null) { + if (other.seqScores != null) + return false; + } else if (!seqScores.equals(other.seqScores)) + return false; + return true; + } + + @XmlAccessorType(XmlAccessType.FIELD) public static class ScoreHolder { @@ -139,5 +168,39 @@ public class ScoreManager { public int getNumberOfScores() { return scores.size(); } + + @Override + public int hashCode() { + final int prime = 17; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + + ((scores == null) ? 0 : scores.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ScoreHolder other = (ScoreHolder) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (scores == null) { + if (other.scores != null) + return false; + } else if (!scores.equals(other.scores)) + return false; + return true; + } + + } } diff --git a/testsrc/compbio/runner/conservation/AAConTester.java b/testsrc/compbio/runner/conservation/AAConTester.java index a18b2c4..1dc0b77 100644 --- a/testsrc/compbio/runner/conservation/AAConTester.java +++ b/testsrc/compbio/runner/conservation/AAConTester.java @@ -39,6 +39,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.FilePuller; @@ -188,9 +189,9 @@ public class AAConTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - HashSet annotations = confAAcon.getResults(); + ScoreManager annotations = confAAcon.getResults(); assertNotNull(annotations); - assertEquals(annotations.size(), 18); + assertEquals(annotations.asSet().size(), 18); assertEquals(al1.getResults(), annotations); } catch (JobSubmissionException e) { e.printStackTrace(); @@ -219,9 +220,9 @@ public class AAConTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - HashSet annotations = confAAcon.getResults(); + ScoreManager annotations = confAAcon.getResults(); assertNotNull(annotations); - assertEquals(annotations.size(), 13); + assertEquals(annotations.asSet().size(), 13); assertEquals(al1.getResults(), annotations); } catch (JobSubmissionException e) { e.printStackTrace(); @@ -252,9 +253,9 @@ public class AAConTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - HashSet annotations = confAAcon.getResults(); + ScoreManager annotations = confAAcon.getResults(); assertNotNull(annotations); - assertEquals(annotations.size(), 3); + assertEquals(annotations.asSet().size(), 3); assertEquals(al1.getResults(), annotations); } catch (JobSubmissionException e) { diff --git a/testsrc/compbio/runner/disorder/DisemblTester.java b/testsrc/compbio/runner/disorder/DisemblTester.java index 8444668..6ea203c 100644 --- a/testsrc/compbio/runner/disorder/DisemblTester.java +++ b/testsrc/compbio/runner/disorder/DisemblTester.java @@ -42,6 +42,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.FilePuller; @@ -190,9 +191,9 @@ public class DisemblTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - Map> al2 = confDisembl.getResults(); + ScoreManager al2 = confDisembl.getResults(); assertNotNull(al2); - assertEquals(al2.size(), 3); + assertEquals(al2.asMap().size(), 3); assertEquals(al1.getResults(), al2); } catch (JobSubmissionException e) { e.printStackTrace(); diff --git a/testsrc/compbio/runner/disorder/GlobPlotTester.java b/testsrc/compbio/runner/disorder/GlobPlotTester.java index 97c5fd8..b32e8d4 100644 --- a/testsrc/compbio/runner/disorder/GlobPlotTester.java +++ b/testsrc/compbio/runner/disorder/GlobPlotTester.java @@ -41,6 +41,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.SyncExecutor; @@ -187,9 +188,9 @@ public class GlobPlotTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - Map> al2 = confGlobPlot.getResults(); + ScoreManager al2 = confGlobPlot.getResults(); assertNotNull(al2); - assertEquals(al2.size(), 3); + assertEquals(al2.asMap().size(), 3); assertEquals(al1.getResults(), al2); } catch (JobSubmissionException e) { e.printStackTrace(); diff --git a/testsrc/compbio/runner/disorder/JronnTester.java b/testsrc/compbio/runner/disorder/JronnTester.java index 972e3ff..4635d10 100644 --- a/testsrc/compbio/runner/disorder/JronnTester.java +++ b/testsrc/compbio/runner/disorder/JronnTester.java @@ -40,6 +40,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.FilePuller; @@ -186,9 +187,9 @@ public class JronnTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - Map al2 = confJronn.getResults(); + ScoreManager al2 = confJronn.getResults(); assertNotNull(al2); - assertEquals(al2.size(), 3); + assertEquals(al2.asMap().size(), 3); assertEquals(al1.getResults(), al2); } catch (JobSubmissionException e) { e.printStackTrace(); @@ -214,9 +215,9 @@ public class JronnTester { lr.executeJob(); ConfiguredExecutable al1 = lr.waitForResult(); assertNotNull(al1.getResults()); - Map al2 = confJronn.getResults(); + ScoreManager al2 = confJronn.getResults(); assertNotNull(al2); - assertEquals(al2.size(), 3); + assertEquals(al2.asMap().size(), 3); assertEquals(al1.getResults(), al2); } catch (JobSubmissionException e) { e.printStackTrace();