diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java index 16de68eb33535db333016537fd151099117d9abb..38f3535f06b82cd99e33d64abe0c7d0d3e754838 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java @@ -31,6 +31,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.IDataStoreServiceFactory import ch.systemsx.cisd.openbis.generic.server.business.ManagerTestTool; import ch.systemsx.cisd.openbis.generic.shared.IDataStoreService; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.AlignmentMatch; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.BlastScore; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSetFileSearchResultLocation; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.EntityPropertyBlastSearchResultLocation; @@ -140,22 +141,22 @@ public class SearchDomainSearcherTest extends AbstractBOTest createSearcher().searchForEntitiesWithSequences(SEQUENCE_DATABASE, SEQUENCE_SNIPPET, OPTIONAL_PARAMETERS); assertEquals("E1", results.get(0).getEntity().getPermId()); - assertEquals("Search Domain: test-db, Score: [11.5], Result location: " + assertEquals("Search Domain: test-db, Score: [Score: 11.5, bit score: 5.75, evalue: 12.5], Result location: " + "[Experiment perm id: E1, property type: S, alignment in sequence: [42-45], " + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(0).getSearchResult().toString()); assertEquals("S2", results.get(1).getEntity().getPermId()); - assertEquals("Search Domain: test-db, Score: [10.5], Result location: " + assertEquals("Search Domain: test-db, Score: [Score: 10.5, bit score: 5.25, evalue: 11.5], Result location: " + "[Sample perm id: S2, property type: OLIGO, alignment in sequence: [42-45], " + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(1).getSearchResult().toString()); assertEquals("S1", results.get(2).getEntity().getPermId()); - assertEquals("Search Domain: test-db, Score: [9.5], Result location: " + assertEquals("Search Domain: test-db, Score: [Score: 9.5, bit score: 4.75, evalue: 10.5], Result location: " + "[Sample perm id: S1, property type: OLIGO, alignment in sequence: [42-45], " + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(2).getSearchResult().toString()); assertEquals("DS1", results.get(3).getEntity().getPermId()); - assertEquals("Search Domain: test-db, Score: [0.5], Result location: " + assertEquals("Search Domain: test-db, Score: [Score: 0.5, bit score: 0.25, evalue: 1.5], Result location: " + "[Data set perm id: DS1, property type: SEQ, alignment in sequence: [42-45], " + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(3).getSearchResult().toString()); @@ -176,22 +177,22 @@ public class SearchDomainSearcherTest extends AbstractBOTest List<SearchDomainSearchResultWithFullEntity> results = createSearcher().searchForEntitiesWithSequences(SEQUENCE_DATABASE, SEQUENCE_SNIPPET, OPTIONAL_PARAMETERS); - assertEquals("Search Domain: test-db, Score: [14.5], Result location: [Data set: ds3, path: ds3/path, " - + "identifier: [id-ds3], position: 42]", + assertEquals("Search Domain: test-db, Score: [Score: 14.5, bit score: 7.25, evalue: 15.5], " + + "Result location: [Data set: ds3, path: ds3/path, identifier: [id-ds3], position: 42]", results.get(0).getSearchResult().toString()); assertEquals(ds3.getCode(), ((AbstractExternalData) results.get(0).getEntity()).getCode()); assertEquals("/G1/P1/exp1", ((AbstractExternalData) results.get(0).getEntity()).getExperiment().getIdentifier()); - assertEquals("Search Domain: test-db, Score: [13.5], Result location: [Data set: ds3, path: ds3/path, " + assertEquals("Search Domain: test-db, Score: [Score: 13.5, bit score: 6.75, evalue: 14.5], Result location: [Data set: ds3, path: ds3/path, " + "identifier: [id-ds3], position: 42]", results.get(1).getSearchResult().toString()); assertEquals(ds3.getCode(), ((AbstractExternalData) results.get(1).getEntity()).getCode()); assertEquals("/G1/P1/exp1", ((AbstractExternalData) results.get(1).getEntity()).getExperiment().getIdentifier()); - assertEquals("Search Domain: test-db, Score: [1.5], Result location: [Data set: ds2, path: ds2/path, " + assertEquals("Search Domain: test-db, Score: [Score: 1.5, bit score: 0.75, evalue: 2.5], Result location: [Data set: ds2, path: ds2/path, " + "identifier: [id-ds2], position: 42]", results.get(2).getSearchResult().toString()); assertEquals(ds2.getCode(), ((AbstractExternalData) results.get(2).getEntity()).getCode()); assertEquals("/G1/P1/exp1", ((AbstractExternalData) results.get(2).getEntity()).getExperiment().getIdentifier()); - assertEquals("Search Domain: test-db, Score: [0.5], Result location: [Data set: ds1, path: ds1/path, " + assertEquals("Search Domain: test-db, Score: [Score: 0.5, bit score: 0.25, evalue: 1.5], Result location: [Data set: ds1, path: ds1/path, " + "identifier: [id-ds1], position: 42]", results.get(3).getSearchResult().toString()); assertEquals(ds1.getCode(), ((AbstractExternalData) results.get(3).getEntity()).getCode()); @@ -242,7 +243,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest SearchDomain searchDomain = new SearchDomain(); searchDomain.setName("test-db"); result.setSearchDomain(searchDomain); - result.setScore(new SimpleScore(score++)); + result.setScore(createScore(score++)); DataSetFileSearchResultLocation resultLocation = new DataSetFileSearchResultLocation(); resultLocation.setDataSetCode(foundDataSet); resultLocation.setPathInDataSet(foundDataSet + "/path"); @@ -272,7 +273,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest SearchDomain searchDomain = new SearchDomain(); searchDomain.setName("test-db"); result.setSearchDomain(searchDomain); - result.setScore(new SimpleScore(score++)); + result.setScore(createScore(score++)); EntityPropertyBlastSearchResultLocation resultLocation = new EntityPropertyBlastSearchResultLocation(); String[] splittedLocation = foundLocation.split(":"); resultLocation.setEntityKind(EntityKind.valueOf(splittedLocation[0])); @@ -394,27 +395,12 @@ public class SearchDomainSearcherTest extends AbstractBOTest return permIds; } - private static final class SimpleScore implements ISearchDomainResultScore + private ISearchDomainResultScore createScore(double score) { - private static final long serialVersionUID = 1L; - private final double score; - - SimpleScore(double score) - { - this.score = score; - } - - @Override - public double getScore() - { - return score; - } - - @Override - public String toString() - { - return Double.toString(score); - } - + BlastScore blastScore = new BlastScore(); + blastScore.setScore(score); + blastScore.setBitScore(score / 2); + blastScore.setEvalue(score + 1); + return blastScore; } }