Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
March 2014
- 3 participants
- 8 discussions
r3034 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by bleny@users.nuiton.org 28 Mar '14
by bleny@users.nuiton.org 28 Mar '14
28 Mar '14
Author: bleny
Date: 2014-03-28 16:21:44 +0100 (Fri, 28 Mar 2014)
New Revision: 3034
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3034
Log:
add a FIXME
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-25 13:45:09 UTC (rev 3033)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-28 15:21:44 UTC (rev 3034)
@@ -204,6 +204,7 @@
boolean noCollision = Sets.intersection(parameters.keySet(), hqlParameters.keySet()).isEmpty();
Preconditions.checkArgument(noCollision, "given arguments " + hqlParameters.keySet() + " contains a conflicting name with the already defined parameters of the query (" + parameters.keySet() + "). You should changes the names of given arguments.");
addWhereClause(whereClause);
+ // FIXME brendan 25/03/14 use putHqlParameterWithAvailableName to prevent conflict
parameters.putAll(hqlParameters);
}
1
0
r3033 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by bleny@users.nuiton.org 25 Mar '14
by bleny@users.nuiton.org 25 Mar '14
25 Mar '14
Author: bleny
Date: 2014-03-25 14:45:09 +0100 (Tue, 25 Mar 2014)
New Revision: 3033
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3033
Log:
implements toString in HqlAndParametersBuilder to ease debugging
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-14 17:23:52 UTC (rev 3032)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-25 13:45:09 UTC (rev 3033)
@@ -30,6 +30,7 @@
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.text.WordUtils;
import java.util.Arrays;
@@ -288,4 +289,11 @@
return CollectionUtils.isNotEmpty(orderByArguments);
}
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("hql", getHql())
+ .append("hqlParameters", getHqlParameters())
+ .toString();
+ }
}
1
0
Author: athimel
Date: 2014-03-14 18:23:52 +0100 (Fri, 14 Mar 2014)
New Revision: 3032
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3032
Log:
fixes #2774 Migrate IT mapping tests
Added:
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaItLegacyDatabase.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/AbstractMappingTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/TopiaItMappingDatabase.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test10/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/EntityWithBasicUniqueFieldsTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyUniqueTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyWithRoleNamedUniqueTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyUniqueTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyWithRoleNamedUniqueTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/EntityWithBasicNotNullFieldsTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/EntityWithNaturalIdTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/BidiAssociationClassTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/ManyToManyAssociationClassTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/OneToManyAssociationClassTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationWithRoleNamedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/ElementCollectionTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/BiDirectionalOneToManyCompositionTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/OneToManyCompositionTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyIndexedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyWithRoleNamedIndexedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderByTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderedTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test8/
trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test9/
Removed:
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java
Modified:
trunk/pom.xml
trunk/topia-it/src/main/xmi/topia-it-mapping.properties
trunk/topia-it/src/main/xmi/topia-it-mapping.zargo
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaUtilTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/pom.xml 2014-03-14 17:23:52 UTC (rev 3032)
@@ -29,7 +29,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>5.0</version>
+ <version>5.0.1</version>
</parent>
<artifactId>topia</artifactId>
@@ -230,6 +230,9 @@
<!-- pour un muli module on doit fixer le projectId -->
<projectId>topia</projectId>
+ <!-- Allow SVN keywords in license headers in ToPIA -->
+ <license.addSvnKeyWords>true</license.addSvnKeyWords>
+
<!-- do not relativize links in generated site -->
<relativizeDecorationLinks>false</relativizeDecorationLinks>
Modified: trunk/topia-it/src/main/xmi/topia-it-mapping.properties
===================================================================
--- trunk/topia-it/src/main/xmi/topia-it-mapping.properties 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/main/xmi/topia-it-mapping.properties 2014-03-14 17:23:52 UTC (rev 3032)
@@ -2,8 +2,8 @@
# #%L
# ToPIA :: Persistence
#
-# $Id: topia-it-mapping.properties 2548 2012-05-29 14:08:35Z athimel $
-# $HeadURL: http://svn.nuiton.org/svn/topia/branches/topia-jpa/topia-persistence-tck/sr… $
+# $Id$
+# $HeadURL$
# %%
# Copyright (C) 2004 - 2010 CodeLutin
# %%
Property changes on: trunk/topia-it/src/main/xmi/topia-it-mapping.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-it/src/main/xmi/topia-it-mapping.zargo
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Deleted: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -1,79 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-import org.nuiton.topia.junit.AbstractDatabaseResource;
-
-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(a)codelutin.com>
- * @since 2.6.8
- */
-public class TopiaDatabase extends AbstractDatabaseResource<TopiaItLegacyTopiaPersistenceContext, TopiaItLegacyTopiaApplicationContext> {
-
- public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties";
-
- public TopiaDatabase() {
- this(DEFAULT_CONFIGURATION_LOCATION);
- }
-
- public TopiaDatabase(String configurationPath) {
- super(configurationPath);
- }
-
- @Override
- protected TopiaItLegacyTopiaApplicationContext createApplicationContext(Properties dbConfiguration) {
- return new TopiaItLegacyTopiaApplicationContext(dbConfiguration);
- }
-
- @Override
- protected String getImplementationClassesAsString() {
- return TopiaItLegacyEntityEnum.getImplementationClassesAsString();
- }
-
-}
-
Copied: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaItLegacyDatabase.java (from rev 3031, trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java)
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaItLegacyDatabase.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaItLegacyDatabase.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,79 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.nuiton.topia.junit.AbstractDatabaseResource;
+
+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 TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
+ *
+ * \@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(a)codelutin.com>
+ * @since 2.6.8
+ */
+public class TopiaItLegacyDatabase extends AbstractDatabaseResource<TopiaItLegacyTopiaPersistenceContext, TopiaItLegacyTopiaApplicationContext> {
+
+ public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties";
+
+ public TopiaItLegacyDatabase() {
+ this(DEFAULT_CONFIGURATION_LOCATION);
+ }
+
+ public TopiaItLegacyDatabase(String configurationPath) {
+ super(configurationPath);
+ }
+
+ @Override
+ protected TopiaItLegacyTopiaApplicationContext createApplicationContext(Properties dbConfiguration) {
+ return new TopiaItLegacyTopiaApplicationContext(dbConfiguration);
+ }
+
+ @Override
+ protected String getImplementationClassesAsString() {
+ return TopiaItLegacyEntityEnum.getImplementationClassesAsString();
+ }
+
+}
+
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -53,7 +53,7 @@
public class TopiaJpaSupportTest {
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
protected TopiaItLegacyTopiaPersistenceContext persistenceContext;
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -34,7 +34,7 @@
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.internal.TopiaConnectionProvider;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
@@ -57,8 +57,8 @@
public static final String TEST_URL = "testURL";
@Rule
- public final TopiaDatabase db =
- new TopiaDatabase("/TopiaConnectionProviderHardcoded.properties") {
+ public final TopiaItLegacyDatabase db =
+ new TopiaItLegacyDatabase("/TopiaConnectionProviderHardcoded.properties") {
@Override
protected void onDbConfigurationCreate(Properties configuration,
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -31,7 +31,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
@@ -47,8 +47,8 @@
public class TopiaContextReplicateTest {
@Rule
- public final TopiaDatabase dbSource =
- new TopiaDatabase() {
+ public final TopiaItLegacyDatabase dbSource =
+ new TopiaItLegacyDatabase() {
@Override
protected void onDbConfigurationCreate(Properties configuration, File testDir, String dbPath) {
@@ -59,8 +59,8 @@
};
@Rule
- public final TopiaDatabase dbTarget =
- new TopiaDatabase() {
+ public final TopiaItLegacyDatabase dbTarget =
+ new TopiaItLegacyDatabase() {
@Override
protected void onDbConfigurationCreate(Properties configuration, File testDir, String dbPath) {
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaUtilTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaUtilTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaUtilTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -30,7 +30,7 @@
import org.hibernate.cfg.Configuration;
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.persistence.util.TopiaUtil;
import org.nuiton.topia.it.legacy.test.entities.PersonImpl;
import org.nuiton.topia.it.legacy.topiatest.Personne;
@@ -51,7 +51,7 @@
protected static final String PERSON_ID2 = "org.nuiton.topia.it.legacy.topiatest.Personne#1226701039001#0.6502325993664999";
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
@Test
public void testGetTopiaIdPattern() throws Exception {
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -29,8 +29,8 @@
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.Company;
import org.nuiton.topia.it.legacy.topiatest.CompanyTopiaDao;
@@ -48,7 +48,7 @@
private final static Log log = LogFactory.getLog(TopiaTestCase.class);
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
// /** Proprietes */
// protected static Properties config;
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -29,7 +29,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.persistence.TopiaEntityVisitor;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
@@ -54,7 +54,7 @@
LogFactory.getLog(EntityVisitorExportXmlTest.class);
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
/**
* Prepare test.
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -30,7 +30,7 @@
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
@@ -49,7 +49,7 @@
private static final Log log = LogFactory.getLog(NaturalIdTest.class);
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
@Test
public void testCreateSucessfull() throws Exception {
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -28,13 +28,13 @@
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
public class DAOAbstractTransformerTest {
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
@Test
public void testAno1882() throws Exception {
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -27,7 +27,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
/**
@@ -36,7 +36,7 @@
public class CascadeSaveTest {
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
/**
* The following test will fail if no topiaId is injected on cascade save. This will test code within this method :
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -27,7 +27,7 @@
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
@@ -38,7 +38,7 @@
public class EnumTest {
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
/**
* Create an entity having two field of type enumeration. One is stored
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -30,7 +30,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.Gender;
import org.nuiton.topia.it.legacy.topiatest.Personne;
@@ -52,7 +52,7 @@
private static final Log log = LogFactory.getLog(DeleteEntityTest.class);
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
/**
* Test for deleting entities with inheritance. Delete from the DAO linked
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/AbstractMappingTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/AbstractMappingTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/AbstractMappingTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,52 @@
+
+package org.nuiton.topia.it.mapping;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Rule;
+
+
+import org.nuiton.topia.persistence.TopiaDao;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaException;
+
+
+/**
+ * Base test for all tests using the {@code mapping} model.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public abstract class AbstractMappingTest {
+
+ @Rule
+ public final TopiaItMappingDatabase db = new TopiaItMappingDatabase();
+
+ protected <E extends TopiaEntity, D extends TopiaDao<E>> D getDao(
+ TopiaItMappingTopiaPersistenceContext tx, Class<E> entityType) throws TopiaException {
+ D dao = (D)tx.getDao(entityType);
+ return dao;
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/AbstractMappingTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/TopiaItMappingDatabase.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/TopiaItMappingDatabase.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/TopiaItMappingDatabase.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,60 @@
+
+package org.nuiton.topia.it.mapping;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import java.util.Properties;
+
+import org.nuiton.topia.junit.AbstractDatabaseResource;
+
+/**
+ * Concrete topia database for {@code mapping} model.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class TopiaItMappingDatabase extends AbstractDatabaseResource<TopiaItMappingTopiaPersistenceContext, TopiaItMappingTopiaApplicationContext> {
+
+ public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties";
+
+ public TopiaItMappingDatabase() {
+ this(DEFAULT_CONFIGURATION_LOCATION);
+ }
+
+ public TopiaItMappingDatabase(String configurationPath) {
+ super(configurationPath);
+ }
+
+ @Override
+ protected TopiaItMappingTopiaApplicationContext createApplicationContext(Properties dbConfiguration) {
+ return new TopiaItMappingTopiaApplicationContext(dbConfiguration);
+ }
+
+ @Override
+ protected String getImplementationClassesAsString() {
+ return TopiaItMappingEntityEnum.getImplementationClassesAsString();
+ }
+
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/TopiaItMappingDatabase.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,124 @@
+package org.nuiton.topia.it.mapping.test1;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional OnetoMany relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalOneToManyRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A12TopiaDao aDAO;
+
+ protected B12TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A12.class);
+ bDAO = getDao(tx, B12.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A12 a = aDAO.create();
+ B12 b = bDAO.create();
+
+ a.addB12(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A12 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB12());
+ Assert.assertEquals(a.getB12().iterator().next(),
+ aBis.getB12().iterator().next());
+ Assert.assertEquals(b, aBis.getB12().iterator().next());
+
+ B12 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB12().iterator().next(), bBis);
+ Assert.assertEquals(aBis, bBis.getA12());
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A12 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B12 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,127 @@
+package org.nuiton.topia.it.mapping.test1;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional OnetoMany relation with role renamed into
+ * {@code roleA} and {@code roleB}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalOneToManyRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A13TopiaDao aDAO;
+
+ protected B13TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A13.class);
+ bDAO = getDao(tx, B13.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A13 a = aDAO.create();
+ B13 b = bDAO.create();
+
+ a.addRoleB13(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A13 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB13());
+ Assert.assertEquals(a.getRoleB13().iterator().next(),
+ aBis.getRoleB13().iterator().next());
+
+ Assert.assertEquals(b, aBis.getRoleB13().iterator().next());
+
+ B13 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getRoleB13().iterator().next(), bBis);
+ Assert.assertEquals(a, bBis.getRoleA13());
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A13 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B13 b = bDAO.findAll().get(0);
+ Assert.assertNull(b.getRoleA13());
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/BiDirectionalOneToManyRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,124 @@
+
+package org.nuiton.topia.it.mapping.test1;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * To test a simple OnetoMany relation betewwen two classes A1 and B1.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A1TopiaDao aDAO;
+
+ protected B1TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A1.class);
+ bDAO = getDao(tx, B1.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A1 a = aDAO.create();
+ B1 b = bDAO.create();
+
+ a.addB1(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A1 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB1());
+ Assert.assertEquals(a.getB1().iterator().next(),
+ aBis.getB1().iterator().next());
+
+ B1 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB1().iterator().next(), bBis);
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A1 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B1 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,124 @@
+
+package org.nuiton.topia.it.mapping.test1;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a simple OnetoMany relation with role renamed into {@code roleB}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11TopiaDao aDAO;
+
+ protected B11TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11.class);
+ bDAO = getDao(tx, B11.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A11 a = aDAO.create();
+ B11 b = bDAO.create();
+
+ a.addRoleB11(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB11());
+ Assert.assertEquals(a.getRoleB11().iterator().next(),
+ aBis.getRoleB11().iterator().next());
+
+ B11 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getRoleB11().iterator().next(), bBis);
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B11 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test1/SimpleOneToManyRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/EntityWithBasicUniqueFieldsTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/EntityWithBasicUniqueFieldsTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/EntityWithBasicUniqueFieldsTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,103 @@
+
+package org.nuiton.topia.it.mapping.test11;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests basic unique fields on a entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class EntityWithBasicUniqueFieldsTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11ETopiaDao aDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11E.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+
+ // a with all fields to null
+ A11E a = aDAO.create();
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ Assert.assertEquals(1, nbA);
+
+ A11E aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+
+ // try another one with null value, can do it since null is not unique ?
+ A11E a2 = aDAO.create();
+ tx.commit();
+
+ nbA = aDAO.count();
+ Assert.assertEquals(2, nbA);
+
+ aBis = aDAO.findByTopiaId(a2.getTopiaId());
+ Assert.assertEquals(a2, aBis);
+
+ A11E a3 = aDAO.create(A11E.PROPERTY_INTEGER_FIELD, 1);
+ tx.commit();
+
+ nbA = aDAO.count();
+ Assert.assertEquals(3, nbA);
+
+ aBis = aDAO.findByTopiaId(a3.getTopiaId());
+ Assert.assertEquals(a3, aBis);
+
+ A11E a4 = aDAO.create(A11E.PROPERTY_INTEGER_FIELD, 1);
+ try {
+ tx.commit();
+ Assert.fail();
+
+ } catch (TopiaException e) {
+ // ok duplicate key
+ tx.rollback();
+ }
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/EntityWithBasicUniqueFieldsTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyUniqueTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyUniqueTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyUniqueTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,92 @@
+
+package org.nuiton.topia.it.mapping.test11;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Tests the tag-value {@code unique} on a {@code ManyToMany} relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToManyUniqueTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11CTopiaDao aDAO;
+
+ protected B11CTopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11C.class);
+ bDAO = getDao(tx, B11C.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A11C a = aDAO.create();
+ B11C b = bDAO.create();
+
+ a.addB11C(b);
+ a.addB11C(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11C aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB11C());
+ Collection<B11C> bs = aBis.getB11C();
+ Iterator<B11C> iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyUniqueTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyWithRoleNamedUniqueTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyWithRoleNamedUniqueTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyWithRoleNamedUniqueTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,93 @@
+
+package org.nuiton.topia.it.mapping.test11;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Tests the tag-value {@code unique} on a {@code ManyToMany} relation with a
+ * renamed role.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToManyWithRoleNamedUniqueTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11DTopiaDao aDAO;
+
+ protected B11DTopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11D.class);
+ bDAO = getDao(tx, B11D.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A11D a = aDAO.create();
+ B11D b = bDAO.create();
+
+ a.addRoleB113(b);
+ a.addRoleB113(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11D aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB113());
+ Collection<B11D> bs = aBis.getRoleB113();
+ Iterator<B11D> iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleManyToManyWithRoleNamedUniqueTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyUniqueTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyUniqueTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyUniqueTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,92 @@
+
+package org.nuiton.topia.it.mapping.test11;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Tests the tag-value {@code unique} on a {@code OneToMany} relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyUniqueTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11ATopiaDao aDAO;
+
+ protected B11ATopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11A.class);
+ bDAO = getDao(tx, B11A.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A11A a = aDAO.create();
+ B11A b = bDAO.create();
+
+ a.addB11A(b);
+ a.addB11A(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11A aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB11A());
+ Collection<B11A> bs = aBis.getB11A();
+ Iterator<B11A> iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyUniqueTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyWithRoleNamedUniqueTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyWithRoleNamedUniqueTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyWithRoleNamedUniqueTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,93 @@
+
+package org.nuiton.topia.it.mapping.test11;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Tests the tag-value {@code unique} on a {@code OneToMany} relation with a
+ * renamed role.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyWithRoleNamedUniqueTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A11BTopiaDao aDAO;
+
+ protected B11BTopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A11B.class);
+ bDAO = getDao(tx, B11B.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A11B a = aDAO.create();
+ B11B b = bDAO.create();
+
+ a.addRoleB111(b);
+ a.addRoleB111(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A11B aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB111());
+ Collection<B11B> bs = aBis.getRoleB111();
+ Iterator<B11B> iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test11/SimpleOneToManyWithRoleNamedUniqueTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/EntityWithBasicNotNullFieldsTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/EntityWithBasicNotNullFieldsTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/EntityWithBasicNotNullFieldsTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,92 @@
+
+package org.nuiton.topia.it.mapping.test12;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+
+import java.util.Date;
+
+/**
+ * Tests entity with basic {@code not null} fields.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class EntityWithBasicNotNullFieldsTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A12ATopiaDao aDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A12A.class);
+ }
+
+ @Test(expected = TopiaException.class)
+ public void createWithNull() throws TopiaException {
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+
+ // a with all fields to null
+ aDAO.create();
+ tx.commit();
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+
+ // a with all fields to null
+ A12A a = aDAO.create(
+ A12A.PROPERTY_STRING_FIELD, "string",
+ A12A.PROPERTY_INTEGER_FIELD, 1,
+ A12A.PROPERTY_DATE_FIELD, new Date()
+ );
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ Assert.assertEquals(1, nbA);
+
+ A12A aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test12/EntityWithBasicNotNullFieldsTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/EntityWithNaturalIdTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/EntityWithNaturalIdTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/EntityWithNaturalIdTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,111 @@
+
+package org.nuiton.topia.it.mapping.test13;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+
+import java.util.Date;
+
+/**
+ * Tests a entity with a {@code natural id}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class EntityWithNaturalIdTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A13ATopiaDao aDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A13A.class);
+ }
+
+ @Test(expected = TopiaException.class)
+ public void createWithNull() throws TopiaException {
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+
+ // a with all fields to null
+ aDAO.create();
+ tx.commit();
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+
+ // a with all fields to null
+ Date date = new Date();
+ A13A a = aDAO.create(
+ A13A.PROPERTY_NATURAL_ID_STRING, "string",
+ A13A.PROPERTY_NATURAL_ID_INTEGER, 1,
+ A13A.PROPERTY_NATURAL_ID_DATE, date
+ );
+ a.setIntegerField(10);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ Assert.assertEquals(1, nbA);
+
+ A13A aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+
+ aBis = aDAO.findByNaturalId(1, "string", date);
+ Assert.assertEquals(a, aBis);
+
+ aDAO.create(
+ A13A.PROPERTY_NATURAL_ID_STRING, "string",
+ A13A.PROPERTY_NATURAL_ID_INTEGER, 1,
+ A13A.PROPERTY_NATURAL_ID_DATE, date
+ );
+
+ try {
+ tx.commit();
+ // duplicated natural id
+ Assert.fail();
+ } catch (TopiaException e) {
+ Assert.assertTrue(true);
+ }
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test13/EntityWithNaturalIdTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/BidiAssociationClassTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/BidiAssociationClassTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/BidiAssociationClassTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,165 @@
+package org.nuiton.topia.it.mapping.test14;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+
+import java.util.List;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class BidiAssociationClassTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A14ATopiaDao aDAO;
+
+ protected B14ATopiaDao bDAO;
+
+ protected Assoc14ATopiaDao assocDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A14A.class);
+ bDAO = getDao(tx, B14A.class);
+ assocDAO = getDao(tx, Assoc14A.class);
+ }
+
+ @Test
+ public void testCreate() throws TopiaException {
+
+ A14A a = aDAO.create();
+ B14A b = bDAO.create();
+
+ Assoc14A assoc = assocDAO.create(Assoc14A.PROPERTY_A14_A, a, Assoc14A.PROPERTY_ROLE_B, b);
+ tx.commit();
+ Assert.assertNotNull(assoc.getTopiaId());
+
+ Assoc14A assocFound = assocDAO.findByTopiaId(assoc.getTopiaId());
+ A14A aFound = assocFound.getA14A();
+ B14A bFound = assocFound.getRoleB();
+
+ Assert.assertNotNull(aFound);
+ Assert.assertEquals(a, aFound);
+ Assert.assertNotNull(bFound);
+ Assert.assertEquals(b, bFound);
+ }
+
+ @Test(expected = TopiaException.class)
+ public void testCreateWithNull() throws TopiaException {
+
+ A14A a = aDAO.create();
+
+ Assert.assertNotNull(a.getTopiaId());
+
+ Assoc14A assoc = assocDAO.create(Assoc14A.PROPERTY_A14_A, a);
+ Assert.assertNotNull(assoc.getTopiaId());
+
+ // Will throw an exception because 'b' is mandatory
+ tx.commit();
+ }
+
+ @Test
+ public void testFindAll() throws TopiaException {
+
+ A14A a1 = aDAO.create();
+ A14A a2 = aDAO.create();
+ B14A b = bDAO.create();
+
+ Assoc14A assoc = assocDAO.create(Assoc14A.PROPERTY_A14_A, a1, Assoc14A.PROPERTY_ROLE_B, b);
+ a1.setRoleB(assoc);
+ aDAO.update(a1);
+ b.setA14AAssoc14A(assoc);
+ bDAO.update(b);
+
+ tx.commit();
+
+ A14A aFound = aDAO.findByAssoc14A(assoc);
+ Assert.assertEquals(a1, aFound);
+
+ aFound = aDAO.findByRoleB(b);
+ Assert.assertEquals(a1, aFound);
+
+ B14A bFound = bDAO.findByA14A(a1);
+ Assert.assertEquals(b, bFound);
+
+ bFound = bDAO.findByA14A(a2);
+ Assert.assertNull(bFound);
+
+ bFound = bDAO.findByAssoc14A(assoc);
+ Assert.assertEquals(b, bFound);
+
+ }
+
+ @Test
+ @Ignore //FIXME AThimel 09/07/2012 #2177: Test is ignored as cascade-delete does not work as expected
+ public void testDeleteCascade() throws TopiaException {
+
+ A14A a1 = aDAO.create();
+ A14A a2 = aDAO.create();
+ B14A b1 = bDAO.create();
+ B14A b2 = bDAO.create();
+
+ Assoc14A assoc11 = assocDAO.create(Assoc14A.PROPERTY_A14_A, a1, Assoc14A.PROPERTY_ROLE_B, b1);
+ Assoc14A assoc22 = assocDAO.create(Assoc14A.PROPERTY_A14_A, a2, Assoc14A.PROPERTY_ROLE_B, b2);
+
+ a1.setRoleB(assoc11);
+ a2.setRoleB(assoc22);
+ b1.setA14AAssoc14A(assoc11);
+ b2.setA14AAssoc14A(assoc22);
+
+ aDAO.update(a1);
+ aDAO.update(a2);
+ bDAO.update(b1);
+ bDAO.update(b2);
+
+ tx.commit();
+
+ Assert.assertEquals(2, assocDAO.count());
+
+ aDAO.delete(a1);
+
+ tx.commit();
+
+ Assert.assertEquals(1, assocDAO.count());
+
+ List<Assoc14A> all = assocDAO.findAll();
+ Assert.assertEquals(1, all.size());
+ Assoc14A first = all.iterator().next();
+ Assert.assertEquals(a2, first.getA14A());
+ Assert.assertEquals(b2, first.getRoleB());
+ }
+
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/BidiAssociationClassTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/ManyToManyAssociationClassTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/ManyToManyAssociationClassTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/ManyToManyAssociationClassTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,165 @@
+package org.nuiton.topia.it.mapping.test14;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.List;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class ManyToManyAssociationClassTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A14DTopiaDao aDAO;
+
+ protected B14DTopiaDao bDAO;
+
+ protected Assoc14DTopiaDao assocDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A14D.class);
+ bDAO = getDao(tx, B14D.class);
+ assocDAO = getDao(tx, Assoc14D.class);
+ }
+
+ @Test
+ public void testCreate() throws TopiaException {
+
+ A14D a = aDAO.create();
+ B14D b = bDAO.create();
+
+ Assoc14D assoc = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a, Assoc14D.PROPERTY_B14_D, b);
+ a.addB14DAssoc14D(assoc);
+ b.addRoleA(assoc);
+ aDAO.update(a);
+ bDAO.update(b);
+ tx.commit();
+
+
+ Assoc14D assocFound = assocDAO.findByTopiaId(assoc.getTopiaId());
+ A14D aFound = assocFound.getRoleA();
+ Assert.assertEquals(a, aFound);
+ B14D bFound = assocFound.getB14D();
+ Assert.assertEquals(b, bFound);
+
+ Assert.assertEquals(1, aFound.sizeB14DAssoc14D());
+ Assert.assertEquals(1, bFound.sizeRoleA());
+
+ }
+
+
+ @Test
+ public void testFindAll() throws TopiaException {
+
+ A14D a1 = aDAO.create();
+ A14D a2 = aDAO.create();
+ B14D b1 = bDAO.create();
+ B14D b2 = bDAO.create();
+
+ Assoc14D assoc11 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a1, Assoc14D.PROPERTY_B14_D, b1);
+ Assoc14D assoc12 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a1, Assoc14D.PROPERTY_B14_D, b2);
+ Assoc14D assoc21 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a2, Assoc14D.PROPERTY_B14_D, b1);
+
+ a1.addB14DAssoc14D(assoc11);
+ a1.addB14DAssoc14D(assoc12);
+ a2.addB14DAssoc14D(assoc21);
+ b1.addRoleA(assoc11);
+ b1.addRoleA(assoc21);
+ b2.addRoleA(assoc12);
+
+ aDAO.update(a1);
+ aDAO.update(a2);
+ bDAO.update(b1);
+ bDAO.update(b2);
+
+ tx.commit();
+
+ Assert.assertEquals(3, assocDAO.count());
+
+ List<Assoc14D> allByB14D = assocDAO.forProperties(Assoc14D.PROPERTY_B14_D, b1).findAll();
+ Assert.assertEquals(2, allByB14D.size());
+
+ List<Assoc14D> allByRoleA = assocDAO.forProperties(Assoc14D.PROPERTY_ROLE_A, a2).findAll();
+ Assert.assertEquals(1, allByRoleA.size());
+
+ }
+
+ @Test
+ @Ignore
+ //FIXME AThimel 09/07/2012 #2177: Test is ignored as cascade-delete does not work as expected
+ public void testDeleteCascade() throws TopiaException {
+
+ A14D a1 = aDAO.create();
+ A14D a2 = aDAO.create();
+ B14D b1 = bDAO.create();
+ B14D b2 = bDAO.create();
+
+ Assoc14D assoc11 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a1, Assoc14D.PROPERTY_B14_D, b1);
+ Assoc14D assoc12 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a1, Assoc14D.PROPERTY_B14_D, b2);
+ Assoc14D assoc21 = assocDAO.create(Assoc14D.PROPERTY_ROLE_A, a2, Assoc14D.PROPERTY_B14_D, b1);
+
+ a1.addB14DAssoc14D(assoc11);
+ a1.addB14DAssoc14D(assoc12);
+ a2.addB14DAssoc14D(assoc21);
+ b1.addRoleA(assoc11);
+ b1.addRoleA(assoc21);
+ b2.addRoleA(assoc12);
+
+ aDAO.update(a1);
+ aDAO.update(a2);
+ bDAO.update(b1);
+ bDAO.update(b2);
+
+ tx.commit();
+
+ Assert.assertEquals(3, assocDAO.count());
+
+ aDAO.delete(a1);
+
+ tx.commit();
+
+ Assert.assertEquals(1, assocDAO.count());
+
+ List<Assoc14D> all = assocDAO.findAll();
+ Assert.assertEquals(1, all.size());
+ Assoc14D first = all.iterator().next();
+ Assert.assertEquals(a2, first.getRoleA());
+ Assert.assertEquals(b1, first.getB14D());
+ }
+
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/ManyToManyAssociationClassTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/OneToManyAssociationClassTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/OneToManyAssociationClassTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/OneToManyAssociationClassTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,127 @@
+package org.nuiton.topia.it.mapping.test14;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.List;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class OneToManyAssociationClassTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A14CTopiaDao aDAO;
+
+ protected B14CTopiaDao bDAO;
+
+ protected Assoc14CTopiaDao assocDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A14C.class);
+ bDAO = getDao(tx, B14C.class);
+ assocDAO = getDao(tx, Assoc14C.class);
+ }
+
+ @Test
+ public void testCreate() throws TopiaException {
+
+ A14C a = aDAO.create();
+ B14C b = bDAO.create();
+
+ Assoc14C assoc = assocDAO.create(Assoc14C.PROPERTY_A14_C, a, Assoc14C.PROPERTY_B14_C, b);
+ a.addB14CAssoc14C(assoc);
+ b.setA14CAssoc14C(assoc);
+ aDAO.update(a);
+ bDAO.update(b);
+ tx.commit();
+
+
+ Assoc14C assocFound = assocDAO.findByTopiaId(assoc.getTopiaId());
+ A14C aFound = assocFound.getA14C();
+ Assert.assertEquals(a, aFound);
+ Assert.assertEquals(b, assocFound.getB14C());
+
+ Assert.assertEquals(1, aFound.sizeB14CAssoc14C());
+ Assert.assertEquals(b, aFound.getB14CAssoc14C().iterator().next().getB14C());
+
+ }
+
+
+ @Test
+ public void testFindAll() throws TopiaException {
+
+ A14C a = aDAO.create();
+ B14C b1 = bDAO.create();
+ B14C b2 = bDAO.create();
+
+ Assoc14C assoc1 = assocDAO.create(Assoc14C.PROPERTY_A14_C, a, Assoc14C.PROPERTY_B14_C, b1);
+ a.addB14CAssoc14C(assoc1);
+ b1.setA14CAssoc14C(assoc1);
+ aDAO.update(a);
+ bDAO.update(b1);
+
+ tx.commit();
+
+ List<B14C> allByA14C = bDAO.findAllByA14C(a);
+ Assert.assertEquals(1, allByA14C.size());
+ Assert.assertEquals(b1, allByA14C.iterator().next());
+
+ B14C bFound = bDAO.findByAssoc14C(assoc1);
+ Assert.assertEquals(b1, bFound);
+
+ Assoc14C assoc2 = assocDAO.create(Assoc14C.PROPERTY_A14_C, a, Assoc14C.PROPERTY_B14_C, b2);
+ a.addB14CAssoc14C(assoc2);
+ b2.setA14CAssoc14C(assoc2);
+
+ aDAO.update(a);
+ bDAO.update(b2);
+
+ tx.commit();
+
+ bFound = bDAO.findByAssoc14C(assoc1);
+ Assert.assertEquals(b1, bFound);
+ bFound = bDAO.findByAssoc14C(assoc2);
+ Assert.assertEquals(b2, bFound);
+
+ allByA14C = bDAO.findAllByA14C(a);
+ Assert.assertEquals(2, allByA14C.size());
+ A14C aFound = allByA14C.iterator().next().getA14CAssoc14C().getA14C();
+ Assert.assertEquals(2, aFound.sizeB14CAssoc14C());
+
+ }
+
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test14/OneToManyAssociationClassTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,124 @@
+
+package org.nuiton.topia.it.mapping.test2;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional ManyToOne relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalManyToOneRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A22TopiaDao aDAO;
+
+ protected B22TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A22.class);
+ bDAO = getDao(tx, B22.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A22 a = aDAO.create();
+ B22 b = bDAO.create();
+
+ b.addA22(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A22 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(b, aBis.getB22());
+ Assert.assertEquals(a.getB22(), aBis.getB22());
+
+ B22 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(1, bBis.sizeA22());
+ Assert.assertEquals(a, bBis.getA22().iterator().next());
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A22 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B22 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,123 @@
+
+package org.nuiton.topia.it.mapping.test2;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional ManyToOne relation with role renamed into
+ * {@code roleA} and {@code roleB}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalManyToOneRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A23TopiaDao aDAO;
+
+ protected B23TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A23.class);
+ bDAO = getDao(tx, B23.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A23 a = aDAO.create();
+ B23 b = bDAO.create();
+
+ b.addRoleA23(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A23 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(b, aBis.getRoleB23());
+
+ B23 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(1, bBis.sizeRoleA23());
+ Assert.assertEquals(a, bBis.getRoleA23().iterator().next());
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A23 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B23 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/BiDirectionalManyToOneRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,121 @@
+
+package org.nuiton.topia.it.mapping.test2;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a simple ManyToOne relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToOneRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A2TopiaDao aDAO;
+
+ protected B2TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A2.class);
+ bDAO = getDao(tx, B2.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A2 a = aDAO.create();
+ B2 b = bDAO.create();
+
+ a.setB2(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A2 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(b, aBis.getB2());
+
+ B2 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB2(), bBis);
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A2 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B2 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,121 @@
+
+package org.nuiton.topia.it.mapping.test2;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a simple ManyToOne relation with role renamed into {@code roleB}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToOneRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A21TopiaDao aDAO;
+
+ protected B21TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A21.class);
+ bDAO = getDao(tx, B21.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A21 a = aDAO.create();
+ B21 b = bDAO.create();
+
+ a.setRoleB21(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A21 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(b, aBis.getRoleB21());
+
+ B21 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getRoleB21(), bBis);
+ }
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A21 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B21 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test2/SimpleManyToOneRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,125 @@
+
+package org.nuiton.topia.it.mapping.test3;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional ManyToMany relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalManyToManyRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A32TopiaDao aDAO;
+
+ protected B32TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A32.class);
+ bDAO = getDao(tx, B32.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A32 a = aDAO.create();
+ B32 b = bDAO.create();
+
+ b.addA32(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A32 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB32());
+ Assert.assertEquals(b, aBis.getB32().iterator().next());
+ Assert.assertEquals(a.getB32(), aBis.getB32());
+
+ B32 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(1, bBis.sizeA32());
+ Assert.assertEquals(a, bBis.getA32().iterator().next());
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A32 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B32 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,125 @@
+
+package org.nuiton.topia.it.mapping.test3;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a bi-directional ManyToMany relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalManyToManyRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A33TopiaDao aDAO;
+
+ protected B33TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A33.class);
+ bDAO = getDao(tx, B33.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A33 a = aDAO.create();
+ B33 b = bDAO.create();
+
+ b.addRoleA33(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A33 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB33());
+ Assert.assertEquals(b, aBis.getRoleB33().iterator().next());
+ Assert.assertEquals(a.getRoleB33(), aBis.getRoleB33());
+
+ B33 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(1, bBis.sizeRoleA33());
+ Assert.assertEquals(a, bBis.getRoleA33().iterator().next());
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A33 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B33 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/BiDirectionalManyToManyRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,123 @@
+
+package org.nuiton.topia.it.mapping.test3;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a simple ManyToMany relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToManyRelationTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A3TopiaDao aDAO;
+
+ protected B3TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A3.class);
+ bDAO = getDao(tx, B3.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A3 a = aDAO.create();
+ B3 b = bDAO.create();
+
+ a.addB3(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A3 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB3());
+ Assert.assertEquals(b, aBis.getB3().iterator().next());
+
+ B3 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB3().iterator().next(), bBis);
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A3 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B3 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationWithRoleNamedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationWithRoleNamedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationWithRoleNamedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,123 @@
+
+package org.nuiton.topia.it.mapping.test3;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Tests a simple ManyToMany relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleManyToManyRelationWithRoleNamedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A31TopiaDao aDAO;
+
+ protected B31TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A31.class);
+ bDAO = getDao(tx, B31.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A31 a = aDAO.create();
+ B31 b = bDAO.create();
+
+ a.addRoleB31(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A31 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeRoleB31());
+ Assert.assertEquals(b, aBis.getRoleB31().iterator().next());
+
+ B31 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getRoleB31().iterator().next(), bBis);
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A31 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(1, nbB);
+
+ B31 b = bDAO.findAll().get(0);
+ bDAO.delete(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test3/SimpleManyToManyRelationWithRoleNamedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/ElementCollectionTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/ElementCollectionTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/ElementCollectionTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,101 @@
+
+package org.nuiton.topia.it.mapping.test4;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.it.mapping.test3.B3TopiaDao;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Arrays;
+
+/**
+ * Tests that everything is ok with fields with multiplicity > 1 on primitive
+ * data.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class ElementCollectionTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A4TopiaDao aDAO;
+
+ protected B3TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A4.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ A4 a = aDAO.create();
+ a.setStrings(Arrays.asList("a", "b", "c"));
+ a.setEnumerations(Arrays.asList(E4.LITERAL1, E4.LITERAL2));
+
+ tx.commit();
+
+ A4 aBis = aDAO.findByTopiaId(a.getTopiaId());
+
+ Assert.assertNotNull(aBis);
+ Assert.assertEquals(a, aBis);
+ Assert.assertNotNull(aBis.getStrings());
+ Assert.assertEquals(3, aBis.sizeStrings());
+ Assert.assertEquals(a.getStrings(), aBis.getStrings());
+
+ Assert.assertNotNull(aBis.getEnumerations());
+ Assert.assertEquals(2, aBis.sizeEnumerations());
+ Assert.assertEquals(a.getEnumerations(), aBis.getEnumerations());
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+
+ Assert.assertEquals(1, nbA);
+
+ A4 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test4/ElementCollectionTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/BiDirectionalOneToManyCompositionTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/BiDirectionalOneToManyCompositionTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/BiDirectionalOneToManyCompositionTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,112 @@
+
+package org.nuiton.topia.it.mapping.test5;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Test behaviour of a bi-directional OnetoMany (composition) relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class BiDirectionalOneToManyCompositionTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A51TopiaDao aDAO;
+
+ protected B51TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A51.class);
+ bDAO = getDao(tx, B51.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A51 a = aDAO.create();
+ B51 b = bDAO.create();
+
+ a.addB51(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A51 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB51());
+ Assert.assertEquals(b, aBis.getB51().iterator().next());
+
+ B51 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB51().iterator().next(), bBis);
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A51 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/BiDirectionalOneToManyCompositionTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/OneToManyCompositionTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/OneToManyCompositionTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/OneToManyCompositionTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,112 @@
+
+package org.nuiton.topia.it.mapping.test5;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+/**
+ * Test behaviour of a OnetoMany (composition) relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class OneToManyCompositionTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A5TopiaDao aDAO;
+
+ protected B5TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A5.class);
+ bDAO = getDao(tx, B5.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A5 a = aDAO.create();
+ B5 b = bDAO.create();
+
+ a.addB5(b);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A5 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(1, aBis.sizeB5());
+ Assert.assertEquals(b, aBis.getB5().iterator().next());
+
+ B5 bBis = bDAO.findByTopiaId(b.getTopiaId());
+ Assert.assertEquals(b, bBis);
+ Assert.assertEquals(aBis.getB5().iterator().next(), bBis);
+ }
+
+ @Test
+ public void delete() throws TopiaException {
+
+ create();
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(1, nbB);
+
+ A5 a = aDAO.findAll().get(0);
+ aDAO.delete(a);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test5/OneToManyCompositionTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyIndexedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyIndexedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyIndexedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,126 @@
+
+package org.nuiton.topia.it.mapping.test6;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import com.google.common.collect.Lists;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.List;
+
+/**
+ * To test a simple OneToMany indexed relation (usage of JPA order-colum)
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyIndexedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A6TopiaDao aDAO;
+
+ protected B6TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A6.class);
+ bDAO = getDao(tx, B6.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A6 a = aDAO.create();
+ B6 b = bDAO.create();
+ B6 b2 = bDAO.create();
+ B6 b3 = bDAO.create();
+
+ a.addB6(b);
+ a.addB6(b2);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(3, nbB);
+
+ A6 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB6());
+ List<B6> bs = aBis.getB6();
+ Assert.assertEquals(b, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+
+ // change order
+ List<B6> bsBis;
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setB6(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB6());
+ bs = aBis.getB6();
+ Assert.assertEquals(b2, bs.get(0));
+ Assert.assertEquals(b, bs.get(1));
+
+ // rechange order
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b3);
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setB6(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(3, aBis.sizeB6());
+ bs = aBis.getB6();
+ Assert.assertEquals(b3, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+ Assert.assertEquals(b, bs.get(2));
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyIndexedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyWithRoleNamedIndexedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyWithRoleNamedIndexedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyWithRoleNamedIndexedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,127 @@
+
+package org.nuiton.topia.it.mapping.test6;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import com.google.common.collect.Lists;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.List;
+
+/**
+ * To test a simple OneToMany indexed relation (usage of JPA order-colum)
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyWithRoleNamedIndexedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A61TopiaDao aDAO;
+
+ protected B61TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A61.class);
+ bDAO = getDao(tx, B61.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A61 a = aDAO.create();
+ B61 b = bDAO.create();
+ B61 b2 = bDAO.create();
+ B61 b3 = bDAO.create();
+
+ a.addRoleB61(b);
+ a.addRoleB61(b2);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(3, nbB);
+
+ A61 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeRoleB61());
+ List<B61> bs = aBis.getRoleB61();
+ Assert.assertEquals(b, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+
+ // change order
+ List<B61> bsBis;
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setRoleB61(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeRoleB61());
+ bs = aBis.getRoleB61();
+ Assert.assertEquals(b2, bs.get(0));
+ Assert.assertEquals(b, bs.get(1));
+
+ // rechange order
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b3);
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setRoleB61(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(3, aBis.sizeRoleB61());
+ bs = aBis.getRoleB61();
+ Assert.assertEquals(b3, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+ Assert.assertEquals(b, bs.get(2));
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test6/SimpleOneToManyWithRoleNamedIndexedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderByTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderByTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderByTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,135 @@
+
+package org.nuiton.topia.it.mapping.test7;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import com.google.common.collect.Lists;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Tests the tag-value {@code ordere-by} on a {@code OneToMany} relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyOrderByTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A71TopiaDao aDAO;
+
+ protected B71TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A71.class);
+ bDAO = getDao(tx, B71.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A71 a = aDAO.create();
+ B71 b = bDAO.create(B71.PROPERTY_NAME, "A");
+ B71 b2 = bDAO.create(B71.PROPERTY_NAME, "B");
+ B71 b3 = bDAO.create(B71.PROPERTY_NAME, "C");
+
+ a.addB71(b);
+ a.addB71(b2);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(3, nbB);
+
+ A71 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB71());
+ Collection<B71> bs = aBis.getB71();
+ Iterator<B71> iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+ Assert.assertEquals(b2, iterator.next());
+
+ // change order
+ List<B71> bsBis;
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b2);
+ bsBis.add(b);
+ aBis.setB71(bsBis);
+ tx.commit();
+
+ tx.getHibernateSupport().getHibernateSession().clear();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB71());
+ bs = aBis.getB71();
+ iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+ Assert.assertEquals(b2, iterator.next());
+
+ // rechange order
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b3);
+ bsBis.add(b2);
+ bsBis.add(b);
+ aBis.setB71(bsBis);
+ tx.commit();
+
+ tx.getHibernateSupport().getHibernateSession().clear();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(3, aBis.sizeB71());
+ bs = aBis.getB71();
+ iterator = bs.iterator();
+ Assert.assertEquals(b, iterator.next());
+ Assert.assertEquals(b2, iterator.next());
+ Assert.assertEquals(b3, iterator.next());
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderByTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderedTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderedTest.java (rev 0)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderedTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -0,0 +1,126 @@
+
+package org.nuiton.topia.it.mapping.test7;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import com.google.common.collect.Lists;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import org.nuiton.topia.it.mapping.AbstractMappingTest;
+import org.nuiton.topia.it.mapping.TopiaItMappingTopiaPersistenceContext;
+import org.nuiton.topia.persistence.TopiaException;
+
+import java.util.List;
+
+/**
+ * Tests the stereotype {@code orderered} on a {@code OneToMany} relation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class SimpleOneToManyOrderedTest extends AbstractMappingTest {
+
+ protected TopiaItMappingTopiaPersistenceContext tx;
+
+ protected A7TopiaDao aDAO;
+
+ protected B7TopiaDao bDAO;
+
+ @Before
+ public void before() throws TopiaException {
+ tx = db.beginTransaction();
+ aDAO = getDao(tx, A7.class);
+ bDAO = getDao(tx, B7.class);
+ }
+
+ @Test
+ public void create() throws TopiaException {
+
+ long nbA = aDAO.count();
+ long nbB = bDAO.count();
+
+ Assert.assertEquals(0, nbA);
+ Assert.assertEquals(0, nbB);
+
+ A7 a = aDAO.create();
+ B7 b = bDAO.create();
+ B7 b2 = bDAO.create();
+ B7 b3 = bDAO.create();
+
+ a.addB7(b);
+ a.addB7(b2);
+
+ tx.commit();
+
+ nbA = aDAO.count();
+ nbB = bDAO.count();
+
+ Assert.assertEquals(1, nbA);
+ Assert.assertEquals(3, nbB);
+
+ A7 aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB7());
+ List<B7> bs = aBis.getB7();
+ Assert.assertEquals(b, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+
+ // change order
+ List<B7> bsBis;
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setB7(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(2, aBis.sizeB7());
+ bs = aBis.getB7();
+ Assert.assertEquals(b2, bs.get(0));
+ Assert.assertEquals(b, bs.get(1));
+
+ // rechange order
+
+ bsBis = Lists.newArrayList();
+ bsBis.add(b3);
+ bsBis.add(b2);
+ bsBis.add(b);
+ a.setB7(bsBis);
+ tx.commit();
+
+ aBis = aDAO.findByTopiaId(a.getTopiaId());
+ Assert.assertEquals(a, aBis);
+ Assert.assertEquals(3, aBis.sizeB7());
+ bs = aBis.getB7();
+ Assert.assertEquals(b3, bs.get(0));
+ Assert.assertEquals(b2, bs.get(1));
+ Assert.assertEquals(b, bs.get(2));
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-it/src/test/java/org/nuiton/topia/it/mapping/test7/SimpleOneToManyOrderedTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -32,7 +32,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaDatabase;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDatabase;
import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
@@ -50,7 +50,7 @@
public class TopiaDaoTest { // Should not be located in topia-it module
@Rule
- public final TopiaDatabase db = new TopiaDatabase();
+ public final TopiaItLegacyDatabase db = new TopiaItLegacyDatabase();
protected TopiaItLegacyTopiaPersistenceContext context;
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-03-14 16:31:08 UTC (rev 3031)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-03-14 17:23:52 UTC (rev 3032)
@@ -315,7 +315,8 @@
// / *{ <one-to-one name="<%=getName(attr, true)%>" class="<%=getType(attr, true)%>"<%=(TopiaGeneratorUtil.notEmpty(attr.getTagValue(TopiaGeneratorUtil.TAG_LENGTH))?(" length=\"" + attr.getTagValue(TopiaGeneratorUtil.TAG_LENGTH) + "\""):"")%><%=(attr.isComposite()?" cascade=\"delete\"":"")%>/>
// } */
// } else {
- String notNull = " " + generateFromTagValue(HIBERNATE_ATTRIBUTE_NOT_NULL, TopiaGeneratorUtil.getNotNullTagValue(attr));
+// String notNull = " " + generateFromTagValue(HIBERNATE_ATTRIBUTE_NOT_NULL, TopiaGeneratorUtil.getNotNullTagValue(attr));
+ String notNull = " " + generateFromTagValue(HIBERNATE_ATTRIBUTE_NOT_NULL, "true"); // AThimel 14/03/2014 I think both assoc class participants must always be not-null
String attrName = getName(attr, true);
String attrType = getType(attr, true);
String lazy = generateFromTagValue(HIBERNATE_ATTRIBUTE_LAZY, TopiaGeneratorUtil.getLazyTagValue(attr));
1
0
Author: athimel
Date: 2014-03-14 17:31:08 +0100 (Fri, 14 Mar 2014)
New Revision: 3031
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3031
Log:
refs-30 2774 Migrate mapping tests model from topia-jpa into topia-it module
Added:
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyApplicationContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyDao.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyEntity.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyPersistenceContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyApplicationContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyDaoSupplier.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyPersistenceContext.java
trunk/topia-it/src/main/xmi/topia-it-legacy.properties
trunk/topia-it/src/main/xmi/topia-it-legacy.zargo
trunk/topia-it/src/main/xmi/topia-it-mapping.properties
trunk/topia-it/src/main/xmi/topia-it-mapping.zargo
Removed:
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestApplicationContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestDao.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestEntity.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestPersistenceContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestApplicationContext.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestDaoSupplier.java
trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestPersistenceContext.java
trunk/topia-it/src/main/xmi/topiatest.properties
trunk/topia-it/src/main/xmi/topiatest.zargo
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/evo1912/
Modified:
trunk/topia-it/pom.xml
trunk/topia-it/src/main/java/org/nuiton/topia/it/TopiaConfigurationHelper.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/GenerateTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TestHelper.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaApplicationContextCacheTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/CollectorTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/EntityOperatorTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityBinderTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityHelperTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityRefTesterTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java
trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java
trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java
trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationOperationTest.java
trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplAllTest.java
trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplTest.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
Modified: trunk/topia-it/pom.xml
===================================================================
--- trunk/topia-it/pom.xml 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/pom.xml 2014-03-14 16:31:08 UTC (rev 3031)
@@ -130,15 +130,36 @@
</configuration>
<executions>
+
+ <!-- Extraction des modèles -->
<execution>
- <id>Model Generator</id>
+ <id>generate-objectmodel</id>
<phase>generate-sources</phase>
<configuration>
+ <skipInputs>model</skipInputs>
+ <inputs>zargo</inputs>
+ <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>
+ <fullPackagePath>org.nuiton.topia.it</fullPackagePath>
+ <defaultPackage>org.nuiton.topia.it</defaultPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+
+ <!-- Génération du modèle "topia-it-legacy" -->
+ <execution>
+ <id>Model Generator (topia-it-legacy)</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <inputs>
+ target/generated-sources/models:topia-it-legacy.objectmodel
+ </inputs>
<templates>
org.nuiton.eugene.java.JavaInterfaceTransformer,
org.nuiton.eugene.java.JavaBeanTransformer,
+ org.nuiton.eugene.java.JavaEnumerationTransformer,
org.nuiton.topia.templates.TopiaMetaTransformer,
- org.nuiton.topia.templates.EntityDTOTransformer,
org.nuiton.topia.templates.BinderHelperTransformer
</templates>
<fullPackagePath>org.nuiton.topia.it.legacy</fullPackagePath>
@@ -148,6 +169,30 @@
<goal>generate</goal>
</goals>
</execution>
+
+ <!-- Génération du modèle "topia-it-mapping" -->
+ <execution>
+ <id>Model Generator (topia-it-mapping)</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <inputs>
+ target/generated-sources/models:topia-it-mapping.objectmodel
+ </inputs>
+ <templates>
+ org.nuiton.eugene.java.JavaInterfaceTransformer,
+ org.nuiton.eugene.java.JavaBeanTransformer,
+ org.nuiton.eugene.java.JavaEnumerationTransformer,
+ org.nuiton.topia.templates.TopiaMetaTransformer,
+ org.nuiton.topia.templates.BinderHelperTransformer
+ </templates>
+ <fullPackagePath>org.nuiton.topia.it.mapping</fullPackagePath>
+ <defaultPackage>org.nuiton.topia.it.mapping</defaultPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+
</executions>
<dependencies>
<dependency>
Modified: trunk/topia-it/src/main/java/org/nuiton/topia/it/TopiaConfigurationHelper.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/TopiaConfigurationHelper.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/TopiaConfigurationHelper.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -27,8 +27,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Environment;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
import org.nuiton.topia.junit.ConfigurationHelper;
import java.io.File;
@@ -104,7 +104,7 @@
configuration.load(stream);
configuration.setProperty(
TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
- TopiaTestEntityEnum.getImplementationClassesAsString());
+ TopiaItLegacyEntityEnum.getImplementationClassesAsString());
return configuration;
}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyApplicationContext.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestApplicationContext.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyApplicationContext.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyApplicationContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,48 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.nuiton.topia.persistence.internal.AbstractTopiaApplicationContext;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public abstract class AbstractTopiaItLegacyApplicationContext<E extends AbstractTopiaItLegacyPersistenceContext>
+ extends AbstractTopiaApplicationContext<E> {
+
+ protected AbstractTopiaItLegacyApplicationContext(Properties properties) {
+ super(properties);
+ }
+
+ protected AbstractTopiaItLegacyApplicationContext(Map<String, String> configuration) {
+ super(configuration);
+ }
+}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyDao.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestDao.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyDao.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyDao.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,37 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.nuiton.topia.persistence.internal.AbstractTopiaDao;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public abstract class AbstractTopiaItLegacyDao<E extends TopiaEntity> extends AbstractTopiaDao<E> {
+}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyEntity.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestEntity.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyEntity.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyEntity.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,37 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.nuiton.topia.persistence.internal.AbstractTopiaEntity;
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public abstract class AbstractTopiaItLegacyEntity extends AbstractTopiaEntity {
+ private static final long serialVersionUID = 1L;
+}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyPersistenceContext.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestPersistenceContext.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyPersistenceContext.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaItLegacyPersistenceContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,44 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+import org.nuiton.topia.persistence.internal.AbstractTopiaPersistenceContext;
+import org.nuiton.topia.persistence.support.TopiaListenableSupport;
+import org.nuiton.topia.persistence.internal.HibernateProvider;
+import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
+import org.nuiton.topia.persistence.TopiaIdFactory;
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public abstract class AbstractTopiaItLegacyPersistenceContext extends AbstractTopiaPersistenceContext {
+
+ protected AbstractTopiaItLegacyPersistenceContext(HibernateProvider hibernateProvider, TopiaListenableSupport listenableSupport, TopiaIdFactory topiaIdFactory, TopiaHibernateSessionRegistry sessionRegistry) {
+ super(hibernateProvider, listenableSupport, topiaIdFactory, sessionRegistry);
+ }
+}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestApplicationContext.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestApplicationContext.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestApplicationContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,48 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-import org.nuiton.topia.persistence.internal.AbstractTopiaApplicationContext;
-
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public abstract class AbstractTopiaTestApplicationContext<E extends AbstractTopiaTestPersistenceContext>
- extends AbstractTopiaApplicationContext<E> {
-
- protected AbstractTopiaTestApplicationContext(Properties properties) {
- super(properties);
- }
-
- protected AbstractTopiaTestApplicationContext(Map<String, String> configuration) {
- super(configuration);
- }
-}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestDao.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestDao.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestDao.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,37 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-import org.nuiton.topia.persistence.internal.AbstractTopiaDao;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public abstract class AbstractTopiaTestDao<E extends TopiaEntity> extends AbstractTopiaDao<E> {
-}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestEntity.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestEntity.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestEntity.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,37 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-import org.nuiton.topia.persistence.internal.AbstractTopiaEntity;
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public abstract class AbstractTopiaTestEntity extends AbstractTopiaEntity {
- private static final long serialVersionUID = 1L;
-}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestPersistenceContext.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestPersistenceContext.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/AbstractTopiaTestPersistenceContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,44 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-import org.nuiton.topia.persistence.internal.AbstractTopiaPersistenceContext;
-import org.nuiton.topia.persistence.support.TopiaListenableSupport;
-import org.nuiton.topia.persistence.internal.HibernateProvider;
-import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
-import org.nuiton.topia.persistence.TopiaIdFactory;
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public abstract class AbstractTopiaTestPersistenceContext extends AbstractTopiaPersistenceContext {
-
- protected AbstractTopiaTestPersistenceContext(HibernateProvider hibernateProvider, TopiaListenableSupport listenableSupport, TopiaIdFactory topiaIdFactory, TopiaHibernateSessionRegistry sessionRegistry) {
- super(hibernateProvider, listenableSupport, topiaIdFactory, sessionRegistry);
- }
-}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyApplicationContext.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestApplicationContext.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyApplicationContext.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyApplicationContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,35 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public interface TopiaItLegacyApplicationContext {
+
+}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyDaoSupplier.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestDaoSupplier.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyDaoSupplier.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyDaoSupplier.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,34 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+/**
+ * Created on 12/20/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since XXX
+ */
+public interface TopiaItLegacyDaoSupplier {
+}
Copied: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyPersistenceContext.java (from rev 3029, trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestPersistenceContext.java)
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyPersistenceContext.java (rev 0)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaItLegacyPersistenceContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,35 @@
+package org.nuiton.topia.it.legacy;
+
+/*
+ * #%L
+ * ToPIA :: IT
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2014 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%
+ */
+
+/**
+ * Created on 12/19/13.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public interface TopiaItLegacyPersistenceContext {
+
+}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestApplicationContext.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestApplicationContext.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestApplicationContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,35 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public interface TopiaTestApplicationContext {
-
-}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestDaoSupplier.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestDaoSupplier.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestDaoSupplier.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,34 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-/**
- * Created on 12/20/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since XXX
- */
-public interface TopiaTestDaoSupplier {
-}
Deleted: trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestPersistenceContext.java
===================================================================
--- trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestPersistenceContext.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/java/org/nuiton/topia/it/legacy/TopiaTestPersistenceContext.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,35 +0,0 @@
-package org.nuiton.topia.it.legacy;
-
-/*
- * #%L
- * ToPIA :: IT
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2014 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%
- */
-
-/**
- * Created on 12/19/13.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public interface TopiaTestPersistenceContext {
-
-}
Copied: trunk/topia-it/src/main/xmi/topia-it-legacy.properties (from rev 3029, trunk/topia-it/src/main/xmi/topiatest.properties)
===================================================================
--- trunk/topia-it/src/main/xmi/topia-it-legacy.properties (rev 0)
+++ trunk/topia-it/src/main/xmi/topia-it-legacy.properties 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,42 @@
+###
+# #%L
+# ToPIA :: IT
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2014 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
+model.tagValue.applicationContextSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaItLegacyApplicationContext
+model.tagValue.persistenceContextSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaItLegacyPersistenceContext
+model.tagValue.daoSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaItLegacyDao
+model.tagValue.entitySuperClass=org.nuiton.topia.it.legacy.AbstractTopiaItLegacyEntity
+
+#org.nuiton.topia.it.legacy.topiatest.Company.class.tagvalue.naturalIdMutable=false
+#org.nuiton.topia.it.legacy.topiatest.Company.attribute.siret.tagvalue.naturalId=true
+#org.nuiton.topia.it.legacy.topiatest.Company.attribute.name.tagvalue.naturalId=true
+#org.nuiton.topia.it.legacy.topiatest.Company.attribute.name.tagvalue.notNull=false
+
+org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNotNull.tagvalue.naturalId=true
+org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.naturalId=true
+org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.notNull=false
+
+org.nuiton.topia.it.legacy.topiatest.Personne.attribute.otherGender.tagValue.useEnumerationName=true
Copied: trunk/topia-it/src/main/xmi/topia-it-legacy.zargo (from rev 3029, trunk/topia-it/src/main/xmi/topiatest.zargo)
===================================================================
(Binary files differ)
Added: trunk/topia-it/src/main/xmi/topia-it-mapping.properties
===================================================================
--- trunk/topia-it/src/main/xmi/topia-it-mapping.properties (rev 0)
+++ trunk/topia-it/src/main/xmi/topia-it-mapping.properties 2014-03-14 16:31:08 UTC (rev 3031)
@@ -0,0 +1,26 @@
+###
+# #%L
+# ToPIA :: Persistence
+#
+# $Id: topia-it-mapping.properties 2548 2012-05-29 14:08:35Z athimel $
+# $HeadURL: http://svn.nuiton.org/svn/topia/branches/topia-jpa/topia-persistence-tck/sr… $
+# %%
+# 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.generateOperatorForDAOHelper=true
+model.tagvalue.constantPrefix=PROPERTY_
Added: trunk/topia-it/src/main/xmi/topia-it-mapping.zargo
===================================================================
(Binary files differ)
Property changes on: trunk/topia-it/src/main/xmi/topia-it-mapping.zargo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/topia-it/src/main/xmi/topiatest.properties
===================================================================
--- trunk/topia-it/src/main/xmi/topiatest.properties 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/main/xmi/topiatest.properties 2014-03-14 16:31:08 UTC (rev 3031)
@@ -1,42 +0,0 @@
-###
-# #%L
-# ToPIA :: IT
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2004 - 2014 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
-model.tagValue.applicationContextSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaTestApplicationContext
-model.tagValue.persistenceContextSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaTestPersistenceContext
-model.tagValue.daoSuperClass=org.nuiton.topia.it.legacy.AbstractTopiaTestDao
-model.tagValue.entitySuperClass=org.nuiton.topia.it.legacy.AbstractTopiaTestEntity
-
-#org.nuiton.topia.it.legacy.topiatest.Company.class.tagvalue.naturalIdMutable=false
-#org.nuiton.topia.it.legacy.topiatest.Company.attribute.siret.tagvalue.naturalId=true
-#org.nuiton.topia.it.legacy.topiatest.Company.attribute.name.tagvalue.naturalId=true
-#org.nuiton.topia.it.legacy.topiatest.Company.attribute.name.tagvalue.notNull=false
-
-org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNotNull.tagvalue.naturalId=true
-org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.naturalId=true
-org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity.attribute.naturalIdNull.tagvalue.notNull=false
-
-org.nuiton.topia.it.legacy.topiatest.Personne.attribute.otherGender.tagValue.useEnumerationName=true
Deleted: trunk/topia-it/src/main/xmi/topiatest.zargo
===================================================================
(Binary files differ)
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/GenerateTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/GenerateTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/GenerateTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -26,18 +26,18 @@
import org.junit.Assert;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestApplicationContext;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestDao;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestEntity;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestPersistenceContext;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestTopiaApplicationContext;
-import org.nuiton.topia.it.legacy.AbstractTopiaTestTopiaPersistenceContext;
-import org.nuiton.topia.it.legacy.TopiaTestApplicationContext;
-import org.nuiton.topia.it.legacy.TopiaTestDaoSupplier;
-import org.nuiton.topia.it.legacy.TopiaTestPersistenceContext;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaApplicationContext;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaDaoSupplier;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyEntity;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyApplicationContext;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyDao;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyPersistenceContext;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyTopiaApplicationContext;
+import org.nuiton.topia.it.legacy.AbstractTopiaItLegacyTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyApplicationContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyDaoSupplier;
+import org.nuiton.topia.it.legacy.TopiaItLegacyPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaApplicationContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaDaoSupplier;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.AbstractPetTopiaDao;
import org.nuiton.topia.it.legacy.test.entities.GeneratedPetTopiaDao;
import org.nuiton.topia.it.legacy.test.entities.PetAbstract;
@@ -58,51 +58,51 @@
public void testApplicationContext() {
// add contract from class-path
- Assert.assertTrue(TopiaTestApplicationContext.class.isAssignableFrom(AbstractTopiaTestTopiaApplicationContext.class));
- Assert.assertTrue(TopiaTestApplicationContext.class.isAssignableFrom(TopiaTestTopiaApplicationContext.class));
+ Assert.assertTrue(TopiaItLegacyApplicationContext.class.isAssignableFrom(AbstractTopiaItLegacyTopiaApplicationContext.class));
+ Assert.assertTrue(TopiaItLegacyApplicationContext.class.isAssignableFrom(TopiaItLegacyTopiaApplicationContext.class));
// add super-class from tag-value applicationContextSuperClass
- Assert.assertTrue(AbstractTopiaTestApplicationContext.class.isAssignableFrom(AbstractTopiaTestTopiaApplicationContext.class));
- Assert.assertTrue(AbstractTopiaTestApplicationContext.class.isAssignableFrom(TopiaTestTopiaApplicationContext.class));
+ Assert.assertTrue(AbstractTopiaItLegacyApplicationContext.class.isAssignableFrom(AbstractTopiaItLegacyTopiaApplicationContext.class));
+ Assert.assertTrue(AbstractTopiaItLegacyApplicationContext.class.isAssignableFrom(TopiaItLegacyTopiaApplicationContext.class));
}
@Test
public void testDaoSupplier() {
// add contract from class-path
- Assert.assertTrue(TopiaTestDaoSupplier.class.isAssignableFrom(TopiaTestTopiaDaoSupplier.class));
+ Assert.assertTrue(TopiaItLegacyDaoSupplier.class.isAssignableFrom(TopiaItLegacyTopiaDaoSupplier.class));
}
@Test
public void testPersistenceContext() {
// use dao supplier as contract of topia persistence context
- Assert.assertTrue(TopiaTestDaoSupplier.class.isAssignableFrom(AbstractTopiaTestTopiaPersistenceContext.class));
+ Assert.assertTrue(TopiaItLegacyDaoSupplier.class.isAssignableFrom(AbstractTopiaItLegacyTopiaPersistenceContext.class));
// add contract from class-path
- Assert.assertTrue(TopiaTestPersistenceContext.class.isAssignableFrom(AbstractTopiaTestTopiaPersistenceContext.class));
- Assert.assertTrue(TopiaTestPersistenceContext.class.isAssignableFrom(TopiaTestTopiaPersistenceContext.class));
+ Assert.assertTrue(TopiaItLegacyPersistenceContext.class.isAssignableFrom(AbstractTopiaItLegacyTopiaPersistenceContext.class));
+ Assert.assertTrue(TopiaItLegacyPersistenceContext.class.isAssignableFrom(TopiaItLegacyTopiaPersistenceContext.class));
// add super-class from tag-value persistenceContextSuperClass
- Assert.assertTrue(AbstractTopiaTestPersistenceContext.class.isAssignableFrom(AbstractTopiaTestTopiaPersistenceContext.class));
- Assert.assertTrue(AbstractTopiaTestPersistenceContext.class.isAssignableFrom(TopiaTestTopiaPersistenceContext.class));
+ Assert.assertTrue(AbstractTopiaItLegacyPersistenceContext.class.isAssignableFrom(AbstractTopiaItLegacyTopiaPersistenceContext.class));
+ Assert.assertTrue(AbstractTopiaItLegacyPersistenceContext.class.isAssignableFrom(TopiaItLegacyTopiaPersistenceContext.class));
}
@Test
public void testDao() {
// add super-class from tag-value daoSuperClass
- Assert.assertTrue(AbstractTopiaTestDao.class.isAssignableFrom(GeneratedPetTopiaDao.class));
- Assert.assertTrue(AbstractTopiaTestDao.class.isAssignableFrom(AbstractPetTopiaDao.class));
- Assert.assertTrue(AbstractTopiaTestDao.class.isAssignableFrom(PetTopiaDao.class));
+ Assert.assertTrue(AbstractTopiaItLegacyDao.class.isAssignableFrom(GeneratedPetTopiaDao.class));
+ Assert.assertTrue(AbstractTopiaItLegacyDao.class.isAssignableFrom(AbstractPetTopiaDao.class));
+ Assert.assertTrue(AbstractTopiaItLegacyDao.class.isAssignableFrom(PetTopiaDao.class));
}
@Test
public void testEntity() {
// add super-class from tag-value entitySuperClass
- Assert.assertTrue(AbstractTopiaTestEntity.class.isAssignableFrom(PetAbstract.class));
- Assert.assertTrue(AbstractTopiaTestEntity.class.isAssignableFrom(PetImpl.class));
+ Assert.assertTrue(AbstractTopiaItLegacyEntity.class.isAssignableFrom(PetAbstract.class));
+ Assert.assertTrue(AbstractTopiaItLegacyEntity.class.isAssignableFrom(PetImpl.class));
}
}
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TestHelper.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TestHelper.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TestHelper.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -92,7 +92,7 @@
protected static final Function<Properties,TopiaApplicationContext> CREATE_TOPIA_TEST_CONTEXT = new Function<Properties, TopiaApplicationContext>() {
@Override
public TopiaApplicationContext apply(Properties input) {
- return new TopiaTestTopiaApplicationContext(input);
+ return new TopiaItLegacyTopiaApplicationContext(input);
}
};
@@ -151,7 +151,7 @@
configuration.load(stream);
configuration.setProperty(
TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES,
- TopiaTestEntityEnum.getImplementationClassesAsString());
+ TopiaItLegacyEntityEnum.getImplementationClassesAsString());
return configuration;
}
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaApplicationContextCacheTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaApplicationContextCacheTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaApplicationContextCacheTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -57,7 +57,7 @@
protected static final Function<Properties,TopiaApplicationContext> CREATE_TOPIA_TEST_CONTEXT = new Function<Properties, TopiaApplicationContext>() {
@Override
public TopiaApplicationContext apply(Properties input) {
- return new TopiaTestTopiaApplicationContext(input);
+ return new TopiaItLegacyTopiaApplicationContext(input);
}
};
@@ -93,7 +93,7 @@
String url = "jdbc:h2:file:" + dbDirectory;
properties.setProperty("hibernate.connection.url", url);
- TopiaTestTopiaApplicationContext test = new TopiaTestTopiaApplicationContext(properties);
+ TopiaItLegacyTopiaApplicationContext test = new TopiaItLegacyTopiaApplicationContext(properties);
contextCache.put(properties, test);
/** EXEC METHOD **/
@@ -107,7 +107,7 @@
log.debug("## testRemoveContext");
/** PREPARE DATA **/
- TopiaTestTopiaApplicationContext test = new TopiaTestTopiaApplicationContext(properties);
+ TopiaItLegacyTopiaApplicationContext test = new TopiaItLegacyTopiaApplicationContext(properties);
contextCache.put(properties, test);
/** EXEC METHOD **/
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaDatabase.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -53,7 +53,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.8
*/
-public class TopiaDatabase extends AbstractDatabaseResource<TopiaTestTopiaPersistenceContext, TopiaTestTopiaApplicationContext> {
+public class TopiaDatabase extends AbstractDatabaseResource<TopiaItLegacyTopiaPersistenceContext, TopiaItLegacyTopiaApplicationContext> {
public static final String DEFAULT_CONFIGURATION_LOCATION = "/TopiaContextImpl.properties";
@@ -66,13 +66,13 @@
}
@Override
- protected TopiaTestTopiaApplicationContext createApplicationContext(Properties dbConfiguration) {
- return new TopiaTestTopiaApplicationContext(dbConfiguration);
+ protected TopiaItLegacyTopiaApplicationContext createApplicationContext(Properties dbConfiguration) {
+ return new TopiaItLegacyTopiaApplicationContext(dbConfiguration);
}
@Override
protected String getImplementationClassesAsString() {
- return TopiaTestEntityEnum.getImplementationClassesAsString();
+ return TopiaItLegacyEntityEnum.getImplementationClassesAsString();
}
}
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/TopiaJpaSupportTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -55,7 +55,7 @@
@Rule
public final TopiaDatabase db = new TopiaDatabase();
- protected TopiaTestTopiaPersistenceContext persistenceContext;
+ protected TopiaItLegacyTopiaPersistenceContext persistenceContext;
protected TopiaJpaSupport jpaSupport;
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaConnectionProviderTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -35,7 +35,7 @@
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.internal.TopiaConnectionProvider;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
import org.nuiton.topia.it.legacy.topiatest.Personne;
@@ -122,7 +122,7 @@
}
private void doStuffOnDb() throws TopiaException {
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
try {
PersonTopiaDao dao = transaction.getPersonDao();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/framework/TopiaContextReplicateTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -32,7 +32,7 @@
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
import org.nuiton.topia.it.legacy.test.entities.Pet;
@@ -89,8 +89,8 @@
// contextSource = TopiaContextFactory.getContext(configSource);
// contextTarget = TopiaContextFactory.getContext(configTarget);
- TopiaTestTopiaPersistenceContext txSource;
- TopiaTestTopiaPersistenceContext txTarget;
+ TopiaItLegacyTopiaPersistenceContext txSource;
+ TopiaItLegacyTopiaPersistenceContext txTarget;
PersonTopiaDao daoSource, daoTarget;
PetTopiaDao petDAOSource, petDAOTarget;
Person personSource, personTarget;
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/generator/TopiaTestCase.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -31,7 +31,7 @@
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.Company;
import org.nuiton.topia.it.legacy.topiatest.CompanyTopiaDao;
import org.nuiton.topia.it.legacy.topiatest.Department;
@@ -115,7 +115,7 @@
}
// try {
- TopiaTestTopiaPersistenceContext newContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext newContext = db.beginTransaction();
CompanyTopiaDao companyDAO = newContext.getCompanyDao();
DepartmentTopiaDao departmentDAO = newContext.getDepartmentDao();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/EntityVisitorExportXmlTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -32,7 +32,7 @@
import org.nuiton.topia.it.legacy.TopiaDatabase;
import org.nuiton.topia.persistence.TopiaEntityVisitor;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.Address;
import org.nuiton.topia.it.legacy.topiatest.AddressTopiaDao;
import org.nuiton.topia.it.legacy.topiatest.Company;
@@ -66,7 +66,7 @@
@Before
public void setUp() throws TopiaException {
- TopiaTestTopiaPersistenceContext newContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext newContext = db.beginTransaction();
try {
// company
CompanyTopiaDao companyDAO = newContext.getCompanyDao();
@@ -112,7 +112,7 @@
@Test
public void testExportXMLDepth() throws TopiaException {
- TopiaTestTopiaPersistenceContext context = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext context = db.beginTransaction();
CompanyTopiaDao companyDAO = context.getCompanyDao();
Company clCompany = companyDAO.findByName("CodeLutin");
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/NaturalIdTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -32,8 +32,8 @@
import org.junit.Test;
import org.nuiton.topia.it.legacy.TopiaDatabase;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.NaturalizedEntity;
import org.nuiton.topia.it.legacy.topiatest.NaturalizedEntityTopiaDao;
@@ -54,7 +54,7 @@
@Test
public void testCreateSucessfull() throws Exception {
log.debug("Test naturalId : create succesfull");
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
NaturalizedEntityTopiaDao dao =
persistenceContext.getNaturalizedEntityDao();
@@ -75,7 +75,7 @@
@Test
public void testCreateFailed() throws Exception {
log.debug("Test naturalId : create failed");
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
NaturalizedEntityTopiaDao dao =
persistenceContext.getNaturalizedEntityDao();
@@ -101,7 +101,7 @@
public void testUpdateFailed() throws Exception {
log.debug("Test naturalId : update failed");
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
NaturalizedEntityTopiaDao dao =
persistenceContext.getNaturalizedEntityDao();
@@ -123,7 +123,7 @@
@Test
public void testFindByNaturalId() throws Exception {
log.debug("Test naturalId : findByNaturalId");
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
NaturalizedEntityTopiaDao dao =
@@ -141,7 +141,7 @@
@Test
public void testExistNaturalId() throws Exception {
log.debug("Test naturalId : existNaturalId");
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
NaturalizedEntityTopiaDao dao =
@@ -164,8 +164,8 @@
public void testNaturalIdAreGeneralized() throws Exception {
// test that natural ids are generalized
- String[] generalizedNaturalizedNaturalIds = TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNaturalIds();
- String[] naturalizedNaturalIds = TopiaTestEntityEnum.NaturalizedEntity.getNaturalIds();
+ String[] generalizedNaturalizedNaturalIds = TopiaItLegacyEntityEnum.GeneralizedNaturalizedEntity.getNaturalIds();
+ String[] naturalizedNaturalIds = TopiaItLegacyEntityEnum.NaturalizedEntity.getNaturalIds();
Assert.assertArrayEquals(generalizedNaturalizedNaturalIds, naturalizedNaturalIds);
}
@@ -173,8 +173,8 @@
public void testNotNullsAreGeneralized() throws Exception {
// test that not nulls are generalized
- String[] generalizedNaturalizedNotNulls = TopiaTestEntityEnum.GeneralizedNaturalizedEntity.getNotNulls();
- String[] naturalizedNotNulls = TopiaTestEntityEnum.NaturalizedEntity.getNotNulls();
+ String[] generalizedNaturalizedNotNulls = TopiaItLegacyEntityEnum.GeneralizedNaturalizedEntity.getNotNulls();
+ String[] naturalizedNotNulls = TopiaItLegacyEntityEnum.NaturalizedEntity.getNotNulls();
Assert.assertArrayEquals(generalizedNaturalizedNotNulls, naturalizedNotNulls);
}
}
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/CollectorTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/CollectorTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/CollectorTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -31,7 +31,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.it.legacy.topiatest.Company;
@@ -50,7 +50,7 @@
@BeforeClass
public static void setUpClass() throws Exception {
- contracts = TopiaTestEntityEnum.getContracts();
+ contracts = TopiaItLegacyEntityEnum.getContracts();
}
@AfterClass
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/EntityOperatorTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/EntityOperatorTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/EntityOperatorTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.topiatest.Company;
import org.nuiton.topia.it.legacy.topiatest.CompanyImpl;
import org.nuiton.topia.it.legacy.topiatest.Department;
@@ -72,10 +72,10 @@
@BeforeClass
public static void setUpClass() throws Exception {
- operationC = TopiaTestEntityEnum.getOperator(Company.class);
- operationE = TopiaTestEntityEnum.getOperator(Employe.class);
- operationP = TopiaTestEntityEnum.getOperator(Personne.class);
- operationD = TopiaTestEntityEnum.getOperator(Department.class);
+ operationC = TopiaItLegacyEntityEnum.getOperator(Company.class);
+ operationE = TopiaItLegacyEntityEnum.getOperator(Employe.class);
+ operationP = TopiaItLegacyEntityEnum.getOperator(Personne.class);
+ operationD = TopiaItLegacyEntityEnum.getOperator(Department.class);
}
@AfterClass
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityBinderTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityBinderTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityBinderTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.it.legacy.topiatest.Company;
@@ -43,7 +43,7 @@
@BeforeClass
public static void setUpClass() throws Exception {
- contracts = TopiaTestEntityEnum.getContracts();
+ contracts = TopiaItLegacyEntityEnum.getContracts();
}
public static class CompanyDTO {
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityHelperTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityHelperTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityHelperTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.persistence.internal.DefaultTopiaIdFactory;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
@@ -74,7 +74,7 @@
@BeforeClass
public static void setUpClass() throws Exception {
- contracts = TopiaTestEntityEnum.getContracts();
+ contracts = TopiaItLegacyEntityEnum.getContracts();
}
@AfterClass
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityRefTesterTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityRefTesterTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/persistence/util/TopiaEntityRefTesterTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.Pet;
import org.nuiton.topia.it.legacy.test.entities.Race;
@@ -41,7 +41,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.3.1
*/
-public class TopiaEntityRefTesterTest extends TopiaEntityRefTester<TopiaTestEntityEnum> {
+public class TopiaEntityRefTesterTest extends TopiaEntityRefTester<TopiaItLegacyEntityEnum> {
/** Logger */
private static final Log log =
@@ -56,26 +56,26 @@
private static final String PERSON1 = "person1";
@Override
- protected TopiaTestEntityEnum[] getContracts0() {
- return new TopiaTestEntityEnum[]{
- TopiaTestEntityEnum.Pet,
- TopiaTestEntityEnum.Person,
- TopiaTestEntityEnum.Race,
+ protected TopiaItLegacyEntityEnum[] getContracts0() {
+ return new TopiaItLegacyEntityEnum[]{
+ TopiaItLegacyEntityEnum.Pet,
+ TopiaItLegacyEntityEnum.Person,
+ TopiaItLegacyEntityEnum.Race,
};
}
@Test
public void testNoReferences() throws Exception {
- Pet pet = newEntity(TopiaTestEntityEnum.Pet, PET1);
+ Pet pet = newEntity(TopiaItLegacyEntityEnum.Pet, PET1);
detectReferences(pet, 0);
- Race race = newEntity(TopiaTestEntityEnum.Race, RACE1);
+ Race race = newEntity(TopiaItLegacyEntityEnum.Race, RACE1);
detectReferences(race, 0);
- Person person = newEntity(TopiaTestEntityEnum.Person, PERSON1);
+ Person person = newEntity(TopiaItLegacyEntityEnum.Person, PERSON1);
detectReferences(person, 0);
@@ -84,10 +84,10 @@
@Test
public void testReferences() throws Exception {
- Pet pet = newEntity(TopiaTestEntityEnum.Pet, PET1);
- Race race = newEntity(TopiaTestEntityEnum.Race, RACE1);
+ Pet pet = newEntity(TopiaItLegacyEntityEnum.Pet, PET1);
+ Race race = newEntity(TopiaItLegacyEntityEnum.Race, RACE1);
pet.setRace(race);
- Person person = newEntity(TopiaTestEntityEnum.Person, PERSON1);
+ Person person = newEntity(TopiaItLegacyEntityEnum.Person, PERSON1);
detectReferences(pet, 1, RACE1);
@@ -115,7 +115,7 @@
assertCurrentEntry(pet, 1);
assertNextAssociationEntityRef(person, Person.PROPERTY_PET, PET1, person, pet);
- Pet pet2 = newEntity(TopiaTestEntityEnum.Pet, PET2);
+ Pet pet2 = newEntity(TopiaItLegacyEntityEnum.Pet, PET2);
person.addPet(pet2);
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/test/ano1882/DAOAbstractTransformerTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
public class DAOAbstractTransformerTest {
@@ -38,7 +38,7 @@
@Test
public void testAno1882() throws Exception {
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
FrenchCompanyTopiaDao dao = transaction.getFrenchCompanyDao();
SIRETTopiaDao siretDAO = transaction.getSIRETDao();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/CascadeSaveTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -28,7 +28,7 @@
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
/**
* @author Arnaud Thimel : thimel(a)codelutin.com
@@ -47,7 +47,7 @@
@Test
public void testSaveCascade() {
- TopiaTestTopiaPersistenceContext persistenceContext = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext persistenceContext = db.beginTransaction();
CompanyTopiaDao companyDao = persistenceContext.getCompanyDao();
DepartmentTopiaDao departmentDao = persistenceContext.getDepartmentDao();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/EnumTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.junit.Test;
import org.nuiton.topia.it.legacy.TopiaDatabase;
import org.nuiton.topia.persistence.TopiaException;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
/**
* Test the support of possibility to have an attribute of type enumeration
@@ -50,7 +50,7 @@
*/
@Test
public void storeEntityWithEnumValue() throws TopiaException {
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
PersonneTopiaDao dao = transaction.getPersonneDao();
Personne personne = new PersonneImpl();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/it/legacy/topiatest/deletetest/DeleteEntityTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -31,7 +31,7 @@
import org.junit.Test;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.topiatest.Gender;
import org.nuiton.topia.it.legacy.topiatest.Personne;
import org.nuiton.topia.it.legacy.topiatest.PersonneTopiaDao;
@@ -42,7 +42,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-it-legacy.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
@@ -66,7 +66,7 @@
public void testDeleteEntityWithInheritance() throws TopiaException {
log.debug("START TEST : testDeleteEntityWithInheritance");
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
log.debug("DAO : PersonneDAO");
PersonneTopiaDao dao = transaction.getPersonneDao();
@@ -117,7 +117,7 @@
public void testDeleteEntityWithManyToManyRelation() throws TopiaException {
log.debug("START TEST : testDeleteEntityWithManyToManyRelation");
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
PersonneTopiaDao dao = transaction.getPersonneDao();
@@ -168,7 +168,7 @@
public void testIsPersisted() {
log.debug("START TEST : testIsPersisted");
- TopiaTestTopiaPersistenceContext transaction = db.beginTransaction();
+ TopiaItLegacyTopiaPersistenceContext transaction = db.beginTransaction();
PersonneTopiaDao dao = transaction.getPersonneDao();
Modified: trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java
===================================================================
--- trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-it/src/test/java/org/nuiton/topia/persistence/internal/TopiaDaoTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -33,7 +33,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.nuiton.topia.it.legacy.TopiaDatabase;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaPersistenceContext;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaPersistenceContext;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonTopiaDao;
@@ -52,7 +52,7 @@
@Rule
public final TopiaDatabase db = new TopiaDatabase();
- protected TopiaTestTopiaPersistenceContext context;
+ protected TopiaItLegacyTopiaPersistenceContext context;
protected PersonTopiaDao dao;
Modified: trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java
===================================================================
--- trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -26,11 +26,11 @@
import org.apache.commons.logging.Log;
import org.junit.Assert;
+import org.nuiton.topia.it.legacy.TopiaItLegacyTopiaApplicationContext;
import org.nuiton.topia.persistence.TopiaApplicationContext;
import org.nuiton.topia.persistence.TopiaDaoSupplier;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.TopiaPersistenceContext;
-import org.nuiton.topia.it.legacy.TopiaTestTopiaApplicationContext;
import org.nuiton.topia.persistence.TopiaDao;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
@@ -85,7 +85,7 @@
protected static final Function<Properties,TopiaApplicationContext> CREATE_TOPIA_TEST_APPLICATION_CONTEXT = new Function<Properties, TopiaApplicationContext>() {
@Override
public TopiaApplicationContext apply(Properties input) {
- return new TopiaTestTopiaApplicationContext(input);
+ return new TopiaItLegacyTopiaApplicationContext(input);
}
};
Modified: trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationOperationTest.java
===================================================================
--- trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationOperationTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationOperationTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -35,7 +35,7 @@
import org.nuiton.topia.persistence.TopiaApplicationContextCache;
import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.it.TopiaConfigurationHelper;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonImpl;
import org.nuiton.topia.it.legacy.test.entities.Pet;
@@ -69,9 +69,9 @@
LogFactory.getLog(TopiaReplicationOperationTest.class);
protected static final TopiaEntityEnum[] contracts = {
- TopiaTestEntityEnum.Person,
- TopiaTestEntityEnum.Pet,
- TopiaTestEntityEnum.Race
+ TopiaItLegacyEntityEnum.Person,
+ TopiaItLegacyEntityEnum.Pet,
+ TopiaItLegacyEntityEnum.Race
};
protected static final String entitiesList =
@@ -158,14 +158,14 @@
public void testCreateOperation_nullPhase() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true);
- getModelBuilder().createOperation(model, TopiaTestEntityEnum.Pet, null, null);
+ getModelBuilder().createOperation(model, TopiaItLegacyEntityEnum.Pet, null, null);
}
@Test(expected = NullPointerException.class)
public void testCreateOperation_nullOperationClass() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true);
- getModelBuilder().createOperation(model, TopiaTestEntityEnum.Pet, ReplicationOperationPhase.before, null);
+ getModelBuilder().createOperation(model, TopiaItLegacyEntityEnum.Pet, ReplicationOperationPhase.before, null);
}
@Test(expected = IllegalArgumentException.class)
@@ -173,7 +173,7 @@
model = getModelBuilder().createModel(sourceContext, contracts, true);
// le noeud Pet n'existe pas
- getModelBuilder().addAfterOperation(model, TopiaTestEntityEnum.Pet, Duplicate.class);
+ getModelBuilder().addAfterOperation(model, TopiaItLegacyEntityEnum.Pet, Duplicate.class);
}
@Test(expected = IllegalArgumentException.class)
@@ -181,87 +181,87 @@
model = getModelBuilder().createModel(sourceContext, contracts, true);
// le noeud Pet n'existe pas
- getModelBuilder().addAfterOperation(model, TopiaTestEntityEnum.Pet, UnregistredOperation.class);
+ getModelBuilder().addAfterOperation(model, TopiaItLegacyEntityEnum.Pet, UnregistredOperation.class);
}
@Test
// @Test(expected = UnsupportedOperationException.class)
public void testCreateSupportedBeforeOperation_Duplicate() throws Exception {
- createSupportedBeforeOperation(TopiaTestEntityEnum.Person, person, Duplicate.class);
+ createSupportedBeforeOperation(TopiaItLegacyEntityEnum.Person, person, Duplicate.class);
}
// @Test(expected = UnsupportedOperationException.class)
// public void testCreateUnsupportedBeforeOperation_AttachAssociation() throws Exception {
-// createUnsupportedBeforeOperation(TopiaTestEntityEnum.Person, person, AttachAssociation.class);
+// createUnsupportedBeforeOperation(TopiaItLegacyEntityEnum.Person, person, AttachAssociation.class);
// }
@Test
// @Test(expected = UnsupportedOperationException.class)
public void testCreateSupportedBeforeOperation_DetachAssociation() throws Exception {
- createSupportedBeforeOperation(TopiaTestEntityEnum.Person, person, DettachAssociation.class);
+ createSupportedBeforeOperation(TopiaItLegacyEntityEnum.Person, person, DettachAssociation.class);
}
@Test
// @Test(expected = UnsupportedOperationException.class)
public void testCreateSupportedAfterOperation_Duplicate() throws Exception {
- createSupportedAfterOperation(TopiaTestEntityEnum.Person, person, Duplicate.class);
+ createSupportedAfterOperation(TopiaItLegacyEntityEnum.Person, person, Duplicate.class);
}
// @Test(expected = UnsupportedOperationException.class)
// public void testCreateSupportedAfterOperation_AttachAssociation() throws Exception {
-// createUnsupportedAfterOperation(TopiaTestEntityEnum.Person, person, AttachAssociation.class);
+// createUnsupportedAfterOperation(TopiaItLegacyEntityEnum.Person, person, AttachAssociation.class);
// }
@Test
// @Test(expected = UnsupportedOperationException.class)
public void testCreateSupportedAfterOperation_DetachAssociation() throws Exception {
- createSupportedAfterOperation(TopiaTestEntityEnum.Person, person, DettachAssociation.class);
+ createSupportedAfterOperation(TopiaItLegacyEntityEnum.Person, person, DettachAssociation.class);
}
// @Test(expected = UnsupportedOperationException.class)
// public void testCreateUnsupportedBeforeOperation_UncreatableOperation() throws Exception {
-// createUnsupportedBeforeOperation(TopiaTestEntityEnum.Person, person, UncreatableOperation.class);
+// createUnsupportedBeforeOperation(TopiaItLegacyEntityEnum.Person, person, UncreatableOperation.class);
// }
// @Test(expected = UnsupportedOperationException.class)
// public void testCreateUnsupportedAfterOperation_UncreatableOperation() throws Exception {
-// createUnsupportedAfterOperation(TopiaTestEntityEnum.Person, person, UncreatableOperation.class);
+// createUnsupportedAfterOperation(TopiaItLegacyEntityEnum.Person, person, UncreatableOperation.class);
// }
@Test(expected = IllegalArgumentException.class)
public void testCreateOperation_wrongParameterNumber() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true, pet.getTopiaId());
- getModelBuilder().addBeforeOperation(model, TopiaTestEntityEnum.Pet, FakeOperation.class);
+ getModelBuilder().addBeforeOperation(model, TopiaItLegacyEntityEnum.Pet, FakeOperation.class);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateOperation_wrongParameterNumber2() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true, pet.getTopiaId());
- getModelBuilder().addBeforeOperation(model, TopiaTestEntityEnum.Pet, FakeOperation.class, String.class, String.class);
+ getModelBuilder().addBeforeOperation(model, TopiaItLegacyEntityEnum.Pet, FakeOperation.class, String.class, String.class);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateOperation_wrongParameterType() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true, pet.getTopiaId());
- getModelBuilder().addBeforeOperation(model, TopiaTestEntityEnum.Pet, FakeOperation.class, Integer.class);
+ getModelBuilder().addBeforeOperation(model, TopiaItLegacyEntityEnum.Pet, FakeOperation.class, Integer.class);
}
@Test(expected = IllegalArgumentException.class)
public void testCreateOperation_nullParameter() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true, pet.getTopiaId());
- getModelBuilder().addBeforeOperation(model, TopiaTestEntityEnum.Pet, FakeOperation.class, (Object) null);
+ getModelBuilder().addBeforeOperation(model, TopiaItLegacyEntityEnum.Pet, FakeOperation.class, (Object) null);
}
@Test
public void testCreateOperation() throws Exception {
model = getModelBuilder().createModel(sourceContext, contracts, true, pet.getTopiaId());
- getModelBuilder().addBeforeOperation(model, TopiaTestEntityEnum.Pet, FakeOperation.class, "before");
- getModelBuilder().addAfterOperation(model, TopiaTestEntityEnum.Race, FakeOperation.class, "after");
+ getModelBuilder().addBeforeOperation(model, TopiaItLegacyEntityEnum.Pet, FakeOperation.class, "before");
+ getModelBuilder().addAfterOperation(model, TopiaItLegacyEntityEnum.Race, FakeOperation.class, "after");
}
@Test(expected = NullPointerException.class)
Modified: trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplAllTest.java
===================================================================
--- trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplAllTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplAllTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -36,7 +36,7 @@
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.it.TopiaConfigurationHelper;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonImpl;
import org.nuiton.topia.it.legacy.test.entities.Pet;
@@ -64,9 +64,9 @@
private static final Log log = LogFactory.getLog(TopiaReplicationServiceImplTest.class);
protected static final TopiaEntityEnum[] contracts = {
- TopiaTestEntityEnum.Person,
- TopiaTestEntityEnum.Pet,
- TopiaTestEntityEnum.Race
+ TopiaItLegacyEntityEnum.Person,
+ TopiaItLegacyEntityEnum.Pet,
+ TopiaItLegacyEntityEnum.Race
};
protected static final String entitiesList =
@@ -147,7 +147,7 @@
@Override
public void testDetectAssociations() throws Exception {
- detectAssociations(person, TopiaTestEntityEnum.Person, Person.PROPERTY_PET);
+ detectAssociations(person, TopiaItLegacyEntityEnum.Person, Person.PROPERTY_PET);
detectAssociations(race);
detectAssociations(pet);
@@ -165,7 +165,7 @@
detectDirectDependencies(person);
detectDirectDependencies(race);
- detectDirectDependencies(pet, TopiaTestEntityEnum.Pet, Pet.PROPERTY_PERSON, TopiaTestEntityEnum.Pet, Pet.PROPERTY_RACE);
+ detectDirectDependencies(pet, TopiaItLegacyEntityEnum.Pet, Pet.PROPERTY_PERSON, TopiaItLegacyEntityEnum.Pet, Pet.PROPERTY_RACE);
detectDirectDependencies(person2);
detectDirectDependencies(race2);
@@ -178,12 +178,12 @@
@Override
public void testDetectShell() throws Exception {
- detectShell(person, TopiaTestEntityEnum.Pet, TopiaTestEntityEnum.Race);
+ detectShell(person, TopiaItLegacyEntityEnum.Pet, TopiaItLegacyEntityEnum.Race);
detectShell(race);
- detectShell(pet, TopiaTestEntityEnum.Person, TopiaTestEntityEnum.Race);
- detectShell(person2, TopiaTestEntityEnum.Pet, TopiaTestEntityEnum.Race);
+ detectShell(pet, TopiaItLegacyEntityEnum.Person, TopiaItLegacyEntityEnum.Race);
+ detectShell(person2, TopiaItLegacyEntityEnum.Pet, TopiaItLegacyEntityEnum.Race);
detectShell(race2);
- detectShell(pet2, TopiaTestEntityEnum.Person, TopiaTestEntityEnum.Race);
+ detectShell(pet2, TopiaItLegacyEntityEnum.Person, TopiaItLegacyEntityEnum.Race);
}
// @Ignore
@@ -193,7 +193,7 @@
public void testDetectDependencies() throws Exception {
detectDependencies(null,
- new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Race}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Person}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Pet});
+ new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Race}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Person}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Pet});
}
// @Ignore
@@ -202,7 +202,7 @@
@Override
public void testDetectObjectsToDettach() throws Exception {
- detectObjectsToDettach(null, TopiaTestEntityEnum.Person, new String[]{Person.PROPERTY_PET});
+ detectObjectsToDettach(null, TopiaItLegacyEntityEnum.Person, new String[]{Person.PROPERTY_PET});
}
// @Ignore
Modified: trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplTest.java
===================================================================
--- trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplTest.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/TopiaReplicationServiceImplTest.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -36,7 +36,7 @@
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.it.TopiaConfigurationHelper;
-import org.nuiton.topia.it.legacy.TopiaTestEntityEnum;
+import org.nuiton.topia.it.legacy.TopiaItLegacyEntityEnum;
import org.nuiton.topia.it.legacy.test.entities.Person;
import org.nuiton.topia.it.legacy.test.entities.PersonImpl;
import org.nuiton.topia.it.legacy.test.entities.Pet;
@@ -70,7 +70,7 @@
private static final Log log =
LogFactory.getLog(TopiaReplicationServiceImplTest.class);
- protected static final TopiaEntityEnum[] contracts = {TopiaTestEntityEnum.Person, TopiaTestEntityEnum.Pet, TopiaTestEntityEnum.Race};
+ protected static final TopiaEntityEnum[] contracts = {TopiaItLegacyEntityEnum.Person, TopiaItLegacyEntityEnum.Pet, TopiaItLegacyEntityEnum.Race};
protected static final String entitiesList = PersonImpl.class.getName() + "," + PetImpl.class.getName() + "," + RaceImpl.class.getName();
@@ -148,7 +148,7 @@
@Override
public void testDetectAssociations() throws Exception {
- detectAssociations(person, TopiaTestEntityEnum.Person, Person.PROPERTY_PET);
+ detectAssociations(person, TopiaItLegacyEntityEnum.Person, Person.PROPERTY_PET);
detectAssociations(race);
detectAssociations(pet);
@@ -163,7 +163,7 @@
detectDirectDependencies(person);
detectDirectDependencies(race);
- detectDirectDependencies(pet, TopiaTestEntityEnum.Pet, Pet.PROPERTY_PERSON, TopiaTestEntityEnum.Pet, Pet.PROPERTY_RACE);
+ detectDirectDependencies(pet, TopiaItLegacyEntityEnum.Pet, Pet.PROPERTY_PERSON, TopiaItLegacyEntityEnum.Pet, Pet.PROPERTY_RACE);
detectDirectDependencies(person2);
detectDirectDependencies(race2);
@@ -174,9 +174,9 @@
@Override
public void testDetectShell() throws Exception {
- detectShell(person, TopiaTestEntityEnum.Pet, TopiaTestEntityEnum.Race);
+ detectShell(person, TopiaItLegacyEntityEnum.Pet, TopiaItLegacyEntityEnum.Race);
detectShell(race);
- detectShell(pet, TopiaTestEntityEnum.Person, TopiaTestEntityEnum.Race);
+ detectShell(pet, TopiaItLegacyEntityEnum.Person, TopiaItLegacyEntityEnum.Race);
detectShell(person2);
detectShell(race2);
detectShell(pet2);
@@ -186,22 +186,22 @@
@Override
public void testDetectDependencies() throws Exception {
- detectDependencies(person, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Race}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Person}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Pet});
- detectDependencies(race, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Race});
- detectDependencies(pet, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Race}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Person}, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Pet});
+ detectDependencies(person, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Race}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Person}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Pet});
+ detectDependencies(race, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Race});
+ detectDependencies(pet, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Race}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Person}, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Pet});
- detectDependencies(person2, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Person});
- detectDependencies(race2, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Race});
- detectDependencies(pet2, new TopiaTestEntityEnum[]{TopiaTestEntityEnum.Pet});
+ detectDependencies(person2, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Person});
+ detectDependencies(race2, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Race});
+ detectDependencies(pet2, new TopiaItLegacyEntityEnum[]{TopiaItLegacyEntityEnum.Pet});
}
@Test
@Override
public void testDetectObjectsToDettach() throws Exception {
- detectObjectsToDettach(person, TopiaTestEntityEnum.Person, new String[]{Person.PROPERTY_PET});
+ detectObjectsToDettach(person, TopiaItLegacyEntityEnum.Person, new String[]{Person.PROPERTY_PET});
detectObjectsToDettach(race);
- detectObjectsToDettach(pet, TopiaTestEntityEnum.Person, new String[]{Person.PROPERTY_PET});
+ detectObjectsToDettach(pet, TopiaItLegacyEntityEnum.Person, new String[]{Person.PROPERTY_PET});
detectObjectsToDettach(person2);
detectObjectsToDettach(race2);
@@ -233,18 +233,18 @@
@Override
public void testDoReplicate() throws Exception {
- doReplicate(TopiaTestEntityEnum.Person, person);
- doReplicate(TopiaTestEntityEnum.Person, person2);
- doReplicate(TopiaTestEntityEnum.Person, person, person2);
+ doReplicate(TopiaItLegacyEntityEnum.Person, person);
+ doReplicate(TopiaItLegacyEntityEnum.Person, person2);
+ doReplicate(TopiaItLegacyEntityEnum.Person, person, person2);
- doReplicate(TopiaTestEntityEnum.Pet, pet);
- doReplicate(TopiaTestEntityEnum.Pet, pet2);
- doReplicate(TopiaTestEntityEnum.Pet, pet, pet2, pet3);
- doReplicate(TopiaTestEntityEnum.Pet, person2, pet3);
+ doReplicate(TopiaItLegacyEntityEnum.Pet, pet);
+ doReplicate(TopiaItLegacyEntityEnum.Pet, pet2);
+ doReplicate(TopiaItLegacyEntityEnum.Pet, pet, pet2, pet3);
+ doReplicate(TopiaItLegacyEntityEnum.Pet, person2, pet3);
- doReplicate(TopiaTestEntityEnum.Race, race);
- doReplicate(TopiaTestEntityEnum.Race, race2);
- doReplicate(TopiaTestEntityEnum.Race, race, race2);
+ doReplicate(TopiaItLegacyEntityEnum.Race, race);
+ doReplicate(TopiaItLegacyEntityEnum.Race, race2);
+ doReplicate(TopiaItLegacyEntityEnum.Race, race, race2);
}
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -258,7 +258,12 @@
Iterator<ObjectModelAttribute> itr = list.iterator();
while (itr.hasNext()) {
ObjectModelAttribute attr = itr.next();
- String attrName = attr.getName();
+ String attrName;
+ if (!attr.hasAssociationClass()) {
+ attrName = attr.getName();
+ } else {
+ attrName = TopiaGeneratorUtil.getAssocAttrName(attr);
+ }
boolean hasNext = itr.hasNext();
initCode.append(""
/*{ <%=clazzName%>.<%=getConstantName(attrName)%><%=(hasNext?",\n":"")%>}*/
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -945,7 +945,7 @@
addParameter(op, assocClassFQN, "value");
setOperationBody(op, ""
/*{
- E result = findByProperty(<%=clazzName + "." + assocPropertyConstantName%>, value);
+ E result = forProperties(<%=clazzName + "." + assocPropertyConstantName%>, value).findAnyOrNull();
return result;
}*/
);
@@ -957,7 +957,7 @@
addParameter(op, assocClassFQN, "value");
setOperationBody(op, ""
/*{
- List<E> result = findAllByProperty(<%=clazzName + "." + assocPropertyConstantName%>, value);
+ List<E> result = forProperties(<%=clazzName + "." + assocPropertyConstantName%>, value).findAll();
return result;
}*/
);
@@ -1199,26 +1199,28 @@
);
}
} else if (attr.hasAssociationClass()) {
- String assocAttrName = TopiaGeneratorUtil.getAssocAttrName(attr);
- String ref = "e." + getJavaBeanMethodName("get", assocAttrName);
if (!TopiaGeneratorUtil.isNMultiplicity(attr)) {
+ String assocAttrName = TopiaGeneratorUtil.getAssocAttrName(attr);
+ String entityAbstractName = TopiaGeneratorUtil.getEntityAbstractName(input);
+ // Use the protected access to entity field
body.append(""
/*{
- if (<%=ref%> != null) {
- tmp.add(<%=ref%>);
+ <%=entityAbstractName%> entityAbstract = (<%=entityAbstractName%>)entity;
+ if (entityAbstract.<%=assocAttrName%> != null) {
+ tmp.add(entityAbstract.<%=assocAttrName%>);
}
}*/
);
} else {
ObjectModelAttribute reverse = attr.getReverseAttribute();
String reverseAttrName = reverse.getName();
- // On utilise pas l'attribut car il est potentiellement
- // pas a jour, car pour les asso avec cardinalité
+ // On utilise pas l'attribut car il n'est potentiellement
+ // pas à jour, car pour les asso avec cardinalité
// personne ne fait de add. Ce qui est normal, mais
- // pour pouvoir faire tout de meme des delete en cascade
+ // pour pouvoir faire tout de même des delete en cascade
// sur les asso, le champs est dans le mapping
// hibernate et donc il le faut aussi dans la classe
- // sinon hibernate rale lorsqu'il charge l'objet
+ // sinon hibernate râle lorsqu'il charge l'objet
// if (<%=ref%> != null) {
// tmp.addAll(<%=ref%>);
// }
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-03-14 14:15:54 UTC (rev 3030)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-03-14 16:31:08 UTC (rev 3031)
@@ -193,7 +193,7 @@
}
public static String getEntityAbstractName(ObjectModelClass input) {
- return "AbstractTopia" + input.getName();
+ return input.getName() + "Abstract";
}
public static String getEntityConcreteName(ObjectModelClass input) {
1
0
r3030 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal
by bleny@users.nuiton.org 14 Mar '14
by bleny@users.nuiton.org 14 Mar '14
14 Mar '14
Author: bleny
Date: 2014-03-14 15:15:54 +0100 (Fri, 14 Mar 2014)
New Revision: 3030
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3030
Log:
fixes #3120
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java 2014-03-14 13:25:07 UTC (rev 3029)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaDao.java 2014-03-14 14:15:54 UTC (rev 3030)
@@ -46,6 +46,7 @@
import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;
import org.nuiton.topia.persistence.TopiaQueryBuilderRunQueryStep;
+import org.nuiton.topia.persistence.support.TopiaHibernateSupport;
import org.nuiton.topia.persistence.support.TopiaJpaSupport;
import org.nuiton.topia.persistence.support.TopiaListenableSupport;
import org.nuiton.topia.persistence.support.TopiaSqlSupport;
@@ -92,6 +93,8 @@
protected TopiaJpaSupport topiaJpaSupport;
+ protected TopiaHibernateSupport topiaHibernateSupport;
+
protected TopiaSqlSupport topiaSqlSupport;
protected TopiaListenableSupport topiaListenableSupport;
@@ -112,6 +115,7 @@
*/
public void init(
TopiaJpaSupport topiaJpaSupport,
+ TopiaHibernateSupport topiaHibernateSupport,
TopiaSqlSupport topiaSqlSupport,
TopiaListenableSupport topiaListenableSupport,
TopiaIdFactory topiaIdFactory,
@@ -121,6 +125,7 @@
log.debug("init dao for " + getEntityClass());
}
this.topiaJpaSupport = topiaJpaSupport;
+ this.topiaHibernateSupport = topiaHibernateSupport;
this.topiaSqlSupport = topiaSqlSupport;
this.topiaListenableSupport = topiaListenableSupport;
this.topiaIdFactory = topiaIdFactory;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java 2014-03-14 13:25:07 UTC (rev 3029)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java 2014-03-14 14:15:54 UTC (rev 3030)
@@ -34,16 +34,16 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
+import org.nuiton.topia.persistence.TopiaDao;
+import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.persistence.TopiaReplicationDestination;
import org.nuiton.topia.persistence.internal.support.HibernateTopiaJpaSupport;
import org.nuiton.topia.persistence.internal.support.HibernateTopiaReplicationSupport;
import org.nuiton.topia.persistence.internal.support.HibernateTopiaSqlSupport;
import org.nuiton.topia.persistence.internal.support.TopiaFiresSupport;
-import org.nuiton.topia.persistence.TopiaDao;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.support.TopiaHibernateSupport;
import org.nuiton.topia.persistence.support.TopiaJpaSupport;
import org.nuiton.topia.persistence.support.TopiaListenableSupport;
@@ -277,7 +277,7 @@
}
@Override
- public <E extends TopiaEntity> void deleteAll(Iterable<E> entities) {
+ public <E extends TopiaEntity> void deleteAll(Iterable<E> entities) {
for (E entity : entities) {
delete(entity);
}
@@ -330,7 +330,7 @@
if (dao instanceof AbstractTopiaDao) {
AbstractTopiaDao abstractTopiaDao = (AbstractTopiaDao) dao;
- abstractTopiaDao.init(jpaSupport, sqlSupport, listenableSupport, topiaIdFactory, firesSupport, this);
+ abstractTopiaDao.init(jpaSupport, hibernateSupport, sqlSupport, listenableSupport, topiaIdFactory, firesSupport, this);
}
daoCache.put(entityClass, dao);
1
0
r3029 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by bleny@users.nuiton.org 14 Mar '14
by bleny@users.nuiton.org 14 Mar '14
14 Mar '14
Author: bleny
Date: 2014-03-14 14:25:07 +0100 (Fri, 14 Mar 2014)
New Revision: 3029
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3029
Log:
fixes #3118 add org.nuiton.topia.persistence.HqlAndParametersBuilder#addLike and #addNotLike
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-06 20:46:38 UTC (rev 3028)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2014-03-14 13:25:07 UTC (rev 3029)
@@ -179,6 +179,20 @@
whereClauses.add(":" + hqlParameterName + " not in elements(" + alias + "." + property + ")");
}
+ public void addLike(String property, String pattern) {
+ Preconditions.checkNotNull(pattern);
+ Preconditions.checkArgument(StringUtils.isNotEmpty(property));
+ String hqlParameterName = putHqlParameterWithAvailableName(property, pattern);
+ whereClauses.add(alias + "." + property + " like :" + hqlParameterName);
+ }
+
+ public void addNotLike(String property, String pattern) {
+ Preconditions.checkNotNull(pattern);
+ Preconditions.checkArgument(StringUtils.isNotEmpty(property));
+ String hqlParameterName = putHqlParameterWithAvailableName(property, pattern);
+ whereClauses.add(alias + "." + property + " not like :" + hqlParameterName);
+ }
+
public void addWhereClause(String whereClause) {
Preconditions.checkArgument(StringUtils.isNotBlank(whereClause));
whereClauses.add(whereClause);
1
0
06 Mar '14
Author: echatellier
Date: 2014-03-06 21:46:38 +0100 (Thu, 06 Mar 2014)
New Revision: 3028
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3028
Log:
Modified:
branches/3.0-hibernate43x/pom.xml
branches/3.0-hibernate43x/topia-it/pom.xml
branches/3.0-hibernate43x/topia-junit/pom.xml
branches/3.0-hibernate43x/topia-persistence/pom.xml
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaApplicationContext.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/HibernateProvider.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/TopiaConnectionProvider.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaHibernateEventListener.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaServiceSupportImpl.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/support/TopiaHibernateSupport.java
branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaUtil.java
branches/3.0-hibernate43x/topia-service-csv/pom.xml
branches/3.0-hibernate43x/topia-service-migration/pom.xml
branches/3.0-hibernate43x/topia-service-replication/pom.xml
branches/3.0-hibernate43x/topia-templates/
branches/3.0-hibernate43x/topia-templates/pom.xml
Modified: branches/3.0-hibernate43x/pom.xml
===================================================================
--- branches/3.0-hibernate43x/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -33,7 +33,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ToPIA</name>
@@ -241,7 +241,7 @@
<nuitonI18nVersion>3.0</nuitonI18nVersion>
<processorPluginVersion>1.3</processorPluginVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
- <hibernateVersion>4.2.8.Final</hibernateVersion>
+ <hibernateVersion>4.3.4.Final</hibernateVersion>
<sl4jVersion>1.7.6</sl4jVersion>
<h2Version>1.3.175</h2Version>
<hamcrestVersion>1.3</hamcrestVersion>
Modified: branches/3.0-hibernate43x/topia-it/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-it/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-it/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/3.0-hibernate43x/topia-junit/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-junit/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-junit/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/3.0-hibernate43x/topia-persistence/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaApplicationContext.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaApplicationContext.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaApplicationContext.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -283,16 +283,18 @@
@Override
public boolean isSchemaEmpty() {
- Configuration configuration = getHibernateProvider().getHibernateConfiguration();
+ /*Configuration configuration = getHibernateProvider().getHibernateConfiguration();
boolean result = TopiaUtil.isSchemaEmpty(configuration);
- return result;
+ return result;*/
+ return false;
}
@Override
public boolean isTableExists(Class<?> clazz) {
- Configuration configuration = getHibernateProvider().getHibernateConfiguration();
+ /*Configuration configuration = getHibernateProvider().getHibernateConfiguration();
boolean result = TopiaUtil.isSchemaExist(configuration, clazz.getName());
- return result;
+ return result;*/
+ return true;
}
@Override
@@ -310,7 +312,7 @@
}
// TODO brendan 11/10/13 reable event
// topiaFiresSupport.firePreCreateSchema(this);
- new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, false, true);
+ //new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, false, true);
// TODO brendan 11/10/13 reable event
// topiaFiresSupport.firePostCreateSchema(this);
} catch (HibernateException eee) {
@@ -323,8 +325,8 @@
@Override
public void showCreateSchema() {
try {
- new SchemaExport(getHibernateProvider().getHibernateConfiguration()).
- execute(true, false, false, true);
+ //new SchemaExport(getHibernateProvider().getHibernateConfiguration()).
+ // execute(true, false, false, true);
} catch (HibernateException eee) {
throw new TopiaException(
String.format("Could not show create schema for reason: %s",
@@ -343,8 +345,8 @@
// TODO brendan 11/10/13 reable event
// topiaFiresSupport.firePreUpdateSchema(this);
- new SchemaUpdate(getHibernateProvider().getHibernateConfiguration()).execute(showSchema,
- true);
+ //new SchemaUpdate(getHibernateProvider().getHibernateConfiguration()).execute(showSchema,
+ // true);
// topiaFiresSupport.firePostUpdateSchema(this);
} catch (HibernateException eee) {
throw new TopiaException(
@@ -363,7 +365,7 @@
// TODO brendan 11/10/13 reable event
// topiaFiresSupport.firePreDropSchema(this);
- new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, true, false);
+ //new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, true, false);
// topiaFiresSupport.firePostDropSchema(this);
} catch (HibernateException eee) {
throw new TopiaException(
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/AbstractTopiaPersistenceContext.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -188,10 +188,10 @@
return hibernateProvider.getSessionFactory();
}
- @Override
+ /*@Override
public Configuration getHibernateConfiguration() {
return hibernateProvider.getHibernateConfiguration();
- }
+ }*/
}
protected void startTransaction() throws TopiaException {
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/HibernateProvider.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/HibernateProvider.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/HibernateProvider.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -36,15 +36,16 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
+import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventType;
+import org.hibernate.metamodel.MetadataSources;
import org.hibernate.service.Service;
import org.hibernate.service.ServiceRegistry;
-import org.hibernate.service.ServiceRegistryBuilder;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
-import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.Stoppable;
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
import org.nuiton.topia.persistence.TopiaNotFoundException;
@@ -98,7 +99,7 @@
public List<Class<?>> getPersistentClasses() {
if (persistentClasses.isEmpty()) {
// Force configuration load
- getHibernateConfiguration();
+ //getHibernateConfiguration();
}
return persistentClasses;
}
@@ -203,7 +204,33 @@
}
return hibernateConfiguration;
}
+
+ public MetadataSources getMetaDataSources() {
+ if (metaSource == null) {
+ builder = new StandardServiceRegistryBuilder();
+ builder.applySettings(configuration);
+ standardServiceRegistry = builder.build();
+ metaSource = new MetadataSources( standardServiceRegistry);
+
+ String listPersistenceClasses = getProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, "");
+ String[] classes = listPersistenceClasses.split(",");
+ for (String classname : classes) {
+ classname = classname.trim();
+ if (StringUtils.isNotEmpty(classname)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load persistent class : " + classname);
+ }
+
+ String mappingResourceName = classname.replace( '.', '/' ) + ".hbm.xml";
+ metaSource.addResource(mappingResourceName);
+ }
+ }
+ }
+
+ return metaSource;
+ }
+
/**
* Method to get an Hibernate service instance from a given Hibernate SessionFactory
* <p/>
@@ -216,13 +243,13 @@
* @see org.hibernate.service.ServiceRegistry#getService(Class)
*/
protected static <S extends Service> S getHibernateService(SessionFactory sessionFactory, Class<S> serviceClass) {
- // Hibernate 4.2.x
- SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
- ServiceRegistryImplementor serviceRegistry = sessionFactoryImplementor.getServiceRegistry();
+// // Hibernate 4.2.x
+// SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
+// ServiceRegistryImplementor serviceRegistry = sessionFactoryImplementor.getServiceRegistry();
-// // Hibernate 4.3.x
-// SessionFactory.SessionFactoryOptions sessionFactoryOptions = sessionFactory.getSessionFactoryOptions();
-// StandardServiceRegistry serviceRegistry = sessionFactoryOptions.getServiceRegistry()
+ // Hibernate 4.3.x
+ SessionFactory.SessionFactoryOptions sessionFactoryOptions = sessionFactory.getSessionFactoryOptions();
+ StandardServiceRegistry serviceRegistry = sessionFactoryOptions.getServiceRegistry();
S result = serviceRegistry.getService(serviceClass);
return result;
@@ -233,6 +260,7 @@
// close connection provider if possible (http://nuiton.org/issues/2757)
ConnectionProvider service = getHibernateService(hibernateSessionFactory, ConnectionProvider.class);
+ // FIXME echatellier 20140301 : https://hibernate.atlassian.net/browse/HHH-8896
if (service instanceof Stoppable) {
Stoppable stoppable = (Stoppable) service;
stoppable.stop();
@@ -242,28 +270,34 @@
}
}
+ StandardServiceRegistryBuilder builder;
+ StandardServiceRegistry standardServiceRegistry;
+ MetadataSources metaSource;
+
public SessionFactory getSessionFactory() {
if (hibernateSessionFactory == null) {
- Properties properties = getHibernateConfiguration().getProperties();
+ //Properties properties = getHibernateConfiguration().getProperties();
// init service registry
// Hibernate 4.2.x
- ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(properties);
- ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
- hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(serviceRegistry);
+// ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(properties);
+// ServiceRegistry serviceRegistry = builder.buildServiceRegistry();
+// hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(serviceRegistry);
-// // Hibernate 4.3.x
-// StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
-// StandardServiceRegistry standardServiceRegistry = builder.applySettings(properties).build();
-// hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(standardServiceRegistry);
+ // Hibernate 4.3.x
+ //builder = new StandardServiceRegistryBuilder();
+ //StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+ //StandardServiceRegistry standardServiceRegistry = builder.applySettings(properties).build();
+ //hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(standardServiceRegistry);
+ hibernateSessionFactory = getMetaDataSources().buildMetadata().buildSessionFactory();
// we can't reuse original serviceRegistry instance
// we must call getServiceRegistry on factory to get a working one
- SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) hibernateSessionFactory;
- ServiceRegistry serviceRegistryInit = sessionFactoryImplementor.getServiceRegistry();
- EventListenerRegistry eventListenerRegistry = serviceRegistryInit.getService(EventListenerRegistry.class);
+ //SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) hibernateSessionFactory;
+ //ServiceRegistry serviceRegistryInit = sessionFactoryImplementor.getServiceRegistry();
+ EventListenerRegistry eventListenerRegistry = standardServiceRegistry.getService(EventListenerRegistry.class);
TopiaHibernateEventListener listener = new TopiaHibernateEventListener(sessionRegistry);
eventListenerRegistry.appendListeners(EventType.PRE_INSERT, listener);
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/TopiaConnectionProvider.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/TopiaConnectionProvider.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/TopiaConnectionProvider.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -24,26 +24,26 @@
* #L%
*/
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
+import org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator;
+import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.UnknownUnwrapTypeException;
-import org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.service.spi.Configurable;
import org.hibernate.service.spi.Stoppable;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
/**
* Customized connection provider.
* <p/>
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaHibernateEventListener.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaHibernateEventListener.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaHibernateEventListener.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -50,11 +50,11 @@
import org.hibernate.event.spi.SaveOrUpdateEventListener;
import org.hibernate.persister.entity.EntityPersister;
import org.nuiton.topia.persistence.TopiaDaoSupplier;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityContextable;
import org.nuiton.topia.persistence.TopiaException;
+import org.nuiton.topia.persistence.TopiaPersistenceContext;
import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
-import org.nuiton.topia.persistence.TopiaPersistenceContext;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaEntityContextable;
import com.google.common.base.Preconditions;
@@ -137,12 +137,12 @@
}
}
-// // Hibernate 4.3.x
-// @Override
-// public boolean requiresPostCommitHanding(EntityPersister persister) {
-// // TODO AThimel 17/12/13 I don't know what to return
-// return false;
-// }
+ // Hibernate 4.3.x
+ @Override
+ public boolean requiresPostCommitHanding(EntityPersister persister) {
+ // TODO AThimel 17/12/13 I don't know what to return
+ return true;
+ }
/* Chargement */
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaServiceSupportImpl.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaServiceSupportImpl.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/internal/support/TopiaServiceSupportImpl.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -56,7 +56,7 @@
public void init() {
preInitServices(this.services);
- applicationContext.getHibernateProvider().getHibernateConfiguration(); // force mapping loading
+ //applicationContext.getHibernateProvider().getHibernateConfiguration(); // force mapping loading
postInitServices(this.services);
}
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/support/TopiaHibernateSupport.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/support/TopiaHibernateSupport.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/support/TopiaHibernateSupport.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -49,6 +49,6 @@
/**
* @return Returns the Hibernate configuration
*/
- Configuration getHibernateConfiguration();
+ //Configuration getHibernateConfiguration();
}
Modified: branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaUtil.java
===================================================================
--- branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaUtil.java 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaUtil.java 2014-03-06 20:46:38 UTC (rev 3028)
@@ -40,14 +40,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table;
-import org.hibernate.service.ServiceRegistry;
-import org.hibernate.service.ServiceRegistryBuilder;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
import org.hibernate.tool.hbm2ddl.TableMetadata;
import org.nuiton.topia.persistence.TopiaConfigurationConstants;
@@ -178,7 +177,7 @@
try {
- Configuration configuration = topiaHibernateSupport.getHibernateConfiguration();
+ Configuration configuration = null;//topiaHibernateSupport.getHibernateConfiguration();
PersistentClass classMapping =
configuration.getClassMapping(entityName);
if (classMapping == null) {
@@ -392,7 +391,7 @@
ConnectionProviderSupplier connectionProviderSupplier = new ConnectionProviderSupplier(topiaHibernateSupport);
- Configuration configuration = topiaHibernateSupport.getHibernateConfiguration();
+ Configuration configuration = null; //topiaHibernateSupport.getHibernateConfiguration();
try {
@@ -496,51 +495,9 @@
/**
* Hibernate 4.2.x compatible Supplier<ConnectionProvider>
*/
- public static class ConnectionProviderSupplier implements Supplier<ConnectionProvider>, Closeable {
-
- protected ServiceRegistry serviceRegistry;
-
- protected ConnectionProvider connectionProvider;
-
- protected final boolean inlineRegistry;
-
- public ConnectionProviderSupplier(TopiaHibernateSupport topiaHibernateSupport) {
- inlineRegistry = false;
- SessionFactory sessionFactory = topiaHibernateSupport.getHibernateFactory();
- SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
- serviceRegistry = sessionFactoryImplementor.getServiceRegistry();
- }
-
- public ConnectionProviderSupplier(Configuration configuration) {
- inlineRegistry = true;
-
- Properties properties = configuration.getProperties();
- ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(properties);
- this.serviceRegistry = builder.buildServiceRegistry();
- }
-
- @Override
- public ConnectionProvider get() {
- if (connectionProvider == null) {
- connectionProvider = serviceRegistry.getService(ConnectionProvider.class);
- }
- return connectionProvider;
- }
-
- @Override
- public void close() throws IOException {
- if (inlineRegistry) {
- ServiceRegistryBuilder.destroy(serviceRegistry);
- }
- }
- }
-
-// /**
-// * Hibernate 4.3.x compatible Supplier<ConnectionProvider>
-// */
// public static class ConnectionProviderSupplier implements Supplier<ConnectionProvider>, Closeable {
//
-// protected StandardServiceRegistry standardServiceRegistry;
+// protected ServiceRegistry serviceRegistry;
//
// protected ConnectionProvider connectionProvider;
//
@@ -549,22 +506,22 @@
// public ConnectionProviderSupplier(TopiaHibernateSupport topiaHibernateSupport) {
// inlineRegistry = false;
// SessionFactory sessionFactory = topiaHibernateSupport.getHibernateFactory();
-// SessionFactory.SessionFactoryOptions sessionFactoryOptions = sessionFactory.getSessionFactoryOptions();
-// this.standardServiceRegistry = sessionFactoryOptions.getServiceRegistry();
+// SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sessionFactory;
+// serviceRegistry = sessionFactoryImplementor.getServiceRegistry();
// }
//
// public ConnectionProviderSupplier(Configuration configuration) {
// inlineRegistry = true;
//
-// StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
// Properties properties = configuration.getProperties();
-// this.standardServiceRegistry = builder.applySettings(properties).build();
+// ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(properties);
+// this.serviceRegistry = builder.buildServiceRegistry();
// }
//
// @Override
// public ConnectionProvider get() {
// if (connectionProvider == null) {
-// connectionProvider = standardServiceRegistry.getService(ConnectionProvider.class);
+// connectionProvider = serviceRegistry.getService(ConnectionProvider.class);
// }
// return connectionProvider;
// }
@@ -572,9 +529,51 @@
// @Override
// public void close() throws IOException {
// if (inlineRegistry) {
-// StandardServiceRegistryBuilder.destroy(standardServiceRegistry);
+// ServiceRegistryBuilder.destroy(serviceRegistry);
// }
// }
// }
+ /**
+ * Hibernate 4.3.x compatible Supplier<ConnectionProvider>
+ */
+ public static class ConnectionProviderSupplier implements Supplier<ConnectionProvider>, Closeable {
+
+ protected StandardServiceRegistry standardServiceRegistry;
+
+ protected ConnectionProvider connectionProvider;
+
+ protected final boolean inlineRegistry;
+
+ public ConnectionProviderSupplier(TopiaHibernateSupport topiaHibernateSupport) {
+ inlineRegistry = false;
+ SessionFactory sessionFactory = topiaHibernateSupport.getHibernateFactory();
+ SessionFactory.SessionFactoryOptions sessionFactoryOptions = sessionFactory.getSessionFactoryOptions();
+ this.standardServiceRegistry = sessionFactoryOptions.getServiceRegistry();
+ }
+
+ public ConnectionProviderSupplier(Configuration configuration) {
+ inlineRegistry = true;
+
+ StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+ Properties properties = configuration.getProperties();
+ this.standardServiceRegistry = builder.applySettings(properties).build();
+ }
+
+ @Override
+ public ConnectionProvider get() {
+ if (connectionProvider == null) {
+ connectionProvider = standardServiceRegistry.getService(ConnectionProvider.class);
+ }
+ return connectionProvider;
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (inlineRegistry) {
+ StandardServiceRegistryBuilder.destroy(standardServiceRegistry);
+ }
+ }
+ }
+
}
Modified: branches/3.0-hibernate43x/topia-service-csv/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-service-csv/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-service-csv/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/3.0-hibernate43x/topia-service-migration/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-service-migration/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-service-migration/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/3.0-hibernate43x/topia-service-replication/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-service-replication/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-service-replication/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Property changes on: branches/3.0-hibernate43x/topia-templates
___________________________________________________________________
Modified: svn:ignore
- target
*.ipr
*.iws
*.iml
.idea
+ target
*.ipr
*.iws
*.iml
.idea
.settings
.classpath
.project
Modified: branches/3.0-hibernate43x/topia-templates/pom.xml
===================================================================
--- branches/3.0-hibernate43x/topia-templates/pom.xml 2014-03-01 09:14:00 UTC (rev 3027)
+++ branches/3.0-hibernate43x/topia-templates/pom.xml 2014-03-06 20:46:38 UTC (rev 3028)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-hib-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: echatellier
Date: 2014-03-01 10:14:00 +0100 (Sat, 01 Mar 2014)
New Revision: 3027
Url: http://nuiton.org/projects/topia/repository/revisions/3027
Log:
Create branch on hibernate 4.3.x
Added:
branches/3.0-hibernate43x/
Property changes on: branches/3.0-hibernate43x
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0