From 6eb07c3caaab5d451fd065b8f8b1b10ddcf23a23 Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Tue, 23 Jun 2009 12:07:02 +0000
Subject: [PATCH] [LMS-921] fixed scalability DB creator task

SVN: 11497
---
 .../server/dataaccess/db/ProjectDAO.java      |  1 -
 .../dataaccess/db/ExternalDataDAOTest.java    |  3 +--
 .../dataaccess/db/scalability/DBCreator.java  | 25 ++++++++-----------
 3 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ProjectDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ProjectDAO.java
index 026a5e35cb1..4b7d79ba8b6 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ProjectDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ProjectDAO.java
@@ -108,7 +108,6 @@ public class ProjectDAO extends AbstractGenericEntityDAO<ProjectPE> implements I
         final HibernateTemplate template = getHibernateTemplate();
         template.saveOrUpdate(project);
         template.flush();
-        template.refresh(project);
         if (operationLog.isInfoEnabled())
         {
             operationLog.info(String.format("SAVE: project '%s'.", project));
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
index fcd677d9d98..202dee4ecac 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
@@ -243,8 +243,7 @@ public final class ExternalDataDAOTest extends AbstractDAOTest
 
     protected DataStorePE pickADataStore()
     {
-        return daoFactory.getExternalDataDAO().tryToFindDataSetByCode("20081105092158673-1")
-                .getDataStore();
+        return daoFactory.getDataStoreDAO().tryToFindDataStoreByCode("STANDARD");
     }
 
     protected DataSetTypePE getDataSetType(DataSetTypeCode type)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
index dcb86b70242..f236be0d115 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
@@ -96,7 +96,7 @@ public final class DBCreator extends AbstractDAOTest
     // number properties
 
     /** a factor for scaling number of all created entities */
-    private static final int FACTOR = 100;
+    private static final int FACTOR = 1;
 
     /** the overall number of Materials created */
     private static final int MATERIALS_NO = FACTOR * 20000;
@@ -162,16 +162,9 @@ public final class DBCreator extends AbstractDAOTest
         }
 
         hibernateTemplate = new HibernateTemplate(sessionFactory);
-        try
-        {
-            createAndSetDefaultEntities();
-            createExperimentsWithSamplesAndDataSets();
-        } catch (Exception e)
-        {
-            System.err.println("DB creation failed");
-            System.err.println(e.getMessage());
-            e.printStackTrace();
-        }
+
+        createAndSetDefaultEntities();
+        createExperimentsWithSamplesAndDataSets();       
     }
 
     // Hibernate Session
@@ -349,13 +342,18 @@ public final class DBCreator extends AbstractDAOTest
         String location = CodeGenerator.generateCode(CreatedEntityKind.DATA_SET);
         externalData.setLocation(location);
         externalData.setStorageFormatVocabularyTerm(pickAStorageFormatVocabularyTerm());
-        externalData.setDataStore(new DataStorePE());
+        externalData.setDataStore(pickADataStore());
 
         return externalData;
     }
 
     // code from ExternalDataDAOTest
 
+    private DataStorePE pickADataStore()
+    {
+        return daoFactory.getDataStoreDAO().tryToFindDataStoreByCode("STANDARD");
+    }
+
     private LocatorTypePE pickALocatorType()
     {
         ILocatorTypeDAO locatorTypeDAO = daoFactory.getLocatorTypeDAO();
@@ -469,8 +467,6 @@ public final class DBCreator extends AbstractDAOTest
 
         private static final Integer REGISTRATOR_ID = 1;
 
-        private static final Integer INHIBITOR_ID = null;
-
         private static final String REGISTRATION_TIMESTAMP = "2007-12-04 15:50:54.111";
 
         private static final Integer DB_INSTANCE = 1;
@@ -514,7 +510,6 @@ public final class DBCreator extends AbstractDAOTest
             appendColumn(sb, CodeGenerator.generateCode(CreatedEntityKind.MATERIAL));
             appendColumn(sb, MATERIAL_TYPE_ID);
             appendColumn(sb, REGISTRATOR_ID);
-            appendColumn(sb, INHIBITOR_ID);
             appendColumn(sb, REGISTRATION_TIMESTAMP);
             appendColumn(sb, DB_INSTANCE);
             sb.append(MODIFICATION_TIMESTAMP);
-- 
GitLab