From 033ede97012d19b11049504f373966b872aed5ed Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 26 Jan 2012 15:39:48 +0000
Subject: [PATCH] LMS-2714 tests fixed

SVN: 24296
---
 ...atchMaterialRegistrationAndUpdateTest.java |  6 +++---
 .../openbis/systemtest/HistoryRowMapper.java  | 12 ++---------
 .../systemtest/PropertiesHistoryTest.java     | 12 +++++------
 .../openbis/systemtest/PropertyHistory.java   | 20 +++++++++----------
 .../openbis/systemtest/SystemTestCase.java    |  8 ++++----
 ...GeneralInformationChangingServiceTest.java |  3 ++-
 6 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/BatchMaterialRegistrationAndUpdateTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/BatchMaterialRegistrationAndUpdateTest.java
index c5cc4e12666..f5b0cfcfb36 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/BatchMaterialRegistrationAndUpdateTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/BatchMaterialRegistrationAndUpdateTest.java
@@ -141,17 +141,17 @@ public class BatchMaterialRegistrationAndUpdateTest extends SystemTestCase
         List<PropertyHistory> history =
                 getMaterialPropertiesHistory(getMaterialOrNull("C1").getId());
         assertEquals(
-                "[BACTERIUM: material:22<a:2>, DESCRIPTION: compound 1<a:2>, GENDER: term:12<a:2>]",
+                "[BACTERIUM: material:BACTERIUM1 [BACTERIUM]<a:2>, DESCRIPTION: compound 1<a:2>, GENDER: term:FEMALE [GENDER]<a:2>]",
                 history.toString());
         assertCurrentValidUntilTimeStamp(history.get(0));
-        assertEquals("[BACTERIUM: material:34<a:2>]",
+        assertEquals("[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:2>]",
                 getMaterialPropertiesHistory(getMaterialOrNull("C2").getId()).toString());
 
         updateMaterials("code\tdescription\tgender\tbacterium\n"
                 + "c2\t--DELETE--\tfemale\tbacterium2\n", MATERIAL_TYPE, false);
 
         assertEquals(
-                "[BACTERIUM: material:34<a:2>, BACTERIUM: material:35<a:2>, DESCRIPTION: compound 2<a:2>, GENDER: term:11<a:2>]",
+                "[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:2>, BACTERIUM: material:BACTERIUM-Y [BACTERIUM]<a:2>, DESCRIPTION: compound 2<a:2>, GENDER: term:MALE [GENDER]<a:2>]",
                 getMaterialPropertiesHistory(getMaterialOrNull("C2").getId()).toString());
         deleteTestMaterials();
     }
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/HistoryRowMapper.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/HistoryRowMapper.java
index 5a0ec9256ac..6230f559b2d 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/HistoryRowMapper.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/HistoryRowMapper.java
@@ -28,16 +28,8 @@ final class HistoryRowMapper implements ParameterizedRowMapper<PropertyHistory>
         PropertyHistory propertyHistory = new PropertyHistory();
         propertyHistory.setPropertyTypeCode(rs.getString("code"));
         propertyHistory.setValue(rs.getString("value"));
-        long id = rs.getLong("cvte_id");
-        if (rs.wasNull() == false)
-        {
-            propertyHistory.setTermID(id);
-        }
-        id = rs.getLong("mate_prop_id");
-        if (rs.wasNull() == false)
-        {
-            propertyHistory.setMaterialID(id);
-        }
+        propertyHistory.setTerm(rs.getString("vocabulary_term"));
+        propertyHistory.setMaterial(rs.getString("material"));
         propertyHistory.setValidFromTimeStamp(rs.getTimestamp("valid_from_timestamp"));
         propertyHistory.setValidUntilTimeStamp(rs.getTimestamp("valid_until_timestamp"));
         propertyHistory.setPersIdAuthor(rs.getLong("pers_id_author"));
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertiesHistoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertiesHistoryTest.java
index f4efa23e345..5c762b2f661 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertiesHistoryTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertiesHistoryTest.java
@@ -77,7 +77,7 @@ public class PropertiesHistoryTest extends SystemTestCase
 
         List<PropertyHistory> history = getExperimentPropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:34<a:2>, DESCRIPTION: A simple experiment<a:1>, GENDER: term:11<a:1>]",
+                "[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:2>, DESCRIPTION: A simple experiment<a:1>, GENDER: term:MALE [GENDER]<a:1>]",
                 history.toString());
     }
 
@@ -112,7 +112,7 @@ public class PropertiesHistoryTest extends SystemTestCase
         assertEquals(0, commonClientService.getExperimentInfo(id).getProperties().size());
         List<PropertyHistory> history = getExperimentPropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:34<a:2>, DESCRIPTION: A simple experiment<a:1>, GENDER: term:11<a:1>]",
+                "[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:2>, DESCRIPTION: A simple experiment<a:1>, GENDER: term:MALE [GENDER]<a:1>]",
                 history.toString());
     }
 
@@ -146,7 +146,7 @@ public class PropertiesHistoryTest extends SystemTestCase
 
         List<PropertyHistory> history = getSamplePropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:34<a:1>, COMMENT: very advanced stuff<a:1>, GENDER: term:11<a:2>]",
+                "[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:1>, COMMENT: very advanced stuff<a:1>, GENDER: term:MALE [GENDER]<a:2>]",
                 history.toString());
     }
 
@@ -178,7 +178,7 @@ public class PropertiesHistoryTest extends SystemTestCase
         assertEquals(3, genericClientService.getSampleInfo(id).getProperties().size());
         List<PropertyHistory> history = getSamplePropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:34<a:1>, COMMENT: very advanced stuff<a:1>, GENDER: term:11<a:2>]",
+                "[BACTERIUM: material:BACTERIUM-X [BACTERIUM]<a:1>, COMMENT: very advanced stuff<a:1>, GENDER: term:MALE [GENDER]<a:2>]",
                 history.toString());
     }
 
@@ -208,7 +208,7 @@ public class PropertiesHistoryTest extends SystemTestCase
 
         List<PropertyHistory> history = getDataSetPropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:22<a:1>, COMMENT: no comment<a:1>, GENDER: term:12<a:1>]",
+                "[BACTERIUM: material:BACTERIUM1 [BACTERIUM]<a:1>, COMMENT: no comment<a:1>, GENDER: term:FEMALE [GENDER]<a:1>]",
                 history.toString());
     }
 
@@ -238,7 +238,7 @@ public class PropertiesHistoryTest extends SystemTestCase
         assertEquals(1, genericClientService.getDataSetInfo(id).getProperties().size());
         List<PropertyHistory> history = getDataSetPropertiesHistory(id.getId());
         assertEquals(
-                "[BACTERIUM: material:22<a:1>, COMMENT: no comment<a:1>, GENDER: term:12<a:1>]",
+                "[BACTERIUM: material:BACTERIUM1 [BACTERIUM]<a:1>, COMMENT: no comment<a:1>, GENDER: term:FEMALE [GENDER]<a:1>]",
                 history.toString());
     }
 
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertyHistory.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertyHistory.java
index c98347bfb37..be87a06f8ca 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertyHistory.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/PropertyHistory.java
@@ -29,9 +29,9 @@ public class PropertyHistory
 
     private String value;
 
-    private Long termID;
+    private String term;
 
-    private Long materialID;
+    private String material;
 
     private Long persIdAuthor;
 
@@ -79,14 +79,14 @@ public class PropertyHistory
         this.value = value;
     }
 
-    public void setTermID(Long termID)
+    public void setTerm(String term)
     {
-        this.termID = termID;
+        this.term = term;
     }
 
-    public void setMaterialID(Long materialID)
+    public void setMaterial(String material)
     {
-        this.materialID = materialID;
+        this.material = material;
     }
 
     @Override
@@ -98,13 +98,13 @@ public class PropertyHistory
         {
             builder.append(' ').append(value);
         }
-        if (termID != null)
+        if (term != null)
         {
-            builder.append(" term:").append(termID);
+            builder.append(" term:").append(term);
         }
-        if (materialID != null)
+        if (material != null)
         {
-            builder.append(" material:").append(materialID);
+            builder.append(" material:").append(material);
         }
         builder.append("<a:" + persIdAuthor + ">");
         return builder.toString();
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java
index ba3764aae03..3a53e85d1e0 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java
@@ -247,7 +247,7 @@ public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringCo
     {
         List<PropertyHistory> list =
                 simpleJdbcTemplate
-                        .query("select t.code, h.value, h.cvte_id, h.mate_prop_id, h.pers_id_author,"
+                        .query("select t.code, h.value, h.vocabulary_term, h.material, h.pers_id_author,"
                                 + " h.valid_from_timestamp, h.valid_until_timestamp"
                                 + " from material_properties_history as h "
                                 + " join material_type_property_types as etpt on h.mtpt_id = etpt.id"
@@ -261,7 +261,7 @@ public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringCo
     {
         List<PropertyHistory> list =
                 simpleJdbcTemplate
-                        .query("select t.code, h.value, h.cvte_id, h.mate_prop_id, h.pers_id_author,"
+                        .query("select t.code, h.value, h.vocabulary_term, h.material, h.pers_id_author,"
                                 + " h.valid_from_timestamp, h.valid_until_timestamp"
                                 + " from experiment_properties_history as h "
                                 + " join experiment_type_property_types as etpt on h.etpt_id = etpt.id"
@@ -275,7 +275,7 @@ public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringCo
     {
         List<PropertyHistory> list =
                 simpleJdbcTemplate
-                        .query("select t.code, h.value, h.cvte_id, h.mate_prop_id, h.pers_id_author,"
+                        .query("select t.code, h.value, h.vocabulary_term, h.material, h.pers_id_author,"
                                 + " h.valid_from_timestamp, h.valid_until_timestamp"
                                 + " from sample_properties_history as h "
                                 + " join sample_type_property_types as etpt on h.stpt_id = etpt.id"
@@ -289,7 +289,7 @@ public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringCo
     {
         List<PropertyHistory> list =
                 simpleJdbcTemplate
-                        .query("select t.code, h.value, h.cvte_id, h.mate_prop_id, h.pers_id_author,"
+                        .query("select t.code, h.value, h.vocabulary_term, h.material, h.pers_id_author,"
                                 + " h.valid_from_timestamp, h.valid_until_timestamp"
                                 + " from data_set_properties_history as h "
                                 + " join data_set_type_property_types as etpt on h.dstpt_id = etpt.id"
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
index 8aaae67166d..7fb1d4e2f19 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
@@ -96,7 +96,8 @@ public class GeneralInformationChangingServiceTest extends SystemTestCase
                 .getParent());
 
         List<PropertyHistory> history = getSamplePropertiesHistory(id.getId());
-        assertEquals("[ANY_MATERIAL: material:41<a:1>, ORGANISM: term:9<a:1>, SIZE: 321<a:1>]",
+        assertEquals(
+                "[ANY_MATERIAL: material:2 [GENE]<a:1>, ORGANISM: term:GORILLA [ORGANISM]<a:1>, SIZE: 321<a:1>]",
                 history.toString());
 
     }
-- 
GitLab