From 52cce2b2c836c4e0c490236481af12b2883c0e37 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Mon, 21 Sep 2009 12:42:39 +0000 Subject: [PATCH] fixed hibernate search dao tests SVN: 12677 --- .../dataaccess/db/HibernateSearchDAOTest.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java index fe4ae1368dc..f03c9a9d876 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAOTest.java @@ -300,7 +300,8 @@ public final class HibernateSearchDAOTest extends AbstractDAOTest // enumerates existing dataset locations in the database private static enum DSLoc { - LOC1("a/3"), LOC2("a/2"), LOC3("a/1"), LOC4("xxx/yyy/zzz"), LOC5("analysis/result"); + LOC1("a/3"), LOC2("a/2"), LOC3("a/1"), LOC4("xxx/yyy/zzz"), LOC5("analysis/result"), LOC6( + "xml/result-12"); private final String location; @@ -337,7 +338,8 @@ public final class HibernateSearchDAOTest extends AbstractDAOTest { DetailedSearchCriterion criterion = createAnyFieldCriterion(); DetailedSearchCriteria criteria = createAndDatasetQuery(criterion); - assertCorrectDatasetsFound(criteria, DSLoc.LOC1, DSLoc.LOC2, DSLoc.LOC4, DSLoc.LOC5); + assertCorrectDatasetsFound(criteria, DSLoc.LOC1, DSLoc.LOC2, DSLoc.LOC4, DSLoc.LOC5, + DSLoc.LOC6); } @Test @@ -364,7 +366,7 @@ public final class HibernateSearchDAOTest extends AbstractDAOTest DetailedSearchCriterion criterion2 = createSimpleFieldCriterion(); DetailedSearchCriteria criteria = createOrDatasetQuery(criterion1, criterion2); assertCorrectDatasetsFound(criteria, DSLoc.LOC1, DSLoc.LOC2, DSLoc.LOC3, DSLoc.LOC4, - DSLoc.LOC5); + DSLoc.LOC5, DSLoc.LOC6); } // @Test @@ -477,20 +479,21 @@ public final class HibernateSearchDAOTest extends AbstractDAOTest public final void testSearchForDataSetsAfterPropertiesUpdate() throws InterruptedException { String propertyCode = "COMMENT"; - DetailedSearchCriterion criterion = + DetailedSearchCriterion criterion1 = mkCriterion(DetailedSearchField.createPropertyField(propertyCode), "no comment"); + DetailedSearchCriterion criterion2 = createSimpleFieldCriterion(); - DetailedSearchCriteria criteria = createAndDatasetQuery(criterion); - assertCorrectDatasetsFound(criteria, DSLoc.LOC1, DSLoc.LOC2, DSLoc.LOC3, DSLoc.LOC4, - DSLoc.LOC5); + DetailedSearchCriteria criteria = createAndDatasetQuery(criterion1, criterion2); - // This data set has "no comment" value as a COMMENT property. + assertCorrectDatasetsFound(criteria, DSLoc.LOC3, DSLoc.LOC4); + + // This data set has "no comment" value as a COMMENT property and TIFF file type. // We change it and check if it is removed from results. - ExternalDataPE externalData = findExternalData("20081105092159111-1"); + ExternalDataPE externalData = findExternalData("20081105092159111-1"); // LOC3 String newValue = "sth"; changeExternalDataProperty(externalData, propertyCode, newValue); flushSearchIndices(); - assertCorrectDatasetsFound(criteria, DSLoc.LOC1, DSLoc.LOC2, DSLoc.LOC4, DSLoc.LOC5); + assertCorrectDatasetsFound(criteria, DSLoc.LOC4); restoreSearchIndex(); } -- GitLab