This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.3.0-beta-9 in repository topia. See https://gitlab.nuiton.org/nuiton/topia.git commit 42422ac8f3f10125afc3271266df9fe0e83b4224 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Mar 6 14:08:13 2010 +0000 fix Tests (resources used in a test must be unique in time) + add license header --- .../nuiton/topia/persistence/NaturalIdTest.java | 21 ++++++++- .../test/java/org/nuiton/topiatest/TestUtils.java | 53 ++++++++++++++++++---- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/topia-persistence/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java b/topia-persistence/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java index 0bd5a4d..8482c4e 100644 --- a/topia-persistence/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java +++ b/topia-persistence/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java @@ -1,4 +1,23 @@ - +/* + * *##% + * ToPIA :: Persistence + * Copyright (C) 2004 - 2010 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##% + */ package org.nuiton.topia.persistence; import org.apache.commons.logging.Log; diff --git a/topia-persistence/src/test/java/org/nuiton/topiatest/TestUtils.java b/topia-persistence/src/test/java/org/nuiton/topiatest/TestUtils.java index f970761..33122ce 100644 --- a/topia-persistence/src/test/java/org/nuiton/topiatest/TestUtils.java +++ b/topia-persistence/src/test/java/org/nuiton/topiatest/TestUtils.java @@ -1,14 +1,34 @@ - +/* + * *##% + * ToPIA :: Persistence + * Copyright (C) 2004 - 2010 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##% + */ package org.nuiton.topiatest; import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import org.hibernate.cfg.Environment; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.junit.Ignore; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaNotFoundException; import org.nuiton.topia.TopiaTestDAOHelper; @@ -25,17 +45,34 @@ import org.nuiton.topia.TopiaTestDAOHelper; */ @Ignore public class TestUtils { + + /** Logger */ + private static final Log log = LogFactory.getLog(TestUtils.class); - public static TopiaContext start(String dbname) throws IOException, TopiaNotFoundException { - InputStream stream = TestUtils.class.getResourceAsStream("/TopiaContextImpl.properties"); + public static TopiaContext start(String dbname) + throws IOException, TopiaNotFoundException { + + InputStream stream = TestUtils.class.getResourceAsStream( + "/TopiaContextImpl.properties"); Properties configuration = new Properties(); configuration.load(stream); - configuration.setProperty("topia.persistence.classes", - TopiaTestDAOHelper.getImplementationClassesAsString()); + configuration.setProperty( + "topia.persistence.classes", + TopiaTestDAOHelper.getImplementationClassesAsString()); - configuration.setProperty("hibernate.connection.url", "jdbc:h2:file:target/surefire-data/" + dbname); + // make sure we always use a different directory + + String dbPath = "target/surefire-data/" + dbname + '_' + + System.nanoTime(); + if (log.isInfoEnabled()) { + log.info("dbPath = " + dbPath); + } + configuration.setProperty( + "hibernate.connection.url", + "jdbc:h2:file:" + dbPath); return TopiaContextFactory.getContext(configuration); } + } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.