Skip to content
Snippets Groups Projects
Commit 95ed08c2 authored by buczekp's avatar buczekp
Browse files

[LMS-921] included scalability DB creator task in nightly builds

SVN: 11500
parent 1ec56e82
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ import java.util.Date; ...@@ -25,6 +25,7 @@ import java.util.Date;
import org.hibernate.Session; import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO;
...@@ -52,11 +53,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; ...@@ -52,11 +53,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
/** /**
* A class that uses features of {@link AbstractDAOTest} but is not a real test of openbis (it is * This class has one test method called main that can be run as a TestNG test using
* excluded from all suites). It has one test method though called main witch should be run as a * "create scalability DB" run configuration in eclipse and creates a DB for scalability testing.
* TestNG test using "create scalability DB" run configuration in eclipse (it sets an environment * The test is in "scalability" group which is included in nightly builds. No rollback is done after
* property that is needed for initialization) and creates a DB for scalability testing. No rollback * this test. <br>
* is done after this method. <br>
* <br> * <br>
* At the beginning it creates a TSV file with materials in a given TSV directory that will be used * At the beginning it creates a TSV file with materials in a given TSV directory that will be used
* in the next step. Then the DB is created from scratch (with new materials added from the TSV * in the next step. Then the DB is created from scratch (with new materials added from the TSV
...@@ -77,8 +77,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; ...@@ -77,8 +77,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
* <li>commenting out flush() in create methods for in {@link IExternalDataDAO} and * <li>commenting out flush() in create methods for in {@link IExternalDataDAO} and
* {@link SampleDAO} * {@link SampleDAO}
* <li>turning off logging (doesn't make a big difference) - change root logging priority in log.xml * <li>turning off logging (doesn't make a big difference) - change root logging priority in log.xml
* from "info" to "error" and also change static variable LOG value to false. * from "info" to "error".
* </ul> * </ul>
* To log the current state of particular entity creation change static LOG variable value to true.
* *
* @author Piotr Buczek * @author Piotr Buczek
*/ */
...@@ -126,22 +127,7 @@ public final class DBCreator extends AbstractDAOTest ...@@ -126,22 +127,7 @@ public final class DBCreator extends AbstractDAOTest
private static boolean initialized = false; private static boolean initialized = false;
static private static final boolean LOG = false;
{
// we don't want this code to be executed when DBCreator.class is loaded by TestNG
// which happens for all test configurations
if (System.getenv("initializeDBCreator") != null)
{
System.setProperty("database.kind", DB_KIND);
System.setProperty("database.create-from-scratch", "true");
System.setProperty("authorization-component-factory", "no-authorization");
MaterialHelper.createMaterialsTSVFile(TSV_DIRECTORY, MATERIALS_NO);
log("created materials TSV file");
initialized = true;
}
}
private static final boolean LOG = true;
private static void log(String format, Object... objects) private static void log(String format, Object... objects)
{ {
...@@ -151,6 +137,18 @@ public final class DBCreator extends AbstractDAOTest ...@@ -151,6 +137,18 @@ public final class DBCreator extends AbstractDAOTest
} }
} }
@BeforeTest()
public void beforeTest()
{
// changes DB configuration to create a new DB
System.setProperty("database.kind", DB_KIND);
System.setProperty("database.create-from-scratch", "true");
System.setProperty("authorization-component-factory", "no-authorization");
MaterialHelper.createMaterialsTSVFile(TSV_DIRECTORY, MATERIALS_NO);
log("created materials TSV file");
initialized = true;
}
@Test @Test
@Rollback(value = false) @Rollback(value = false)
public final void main() throws Exception public final void main() throws Exception
...@@ -164,7 +162,7 @@ public final class DBCreator extends AbstractDAOTest ...@@ -164,7 +162,7 @@ public final class DBCreator extends AbstractDAOTest
hibernateTemplate = new HibernateTemplate(sessionFactory); hibernateTemplate = new HibernateTemplate(sessionFactory);
createAndSetDefaultEntities(); createAndSetDefaultEntities();
createExperimentsWithSamplesAndDataSets(); createExperimentsWithSamplesAndDataSets();
} }
// Hibernate Session // Hibernate Session
......
...@@ -8,6 +8,17 @@ ...@@ -8,6 +8,17 @@
</groups> </groups>
<packages> <packages>
<package name="ch.systemsx.cisd.openbis.*" /> <package name="ch.systemsx.cisd.openbis.*" />
</packages> </packages>
</test> </test>
<test name="scalability" annotations="JDK">
<groups>
<run>
<include name="scalability"/>
<exclude name="broken" />
</run>
</groups>
<packages>
<package name="ch.systemsx.cisd.openbis.*" />
</packages>
</test>
</suite> </suite>
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
<run> <run>
<include name="db" /> <include name="db" />
<exclude name="broken" /> <exclude name="broken" />
<exclude name="scalability" />
</run> </run>
</groups> </groups>
<packages> <packages>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment