r2447 - in trunk/topia-persistence-tck: . src/main/java/org/nuiton/topia/tck src/main/java/org/nuiton/topia/tck/it src/main/java/org/nuiton/topia/tck/it/beangen src/main/java/org/nuiton/topia/tck/it/deletetest src/main/java/org/nuiton/topia/tck/it/persistence src/main/java/org/nuiton/topia/tck/it/service src/main/resources/i18n src/main/xmi src/test/java/org/nuiton/topia src/test/java/org/nuiton/topia/framework src/test/java/org/nuiton/topia/generator src/test/java/org/nuiton/topia/persisten
Author: athimel Date: 2012-05-09 16:10:52 +0200 (Wed, 09 May 2012) New Revision: 2447 Url: http://nuiton.org/repositories/revision/topia/2447 Log: topia-persistence-tck compiles (skipping tests) Added: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TestHelper.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TopiaDatabase.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/EnumTest.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/beangen/ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/ trunk/topia-persistence-tck/src/main/resources/i18n/topia-persistence-tck_en_GB.properties trunk/topia-persistence-tck/src/main/resources/i18n/topia-persistence-tck_es_ES.properties trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.properties trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.zargo Removed: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Gender.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Title.java trunk/topia-persistence-tck/src/main/xmi/topiatest.properties trunk/topia-persistence-tck/src/main/xmi/topiatest.zargo trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TestHelper.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaDatabase.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/EnumTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/beangen/ trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/deletetest/ trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/persistence/ trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/service/ Modified: trunk/topia-persistence-tck/pom.xml trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/beangen/RoueImpl.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/DeleteEntityTest.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Abstract.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Impl.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/package-info.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/FakeService.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/TestService.java trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/package-info.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaConnectionProviderTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextReplicateTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaUtilTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/generator/TopiaTestCase.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/EntityVisitorExportXmlTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/CollectorTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityBinderTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityRefTesterTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1882/DAOAbstractTransformerTest.java trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java Modified: trunk/topia-persistence-tck/pom.xml =================================================================== --- trunk/topia-persistence-tck/pom.xml 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/pom.xml 2012-05-09 14:10:52 UTC (rev 2447) @@ -33,6 +33,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> + <scope>compile</scope> </dependency> <dependency> Deleted: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Gender.java =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Gender.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Gender.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,29 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2011 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>. - * #L% - */ -package org.nuiton.topia.tck; - -public enum Gender { - MALE, FEMALE -} Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TestHelper.java (from rev 2446, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TestHelper.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TestHelper.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TestHelper.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,162 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * 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>. + * #L% + */ +package org.nuiton.topia.tck; + +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.TopiaNotFoundException; +import org.nuiton.topia.TopiaTckItDAOHelper; +import org.nuiton.util.FileUtil; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * Helper for all topia tests. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.5 + */ +@Ignore +// this is not a test :) +public class TestHelper { + + private static final Log log = LogFactory.getLog(TestHelper.class); + + protected static File testBasedir; + + protected static File targetdir; + + protected static File dirDatabase; + + public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties"; + + public static File getTestWorkdir() { + if (testBasedir == null) { + String base = System.getProperty("java.io.tmpdir"); + if (base == null || base.isEmpty()) { + base = new File("").getAbsolutePath(); + } + testBasedir = new File(base); + log.info("basedir for test " + testBasedir); + } + return testBasedir; + } + + public static File getTestBasedir(Class<?> testClass) throws IOException { + File dir = getTestWorkdir(); + File result = new File(dir, testClass.getName()); + if (result.exists()) { + + // when calling this method (always in a BeforeClass method), we wants + // to clean the directory, this is a new build + FileUtil.deleteRecursively(result); + } + + // always create the directory + FileUtil.createDirectoryIfNecessary(result); + return result; + } + + public static TopiaContext initTopiaContext(File testDirectory, + String dbname) + throws IOException, TopiaNotFoundException { + + + TopiaContext topiaContext = initTopiaContext( + testDirectory, + DEFAULT_CONFIGURATION_LOCATION, + dbname + ); + return topiaContext; + } + + public static TopiaContext initTopiaContext(File testDirectory, + String dbPropertiesPath, + String dbname) + throws IOException, TopiaNotFoundException { + + Properties configuration = initTopiaContextConfiguration( + testDirectory, + dbPropertiesPath, + dbname); + return TopiaContextFactory.getContext(configuration); + } + + public static Properties initTopiaContextConfiguration(File testDirectory, + String dbPropertiesPath, + String dbname) + throws IOException { + + Properties configuration = loadHibernateConfiguration(dbPropertiesPath); + + // make sure we always use a different directory + + String dbPath = getDbName(testDirectory, dbname); + + if (log.isInfoEnabled()) { + log.info("dbPath = " + dbPath); + } + configuration.setProperty( +// Environment.URL, + "hibernate.connection.url", + "jdbc:h2:file:" + dbPath); + + return configuration; + } + + public static Properties loadHibernateConfiguration(String dbPropertiesPath) throws IOException { + InputStream stream = TestHelper.class.getResourceAsStream(dbPropertiesPath); + + Properties configuration = new Properties(); + + configuration.load(stream); + configuration.setProperty( + TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, + TopiaTckItDAOHelper.getImplementationClassesAsString()); + return configuration; + } + + public static String getDbName(File testDirectory, String dbname) { + return new File(testDirectory, + dbname + '_' + System.nanoTime()).getAbsolutePath(); + } + + public static Properties initTopiaContextConfiguration(File testDirectory, + String dbname) + throws IOException { + + return initTopiaContextConfiguration( + testDirectory, + DEFAULT_CONFIGURATION_LOCATION, + dbname + ); + } +} Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TestHelper.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Title.java =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Title.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Title.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,37 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2011 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>. - * #L% - */ -package org.nuiton.topia.tck; - -/** - * To test http://nuiton.org/issues/1732. - * - * @author tchemit <chemit@codelutin.com> - * @since 2.6.2 - */ -public enum Title { - Mr, - Madam, - Other -} Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TopiaDatabase.java (from rev 2446, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaDatabase.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TopiaDatabase.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TopiaDatabase.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,196 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2012 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>. + * #L% + */ +package org.nuiton.topia.tck; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaTckItDAOHelper; + +import java.io.File; +import java.io.InputStream; +import java.util.Properties; + +/** + * Put this class as a Rule in test to obtain a new isolated db for each test. + * <p/> + * Here is a simple example of usage : + * <pre> + * public class MyTest { + * + * \@Rule + * public final TopiaDatabase db = new TopiaDatabase(); + * + * \@Test + * public void testMethod() throws TopiaException { + * + * TopiaContext tx = db.beginTransaction(); + * ... + * } + * </pre> + * The db created will be unique for each test method (and for each build also). + * <p/> + * You don't need to close any transaction, it will be done for you and the end + * of each method test. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.6.8 + */ +public class TopiaDatabase extends TestWatcher { + + /** Logger. */ + private static final Log log = LogFactory.getLog(TopiaDatabase.class); + + /** A time-stamp, allow to make multiple build and keep the tests data. */ + public static final String TIMESTAMP = String.valueOf(System.nanoTime()); + + private File testBasedir; + + private Properties dbConfiguration; + + private TopiaContext rootCtxt; + + private final String configurationPath; + + public TopiaDatabase() { + this(TestHelper.DEFAULT_CONFIGURATION_LOCATION); + } + + public TopiaDatabase(String configurationPath) { + this.configurationPath = configurationPath; + } + + @Override + protected void starting(Description description) { + + // get test directory + testBasedir = getTestSpecificDirectory( + description.getTestClass(), + description.getMethodName()); + + if (log.isDebugEnabled()) { + log.debug("testBasedir = " + testBasedir); + } + + // create the root context + try { + + dbConfiguration = new Properties(); + InputStream stream = + getClass().getResourceAsStream(configurationPath); + + try { + dbConfiguration.load(stream); + } finally { + stream.close(); + } + dbConfiguration.setProperty( + TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, + TopiaTckItDAOHelper.getImplementationClassesAsString()); + + // make sure we always use a different directory + + String dbPath = new File(testBasedir, "db").getAbsolutePath(); + + if (log.isDebugEnabled()) { + log.debug("dbPath = " + dbPath); + } + dbConfiguration.setProperty( + TopiaContextFactory.CONFIG_URL, "jdbc:h2:file:" + dbPath); + + onDbConfigurationCreate(dbConfiguration, testBasedir, dbPath); + + rootCtxt = TopiaContextFactory.getContext(dbConfiguration); + } catch (Exception e) { + throw new IllegalStateException( + "Could not start db at " + testBasedir, e); + } + } + + @Override + public void finished(Description description) { + + if (rootCtxt != null && !rootCtxt.isClosed()) { + try { + rootCtxt.closeContext(); + } catch (TopiaException e) { + if (log.isErrorEnabled()) { + log.error("Could not close topia root context", e); + } + } + } + rootCtxt = null; + dbConfiguration = null; + } + + public File getTestBasedir() { + return testBasedir; + } + + public TopiaContext getRootCtxt() { + return rootCtxt; + } + + public Properties getDbConfiguration() { + return dbConfiguration; + } + + public TopiaContext beginTransaction() throws TopiaException { + return rootCtxt.beginTransaction(); + } + + protected void onDbConfigurationCreate(Properties configuration, + File testDir, + String dbPath) { + + } + + public static File getTestSpecificDirectory(Class<?> testClassName, String methodName) { + // Trying to look for the temporary folder to store data for the test + String tempDirPath = System.getProperty("java.io.tmpdir"); + if (tempDirPath == null) { + // can this really occur ? + tempDirPath = ""; + if (log.isWarnEnabled()) { + log.warn("'\"java.io.tmpdir\" not defined"); + } + } + File tempDirFile = new File(tempDirPath); + + // create the directory to store database data + String dataBasePath = testClassName.getName() + + File.separator // a directory with the test class name + + methodName// a sub-directory with the method name + + '_' + + TIMESTAMP; // and a timestamp + File databaseFile = new File(tempDirFile, dataBasePath); + return databaseFile; + } +} + Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/TopiaDatabase.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/EnumTest.java (from rev 2446, trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/EnumTest.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/EnumTest.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/EnumTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,75 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 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>. + * #L% + */ +package org.nuiton.topia.tck.it; + +import junit.framework.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.tck.TopiaDatabase; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaTckItDAOHelper; + +/** + * Test the support of possibility to have an attribute of type enumeration + * in a entity + */ +public class EnumTest { + + @Rule + public final TopiaDatabase db = new TopiaDatabase(); + + /** + * Create an entity having two field of type enumeration. One is stored + * using ordinal, the other using the name. + * <p/> + * The test check that values are stored, and that find methods works + * + * @throws TopiaException if any exception with db + */ + @Test + public void storeEntityWithEnumValue() throws TopiaException { + TopiaContext transaction = db.beginTransaction(); + + PersonneDAO dao = TopiaTckItDAOHelper.getPersonneDAO(transaction); + Personne personne = new PersonneImpl(); + personne.setGender(Gender.FEMALE); + personne.setOtherGender(Gender.MALE); + dao.create(personne); + String topiaId = personne.getTopiaId(); + transaction.commitTransaction(); + transaction.closeContext(); + + transaction = db.beginTransaction(); + dao = TopiaTckItDAOHelper.getPersonneDAO(transaction); + dao.findByTopiaId(topiaId); + Assert.assertEquals(Gender.FEMALE, personne.getGender()); + Assert.assertEquals(Gender.MALE, personne.getOtherGender()); + + Assert.assertNotNull(dao.findByGender(Gender.FEMALE)); + Assert.assertNotNull(dao.findByOtherGender(Gender.MALE)); + transaction.closeContext(); + } +} Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/EnumTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java (from rev 2446, trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,42 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * 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>. + * #L% + */ +package org.nuiton.topia.tck.it; + +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.tck.it.ExtraDAOEntity; +import org.nuiton.topia.tck.it.ExtraDAOEntityDAOAbstract; + +/** + * Created: 26 mai 2010 + * + * @author fdesbois <fdesbois@codelutin.com> + * @version $Id$ + */ +public class ExtraDAOEntityDAOImpl<E extends ExtraDAOEntity> extends ExtraDAOEntityDAOAbstract<E> { + + @Override + public void extra() throws TopiaException { + } +} Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java (from rev 2445, trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Gender.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,29 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 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>. + * #L% + */ +package org.nuiton.topia.tck.it; + +public enum Gender { + MALE, FEMALE +} Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java (from rev 2445, trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/Title.java) =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java (rev 0) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,37 @@ +/* + * #%L + * ToPIA :: Persistence + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 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>. + * #L% + */ +package org.nuiton.topia.tck.it; + +/** + * To test http://nuiton.org/issues/1732. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.6.2 + */ +public enum Title { + Mr, + Madam, + Other +} Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/beangen/RoueImpl.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/beangen/RoueImpl.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/beangen/RoueImpl.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -23,9 +23,9 @@ * #L% */ -package org.nuiton.topiatest.beangen; +package org.nuiton.topia.tck.it.beangen; -import org.nuiton.topiatest.Product; +import org.nuiton.topia.tck.it.Product; /** * RoueImpl Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/deletetest/Contact2DAOImpl.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -23,14 +23,14 @@ * #L% */ -package org.nuiton.topiatest.deletetest; +package org.nuiton.topia.tck.it.deletetest; import java.util.Set; import java.util.TreeSet; import org.nuiton.topia.TopiaException; -import org.nuiton.topiatest.Company; -import org.nuiton.topiatest.Employe; +import org.nuiton.topia.tck.it.Company; +import org.nuiton.topia.tck.it.Employe; /** * Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/DeleteEntityTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/deletetest/DeleteEntityTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/DeleteEntityTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -36,18 +36,18 @@ * par : $Author$ */ -package org.nuiton.topiatest.deletetest; +package org.nuiton.topia.tck.it.deletetest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; -import org.nuiton.topiatest.Personne; -import org.nuiton.topiatest.PersonneDAO; +import org.nuiton.topia.TopiaTckItDAOHelper; +import org.nuiton.topia.tck.TopiaDatabase; +import org.nuiton.topia.tck.it.Personne; +import org.nuiton.topia.tck.it.PersonneDAO; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -55,7 +55,7 @@ /** * Deleting tests with DAO and Entities generated with ToPIA (diagram - * delete-test in topiatest.zargo). Different case of deleting, with inheritance + * delete-test in topia-tck-it.zargo). Different case of deleting, with inheritance * or NMultiplicity relationship between two entities, or both. Initiate from an * issue with DAOAbstractGenerator delete method generation. Tests with H2 * Database. Configuration in src/test/resources/TopiaContextImpl.properties @@ -82,7 +82,7 @@ TopiaContext transaction = db.beginTransaction(); log.debug("DAO : PersonneDAO"); - PersonneDAO dao = TopiaTestDAOHelper.getPersonneDAO(transaction); + PersonneDAO dao = TopiaTckItDAOHelper.getPersonneDAO(transaction); log.debug("CREATE PERSONNE : Bob Marley"); Personne personne = dao.create(Personne.PROPERTY_NAME, "Bob Marley"); @@ -106,7 +106,7 @@ log.debug("ENTITY PERSONNE SAVED !"); log.debug("DAO parent (abstract) : PartyDAO"); - Party2DAO dao2 = TopiaTestDAOHelper.getParty2DAO(transaction); + Party2DAO dao2 = TopiaTckItDAOHelper.getParty2DAO(transaction); log.debug("DELETE PERSONNE with PartyDAO"); dao2.delete(personne2); @@ -133,7 +133,7 @@ TopiaContext transaction = db.beginTransaction(); - PersonneDAO dao = TopiaTestDAOHelper.getPersonneDAO(transaction); + PersonneDAO dao = TopiaTckItDAOHelper.getPersonneDAO(transaction); log.debug("CREATE PERSONNE : Bob Marley"); Personne personne = dao.create(Personne.PROPERTY_NAME, "Bob Marley"); @@ -142,7 +142,7 @@ assertNotNull(idPersonne); log.debug("ENTITY PERSONNE SAVED !"); - Contact2DAO contactDAO = TopiaTestDAOHelper.getContact2DAO(transaction); + Contact2DAO contactDAO = TopiaTckItDAOHelper.getContact2DAO(transaction); log.debug("CREATE CONTACT : jaja@codelutin.com"); Contact2 contact = contactDAO.create(Contact2.PROPERTY_CONTACT_VALUE, "jaja@codelutin.com"); Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/persistence/Entity1.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -22,7 +22,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.topiatest.persistence; +package org.nuiton.topia.tck.it.persistence; import org.nuiton.topia.persistence.TopiaEntity; Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Abstract.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/persistence/Entity1Abstract.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Abstract.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -22,7 +22,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.topiatest.persistence; +package org.nuiton.topia.tck.it.persistence; import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.EntityVisitor; Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Impl.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/persistence/Entity1Impl.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/Entity1Impl.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -22,11 +22,8 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.topiatest.persistence; +package org.nuiton.topia.tck.it.persistence; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.persistence.EntityVisitor; - /** * Created: 11 mai 2010 * Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/package-info.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/persistence/package-info.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/persistence/package-info.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -25,4 +25,4 @@ /** * Contains persistent entities for Tests. */ -package org.nuiton.topiatest.persistence; \ No newline at end of file +package org.nuiton.topia.tck.it.persistence; \ No newline at end of file Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/FakeService.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/service/FakeService.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/FakeService.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -22,10 +22,9 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.topiatest.service; +package org.nuiton.topia.tck.it.service; import org.nuiton.topia.framework.TopiaContextImpl; -import org.nuiton.topia.framework.TopiaContextImplTest; import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.framework.TopiaService; Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/TestService.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/service/TestService.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/TestService.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -22,11 +22,10 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.topiatest.service; +package org.nuiton.topia.tck.it.service; import org.junit.Ignore; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.framework.TopiaContextImplTest; import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.framework.TopiaService; Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/package-info.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/service/package-info.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/service/package-info.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -26,4 +26,4 @@ * This package contains classes which implements {@link * org.nuiton.topia.framework.TopiaService} to test services API. */ -package org.nuiton.topiatest.service; \ No newline at end of file +package org.nuiton.topia.tck.it.service; \ No newline at end of file Added: trunk/topia-persistence-tck/src/main/resources/i18n/topia-persistence-tck_en_GB.properties =================================================================== Added: trunk/topia-persistence-tck/src/main/resources/i18n/topia-persistence-tck_es_ES.properties =================================================================== Copied: trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.properties (from rev 2445, trunk/topia-persistence-tck/src/main/xmi/topiatest.properties) =================================================================== --- trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.properties (rev 0) +++ trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.properties 2012-05-09 14:10:52 UTC (rev 2447) @@ -0,0 +1,39 @@ +### +# #%L +# ToPIA :: Persistence +# +# $Id$ +# $HeadURL$ +# %% +# 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>. +# #L% +### +model.tagvalue.i18n=topia.test.common. +model.tagvalue.generateOperatorForDAOHelper=true +model.tagvalue.constantPrefix=PROPERTY_ +model.tagvalue.generateDTOTopiaId=true + +#org.nuiton.topiatest.Company.class.tagvalue.naturalIdMutable=false +#org.nuiton.topiatest.Company.attribute.siret.tagvalue.naturalId=true +#org.nuiton.topiatest.Company.attribute.name.tagvalue.naturalId=true +#org.nuiton.topiatest.Company.attribute.name.tagvalue.notNull=false + +org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNotNull.tagvalue.naturalId=true +org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.naturalId=true +org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.notNull=false + +org.nuiton.topiatest.Personne.attribute.otherGender.tagValue.useEnumerationName=true \ No newline at end of file Property changes on: trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.zargo (from rev 2445, trunk/topia-persistence-tck/src/main/xmi/topiatest.zargo) =================================================================== (Binary files differ) Property changes on: trunk/topia-persistence-tck/src/main/xmi/topia-tck-it.zargo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:keywords + Author Date Id Revision HeadURL Deleted: trunk/topia-persistence-tck/src/main/xmi/topiatest.properties =================================================================== --- trunk/topia-persistence-tck/src/main/xmi/topiatest.properties 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/main/xmi/topiatest.properties 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,39 +0,0 @@ -### -# #%L -# ToPIA :: Persistence -# -# $Id$ -# $HeadURL$ -# %% -# 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>. -# #L% -### -model.tagvalue.i18n=topia.test.common. -model.tagvalue.generateOperatorForDAOHelper=true -model.tagvalue.constantPrefix=PROPERTY_ -model.tagvalue.generateDTOTopiaId=true - -#org.nuiton.topiatest.Company.class.tagvalue.naturalIdMutable=false -#org.nuiton.topiatest.Company.attribute.siret.tagvalue.naturalId=true -#org.nuiton.topiatest.Company.attribute.name.tagvalue.naturalId=true -#org.nuiton.topiatest.Company.attribute.name.tagvalue.notNull=false - -org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNotNull.tagvalue.naturalId=true -org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.naturalId=true -org.nuiton.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.notNull=false - -org.nuiton.topiatest.Personne.attribute.otherGender.tagValue.useEnumerationName=true \ No newline at end of file Deleted: trunk/topia-persistence-tck/src/main/xmi/topiatest.zargo =================================================================== (Binary files differ) Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TestHelper.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TestHelper.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TestHelper.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,159 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * 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>. - * #L% - */ -package org.nuiton.topia; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.cfg.Environment; -import org.junit.Ignore; -import org.nuiton.util.FileUtil; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * Helper for all topia tests. - * - * @author tchemit <chemit@codelutin.com> - * @since 2.5 - */ -@Ignore -// this is not a test :) -public class TestHelper { - - private static final Log log = LogFactory.getLog(TestHelper.class); - - protected static File testBasedir; - - protected static File targetdir; - - protected static File dirDatabase; - - public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties"; - - public static File getTestWorkdir() { - if (testBasedir == null) { - String base = System.getProperty("java.io.tmpdir"); - if (base == null || base.isEmpty()) { - base = new File("").getAbsolutePath(); - } - testBasedir = new File(base); - log.info("basedir for test " + testBasedir); - } - return testBasedir; - } - - public static File getTestBasedir(Class<?> testClass) throws IOException { - File dir = getTestWorkdir(); - File result = new File(dir, testClass.getName()); - if (result.exists()) { - - // when calling this method (always in a BeforeClass method), we wants - // to clean the directory, this is a new build - FileUtil.deleteRecursively(result); - } - - // always create the directory - FileUtil.createDirectoryIfNecessary(result); - return result; - } - - public static TopiaContext initTopiaContext(File testDirectory, - String dbname) - throws IOException, TopiaNotFoundException { - - - TopiaContext topiaContext = initTopiaContext( - testDirectory, - DEFAULT_CONFIGURATION_LOCATION, - dbname - ); - return topiaContext; - } - - public static TopiaContext initTopiaContext(File testDirectory, - String dbPropertiesPath, - String dbname) - throws IOException, TopiaNotFoundException { - - Properties configuration = initTopiaContextConfiguration( - testDirectory, - dbPropertiesPath, - dbname); - return TopiaContextFactory.getContext(configuration); - } - - public static Properties initTopiaContextConfiguration(File testDirectory, - String dbPropertiesPath, - String dbname) - throws IOException { - - Properties configuration = loadHibernateConfiguration(dbPropertiesPath); - - // make sure we always use a different directory - - String dbPath = getDbName(testDirectory, dbname); - - if (log.isInfoEnabled()) { - log.info("dbPath = " + dbPath); - } - configuration.setProperty( - Environment.URL, -// "hibernate.connection.url", - "jdbc:h2:file:" + dbPath); - - return configuration; - } - - public static Properties loadHibernateConfiguration(String dbPropertiesPath) throws IOException { - InputStream stream = TestHelper.class.getResourceAsStream(dbPropertiesPath); - - Properties configuration = new Properties(); - - configuration.load(stream); - configuration.setProperty( - TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, - TopiaTestDAOHelper.getImplementationClassesAsString()); - return configuration; - } - - public static String getDbName(File testDirectory, String dbname) { - return new File(testDirectory, - dbname + '_' + System.nanoTime()).getAbsolutePath(); - } - - public static Properties initTopiaContextConfiguration(File testDirectory, - String dbname) - throws IOException { - - return initTopiaContextConfiguration( - testDirectory, - DEFAULT_CONFIGURATION_LOCATION, - dbname - ); - } -} Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -31,6 +31,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.topia.framework.TopiaContextImpl; +import org.nuiton.topia.tck.TopiaDatabase; import java.io.File; import java.io.IOException; Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaDatabase.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaDatabase.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaDatabase.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,192 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2012 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>. - * #L% - */ -package org.nuiton.topia; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; - -import java.io.File; -import java.io.InputStream; -import java.util.Properties; - -/** - * Put this class as a Rule in test to obtain a new isolated db for each test. - * <p/> - * Here is a simple example of usage : - * <pre> - * public class MyTest { - * - * \@Rule - * public final TopiaDatabase db = new TopiaDatabase(); - * - * \@Test - * public void testMethod() throws TopiaException { - * - * TopiaContext tx = db.beginTransaction(); - * ... - * } - * </pre> - * The db created will be unique for each test method (and for each build also). - * <p/> - * You don't need to close any transaction, it will be done for you and the end - * of each method test. - * - * @author tchemit <chemit@codelutin.com> - * @since 2.6.8 - */ -public class TopiaDatabase extends TestWatcher { - - /** Logger. */ - private static final Log log = LogFactory.getLog(TopiaDatabase.class); - - /** A time-stamp, allow to make multiple build and keep the tests data. */ - public static final String TIMESTAMP = String.valueOf(System.nanoTime()); - - private File testBasedir; - - private Properties dbConfiguration; - - private TopiaContext rootCtxt; - - private final String configurationPath; - - public TopiaDatabase() { - this(TestHelper.DEFAULT_CONFIGURATION_LOCATION); - } - - public TopiaDatabase(String configurationPath) { - this.configurationPath = configurationPath; - } - - @Override - protected void starting(Description description) { - - // get test directory - testBasedir = getTestSpecificDirectory( - description.getTestClass(), - description.getMethodName()); - - if (log.isDebugEnabled()) { - log.debug("testBasedir = " + testBasedir); - } - - // create the root context - try { - - dbConfiguration = new Properties(); - InputStream stream = - getClass().getResourceAsStream(configurationPath); - - try { - dbConfiguration.load(stream); - } finally { - stream.close(); - } - dbConfiguration.setProperty( - TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, - TopiaTestDAOHelper.getImplementationClassesAsString()); - - // make sure we always use a different directory - - String dbPath = new File(testBasedir, "db").getAbsolutePath(); - - if (log.isDebugEnabled()) { - log.debug("dbPath = " + dbPath); - } - dbConfiguration.setProperty( - TopiaContextFactory.CONFIG_URL, "jdbc:h2:file:" + dbPath); - - onDbConfigurationCreate(dbConfiguration, testBasedir, dbPath); - - rootCtxt = TopiaContextFactory.getContext(dbConfiguration); - } catch (Exception e) { - throw new IllegalStateException( - "Could not start db at " + testBasedir, e); - } - } - - @Override - public void finished(Description description) { - - if (rootCtxt != null && !rootCtxt.isClosed()) { - try { - rootCtxt.closeContext(); - } catch (TopiaException e) { - if (log.isErrorEnabled()) { - log.error("Could not close topia root context", e); - } - } - } - rootCtxt = null; - dbConfiguration = null; - } - - public File getTestBasedir() { - return testBasedir; - } - - public TopiaContext getRootCtxt() { - return rootCtxt; - } - - public Properties getDbConfiguration() { - return dbConfiguration; - } - - public TopiaContext beginTransaction() throws TopiaException { - return rootCtxt.beginTransaction(); - } - - protected void onDbConfigurationCreate(Properties configuration, - File testDir, - String dbPath) { - - } - - public static File getTestSpecificDirectory(Class<?> testClassName, String methodName) { - // Trying to look for the temporary folder to store data for the test - String tempDirPath = System.getProperty("java.io.tmpdir"); - if (tempDirPath == null) { - // can this really occur ? - tempDirPath = ""; - if (log.isWarnEnabled()) { - log.warn("'\"java.io.tmpdir\" not defined"); - } - } - File tempDirFile = new File(tempDirPath); - - // create the directory to store database data - String dataBasePath = testClassName.getName() - + File.separator // a directory with the test class name - + methodName// a sub-directory with the method name - + '_' - + TIMESTAMP; // and a timestamp - File databaseFile = new File(tempDirFile, dataBasePath); - return databaseFile; - } -} - Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaConnectionProviderTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaConnectionProviderTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaConnectionProviderTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -29,12 +29,10 @@ import org.junit.Test; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; import org.nuiton.topia.test.entities.Person; import org.nuiton.topia.test.entities.PersonDAO; -import org.nuiton.topiatest.Personne; import java.io.File; import java.util.Locale; @@ -125,7 +123,7 @@ TopiaContext transaction = db.beginTransaction(); try { - PersonDAO dao = TopiaTestDAOHelper.getPersonDAO(transaction); + PersonDAO dao = TopiaTckItDAOHelper.getPersonDAO(transaction); Person personne = dao.create(Personne.PROPERTY_NAME, "Jack Bauer"); transaction.commitTransaction(); Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -35,11 +35,8 @@ import org.junit.Test; import org.nuiton.i18n.I18n; import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaNotFoundException; -import org.nuiton.topiatest.persistence.Entity1Impl; -import org.nuiton.topiatest.service.FakeService; -import org.nuiton.topiatest.service.TestService; import java.io.File; import java.util.HashMap; @@ -374,8 +371,8 @@ // Pet petSource, petTarget; // // txSource = contextSource.beginTransaction(); -// daoSource = TopiaTestDAOHelper.getPersonDAO(txSource); -// petDAOSource = TopiaTestDAOHelper.getPetDAO(txSource); +// daoSource = TopiaTckItDAOHelper.getPersonDAO(txSource); +// petDAOSource = TopiaTckItDAOHelper.getPetDAO(txSource); // // personSource = daoSource.create(Person.PROPERTY_FIRSTNAME, " firstName", // Person.PROPERTY_NAME, " name" @@ -390,7 +387,7 @@ // // txSource.commitTransaction(); // -// daoSource = TopiaTestDAOHelper.getPersonDAO(txSource); +// daoSource = TopiaTckItDAOHelper.getPersonDAO(txSource); // // personSource = daoSource.findByTopiaId(personSource.getTopiaId()); // Assert.assertNotNull(personSource); @@ -407,8 +404,8 @@ // // txTarget.commitTransaction(); // -// daoTarget = TopiaTestDAOHelper.getPersonDAO(txTarget); -// petDAOTarget = TopiaTestDAOHelper.getPetDAO(txTarget); +// daoTarget = TopiaTckItDAOHelper.getPersonDAO(txTarget); +// petDAOTarget = TopiaTckItDAOHelper.getPetDAO(txTarget); // // personTarget = daoTarget.findByTopiaId(personSource.getTopiaId()); // Assert.assertNotNull(personTarget); Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextReplicateTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextReplicateTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextReplicateTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -29,8 +29,8 @@ import org.junit.Test; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaDatabase; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.tck.TopiaDatabase; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topia.test.entities.Person; import org.nuiton.topia.test.entities.PersonDAO; import org.nuiton.topia.test.entities.Pet; @@ -100,8 +100,8 @@ Pet petSource, petTarget; txSource = contextSource.beginTransaction(); - daoSource = TopiaTestDAOHelper.getPersonDAO(txSource); - petDAOSource = TopiaTestDAOHelper.getPetDAO(txSource); + daoSource = TopiaTckItDAOHelper.getPersonDAO(txSource); + petDAOSource = TopiaTckItDAOHelper.getPetDAO(txSource); personSource = daoSource.create(Person.PROPERTY_FIRSTNAME, " firstName", Person.PROPERTY_NAME, " name" @@ -116,7 +116,7 @@ txSource.commitTransaction(); - daoSource = TopiaTestDAOHelper.getPersonDAO(txSource); + daoSource = TopiaTckItDAOHelper.getPersonDAO(txSource); personSource = daoSource.findByTopiaId(personSource.getTopiaId()); Assert.assertNotNull(personSource); @@ -133,8 +133,8 @@ txTarget.commitTransaction(); - daoTarget = TopiaTestDAOHelper.getPersonDAO(txTarget); - petDAOTarget = TopiaTestDAOHelper.getPetDAO(txTarget); + daoTarget = TopiaTckItDAOHelper.getPersonDAO(txTarget); + petDAOTarget = TopiaTckItDAOHelper.getPetDAO(txTarget); personTarget = daoTarget.findByTopiaId(personSource.getTopiaId()); Assert.assertNotNull(personTarget); Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaUtilTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaUtilTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaUtilTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -28,7 +28,7 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.test.entities.PersonImpl; import org.nuiton.topiatest.Personne; Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/generator/TopiaTestCase.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/generator/TopiaTestCase.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/generator/TopiaTestCase.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -31,9 +31,9 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topiatest.Company; import org.nuiton.topiatest.CompanyDAO; import org.nuiton.topiatest.Department; @@ -77,7 +77,7 @@ // "/TopiaContextImpl.properties", // "TopiaTestCaseDb"); //// config = new Properties(); -//// config.setProperty("topia.persistence.classes", TopiaTestDAOHelper.getImplementationClassesAsString()); +//// config.setProperty("topia.persistence.classes", TopiaTckItDAOHelper.getImplementationClassesAsString()); //// //// config.setProperty(Environment.USER, "sa"); //// config.setProperty(Environment.PASS, ""); @@ -123,8 +123,8 @@ // try { TopiaContext newContext = db.beginTransaction(); - CompanyDAO companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); - DepartmentDAO departmentDAO = TopiaTestDAOHelper.getDepartmentDAO(newContext); + CompanyDAO companyDAO = TopiaTckItDAOHelper.getCompanyDAO(newContext); + DepartmentDAO departmentDAO = TopiaTckItDAOHelper.getDepartmentDAO(newContext); Company company = companyDAO.create(); company.setName("Ma société"); @@ -154,7 +154,7 @@ newContext = db.beginTransaction(); - companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); + companyDAO = TopiaTckItDAOHelper.getCompanyDAO(newContext); company = companyDAO.findByTopiaId(company.getTopiaId()); Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/EntityVisitorExportXmlTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/EntityVisitorExportXmlTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/EntityVisitorExportXmlTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -31,9 +31,9 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topiatest.Address; import org.nuiton.topiatest.AddressDAO; import org.nuiton.topiatest.Company; @@ -73,14 +73,14 @@ TopiaContext newContext = db.beginTransaction(); try { // company - CompanyDAO companyDAO = TopiaTestDAOHelper.getCompanyDAO(newContext); + CompanyDAO companyDAO = TopiaTckItDAOHelper.getCompanyDAO(newContext); Company clCompany = companyDAO.create(Company.PROPERTY_NAME, "CodeLutin"); // employe - EmployeDAO employeDAO = TopiaTestDAOHelper.getEmployeDAO(newContext); + EmployeDAO employeDAO = TopiaTckItDAOHelper.getEmployeDAO(newContext); Employe empl1 = employeDAO.create(Employe.PROPERTY_NAME, "boss", Employe.PROPERTY_SALARY, 30000); - AddressDAO adressDAO = TopiaTestDAOHelper.getAddressDAO(newContext); + AddressDAO adressDAO = TopiaTckItDAOHelper.getAddressDAO(newContext); Address addr1 = adressDAO.create(Address.PROPERTY_CITY, "Nantes", Address.PROPERTY_ADRESS, "12 Avenue Jules Vernes"); empl1.setAddress(addr1); @@ -89,7 +89,7 @@ empl2.setAddress(addr2); // departement - DepartmentDAO departmentDAO = TopiaTestDAOHelper.getDepartmentDAO(newContext); + DepartmentDAO departmentDAO = TopiaTckItDAOHelper.getDepartmentDAO(newContext); Department depComm = departmentDAO.create(Department.PROPERTY_NAME, "Commercial"); depComm.setLeader(empl1); @@ -118,7 +118,7 @@ TopiaContext context = db.beginTransaction(); - CompanyDAO companyDAO = TopiaTestDAOHelper.getCompanyDAO(context); + CompanyDAO companyDAO = TopiaTckItDAOHelper.getCompanyDAO(context); Company clCompany = companyDAO.findByName("CodeLutin"); EntityVisitor delegateVisitor = new ExportXMLVisitor(); Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/NaturalIdTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -32,9 +32,9 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topiatest.NaturalizedEntity; import org.nuiton.topiatest.NaturalizedEntityDAO; @@ -62,7 +62,7 @@ TopiaContext transaction = db.beginTransaction(); NaturalizedEntityDAO dao = - TopiaTestDAOHelper.getNaturalizedEntityDAO(transaction); + TopiaTckItDAOHelper.getNaturalizedEntityDAO(transaction); // No exception will be thrown with the two properties dao.createByNaturalId(5, "str"); @@ -83,7 +83,7 @@ TopiaContext transaction = db.beginTransaction(); NaturalizedEntityDAO dao = - TopiaTestDAOHelper.getNaturalizedEntityDAO(transaction); + TopiaTckItDAOHelper.getNaturalizedEntityDAO(transaction); // Exception will be throw // try { @@ -104,7 +104,7 @@ TopiaContext transaction = db.beginTransaction(); NaturalizedEntityDAO dao = - TopiaTestDAOHelper.getNaturalizedEntityDAO(transaction); + TopiaTckItDAOHelper.getNaturalizedEntityDAO(transaction); NaturalizedEntity entity = dao.createByNaturalId(5, "str"); @@ -126,7 +126,7 @@ TopiaContext transaction = db.beginTransaction(); NaturalizedEntityDAO dao = - TopiaTestDAOHelper.getNaturalizedEntityDAO(transaction); + TopiaTckItDAOHelper.getNaturalizedEntityDAO(transaction); NaturalizedEntity entity = dao.createByNaturalId(5, "str"); @@ -143,7 +143,7 @@ TopiaContext transaction = db.beginTransaction(); NaturalizedEntityDAO dao = - TopiaTestDAOHelper.getNaturalizedEntityDAO(transaction); + TopiaTckItDAOHelper.getNaturalizedEntityDAO(transaction); dao.createByNaturalId(5, "str"); transaction.commitTransaction(); @@ -162,8 +162,8 @@ public void testNaturalIdAreGeneralized() throws Exception { // test that natural ids are generalized - String[] generalizedNaturalizedNaturalIds = TopiaTestDAOHelper.TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNaturalIds(); - String[] naturalizedNaturalIds = TopiaTestDAOHelper.TopiaTestEntityEnum.NaturalizedEntity.getNaturalIds(); + String[] generalizedNaturalizedNaturalIds = TopiaTckItDAOHelper.TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNaturalIds(); + String[] naturalizedNaturalIds = TopiaTckItDAOHelper.TopiaTestEntityEnum.NaturalizedEntity.getNaturalIds(); Assert.assertArrayEquals(generalizedNaturalizedNaturalIds, naturalizedNaturalIds); } @@ -171,8 +171,8 @@ public void testNotNullsAreGeneralized() throws Exception { // test that not nulls are generalized - String[] generalizedNaturalizedNotNulls = TopiaTestDAOHelper.TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNotNulls(); - String[] naturalizedNotNulls = TopiaTestDAOHelper.TopiaTestEntityEnum.NaturalizedEntity.getNotNulls(); + String[] generalizedNaturalizedNotNulls = TopiaTckItDAOHelper.TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNotNulls(); + String[] naturalizedNotNulls = TopiaTckItDAOHelper.TopiaTestEntityEnum.NaturalizedEntity.getNotNulls(); Assert.assertArrayEquals(generalizedNaturalizedNotNulls, naturalizedNotNulls); } } Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/CollectorTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/CollectorTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/CollectorTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -32,7 +32,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaEntityEnum; import org.nuiton.topiatest.Company; @@ -52,7 +52,7 @@ @BeforeClass public static void setUpClass() throws Exception { - contracts = TopiaTestDAOHelper.getContracts(); + contracts = TopiaTckItDAOHelper.getContracts(); } @AfterClass Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -30,15 +30,10 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.nuiton.topia.TopiaTestDAOHelper; -import org.nuiton.topiatest.Company; -import org.nuiton.topiatest.CompanyImpl; -import org.nuiton.topiatest.Department; -import org.nuiton.topiatest.DepartmentImpl; -import org.nuiton.topiatest.Employe; -import org.nuiton.topiatest.EmployeImpl; -import org.nuiton.topiatest.Personne; -import org.nuiton.topiatest.PersonneImpl; +import org.nuiton.topia.tck.it.Company; +import org.nuiton.topia.tck.it.Department; +import org.nuiton.topia.tck.it.Employe; +import org.nuiton.topia.tck.it.Personne; import java.util.Collection; @@ -72,10 +67,10 @@ @BeforeClass public static void setUpClass() throws Exception { - operationC = TopiaTestDAOHelper.getOperator(Company.class); - operationE = TopiaTestDAOHelper.getOperator(Employe.class); - operationP = TopiaTestDAOHelper.getOperator(Personne.class); - operationD = TopiaTestDAOHelper.getOperator(Department.class); + operationC = TopiaTckItDAOHelper.getOperator(Company.class); + operationE = TopiaTckItDAOHelper.getOperator(Employe.class); + operationP = TopiaTckItDAOHelper.getOperator(Personne.class); + operationD = TopiaTckItDAOHelper.getOperator(Department.class); } @AfterClass Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityBinderTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityBinderTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityBinderTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -30,7 +30,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaEntityEnum; import org.nuiton.topiatest.Company; @@ -44,7 +44,7 @@ @BeforeClass public static void setUpClass() throws Exception { - contracts = TopiaTestDAOHelper.getContracts(); + contracts = TopiaTckItDAOHelper.getContracts(); } public static class CompanyDTO { Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -30,7 +30,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaEntityEnum; import org.nuiton.topia.persistence.TopiaId; @@ -70,7 +70,7 @@ @BeforeClass public static void setUpClass() throws Exception { - contracts = TopiaTestDAOHelper.getContracts(); + contracts = TopiaTckItDAOHelper.getContracts(); } @AfterClass Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityRefTesterTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityRefTesterTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityRefTesterTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -28,7 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; -import org.nuiton.topia.TopiaTestDAOHelper.TopiaTestEntityEnum; +import org.nuiton.topia.TopiaTckItDAOHelper.TopiaTestEntityEnum; import org.nuiton.topia.test.entities.Person; import org.nuiton.topia.test.entities.Pet; import org.nuiton.topia.test.entities.Race; Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1882/DAOAbstractTransformerTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1882/DAOAbstractTransformerTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1882/DAOAbstractTransformerTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -27,8 +27,8 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.tck.TopiaDatabase; +import org.nuiton.topia.TopiaTckItDAOHelper; import java.util.Arrays; @@ -41,8 +41,8 @@ public void testAno1882() throws Exception { TopiaContext transaction = db.beginTransaction(); - FrenchCompanyDAO dao = TopiaTestDAOHelper.getFrenchCompanyDAO(transaction); - SIRETDAO siretDAO = TopiaTestDAOHelper.getSIRETDAO(transaction); + FrenchCompanyDAO dao = TopiaTckItDAOHelper.getFrenchCompanyDAO(transaction); + SIRETDAO siretDAO = TopiaTckItDAOHelper.getSIRETDAO(transaction); SIRET siret = siretDAO.create(); FrenchCompany entity = dao.create( Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -28,9 +28,9 @@ import org.junit.Rule; import org.junit.Test; import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; +import org.nuiton.topia.tck.TopiaDatabase; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; +import org.nuiton.topia.TopiaTckItDAOHelper; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.test.entities.Person; import org.nuiton.topia.test.entities.PersonDAO; @@ -56,7 +56,7 @@ TopiaContext context = db.beginTransaction(); - PersonDAO personDAO = TopiaTestDAOHelper.getPersonDAO(context); + PersonDAO personDAO = TopiaTckItDAOHelper.getPersonDAO(context); // appel 1 find all Person toto = personDAO.create(Person.PROPERTY_NAME, "toto"); @@ -89,8 +89,8 @@ TopiaContext context = db.beginTransaction(); - PetDAO petDAO = TopiaTestDAOHelper.getPetDAO(context); - PersonDAO personDAO = TopiaTestDAOHelper.getPersonDAO(context); + PetDAO petDAO = TopiaTckItDAOHelper.getPetDAO(context); + PersonDAO personDAO = TopiaTckItDAOHelper.getPersonDAO(context); Pet bernard = petDAO.create(Pet.PROPERTY_NAME, "bernard"); Pet bianca = petDAO.create(Pet.PROPERTY_NAME, "bianca"); Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/EnumTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/EnumTest.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/EnumTest.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,75 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2004 - 2011 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>. - * #L% - */ -package org.nuiton.topiatest; - -import junit.framework.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaDatabase; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaTestDAOHelper; - -/** - * Test the support of possibility to have an attribute of type enumeration - * in a entity - */ -public class EnumTest { - - @Rule - public final TopiaDatabase db = new TopiaDatabase(); - - /** - * Create an entity having two field of type enumeration. One is stored - * using ordinal, the other using the name. - * <p/> - * The test check that values are stored, and that find methods works - * - * @throws TopiaException if any exception with db - */ - @Test - public void storeEntityWithEnumValue() throws TopiaException { - TopiaContext transaction = db.beginTransaction(); - - PersonneDAO dao = TopiaTestDAOHelper.getPersonneDAO(transaction); - Personne personne = new PersonneImpl(); - personne.setGender(Gender.FEMALE); - personne.setOtherGender(Gender.MALE); - dao.create(personne); - String topiaId = personne.getTopiaId(); - transaction.commitTransaction(); - transaction.closeContext(); - - transaction = db.beginTransaction(); - dao = TopiaTestDAOHelper.getPersonneDAO(transaction); - dao.findByTopiaId(topiaId); - Assert.assertEquals(Gender.FEMALE, personne.getGender()); - Assert.assertEquals(Gender.MALE, personne.getOtherGender()); - - Assert.assertNotNull(dao.findByGender(Gender.FEMALE)); - Assert.assertNotNull(dao.findByOtherGender(Gender.MALE)); - transaction.closeContext(); - } -} Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java 2012-05-09 13:57:04 UTC (rev 2446) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java 2012-05-09 14:10:52 UTC (rev 2447) @@ -1,40 +0,0 @@ -/* - * #%L - * ToPIA :: Persistence - * - * $Id$ - * $HeadURL$ - * %% - * 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>. - * #L% - */ -package org.nuiton.topiatest; - -import org.nuiton.topia.TopiaException; - -/** - * Created: 26 mai 2010 - * - * @author fdesbois <fdesbois@codelutin.com> - * @version $Id$ - */ -public class ExtraDAOEntityDAOImpl<E extends ExtraDAOEntity> extends ExtraDAOEntityDAOAbstract<E> { - - @Override - public void extra() throws TopiaException { - } -}
participants (1)
-
athimel@users.nuiton.org