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
May 2012
- 4 participants
- 135 discussions
23 May '12
Author: tchemit
Date: 2012-05-23 19:48:01 +0200 (Wed, 23 May 2012)
New Revision: 2520
Url: http://nuiton.org/repositories/revision/topia/2520
Log:
comment hibernate show sql
Modified:
trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties
Modified: trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties
===================================================================
--- trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties 2012-05-23 16:25:48 UTC (rev 2519)
+++ trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties 2012-05-23 17:48:01 UTC (rev 2520)
@@ -1,7 +1,7 @@
# Proprietes par defaut pour une base de donnees de type H2 et le model mapping
hibernate.hbm2ddl.auto=update
-hibernate.show_sql=true
-hibernate.format_sql=true
+#hibernate.show_sql=true
+#hibernate.format_sql=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
topia.use.hibernate.mapping.files=false
1
0
r2519 - in trunk/topia-persistence/src/main/java/org/nuiton/topia: . event framework
by athimel@users.nuiton.org 23 May '12
by athimel@users.nuiton.org 23 May '12
23 May '12
Author: athimel
Date: 2012-05-23 18:25:48 +0200 (Wed, 23 May 2012)
New Revision: 2519
Url: http://nuiton.org/repositories/revision/topia/2519
Log:
Improve TopiaContext javadoc (still in progress) ; Rename TopiaContextListener by TopiaSchemaListener
Added:
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPredicates.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-05-23 15:42:02 UTC (rev 2518)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -29,6 +29,7 @@
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.framework.TopiaH2Util;
@@ -53,52 +54,254 @@
*/
public interface TopiaContext {
- /* Adders */
+ /**
+ * Returns a new context containing its own transaction.
+ *
+ * @return new context with transaction
+ * @throws TopiaException if any exception
+ */
+ TopiaContext beginTransaction() throws TopiaException;
+ /**
+ * Applies all the modifications made to this context on the persistence
+ * device. Once commit is done, a new transaction is started.
+ *
+ * @throws TopiaException if any exception
+ */
+ void commitTransaction() throws TopiaException;
+
+ /**
+ * Cancels all the modifications made to this context, coming back to the
+ * state on the last beginTransaction. Once rollback is done, a new
+ * transaction is started.
+ *
+ * @throws TopiaException if any exception
+ */
+ void rollbackTransaction() throws TopiaException;
+
+ /**
+ * Closes the context. All the children contexts will be closed in the same
+ * time.
+ *
+ * @throws TopiaException if any exception
+ */
+ void closeContext() throws TopiaException;
+
+ /**
+ * Tells if the context is closed
+ *
+ * @return {@code true} if the context is closed, {@code false} otherwise
+ */
+ boolean isClosed();
+
+
+ /* TopiaEntityListener */
+
+ /**
+ * Register to the context a TopiaEntityListener about any TopiaEntity.
+ * <code>listener</code> instance will be notified AFTER any operation on
+ * the entity.
+ *
+ * @param listener the listener instance to register
+ */
void addTopiaEntityListener(TopiaEntityListener listener);
+ /**
+ * Register to the context a TopiaEntityListener about the given entity
+ * class. <code>listener</code> instance will be notified AFTER any
+ * operation on the entity.
+ *
+ * @param entityClass the TopiaEntity's class to listen
+ * @param listener the listener instance to register
+ */
void addTopiaEntityListener(
Class<? extends TopiaEntity> entityClass,
TopiaEntityListener listener);
+ /**
+ * Unregister the given TopiaEntityListener about any TopiaEntity from the
+ * context
+ *
+ * @param listener the listener instance to unregister
+ */
+ void removeTopiaEntityListener(TopiaEntityListener listener);
+
+ /**
+ * Unregister the given TopiaEntityListener about he given entity class from
+ * the context
+ *
+ * @param entityClass the listened TopiaEntity's class
+ * @param listener the listener instance to unregister
+ */
+ void removeTopiaEntityListener(
+ Class<? extends TopiaEntity> entityClass,
+ TopiaEntityListener listener);
+
+
+ /* TopiaEntityVetoable */
+
+ /**
+ * Register to the context a TopiaEntityVetoable about any TopiaEntity.
+ * <code>vetoable</code> instance will be notified BEFORE any operation on
+ * the entity.
+ *
+ * @param vetoable the vetoable instance to register
+ */
void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+ /**
+ * Register to the context a TopiaEntityVetoable about the given entity
+ * class. <code>vetoable</code> instance will be notified BEFORE any
+ * operation on the entity.
+ *
+ * @param entityClass the TopiaEntity's class to listen
+ * @param vetoable the vetoable instance to register
+ */
void addTopiaEntityVetoable(
Class<? extends TopiaEntity> entityClass,
TopiaEntityVetoable vetoable);
+ /**
+ * Unregister the given TopiaEntityVetoable about any TopiaEntity from the
+ * context
+ *
+ * @param vetoable the vetoable instance to unregister
+ */
+ void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+
+ /**
+ * Unregister the given TopiaEntityVetoable about he given entity class from
+ * the context
+ *
+ * @param entityClass the listened TopiaEntity's class
+ * @param vetoable the vetoable instance to unregister
+ */
+ void removeTopiaEntityVetoable(
+ Class<? extends TopiaEntity> entityClass,
+ TopiaEntityVetoable vetoable);
+
+
+ /* TopiaTransactionListener */
+
+ /**
+ * Register to the context a TopiaTransactionListener about the transaction.
+ * <code>listener</code> instance will be notified AFTER any operation on
+ * the transaction.
+ *
+ * @param listener the listener instance to register
+ */
void addTopiaTransactionListener(TopiaTransactionListener listener);
+ /**
+ * Unregister the given TopiaTransactionListener about the transaction from
+ * the context
+ *
+ * @param listener the listener instance to unregister
+ */
+ void removeTopiaTransactionListener(TopiaTransactionListener listener);
+
+ /* TopiaTransactionVetoable */
+
+ /**
+ * Register to the context a TopiaTransactionVetoable about the transaction.
+ * <code>vetoable</code> instance will be notified BEFORE any operation on
+ * the transaction.
+ *
+ * @param vetoable the vetoable instance to register
+ */
void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
+ /**
+ * Unregister the given TopiaTransactionVetoable about the transaction from
+ * the context
+ *
+ * @param vetoable the vetoable instance to unregister
+ */
+ void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
+
+
+ /* PropertyChangeListener */
+
+ /**
+ * Register to the context a PropertyChangeListener about some entity's
+ * property change. <code>listener</code> instance will be notified AFTER
+ * any change on the entity's property
+ *
+ * @param listener the listener instance to register
+ */
void addPropertyChangeListener(PropertyChangeListener listener);
+ /**
+ * Unregister the given PropertyChangeListener about some entity's
+ * property change from the context
+ *
+ * @param listener the listener instance to unregister
+ */
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+ /* TopiaSchemaListener */
+
+ /**
+ * Register to the context a TopiaSchemaListener about any schema
+ * modification. <code>listener</code> instance will be notified BEFORE and
+ * AFTER any change on the schema
+ *
+ * @param listener the listener instance to register
+ */
+ void addTopiaSchemaListener(TopiaSchemaListener listener);
+
+ /**
+ * Unregister the given TopiaSchemaListener about any schema modification
+ * from the context
+ *
+ * @param listener the listener instance to unregister
+ */
+ void removeTopiaSchemaListener(TopiaSchemaListener listener);
+
+
+ /* TopiaContextListener */
+
+ /**
+ * Register to the context a TopiaContextListener about any schema
+ * modification. <code>listener</code> instance will be notified BEFORE and
+ * AFTER any change on the schema
+ *
+ * @param listener the listener instance to register
+ * @deprecated Use addTopiaSchemaListener
+ */
+ @Deprecated
void addTopiaContextListener(TopiaContextListener listener);
- void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
+ /**
+ * Unregister the given TopiaContextListener about any schema modification
+ * from the context
+ *
+ * @param listener the listener instance to unregister
+ * @deprecated Use removeTopiaSchemaListener
+ */
+ @Deprecated
+ void removeTopiaContextListener(TopiaContextListener listener);
- /* Removers */
- void removeTopiaEntityListener(TopiaEntityListener listener);
- void removeTopiaEntityListener(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityListener listener);
+
- void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
- void removeTopiaEntityVetoable(
- Class<? extends TopiaEntity> entityClass,
- TopiaEntityVetoable vetoable);
- void removeTopiaTransactionListener(TopiaTransactionListener listener);
- void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable);
- void removePropertyChangeListener(PropertyChangeListener listener);
- void removeTopiaContextListener(TopiaContextListener listener);
+
+
+
+
+
+ /* TopiaEntitiesVetoable */
+
+ void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
+
void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable);
/**
@@ -154,28 +357,6 @@
void updateSchema() throws TopiaException;
/**
- * Return a new context containing his own transaction.
- *
- * @return new context with transaction
- * @throws TopiaException if any exception
- */
- TopiaContext beginTransaction() throws TopiaException;
-
- /**
- * applique les modifications apporté a ce context sur la base de données.
- *
- * @throws TopiaException if any exception
- */
- void commitTransaction() throws TopiaException;
-
- /**
- * annule les modifications apporté a ce context.
- *
- * @throws TopiaException if any exception
- */
- void rollbackTransaction() throws TopiaException;
-
- /**
* Retrieve {@link TopiaEntity} using its unique {@code id}.
*
* @param topiaId unique identifier of the entity in all the application.
@@ -342,21 +523,6 @@
throws TopiaException, IllegalArgumentException;
/**
- * Closes the context. All the child contexts will be closed in the same
- * time.
- *
- * @throws TopiaException if any exception
- */
- void closeContext() throws TopiaException;
-
- /**
- * Indique si le contexte a ete fermé.
- *
- * @return {@code true} si le context est fermé, {@code false} autrement
- */
- boolean isClosed();
-
- /**
* Execute a given sql code inside this transaction.
*
* @param sqlScript the sql script to execute
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java 2012-05-23 15:42:02 UTC (rev 2518)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextListener.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -25,62 +25,46 @@
package org.nuiton.topia.event;
-import java.util.EventListener;
-
/**
- * Listener for TopiaContext actions.
- * <p/>
- * Listener are notified for action such as :
- * <ul>
- * <li>createSchema</li>
- * <li>updateSchema</li>
- * <li>...</li>
- * </ul>
- *
- * @author chatellier <chatellier(a)codelutin.com>
- * @version $Id$
+ * @deprecated Use {@link TopiaSchemaListener}
*/
-public interface TopiaContextListener extends EventListener {
+@Deprecated
+public interface TopiaContextListener extends TopiaSchemaListener {
/**
- * Called before createSchema call
- *
- * @param event evet
+ * @deprecated Use {@link TopiaSchemaListener#preCreateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void preCreateSchema(TopiaContextEvent event);
/**
- * Called after createSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postCreateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postCreateSchema(TopiaContextEvent event);
/**
- * Called before updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#preUpdateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void preUpdateSchema(TopiaContextEvent event);
/**
- * Called after updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postUpdateSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postUpdateSchema(TopiaContextEvent event);
/**
- * Called after updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#preRestoreSchema(TopiaContextEvent)}
*/
+ @Deprecated
void preRestoreSchema(TopiaContextEvent event);
/**
- * Called after updateSchema call
- *
- * @param event event
+ * @deprecated Use {@link TopiaSchemaListener#postRestoreSchema(TopiaContextEvent)}
*/
+ @Deprecated
void postRestoreSchema(TopiaContextEvent event);
+
}
Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java (rev 0)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaSchemaListener.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -0,0 +1,62 @@
+package org.nuiton.topia.event;
+
+import java.util.EventListener;
+
+/**
+ * Listener for TopiaContext actions.
+ * <p/>
+ * Listener are notified for action such as :
+ * <ul>
+ * <li>createSchema</li>
+ * <li>updateSchema</li>
+ * <li>...</li>
+ * </ul>
+ *
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ * @version $Id: TopiaContextListener.java 2142 2010-11-18 16:17:42Z tchemit $
+ */
+public interface TopiaSchemaListener extends EventListener {
+
+ /**
+ * Called before createSchema call
+ *
+ * @param event event
+ */
+ void preCreateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after createSchema call
+ *
+ * @param event event
+ */
+ void postCreateSchema(TopiaContextEvent event);
+
+ /**
+ * Called before updateSchema call
+ *
+ * @param event event
+ */
+ void preUpdateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void postUpdateSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void preRestoreSchema(TopiaContextEvent event);
+
+ /**
+ * Called after updateSchema call
+ *
+ * @param event event
+ */
+ void postRestoreSchema(TopiaContextEvent event);
+
+}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-23 15:42:02 UTC (rev 2518)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -25,7 +25,6 @@
package org.nuiton.topia.framework;
-import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -49,6 +48,7 @@
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.persistence.TopiaDAO;
@@ -117,17 +117,6 @@
private static final Log log = LogFactory.getLog(TopiaContextImpl.class);
/**
- * Predicate to know if the given context is the root context
- */
- protected final static Predicate<TopiaContextImplementor> IS_ROOT_CONTEXT =
- new Predicate<TopiaContextImplementor>() {
- @Override
- public boolean apply(TopiaContextImplementor context) {
- return context.getParentContext() == null;
- }
- };
-
- /**
* This context's parent. Root contexts does not have a parent context
*/
protected TopiaContextImplementor parentContext;
@@ -489,7 +478,7 @@
"getDAO", "entityClass");
throw new IllegalArgumentException(message);
}
- if (IS_ROOT_CONTEXT.apply(this)) {
+ if (TopiaPredicates.IS_ROOT_CONTEXT.apply(this)) {
throw new TopiaException(
"You are on root context, you MUST open a transaction to perform any database access.");
}
@@ -600,7 +589,7 @@
@Override
public void commitTransaction() throws TopiaException {
- if (IS_ROOT_CONTEXT.apply(this)) {
+ if (TopiaPredicates.IS_ROOT_CONTEXT.apply(this)) {
String message = String.format("Operation '%s' is not permitted on root context", "commitTransaction");
throw new TopiaException(message);
}
@@ -628,7 +617,7 @@
@Override
public void rollbackTransaction() throws TopiaException {
- if (IS_ROOT_CONTEXT.apply(this)) {
+ if (TopiaPredicates.IS_ROOT_CONTEXT.apply(this)) {
String message = String.format("Operation '%s' is not permitted on root context", "rollbackTransaction");
throw new TopiaException(message);
}
@@ -670,7 +659,7 @@
}
}
- if (IS_ROOT_CONTEXT.apply(this)) {
+ if (TopiaPredicates.IS_ROOT_CONTEXT.apply(this)) {
if (entityManagerFactory != null) {
entityManagerFactory.close();
closed = true;
@@ -761,10 +750,15 @@
}
@Override
- public void addTopiaContextListener(TopiaContextListener listener) {
+ public void addTopiaSchemaListener(TopiaSchemaListener listener) {
getFiresSupport().addTopiaContextListener(listener);
}
+ @Override
+ public void addTopiaContextListener(TopiaContextListener listener) {
+ addTopiaSchemaListener(listener);
+ }
+
/* Listeners removers */
@Override
@@ -812,6 +806,11 @@
@Override
public void removeTopiaContextListener(TopiaContextListener listener) {
+ removeTopiaSchemaListener(listener);
+ }
+
+ @Override
+ public void removeTopiaSchemaListener(TopiaSchemaListener listener) {
getFiresSupport().removeTopiaContextListener(listener);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-23 15:42:02 UTC (rev 2518)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -28,32 +28,16 @@
import org.apache.commons.collections.map.IdentityMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-//import org.hibernate.event.PostDeleteEvent;
-//import org.hibernate.event.PostDeleteEventListener;
-//import org.hibernate.event.PostInsertEvent;
-//import org.hibernate.event.PostInsertEventListener;
-//import org.hibernate.event.PostLoadEvent;
-//import org.hibernate.event.PostLoadEventListener;
-//import org.hibernate.event.PostUpdateEvent;
-//import org.hibernate.event.PostUpdateEventListener;
-//import org.hibernate.event.PreDeleteEvent;
-//import org.hibernate.event.PreDeleteEventListener;
-//import org.hibernate.event.PreInsertEvent;
-//import org.hibernate.event.PreInsertEventListener;
-//import org.hibernate.event.PreLoadEvent;
-//import org.hibernate.event.PreLoadEventListener;
-//import org.hibernate.event.PreUpdateEvent;
-//import org.hibernate.event.PreUpdateEventListener;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaVetoException;
import org.nuiton.topia.event.TopiaContextEvent;
-import org.nuiton.topia.event.TopiaContextListener;
import org.nuiton.topia.event.TopiaEntitiesEvent;
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityEvent;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
+import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionEvent;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
@@ -126,8 +110,8 @@
/* Pour les actions du topia context */
- protected ListenerSet<TopiaContextListener> topiaContextListeners =
- new ListenerSet<TopiaContextListener>();
+ protected ListenerSet<TopiaSchemaListener> topiaSchemaListeners =
+ new ListenerSet<TopiaSchemaListener>();
/**
* used to register objects loaded during transaction.
@@ -769,7 +753,7 @@
log.debug("firePreCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaContextListener : topiaSchemaListeners) {
try {
topiaContextListener.preCreateSchema(event);
} catch (Exception eee) {
@@ -788,9 +772,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postCreateSchema(event);
+ topiaSchemaListener.postCreateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -807,9 +791,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preUpdateSchema(event);
+ topiaSchemaListener.preUpdateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -826,9 +810,9 @@
log.debug("firePostCreateSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postUpdateSchema(event);
+ topiaSchemaListener.postUpdateSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -845,9 +829,9 @@
log.debug("firePreRestoreSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.preRestoreSchema(event);
+ topiaSchemaListener.preRestoreSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -864,9 +848,9 @@
log.debug("firePostRestoreSchema");
}
TopiaContextEvent event = new TopiaContextEvent(context);
- for (TopiaContextListener topiaContextListener : topiaContextListeners) {
+ for (TopiaSchemaListener topiaSchemaListener : topiaSchemaListeners) {
try {
- topiaContextListener.postRestoreSchema(event);
+ topiaSchemaListener.postRestoreSchema(event);
} catch (Exception eee) {
throw new TopiaVetoException(eee);
}
@@ -918,8 +902,8 @@
return transactionVetoables;
}
- public ListenerSet<TopiaContextListener> getTopiaContextListeners() {
- return topiaContextListeners;
+ public ListenerSet<TopiaSchemaListener> getTopiaSchemaListeners() {
+ return topiaSchemaListeners;
}
public ListenerSet<TopiaEntitiesVetoable> getTopiaEntitiesVetoable() {
@@ -975,11 +959,11 @@
propertyChangeListeners.add(listener);
}
- public void addTopiaContextListener(TopiaContextListener listener) {
+ public void addTopiaContextListener(TopiaSchemaListener listener) {
if (listener == null) {
throw new NullPointerException("Listener can not be null.");
}
- topiaContextListeners.add(listener);
+ topiaSchemaListeners.add(listener);
}
public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
@@ -1038,11 +1022,11 @@
propertyChangeListeners.remove(listener);
}
- public void removeTopiaContextListener(TopiaContextListener listener) {
+ public void removeTopiaContextListener(TopiaSchemaListener listener) {
if (listener == null) {
throw new NullPointerException("Listener can not be null.");
}
- topiaContextListeners.remove(listener);
+ topiaSchemaListeners.remove(listener);
}
public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPredicates.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPredicates.java 2012-05-23 15:42:02 UTC (rev 2518)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPredicates.java 2012-05-23 16:25:48 UTC (rev 2519)
@@ -19,4 +19,17 @@
}
};
}
+
+
+ /**
+ * Predicate to know if the given context is the root context
+ */
+ public final static Predicate<TopiaContextImplementor> IS_ROOT_CONTEXT =
+ new Predicate<TopiaContextImplementor>() {
+ @Override
+ public boolean apply(TopiaContextImplementor context) {
+ return context.getParentContext() == null;
+ }
+ };
+
}
1
0
Author: tchemit
Date: 2012-05-23 17:42:02 +0200 (Wed, 23 May 2012)
New Revision: 2518
Url: http://nuiton.org/repositories/revision/topia/2518
Log:
- add logger in test
- move some methods to TopiaUtil
- fix mapping test
Added:
trunk/topia-persistence-tck/src/test/resources/log4j.properties
Modified:
trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test7/SimpleOneToManyOrderByTest.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceUtil.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaEntityHelper.java
trunk/topia-service-replication/src/main/java/org/nuiton/topia/replication/operation/AttachLink.java
trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -26,6 +26,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,6 +37,7 @@
import java.net.URL;
import java.util.Collection;
+import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
@@ -162,6 +164,33 @@
return result;
}
+ /**
+ * Construit la liste des topiaId d'une liste donnée d'entités.
+ *
+ * @param entities la liste des entités
+ * @return la liste des topiaId
+ */
+ public static List<String> getTopiaIdList(
+ List<? extends TopiaEntity> entities) {
+ List<String> ids = Lists.transform(entities,
+ TopiaFunctions.GET_TOPIA_ID);
+ return ids;
+ }
+
+ /**
+ * Construit un tableau des topiaId d'une liste donnée d'entités.
+ *
+ * @param entities la liste des entités
+ * @return le tableau des topiaId
+ * @since 2.5.2
+ */
+ public static String[] getTopiaIdArray(
+ List<? extends TopiaEntity> entities) {
+ List<String> list = getTopiaIdList(entities);
+ String[] ids = list.toArray(new String[list.size()]);
+ return ids;
+ }
+
// /**
// * Test si une entite donnee correspondant a une configuration existe en
// * base.
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -45,7 +45,6 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityAbstract;
import org.nuiton.topia.persistence.TopiaEntityContextable;
-import org.nuiton.topia.persistence.util.TopiaEntityHelper;
import java.util.ArrayList;
import java.util.Collection;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceUtil.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaPersistenceUtil.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -12,7 +12,6 @@
// no constructor for a util class
}
-
/**
* Obtain the *entity* contract from a given class.
* <p/>
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaEntityHelper.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaEntityHelper.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/util/TopiaEntityHelper.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -930,14 +930,12 @@
*
* @param entities la liste des entités
* @return la liste des topiaId
+ * @deprecated since 3.0, use instead {@link TopiaUtil#getTopiaIdList(List)}
*/
+ @Deprecated
public static List<String> getTopiaIdList(
List<? extends TopiaEntity> entities) {
- List<String> ids = new ArrayList<String>(entities.size());
- for (TopiaEntity entity : entities) {
- ids.add(entity.getTopiaId());
- }
- return ids;
+ return TopiaUtil.getTopiaIdList(entities);
}
/**
@@ -946,7 +944,9 @@
* @param entities la liste des entités
* @return le tableau des topiaId
* @since 2.5.2
+ * @deprecated since 3.0, use instead {@link TopiaUtil#getTopiaIdArray(List)}
*/
+ @Deprecated
public static String[] getTopiaIdArray(
List<? extends TopiaEntity> entities) {
String[] ids = new String[entities.size()];
@@ -996,8 +996,8 @@
DiffState.DiffStateMap result = DiffState.newMap();
// construction des deux listes d'id
- List<String> referentielIdList = getTopiaIdList(referentiel);
- List<String> localeIdList = getTopiaIdList(locale);
+ List<String> referentielIdList = TopiaUtil.getTopiaIdList(referentiel);
+ List<String> localeIdList = TopiaUtil.getTopiaIdList(locale);
for (E aReferentiel : referentiel) {
TopiaEntity referentielEntity = aReferentiel;
Modified: trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties
===================================================================
--- trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence-hibernate/src/test/resources/TopiaContext-mapping.properties 2012-05-23 15:42:02 UTC (rev 2518)
@@ -1,7 +1,7 @@
# Proprietes par defaut pour une base de donnees de type H2 et le model mapping
hibernate.hbm2ddl.auto=update
-hibernate.show_sql=false
-
+hibernate.show_sql=true
+hibernate.format_sql=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
topia.use.hibernate.mapping.files=false
Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test7/SimpleOneToManyOrderByTest.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test7/SimpleOneToManyOrderByTest.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test7/SimpleOneToManyOrderByTest.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -6,6 +6,7 @@
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.tck.mapping.AbstractMappingTest;
import java.util.Collection;
@@ -72,9 +73,11 @@
bsBis = Lists.newArrayList();
bsBis.add(b2);
bsBis.add(b);
- a.setB71(bsBis);
+ aBis.setB71(bsBis);
tx.commitTransaction();
+ ((TopiaContextImplementor)tx).getEntityManager().clear();
+
aBis = aDAO.findByTopiaId(a.getTopiaId());
Assert.assertEquals(a, aBis);
Assert.assertEquals(2, aBis.sizeB71());
@@ -89,9 +92,11 @@
bsBis.add(b3);
bsBis.add(b2);
bsBis.add(b);
- a.setB71(bsBis);
+ aBis.setB71(bsBis);
tx.commitTransaction();
+ ((TopiaContextImplementor)tx).getEntityManager().clear();
+
aBis = aDAO.findByTopiaId(a.getTopiaId());
Assert.assertEquals(a, aBis);
Assert.assertEquals(3, aBis.sizeB71());
Copied: trunk/topia-persistence-tck/src/test/resources/log4j.properties (from rev 2513, trunk/topia-persistence-hibernate/src/test/resources/log4j.properties)
===================================================================
--- trunk/topia-persistence-tck/src/test/resources/log4j.properties (rev 0)
+++ trunk/topia-persistence-tck/src/test/resources/log4j.properties 2012-05-23 15:42:02 UTC (rev 2518)
@@ -0,0 +1,34 @@
+###
+# #%L
+# ToPIA :: Persistence
+#
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2010 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+#This log is used to display trace in generation
+
+# Global logging configuration
+log4j.rootLogger=WARN, stdout
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+# package level
+log4j.logger.org.nuiton.topia=INFO
Modified: trunk/topia-service-replication/src/main/java/org/nuiton/topia/replication/operation/AttachLink.java
===================================================================
--- trunk/topia-service-replication/src/main/java/org/nuiton/topia/replication/operation/AttachLink.java 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-service-replication/src/main/java/org/nuiton/topia/replication/operation/AttachLink.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -29,16 +29,15 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.framework.TopiaUtil;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.util.EntityOperator;
import org.nuiton.topia.persistence.util.TopiaEntityHelper;
import org.nuiton.topia.replication.TopiaReplicationContext;
import org.nuiton.topia.replication.TopiaReplicationOperation;
import org.nuiton.topia.replication.model.ReplicationLink;
-import org.nuiton.topia.replication.model.ReplicationModel;
import org.nuiton.topia.replication.model.ReplicationNode;
import org.nuiton.topia.replication.model.ReplicationOperationDef;
-import org.nuiton.topia.replication.model.ReplicationOperationPhase;
import java.util.Collection;
import java.util.Collections;
@@ -62,9 +61,6 @@
* l'assocation et on retrouve les entities a partir d'un troisieme parametre
* qui donne le node source des entities sources.
* <p/>
- * Note : cette operation est interne, et n'est pas creable par l'utilisateur
- * via la methode {@link #register(ReplicationModel, ReplicationNode,
- * ReplicationOperationPhase, Object...)}.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.2.0
@@ -105,11 +101,11 @@
List<String> ownerIds = null;
if (ownerNode.equals(operationDef.getNode())) {
- ownerIds = TopiaEntityHelper.getTopiaIdList(nodeEntities);
+ ownerIds = TopiaUtil.getTopiaIdList(nodeEntities);
}
if (cibleNode.equals(operationDef.getNode())) {
- associationIds = TopiaEntityHelper.getTopiaIdList(nodeEntities);
+ associationIds = TopiaUtil.getTopiaIdList(nodeEntities);
}
if (ownerIds == null) {
@@ -182,7 +178,7 @@
List<String> dstTargetAssociationsId =
dstTargetEntities == null ?
Collections.<String>emptyList() :
- TopiaEntityHelper.getTopiaIdList(
+ TopiaUtil.getTopiaIdList(
(List<? extends TopiaEntity>) dstTargetEntities);
boolean shouldUpdate = false;
for (Object a : targetEntities) {
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 2012-05-23 14:23:29 UTC (rev 2517)
+++ trunk/topia-service-replication/src/test/java/org/nuiton/topia/replication/AbstractTopiaReplicationServiceTest.java 2012-05-23 15:42:02 UTC (rev 2518)
@@ -31,6 +31,7 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.framework.TopiaUtil;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
@@ -409,7 +410,7 @@
TopiaContext rootCtxt = createReplicateDb("doReplicate_" + contract);
- List<String> ids = TopiaEntityHelper.getTopiaIdList(Arrays.asList(entity));
+ List<String> ids = TopiaUtil.getTopiaIdList(Arrays.asList(entity));
getLog().info("entity " + ids);
prepareModel(ids.toArray(new String[ids.size()]));
@@ -461,7 +462,7 @@
TopiaContext rootCtxt = createReplicateDb("doReplicateWithComputedOrder");
- List<String> ids = TopiaEntityHelper.getTopiaIdList(Arrays.asList(entity));
+ List<String> ids = TopiaUtil.getTopiaIdList(Arrays.asList(entity));
prepareModelWithComputedOrder(ids.toArray(new String[ids.size()]));
1
0
Author: athimel
Date: 2012-05-23 16:23:29 +0200 (Wed, 23 May 2012)
New Revision: 2517
Url: http://nuiton.org/repositories/revision/topia/2517
Log:
topia-persistence-tck does not need to depend of junit in scope compile anymore
Modified:
trunk/topia-persistence-tck/pom.xml
Modified: trunk/topia-persistence-tck/pom.xml
===================================================================
--- trunk/topia-persistence-tck/pom.xml 2012-05-23 14:21:19 UTC (rev 2516)
+++ trunk/topia-persistence-tck/pom.xml 2012-05-23 14:23:29 UTC (rev 2517)
@@ -59,7 +59,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>compile</scope>
</dependency>
<dependency>
1
0
r2516 - in trunk: . topia-persistence-tck topia-persistence-tck/src/main/java/org/nuiton/topia topia-persistence-tck/src/test/java/org/nuiton/topia topia-persistence-tck/src/test/resources/META-INF/services
by athimel@users.nuiton.org 23 May '12
by athimel@users.nuiton.org 23 May '12
23 May '12
Author: athimel
Date: 2012-05-23 16:21:19 +0200 (Wed, 23 May 2012)
New Revision: 2516
Url: http://nuiton.org/repositories/revision/topia/2516
Log:
Fix TopiaContextFactoryTest
Added:
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/DummyPersistenceProvider.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java
trunk/topia-persistence-tck/src/test/resources/META-INF/services/javax.persistence.spi.PersistenceProvider
Removed:
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java
Modified:
trunk/pom.xml
trunk/topia-persistence-tck/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-05-23 13:51:23 UTC (rev 2515)
+++ trunk/pom.xml 2012-05-23 14:21:19 UTC (rev 2516)
@@ -77,6 +77,7 @@
<hibernateVersion>4.1.3.Final</hibernateVersion>
<sl4jVersion>1.6.4</sl4jVersion>
<h2Version>1.3.166</h2Version>
+ <mockitoVersion>1.9.0</mockitoVersion>
<geronimoJpaSpecVersion>1.1</geronimoJpaSpecVersion>
<!-- i18n configuration -->
@@ -189,6 +190,13 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockitoVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Modified: trunk/topia-persistence-tck/pom.xml
===================================================================
--- trunk/topia-persistence-tck/pom.xml 2012-05-23 13:51:23 UTC (rev 2515)
+++ trunk/topia-persistence-tck/pom.xml 2012-05-23 14:21:19 UTC (rev 2516)
@@ -68,6 +68,11 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+
</dependencies>
<build>
Deleted: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-23 13:51:23 UTC (rev 2515)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-23 14:21:19 UTC (rev 2516)
@@ -1,190 +0,0 @@
-/*
- * #%L
- * ToPIA :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.topia;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.nuiton.topia.framework.TopiaContextImpl;
-//import org.nuiton.topia.tck.TopiaDatabase;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Created: 8 mai 2010
- *
- * @author fdesbois <fdesbois(a)codelutin.com>
- * @version $Id$
- */
-public class TopiaContextFactoryTest {
-
- private static final Log log =
- LogFactory.getLog(TopiaContextFactoryTest.class);
-
- protected static File testBasedir;
-
- protected Properties properties;
-
- @BeforeClass
- public static void init() throws IOException {
-
-// testBasedir = TopiaDatabase.getTestSpecificDirectory(TopiaContextFactoryTest.class, "dummy");
-
- }
-
- @Before
- public void setUp() throws Exception {
- properties = new Properties();
- properties.setProperty("prop1", "value1");
- properties.setProperty("prop2", "value2");
- TopiaContextFactory.contextCache.clear();
- }
-
- @Test
- public void testGetContextOpened() throws Exception {
- log.debug("## testGetContextOpened");
-
- /** PREPARE DATA **/
- String databaseName = "h2data-testGetContextByPropertie";
- File dbDirectory = new File(testBasedir, databaseName);
- String url = "jdbc:h2:file:" + dbDirectory;
- properties.setProperty(TopiaContextFactory.CONFIG_URL, url);
-
- TopiaContextImpl test = new TopiaContextImpl(properties);
- TopiaContextFactory.contextCache.put(properties, test);
-
- /** EXEC METHOD **/
- List<String> result = TopiaContextFactory.getContextOpened();
- Assert.assertEquals(1, result.size());
- Assert.assertEquals(url, result.get(0));
- }
-
- @Test
- public void testRemoveContext() throws Exception {
- log.debug("## testRemoveContext");
-
- /** PREPARE DATA **/
- TopiaContextImpl test = new TopiaContextImpl(properties);
- TopiaContextFactory.contextCache.put(properties, test);
-
- /** EXEC METHOD **/
- TopiaContextFactory.removeContext(test);
- Assert.assertEquals(0, TopiaContextFactory.contextCache.size());
- }
-
- //@Test
-
- public void testGetContext() throws Exception {
- // TODO-fdesbois-20100508 : only used TopiaUtil.getProperties, need tests for this method
- }
-
- @Test
- public void testGetContextByProperties() throws Exception {
- log.debug("## testGetContextByProperties");
-
- /** PREPARE DATA **/
- Properties propertiesParent = new Properties(properties);
- propertiesParent.setProperty("prop3", "value3");
-
- Properties propertiesAll = new Properties();
- propertiesAll.setProperty("prop1", "value1");
- propertiesAll.setProperty("prop2", "value2");
- propertiesAll.setProperty("prop3", "value3");
-
- /** EXEC METHOD **/
-
- log.info("test 0 : add null properties");
- try {
- TopiaContextFactory.getContext(null);
- } catch (Exception eee) {
- Assert.assertEquals(NullPointerException.class, eee.getClass());
- }
-
- log.info("test 1 : add new properties, will instantiate a new" +
- " TopiaContext");
- TopiaContext test1 = TopiaContextFactory.getContext(propertiesParent);
- Assert.assertNotNull(test1);
- Assert.assertEquals(1, TopiaContextFactory.contextCache.size());
-
- log.info("test 2 : with same properties, will retrieve existing" +
- " TopiaContext");
- TopiaContext test2 = TopiaContextFactory.getContext(propertiesParent);
- Assert.assertEquals(test1, test2);
- Assert.assertEquals(1, TopiaContextFactory.contextCache.size());
-
- log.info("test 3 : use other properties, will instantiate a different" +
- "TopiaContext");
- TopiaContext test3 = TopiaContextFactory.getContext(properties);
- log.debug("cache size : " + TopiaContextFactory.contextCache.size());
- log.debug("result : " + test1);
- log.debug("result3 : " + test3);
- Assert.assertNotSame(test1, test3);
- Assert.assertEquals(2, TopiaContextFactory.contextCache.size());
-
- log.info("test 4 : use other properties but equivalent to existing " +
- "TopiaContext");
- // Test flating of properties
- TopiaContext test4 = TopiaContextFactory.getContext(propertiesAll);
- Assert.assertEquals(test1, test4);
- Assert.assertEquals(2, TopiaContextFactory.contextCache.size());
-
- log.info("test5a : reinstantiate new TopiaContext after one is closed.");
- // TEST
- // Strange behavior the closed flag of context stay true if
- // entityManagerFactory is not loaded from real properties
-// test1.closeContext();
-// Assert.assertTrue(test1.isClosed());
-
- // Add properties for Hibernate to have real opened topiaContext
- String databaseName = "h2data-testGetContextByPropertie";
- File f = new File(testBasedir, databaseName);
-
- properties.setProperty("hibernate.connection.username", "sa");
- properties.setProperty("hibernate.connection.password", "");
- properties.setProperty("hibernate.connection.driver_class", "org.h2.Driver");
- properties.setProperty("hibernate.connection.url",
- "jdbc:h2:file:" + f.getAbsolutePath());
-
-
- TopiaContext test5 = TopiaContextFactory.getContext(properties);
- Assert.assertNotSame(test1, test5);
- Assert.assertEquals(3, TopiaContextFactory.contextCache.size());
-
- log.info("test5b : beginTransaction to properly close the context");
- test5.beginTransaction();
-
- test5.closeContext();
-
- TopiaContext result = TopiaContextFactory.getContext(properties);
- Assert.assertNotSame(test5, result);
- Assert.assertEquals(3, TopiaContextFactory.contextCache.size());
- }
-}
Added: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/DummyPersistenceProvider.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/DummyPersistenceProvider.java (rev 0)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/DummyPersistenceProvider.java 2012-05-23 14:21:19 UTC (rev 2516)
@@ -0,0 +1,33 @@
+package org.nuiton.topia;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.mockito.Mockito;
+import org.nuiton.topia.framework.TopiaPersistenceProvider;
+import org.nuiton.topia.framework.TopiaSpecificUtil;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class DummyPersistenceProvider extends TopiaPersistenceProvider {
+
+ @Override
+ public Pair<EntityManagerFactory, TopiaSpecificUtil> configureSpecific(
+ String entityManagerName, Map<String, Object> properties, Set<Class<?>> entities) {
+
+ EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
+ EntityManager em = Mockito.mock(EntityManager.class);
+ EntityTransaction tx = Mockito.mock(EntityTransaction.class);
+
+ Mockito.when(emf.createEntityManager()).thenReturn(em);
+ Mockito.when(em.getTransaction()).thenReturn(tx);
+
+ return Pair.of(emf, null);
+ }
+
+}
Copied: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java (from rev 2514, trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java)
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java (rev 0)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-23 14:21:19 UTC (rev 2516)
@@ -0,0 +1,190 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.topia;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.topia.framework.TopiaContextImpl;
+import org.nuiton.topia.tck.TopiaDatabase;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Created: 8 mai 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ * @version $Id$
+ */
+public class TopiaContextFactoryTest {
+
+ private static final Log log =
+ LogFactory.getLog(TopiaContextFactoryTest.class);
+
+ protected static File testBasedir;
+
+ protected Properties properties;
+
+ @BeforeClass
+ public static void init() throws IOException {
+
+ testBasedir = TopiaDatabase.getTestSpecificDirectory(TopiaContextFactoryTest.class, "dummy");
+
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ properties = new Properties();
+ properties.setProperty("prop1", "value1");
+ properties.setProperty("prop2", "value2");
+ TopiaContextFactory.contextCache.clear();
+ }
+
+ @Test
+ public void testGetContextOpened() throws Exception {
+ log.debug("## testGetContextOpened");
+
+ /** PREPARE DATA **/
+ String databaseName = "h2data-testGetContextByPropertie";
+ File dbDirectory = new File(testBasedir, databaseName);
+ String url = "jdbc:h2:file:" + dbDirectory;
+ properties.setProperty(TopiaContextFactory.CONFIG_URL, url);
+
+ TopiaContextImpl test = new TopiaContextImpl(properties);
+ TopiaContextFactory.contextCache.put(properties, test);
+
+ /** EXEC METHOD **/
+ List<String> result = TopiaContextFactory.getContextOpened();
+ Assert.assertEquals(1, result.size());
+ Assert.assertEquals(url, result.get(0));
+ }
+
+ @Test
+ public void testRemoveContext() throws Exception {
+ log.debug("## testRemoveContext");
+
+ /** PREPARE DATA **/
+ TopiaContextImpl test = new TopiaContextImpl(properties);
+ TopiaContextFactory.contextCache.put(properties, test);
+
+ /** EXEC METHOD **/
+ TopiaContextFactory.removeContext(test);
+ Assert.assertEquals(0, TopiaContextFactory.contextCache.size());
+ }
+
+ //@Test
+
+ public void testGetContext() throws Exception {
+ // TODO-fdesbois-20100508 : only used TopiaUtil.getProperties, need tests for this method
+ }
+
+ @Test
+ public void testGetContextByProperties() throws Exception {
+ log.debug("## testGetContextByProperties");
+
+ /** PREPARE DATA **/
+ Properties propertiesParent = new Properties(properties);
+ propertiesParent.setProperty("prop3", "value3");
+
+ Properties propertiesAll = new Properties();
+ propertiesAll.setProperty("prop1", "value1");
+ propertiesAll.setProperty("prop2", "value2");
+ propertiesAll.setProperty("prop3", "value3");
+
+ /** EXEC METHOD **/
+
+ log.info("test 0 : add null properties");
+ try {
+ TopiaContextFactory.getContext(null);
+ } catch (Exception eee) {
+ Assert.assertEquals(NullPointerException.class, eee.getClass());
+ }
+
+ log.info("test 1 : add new properties, will instantiate a new" +
+ " TopiaContext");
+ TopiaContext test1 = TopiaContextFactory.getContext(propertiesParent);
+ Assert.assertNotNull(test1);
+ Assert.assertEquals(1, TopiaContextFactory.contextCache.size());
+
+ log.info("test 2 : with same properties, will retrieve existing" +
+ " TopiaContext");
+ TopiaContext test2 = TopiaContextFactory.getContext(propertiesParent);
+ Assert.assertEquals(test1, test2);
+ Assert.assertEquals(1, TopiaContextFactory.contextCache.size());
+
+ log.info("test 3 : use other properties, will instantiate a different" +
+ "TopiaContext");
+ TopiaContext test3 = TopiaContextFactory.getContext(properties);
+ log.debug("cache size : " + TopiaContextFactory.contextCache.size());
+ log.debug("result : " + test1);
+ log.debug("result3 : " + test3);
+ Assert.assertNotSame(test1, test3);
+ Assert.assertEquals(2, TopiaContextFactory.contextCache.size());
+
+ log.info("test 4 : use other properties but equivalent to existing " +
+ "TopiaContext");
+ // Test flating of properties
+ TopiaContext test4 = TopiaContextFactory.getContext(propertiesAll);
+ Assert.assertEquals(test1, test4);
+ Assert.assertEquals(2, TopiaContextFactory.contextCache.size());
+
+ log.info("test5a : reinstantiate new TopiaContext after one is closed.");
+ // TEST
+ // Strange behavior the closed flag of context stay true if
+ // entityManagerFactory is not loaded from real properties
+// test1.closeContext();
+// Assert.assertTrue(test1.isClosed());
+
+ // Add properties for Hibernate to have real opened topiaContext
+ String databaseName = "h2data-testGetContextByPropertie";
+ File f = new File(testBasedir, databaseName);
+
+ properties.setProperty("hibernate.connection.username", "sa");
+ properties.setProperty("hibernate.connection.password", "");
+ properties.setProperty("hibernate.connection.driver_class", "org.h2.Driver");
+ properties.setProperty("hibernate.connection.url",
+ "jdbc:h2:file:" + f.getAbsolutePath());
+
+
+ TopiaContext test5 = TopiaContextFactory.getContext(properties);
+ Assert.assertNotSame(test1, test5);
+ Assert.assertEquals(3, TopiaContextFactory.contextCache.size());
+
+ log.info("test5b : beginTransaction to properly close the context");
+ test5.beginTransaction();
+
+ test5.closeContext();
+
+ TopiaContext result = TopiaContextFactory.getContext(properties);
+ Assert.assertNotSame(test5, result);
+ Assert.assertEquals(3, TopiaContextFactory.contextCache.size());
+ }
+}
Property changes on: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/TopiaContextFactoryTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/topia-persistence-tck/src/test/resources/META-INF/services/javax.persistence.spi.PersistenceProvider (from rev 2515, trunk/topia-persistence-hibernate/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider)
===================================================================
--- trunk/topia-persistence-tck/src/test/resources/META-INF/services/javax.persistence.spi.PersistenceProvider (rev 0)
+++ trunk/topia-persistence-tck/src/test/resources/META-INF/services/javax.persistence.spi.PersistenceProvider 2012-05-23 14:21:19 UTC (rev 2516)
@@ -0,0 +1 @@
+org.nuiton.topia.DummyPersistenceProvider
\ No newline at end of file
1
0
r2515 - in trunk: topia-persistence/src/main/java/org/nuiton/topia/framework topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util
by tchemit@users.nuiton.org 23 May '12
by tchemit@users.nuiton.org 23 May '12
23 May '12
Author: tchemit
Date: 2012-05-23 15:51:23 +0200 (Wed, 23 May 2012)
New Revision: 2515
Url: http://nuiton.org/repositories/revision/topia/2515
Log:
fix getEntityByTopiaId
Modified:
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java 2012-05-23 13:43:51 UTC (rev 2514)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java 2012-05-23 13:51:23 UTC (rev 2515)
@@ -143,7 +143,7 @@
}
/**
- * Get Récupère une entité dans une liste d'entités à partir de son {@link
+ * Récupère une entité dans une liste d'entités à partir de son {@link
* TopiaEntity#getTopiaId()}.
*
* @param entities la liste des entités à scanner
@@ -157,7 +157,7 @@
E result = null;
if (CollectionUtils.isNotEmpty(entities)) {
Predicate<E> predicate = TopiaPredicates.newTopiaIdEquals(topiaId);
- result = Iterables.find(entities, predicate);
+ result = Iterables.tryFind(entities, predicate).orNull();
}
return result;
}
Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java 2012-05-23 13:43:51 UTC (rev 2514)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/EntityOperatorTest.java 2012-05-23 13:51:23 UTC (rev 2515)
@@ -51,9 +51,6 @@
/** @author tchemit <chemit(a)codelutin.com> */
public class EntityOperatorTest {
- public EntityOperatorTest() {
- }
-
static EntityOperator<Company> operationC;
static EntityOperator<Employe> operationE;
1
0
Author: tchemit
Date: 2012-05-23 15:43:51 +0200 (Wed, 23 May 2012)
New Revision: 2514
Url: http://nuiton.org/repositories/revision/topia/2514
Log:
do NOt launch tests on tck package
Modified:
trunk/topia-persistence-tck/pom.xml
Modified: trunk/topia-persistence-tck/pom.xml
===================================================================
--- trunk/topia-persistence-tck/pom.xml 2012-05-23 13:36:21 UTC (rev 2513)
+++ trunk/topia-persistence-tck/pom.xml 2012-05-23 13:43:51 UTC (rev 2514)
@@ -168,6 +168,21 @@
</dependencies>
</plugin>
</plugins>
+
+ <pluginManagement>
+ <plugins>
+
+ <!-- Do not launch tck-like tests here -->
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/tck/**/*Test.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>
1
0
Author: athimel
Date: 2012-05-23 15:36:21 +0200 (Wed, 23 May 2012)
New Revision: 2513
Url: http://nuiton.org/repositories/revision/topia/2513
Log:
Move back necessary classes to src/main/java
Added:
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/beangen/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/naturalId.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test4/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test4/E4.java
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test9/
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test9/E9.java
Removed:
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Gender.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Title.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/beangen/
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/naturalId.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test4/E4.java
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test9/E9.java
Modified:
trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java
Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/TopiaContextFactoryTest.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -31,7 +31,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.framework.TopiaContextImpl;
-import org.nuiton.topia.tck.TopiaDatabase;
+//import org.nuiton.topia.tck.TopiaDatabase;
import java.io.File;
import java.io.IOException;
@@ -56,7 +56,7 @@
@BeforeClass
public static void init() throws IOException {
- testBasedir = TopiaDatabase.getTestSpecificDirectory(TopiaContextFactoryTest.class, "dummy");
+// testBasedir = TopiaDatabase.getTestSpecificDirectory(TopiaContextFactoryTest.class, "dummy");
}
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,42 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.topia.tck.it;
+
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.tck.it.ExtraDAOEntity;
+import org.nuiton.topia.tck.it.ExtraDAOEntityDAOAbstract;
+
+/**
+ * Created: 26 mai 2010
+ *
+ * @author fdesbois <fdesbois(a)codelutin.com>
+ * @version $Id$
+ */
+public class ExtraDAOEntityDAOImpl<E extends ExtraDAOEntity> extends ExtraDAOEntityDAOAbstract<E> {
+
+ @Override
+ public void extra() throws TopiaException {
+ }
+}
Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Gender.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.topia.tck.it;
+
+public enum Gender {
+ MALE, FEMALE
+}
Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Gender.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Title.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.topia.tck.it;
+
+/**
+ * To test http://nuiton.org/issues/1732.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.2
+ */
+public enum Title {
+ Mr,
+ Madam,
+ Other
+}
Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/Title.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,50 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.topia.tck.it.deletetest;
+
+
+import java.util.Set;
+import java.util.TreeSet;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.tck.it.Company;
+import org.nuiton.topia.tck.it.Employe;
+
+/**
+ *
+ * @author desbois
+ */
+public class Contact2DAOImpl<E extends Contact2> extends Contact2DAOAbstract<E> {
+
+ @Override
+ public Set<Contact2> findAllByCompany(Company company) throws TopiaException {
+ Set<Contact2> contacts = new TreeSet<Contact2>();
+ for (Employe e : company.getEmploye()) {
+ contacts.addAll(e.getContacts());
+ }
+ return contacts;
+ }
+
+}
Property changes on: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/naturalId.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/naturalId.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/naturalId.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/naturalId.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,32 @@
+package org.nuiton.topia.tck.it;
+
+/**
+ * Class that contains the natural ids of NaturalizedEntity.
+ * TODO AThimel 22/05/2012 This has to be generated ? To discuss
+ * TODO AThimel 22/05/2012 Find a better name
+ *
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class naturalId {
+
+ protected Integer naturalIdNotNull;
+
+ protected String naturalIdNull;
+
+ public Integer getNaturalIdNotNull() {
+ return naturalIdNotNull;
+ }
+
+ public void setNaturalIdNotNull(Integer naturalIdNotNull) {
+ this.naturalIdNotNull = naturalIdNotNull;
+ }
+
+ public String getNaturalIdNull() {
+ return naturalIdNull;
+ }
+
+ public void setNaturalIdNull(String naturalIdNull) {
+ this.naturalIdNull = naturalIdNull;
+ }
+
+}
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test4/E4.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test4/E4.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test4/E4.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test4/E4.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,12 @@
+package org.nuiton.topia.tck.mapping.test4;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public enum E4 {
+ LITERAL1,
+ LITERAL2,
+}
Copied: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test9/E9.java (from rev 2510, trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test9/E9.java)
===================================================================
--- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test9/E9.java (rev 0)
+++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/mapping/test9/E9.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -0,0 +1,12 @@
+package org.nuiton.topia.tck.mapping.test9;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */
+public enum E9 {
+ LITERAL1,
+ LITERAL2
+}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/ExtraDAOEntityDAOImpl.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,42 +0,0 @@
-/*
- * #%L
- * ToPIA :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.topia.tck.it;
-
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.tck.it.ExtraDAOEntity;
-import org.nuiton.topia.tck.it.ExtraDAOEntityDAOAbstract;
-
-/**
- * Created: 26 mai 2010
- *
- * @author fdesbois <fdesbois(a)codelutin.com>
- * @version $Id$
- */
-public class ExtraDAOEntityDAOImpl<E extends ExtraDAOEntity> extends ExtraDAOEntityDAOAbstract<E> {
-
- @Override
- public void extra() throws TopiaException {
- }
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Gender.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Gender.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Gender.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,29 +0,0 @@
-/*
- * #%L
- * ToPIA :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.topia.tck.it;
-
-public enum Gender {
- MALE, FEMALE
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Title.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Title.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/Title.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,37 +0,0 @@
-/*
- * #%L
- * ToPIA :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.topia.tck.it;
-
-/**
- * To test http://nuiton.org/issues/1732.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.6.2
- */
-public enum Title {
- Mr,
- Madam,
- Other
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/deletetest/Contact2DAOImpl.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,50 +0,0 @@
-/*
- * #%L
- * ToPIA :: Persistence
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package org.nuiton.topia.tck.it.deletetest;
-
-
-import java.util.Set;
-import java.util.TreeSet;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.tck.it.Company;
-import org.nuiton.topia.tck.it.Employe;
-
-/**
- *
- * @author desbois
- */
-public class Contact2DAOImpl<E extends Contact2> extends Contact2DAOAbstract<E> {
-
- @Override
- public Set<Contact2> findAllByCompany(Company company) throws TopiaException {
- Set<Contact2> contacts = new TreeSet<Contact2>();
- for (Employe e : company.getEmploye()) {
- contacts.addAll(e.getContacts());
- }
- return contacts;
- }
-
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/naturalId.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/naturalId.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/it/naturalId.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,32 +0,0 @@
-package org.nuiton.topia.tck.it;
-
-/**
- * Class that contains the natural ids of NaturalizedEntity.
- * TODO AThimel 22/05/2012 This has to be generated ? To discuss
- * TODO AThimel 22/05/2012 Find a better name
- *
- * @author Arnaud Thimel <thimel(a)codelutin.com>
- */
-public class naturalId {
-
- protected Integer naturalIdNotNull;
-
- protected String naturalIdNull;
-
- public Integer getNaturalIdNotNull() {
- return naturalIdNotNull;
- }
-
- public void setNaturalIdNotNull(Integer naturalIdNotNull) {
- this.naturalIdNotNull = naturalIdNotNull;
- }
-
- public String getNaturalIdNull() {
- return naturalIdNull;
- }
-
- public void setNaturalIdNull(String naturalIdNull) {
- this.naturalIdNull = naturalIdNull;
- }
-
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test4/E4.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test4/E4.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test4/E4.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,12 +0,0 @@
-package org.nuiton.topia.tck.mapping.test4;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 3.0
- */
-public enum E4 {
- LITERAL1,
- LITERAL2,
-}
Deleted: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test9/E9.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test9/E9.java 2012-05-23 13:33:30 UTC (rev 2512)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/tck/mapping/test9/E9.java 2012-05-23 13:36:21 UTC (rev 2513)
@@ -1,12 +0,0 @@
-package org.nuiton.topia.tck.mapping.test9;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since TODO
- */
-public enum E9 {
- LITERAL1,
- LITERAL2
-}
1
0
Author: tchemit
Date: 2012-05-23 15:33:30 +0200 (Wed, 23 May 2012)
New Revision: 2512
Url: http://nuiton.org/repositories/revision/topia/2512
Log:
usage of TopiaIdUtil instead of TopiaId
Modified:
trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdUtil.java
trunk/topia-service-security/src/main/java/org/nuiton/topia/security/TopiaSecurityServiceImpl.java
trunk/topia-service-security/src/main/java/org/nuiton/topia/security/entities/authorization/TopiaAssociationAuthorizationImpl.java
trunk/topia-service-security/src/main/java/org/nuiton/topia/security/listener/EntityVetoable.java
trunk/topia-service-security/src/main/java/org/nuiton/topia/security/util/TopiaSecurityUtil.java
trunk/topia-service-security/src/main/java/org/nuiton/topia/taas/TaasService.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -54,7 +54,7 @@
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaDAOImpl;
import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -832,7 +832,7 @@
public TopiaEntity findByTopiaId(String id) throws TopiaException {
checkClosed("findByTopiaId");
- Class<TopiaEntity> entityClass = TopiaId.getClassName(id);
+ Class<TopiaEntity> entityClass = TopiaIdUtil.getClassName(id);
TopiaDAO<TopiaEntity> dao = getDAO(entityClass);
TopiaEntity result = dao.findByTopiaId(id);
return result;
@@ -927,7 +927,7 @@
checkClosed("add");
String id = e.getTopiaId();
- Class<TopiaEntity> entityClass = TopiaId.getClassName(id);
+ Class<TopiaEntity> entityClass = TopiaIdUtil.getClassName(id);
TopiaDAO<TopiaEntity> dao = getDAO(entityClass);
dao.update(e);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -30,7 +30,7 @@
import org.nuiton.topia.TopiaNotFoundException;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
@@ -169,7 +169,7 @@
if (hasReference()) {
try {
- Class<?> referenceClass = TopiaId.getClassName(referenceId);
+ Class<?> referenceClass = TopiaIdUtil.getClassName(referenceId);
if (referenceClass.isAssignableFrom(entityClass)) {
result = true;
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -265,7 +265,7 @@
protected E create0(E result) throws TopiaException {
// XXX AThimel 22/05/2012 Add it back here because it does not work in PrePersist event
- String topiaId = TopiaId.create(entityClass);
+ String topiaId = TopiaIdUtil.create(entityClass);
result.setTopiaId(topiaId);
// on fait un save maintenant, car puisqu'on a creer l'entity au
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdUtil.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdUtil.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -12,6 +12,8 @@
/**
* Useful methods around the {@code topia-id}.
*
+ * TODO-tchemit-2012-05-23 Finish javadoc
+ *
* @author tchemit <chemit(a)codelutin.com>
* @since 3.0
*/
Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java
===================================================================
--- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/persistence/util/TopiaEntityHelperTest.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -30,10 +30,10 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import org.nuiton.topia.tck.it.TopiaTckItDAOHelper;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
-import org.nuiton.topia.persistence.TopiaId;
import org.nuiton.topia.tck.it.Company;
import org.nuiton.topia.tck.it.CompanyImpl;
import org.nuiton.topia.tck.it.Department;
@@ -166,11 +166,11 @@
public void testDetector() throws Exception {
Company company = new CompanyImpl();
- company.setTopiaId(TopiaId.create(Company.class));
+ company.setTopiaId(TopiaIdUtil.create(Company.class));
Employe employe = new EmployeImpl();
- employe.setTopiaId(TopiaId.create(Employe.class));
+ employe.setTopiaId(TopiaIdUtil.create(Employe.class));
Department department = new DepartmentImpl();
- department.setTopiaId(TopiaId.create(Department.class));
+ department.setTopiaId(TopiaIdUtil.create(Department.class));
detectEntities(new Class<?>[]{Company.class, Employe.class, Department.class}, new int[]{1, 1, 1}, company, employe, department);
detectEntityIds(new Class<?>[]{Company.class, Employe.class, Department.class}, new int[]{1, 1, 1}, company, employe, department);
Modified: trunk/topia-service-security/src/main/java/org/nuiton/topia/security/TopiaSecurityServiceImpl.java
===================================================================
--- trunk/topia-service-security/src/main/java/org/nuiton/topia/security/TopiaSecurityServiceImpl.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-service-security/src/main/java/org/nuiton/topia/security/TopiaSecurityServiceImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -35,7 +35,7 @@
import org.nuiton.topia.event.TopiaTransactionEvent;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import org.nuiton.topia.security.entities.authorization.TopiaAssociationAuthorizationDAO;
import org.nuiton.topia.security.entities.authorization.TopiaAuthorization;
import org.nuiton.topia.security.entities.authorization.TopiaAuthorizationDAO;
@@ -297,7 +297,7 @@
Set<Permission> permissions = new HashSet<Permission>();
permissionsCache.put(principalName, permissions);
- String className = TopiaId.getClassNameAsString(principalName);
+ String className = TopiaIdUtil.getClassNameAsString(principalName);
// AddEmptyPrincipals pr�cise si il faut les autorisations dont les principals sont vide
boolean addEmptyPrincipals = className.equals(TopiaUser.class.getName());
@@ -428,7 +428,7 @@
*/
protected int getRealActions(String topiaId, int actions) {
try {
- Class<?> klass = TopiaId.getClassName(topiaId);
+ Class<?> klass = TopiaIdUtil.getClassName(topiaId);
//if(TopiaSecurityUtil.isImplement(klass, NoSecurityLoad.class)) {
if (NoSecurityLoad.class.isAssignableFrom(klass)) {
Modified: trunk/topia-service-security/src/main/java/org/nuiton/topia/security/entities/authorization/TopiaAssociationAuthorizationImpl.java
===================================================================
--- trunk/topia-service-security/src/main/java/org/nuiton/topia/security/entities/authorization/TopiaAssociationAuthorizationImpl.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-service-security/src/main/java/org/nuiton/topia/security/entities/authorization/TopiaAssociationAuthorizationImpl.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -32,7 +32,7 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
/**
* Classe permettant les autorisations de type association. C'est à dire l'autorisation
@@ -62,7 +62,7 @@
@Override
public boolean impliesExpression(String thisExpression, String thatExpression) {
String select = "count(test)";
- String from = TopiaId.getClassNameAsString(thisExpression) + " test join test." + nameAssociation + " as association";
+ String from = TopiaIdUtil.getClassNameAsString(thisExpression) + " test join test." + nameAssociation + " as association";
String where = "test.topiaId=:test and association.topiaId=:association";
TopiaContext context = getTopiaContext();
try {
Modified: trunk/topia-service-security/src/main/java/org/nuiton/topia/security/listener/EntityVetoable.java
===================================================================
--- trunk/topia-service-security/src/main/java/org/nuiton/topia/security/listener/EntityVetoable.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-service-security/src/main/java/org/nuiton/topia/security/listener/EntityVetoable.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -43,7 +43,7 @@
import org.nuiton.topia.event.TopiaEntityEvent;
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import org.nuiton.topia.security.TopiaSecurityServiceImpl;
import static org.nuiton.topia.security.util.TopiaSecurityUtil.CREATE;
@@ -72,7 +72,7 @@
String topiaId = entity.getTopiaId();
Class<? extends TopiaEntity> clazz;
try {
- clazz = TopiaId.getClassName(topiaId);
+ clazz = TopiaIdUtil.getClassName(topiaId);
} catch (TopiaNotFoundException e) {
// Ne devrait jamais ce produire
throw new SecurityException("Access denied to entity creation", e);
Modified: trunk/topia-service-security/src/main/java/org/nuiton/topia/security/util/TopiaSecurityUtil.java
===================================================================
--- trunk/topia-service-security/src/main/java/org/nuiton/topia/security/util/TopiaSecurityUtil.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-service-security/src/main/java/org/nuiton/topia/security/util/TopiaSecurityUtil.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -43,7 +43,7 @@
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.framework.TopiaContextImpl;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import org.nuiton.topia.security.entities.authorization.TopiaAssociationAuthorizationImpl;
import org.nuiton.topia.security.entities.authorization.TopiaAuthorizationImpl;
import org.nuiton.topia.security.entities.authorization.TopiaEntityAuthorizationImpl;
@@ -227,7 +227,7 @@
Subject subject = Subject.getSubject(AccessController.getContext());
if (subject != null) {
for (Principal principal : subject.getPrincipals()) {
- String className = TopiaId.getClassNameAsString(principal.getName());
+ String className = TopiaIdUtil.getClassNameAsString(principal.getName());
if(className.equals(TopiaUser.class.getName())) {
return principal.getName();
}
Modified: trunk/topia-service-security/src/main/java/org/nuiton/topia/taas/TaasService.java
===================================================================
--- trunk/topia-service-security/src/main/java/org/nuiton/topia/taas/TaasService.java 2012-05-23 13:25:58 UTC (rev 2511)
+++ trunk/topia-service-security/src/main/java/org/nuiton/topia/taas/TaasService.java 2012-05-23 13:33:30 UTC (rev 2512)
@@ -50,7 +50,7 @@
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityAbstract;
-import org.nuiton.topia.persistence.TopiaId;
+import org.nuiton.topia.persistence.TopiaIdUtil;
import org.nuiton.topia.taas.entities.TaasAuthorizationImpl;
import org.nuiton.topia.taas.entities.TaasPrincipalImpl;
import org.nuiton.topia.taas.entities.TaasUserImpl;
@@ -449,7 +449,7 @@
Class<? extends TopiaEntity> klass;
try {
- klass = TopiaId.getClassName(topiaId);
+ klass = TopiaIdUtil.getClassName(topiaId);
} catch (TopiaNotFoundException e) {
throw new SecurityException("Invalid topiaId", e);
}
1
0
r2511 - trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia
by athimel@users.nuiton.org 23 May '12
by athimel@users.nuiton.org 23 May '12
23 May '12
Author: athimel
Date: 2012-05-23 15:25:58 +0200 (Wed, 23 May 2012)
New Revision: 2511
Url: http://nuiton.org/repositories/revision/topia/2511
Log:
Add svn:externals to t-p-tck tests
Modified:
trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia/
Property changes on: trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia
___________________________________________________________________
Added: svn:externals
+ tck http://svn.nuiton.org/svn/topia/trunk/topia-persistence-tck/src/test/java/o…
1
0