r2454 - in trunk: topia-persistence/src/main/java/org/nuiton/topia/framework topia-persistence-hibernate/src/main/java/org/nuiton/topia/persistence/hibernate topia-persistence-hibernate/src/main/resources/META-INF/services topia-persistence-hibernate/src/test/java/org/nuiton/topia/tck topia-persistence-tck/src/main/resources topia-persistence-tck/src/test/resources
Author: athimel Date: 2012-05-09 18:07:09 +0200 (Wed, 09 May 2012) New Revision: 2454 Url: http://nuiton.org/repositories/revision/topia/2454 Log: Fix TopiaPersistenceProvider common impl Added: trunk/topia-persistence-tck/src/main/resources/TopiaConnectionProviderHardcoded.properties trunk/topia-persistence-tck/src/main/resources/TopiaContextImpl.properties trunk/topia-persistence-tck/src/main/resources/log4j.properties Removed: trunk/topia-persistence-tck/src/test/resources/TopiaConnectionProviderHardcoded.properties trunk/topia-persistence-tck/src/test/resources/TopiaContextImpl.properties trunk/topia-persistence-tck/src/test/resources/log4j.properties Modified: trunk/topia-persistence-hibernate/src/main/java/org/nuiton/topia/persistence/hibernate/TopiaHibernatePersistenceProvider.java trunk/topia-persistence-hibernate/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia/tck/TopiaTckHibernateTestSuite.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.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-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-09 16:07:09 UTC (rev 2454) @@ -94,6 +94,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; @@ -197,7 +198,7 @@ protected TopiaFiresSupport firesSupport = new TopiaFiresSupport(); /** Liste des classes perssitance */ - protected List<Class<?>> persistenceClasses = new ArrayList<Class<?>>(); + protected Set<Class<?>> persistenceClasses = new LinkedHashSet<Class<?>>(); /** Default constructor, useful for tests. */ protected TopiaContextImpl() { @@ -1426,7 +1427,7 @@ } @Override - public List<Class<?>> getPersistenceClasses() { + public Set<Class<?>> getPersistenceClasses() { return persistenceClasses; } Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2012-05-09 16:07:09 UTC (rev 2454) @@ -137,6 +137,7 @@ Map<String, TopiaService> getServices(); - List<Class<?>> getPersistenceClasses(); + Set<Class<?>> getPersistenceClasses(); + } //TopiaContextImplementor Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java 2012-05-09 16:07:09 UTC (rev 2454) @@ -24,6 +24,8 @@ @Override public EntityManagerFactory createEntityManagerFactory(String emName, Map map) { System.out.println("createEntityManagerFactory " + emName); + + EntityManagerFactory result = null; if ("topia".equals(emName)) { // Use PersistenceProvider of the underlying JPA library @@ -38,9 +40,9 @@ throw new TopiaRuntimeException("topia.entities list must be provided"); } - configureSpecific(emName, map, entityClasses); + result = configureSpecific(emName, map, entityClasses); } - return null; + return result; } @Override Modified: trunk/topia-persistence-hibernate/src/main/java/org/nuiton/topia/persistence/hibernate/TopiaHibernatePersistenceProvider.java =================================================================== --- trunk/topia-persistence-hibernate/src/main/java/org/nuiton/topia/persistence/hibernate/TopiaHibernatePersistenceProvider.java 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-hibernate/src/main/java/org/nuiton/topia/persistence/hibernate/TopiaHibernatePersistenceProvider.java 2012-05-09 16:07:09 UTC (rev 2454) @@ -28,7 +28,7 @@ map.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); map.put("hibernate.hbm2ddl.auto", "create-drop"); - map.put("hibernate.show_sql", "true"); + map.put("hibernate.show_sql", "false"); // map.put("hibernate.connection.provider_class", "org.nuiton.topia.framework.TopiaConnectionProviderHardCoded"); // Set<Class<?>> entities = new HashSet<Class<?>>(); @@ -76,6 +76,10 @@ metadata.setHbmfiles(entitiesHbmFiles); Ejb3Configuration configured = cfg.configure(metadata, map); - return configured != null ? configured.buildEntityManagerFactory() : null; + EntityManagerFactory result = null; + if (configured != null) { + result = configured.buildEntityManagerFactory(); + } + return result; } } Modified: trunk/topia-persistence-hibernate/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider =================================================================== --- trunk/topia-persistence-hibernate/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-hibernate/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider 2012-05-09 16:07:09 UTC (rev 2454) @@ -1 +1 @@ -org.nuiton.topia.framework.TopiaHibernatePersistenceProvider +org.nuiton.topia.persistence.hibernate.TopiaHibernatePersistenceProvider Modified: trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia/tck/TopiaTckHibernateTestSuite.java =================================================================== --- trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia/tck/TopiaTckHibernateTestSuite.java 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-hibernate/src/test/java/org/nuiton/topia/tck/TopiaTckHibernateTestSuite.java 2012-05-09 16:07:09 UTC (rev 2454) @@ -1,6 +1,8 @@ package org.nuiton.topia.tck; +import org.junit.runners.Suite; import org.nuiton.topia.tck.TopiaTckTestSuite; +import org.nuiton.topia.tck.ano1882.DAOAbstractTransformerTest; /** * Do not remove event if empty : this class represents the TCK IT tests Copied: trunk/topia-persistence-tck/src/main/resources/TopiaConnectionProviderHardcoded.properties (from rev 2453, trunk/topia-persistence-tck/src/test/resources/TopiaConnectionProviderHardcoded.properties) =================================================================== --- trunk/topia-persistence-tck/src/main/resources/TopiaConnectionProviderHardcoded.properties (rev 0) +++ trunk/topia-persistence-tck/src/main/resources/TopiaConnectionProviderHardcoded.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -0,0 +1,35 @@ +### +# #%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% +### +# Proprietes par defaut pour une base de donnees de type H2 +hibernate.hbm2ddl.auto=update +hibernate.show_sql=false + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.username=sa +hibernate.connection.password= +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProviderHardCoded +# tchemit 2010-11-28 : comment this line, each test must define his own db path +#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data \ No newline at end of file Property changes on: trunk/topia-persistence-tck/src/main/resources/TopiaConnectionProviderHardcoded.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/resources/TopiaContextImpl.properties (from rev 2453, trunk/topia-persistence-tck/src/test/resources/TopiaContextImpl.properties) =================================================================== --- trunk/topia-persistence-tck/src/main/resources/TopiaContextImpl.properties (rev 0) +++ trunk/topia-persistence-tck/src/main/resources/TopiaContextImpl.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -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% +### +# Proprietes par defaut pour une base de donnees de type H2 +hibernate.hbm2ddl.auto=update +hibernate.show_sql=false + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.username=sa +hibernate.connection.password= +hibernate.connection.driver_class=org.h2.Driver +# tchemit 2010-11-28 : comment this line, each test must define his own db path +#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data \ No newline at end of file Property changes on: trunk/topia-persistence-tck/src/main/resources/TopiaContextImpl.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/topia-persistence-tck/src/main/resources/log4j.properties (from rev 2453, trunk/topia-persistence-tck/src/test/resources/log4j.properties) =================================================================== --- trunk/topia-persistence-tck/src/main/resources/log4j.properties (rev 0) +++ trunk/topia-persistence-tck/src/main/resources/log4j.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -0,0 +1,36 @@ +### +# #%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% +### +#\u00a0This 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 +#log4j.logger.org.nuiton.topiatest=DEBUG +log4j.logger.org.nuiton.topia.persistence.util=INFO Property changes on: trunk/topia-persistence-tck/src/main/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/topia-persistence-tck/src/test/resources/TopiaConnectionProviderHardcoded.properties =================================================================== --- trunk/topia-persistence-tck/src/test/resources/TopiaConnectionProviderHardcoded.properties 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-tck/src/test/resources/TopiaConnectionProviderHardcoded.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -1,35 +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% -### -# Proprietes par defaut pour une base de donnees de type H2 -hibernate.hbm2ddl.auto=update -hibernate.show_sql=false - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.username=sa -hibernate.connection.password= -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProviderHardCoded -# tchemit 2010-11-28 : comment this line, each test must define his own db path -#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data \ No newline at end of file Deleted: trunk/topia-persistence-tck/src/test/resources/TopiaContextImpl.properties =================================================================== --- trunk/topia-persistence-tck/src/test/resources/TopiaContextImpl.properties 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-tck/src/test/resources/TopiaContextImpl.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -1,34 +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% -### -# Proprietes par defaut pour une base de donnees de type H2 -hibernate.hbm2ddl.auto=update -hibernate.show_sql=false - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.username=sa -hibernate.connection.password= -hibernate.connection.driver_class=org.h2.Driver -# tchemit 2010-11-28 : comment this line, each test must define his own db path -#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data \ No newline at end of file Deleted: trunk/topia-persistence-tck/src/test/resources/log4j.properties =================================================================== --- trunk/topia-persistence-tck/src/test/resources/log4j.properties 2012-05-09 15:48:05 UTC (rev 2453) +++ trunk/topia-persistence-tck/src/test/resources/log4j.properties 2012-05-09 16:07:09 UTC (rev 2454) @@ -1,36 +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% -### -#\u00a0This 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 -#log4j.logger.org.nuiton.topiatest=DEBUG -log4j.logger.org.nuiton.topia.persistence.util=INFO
participants (1)
-
athimelï¼ users.nuiton.org