Fixes to test cases
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 10 Feb 2011 12:05:04 +0000 (12:05 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 10 Feb 2011 12:05:04 +0000 (12:05 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3734 e3abac25-378b-4346-85de-24260fe3988d

datamodel/compbio/data/sequence/ScoreManager.java
testsrc/compbio/runner/conservation/AAConTester.java
testsrc/compbio/runner/disorder/DisemblTester.java
testsrc/compbio/runner/disorder/GlobPlotTester.java
testsrc/compbio/runner/disorder/JronnTester.java

index b0305e6..f384308 100644 (file)
@@ -104,6 +104,35 @@ public class ScoreManager {
                }\r
                writer.flush();\r
        }\r
+       \r
+\r
+       @Override\r
+       public int hashCode() {\r
+               final int prime = 31;\r
+               int result = 1;\r
+               result = prime * result\r
+                               + ((seqScores == null) ? 0 : seqScores.hashCode());\r
+               return result;\r
+       }\r
+\r
+       @Override\r
+       public boolean equals(Object obj) {\r
+               if (this == obj)\r
+                       return true;\r
+               if (obj == null)\r
+                       return false;\r
+               if (getClass() != obj.getClass())\r
+                       return false;\r
+               ScoreManager other = (ScoreManager) obj;\r
+               if (seqScores == null) {\r
+                       if (other.seqScores != null)\r
+                               return false;\r
+               } else if (!seqScores.equals(other.seqScores))\r
+                       return false;\r
+               return true;\r
+       }\r
+\r
+\r
 \r
        @XmlAccessorType(XmlAccessType.FIELD)\r
        public static class ScoreHolder {\r
@@ -139,5 +168,39 @@ public class ScoreManager {
                public int getNumberOfScores() {\r
                        return scores.size();\r
                }\r
+\r
+               @Override\r
+               public int hashCode() {\r
+                       final int prime = 17;\r
+                       int result = 1;\r
+                       result = prime * result + ((id == null) ? 0 : id.hashCode());\r
+                       result = prime * result\r
+                                       + ((scores == null) ? 0 : scores.hashCode());\r
+                       return result;\r
+               }\r
+\r
+               @Override\r
+               public boolean equals(Object obj) {\r
+                       if (this == obj)\r
+                               return true;\r
+                       if (obj == null)\r
+                               return false;\r
+                       if (getClass() != obj.getClass())\r
+                               return false;\r
+                       ScoreHolder other = (ScoreHolder) obj;\r
+                       if (id == null) {\r
+                               if (other.id != null)\r
+                                       return false;\r
+                       } else if (!id.equals(other.id))\r
+                               return false;\r
+                       if (scores == null) {\r
+                               if (other.scores != null)\r
+                                       return false;\r
+                       } else if (!scores.equals(other.scores))\r
+                               return false;\r
+                       return true;\r
+               }\r
+               \r
+               \r
        }\r
 }\r
index a18b2c4..1dc0b77 100644 (file)
@@ -39,6 +39,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;\r
 \r
 import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.FilePuller;\r
@@ -188,9 +189,9 @@ public class AAConTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       HashSet<Score> annotations = confAAcon.getResults();\r
+                       ScoreManager annotations = confAAcon.getResults();\r
                        assertNotNull(annotations);\r
-                       assertEquals(annotations.size(), 18);\r
+                       assertEquals(annotations.asSet().size(), 18);\r
                        assertEquals(al1.getResults(), annotations);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
@@ -219,9 +220,9 @@ public class AAConTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       HashSet<Score> annotations = confAAcon.getResults();\r
+                       ScoreManager annotations = confAAcon.getResults();\r
                        assertNotNull(annotations);\r
-                       assertEquals(annotations.size(), 13);\r
+                       assertEquals(annotations.asSet().size(), 13);\r
                        assertEquals(al1.getResults(), annotations);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
@@ -252,9 +253,9 @@ public class AAConTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       HashSet<Score> annotations = confAAcon.getResults();\r
+                       ScoreManager annotations = confAAcon.getResults();\r
                        assertNotNull(annotations);\r
-                       assertEquals(annotations.size(), 3);\r
+                       assertEquals(annotations.asSet().size(), 3);\r
                        assertEquals(al1.getResults(), annotations);\r
 \r
                } catch (JobSubmissionException e) {\r
index 8444668..6ea203c 100644 (file)
@@ -42,6 +42,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;\r
 \r
 import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.FilePuller;\r
@@ -190,9 +191,9 @@ public class DisemblTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       Map<String,Set<Score>> al2 = confDisembl.getResults();\r
+                       ScoreManager al2 = confDisembl.getResults();\r
                        assertNotNull(al2);\r
-                       assertEquals(al2.size(), 3);\r
+                       assertEquals(al2.asMap().size(), 3);\r
                        assertEquals(al1.getResults(), al2);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
index 97c5fd8..b32e8d4 100644 (file)
@@ -41,6 +41,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;\r
 \r
 import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.SyncExecutor;\r
@@ -187,9 +188,9 @@ public class GlobPlotTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       Map<String, Set<Score>> al2 = confGlobPlot.getResults();\r
+                       ScoreManager al2 = confGlobPlot.getResults();\r
                        assertNotNull(al2);\r
-                       assertEquals(al2.size(), 3);\r
+                       assertEquals(al2.asMap().size(), 3);\r
                        assertEquals(al1.getResults(), al2);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
index 972e3ff..4635d10 100644 (file)
@@ -40,6 +40,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;\r
 \r
 import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.FilePuller;\r
@@ -186,9 +187,9 @@ public class JronnTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       Map<String, Score> al2 = confJronn.getResults();\r
+                       ScoreManager al2 = confJronn.getResults();\r
                        assertNotNull(al2);\r
-                       assertEquals(al2.size(), 3);\r
+                       assertEquals(al2.asMap().size(), 3);\r
                        assertEquals(al1.getResults(), al2);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
@@ -214,9 +215,9 @@ public class JronnTester {
                        lr.executeJob();\r
                        ConfiguredExecutable<?> al1 = lr.waitForResult();\r
                        assertNotNull(al1.getResults());\r
-                       Map<String, Score> al2 = confJronn.getResults();\r
+                       ScoreManager al2 = confJronn.getResults();\r
                        assertNotNull(al2);\r
-                       assertEquals(al2.size(), 3);\r
+                       assertEquals(al2.asMap().size(), 3);\r
                        assertEquals(al1.getResults(), al2);\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r