[jboss-cvs] JBossAS SVN: r81607 - in trunk: testsuite/imports/sections and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 25 23:14:41 EST 2008
Author: pferraro
Date: 2008-11-25 23:14:41 -0500 (Tue, 25 Nov 2008)
New Revision: 81607
Added:
trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/
trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettings.java
trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettingsBean.java
trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/unit/
trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/unit/PersistenceUnitSettingsUnitTestCase.java
trunk/testsuite/src/resources/ejb3/ejbthree1597/
trunk/testsuite/src/resources/ejb3/ejbthree1597/META-INF/
trunk/testsuite/src/resources/ejb3/ejbthree1597/META-INF/persistence.xml
Removed:
trunk/ejb3/src/resources/META-INF/persistence.properties
Modified:
trunk/ejb3/src/resources/META-INF/jpa-deployers-jboss-beans.xml
trunk/testsuite/imports/sections/ejb3.xml
Log:
[EJBTHREE-1597] Missing default persistence properties
Updated clustered 2LC comments to use new RegionFactory impl
Modified: trunk/ejb3/src/resources/META-INF/jpa-deployers-jboss-beans.xml
===================================================================
--- trunk/ejb3/src/resources/META-INF/jpa-deployers-jboss-beans.xml 2008-11-26 04:12:52 UTC (rev 81606)
+++ trunk/ejb3/src/resources/META-INF/jpa-deployers-jboss-beans.xml 2008-11-26 04:14:41 UTC (rev 81607)
@@ -18,6 +18,68 @@
<key>hibernate.transaction.manager_lookup_class</key>
<value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
</entry>
+ <!--entry>
+ <key>hibernate.connection.release_mode</key>
+ <value>after_statement</value>
+ </entry-->
+ <!--entry>
+ <key>hibernate.transaction.flush_before_completion</key>
+ <value>false</value>
+ </entry-->
+ <!--entry>
+ <key>hibernate.transaction.auto_close_session</key>
+ <value>false</value>
+ </entry-->
+ <!--entry>
+ <key>hibernate.query.factory_class</key>
+ <value>org.hibernate.hql.ast.ASTQueryTranslatorFactory</value>
+ </entry-->
+ <!--entry>
+ <key>hibernate.hbm2ddl.auto</key>
+ <value>create-drop</value>
+ </entry-->
+ <entry>
+ <key>hibernate.cache.provider_class</key>
+ <value>org.hibernate.cache.HashtableCacheProvider</value>
+ </entry>
+ <!-- Clustered cache with JBoss Cache -->
+ <!--entry>
+ <key>hibernate.cache.region.factory_class</key>
+ <value>org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory</value>
+ </entry>
+ <entry>
+ <key>hibernate.cache.region.jbc2.cachefactory</key>
+ <value>java:CacheManager</value>
+ </entry>
+ <entry>
+ <key>hibernate.cache.region.jbc2.cfg.entity</key>
+ <value>pessimistic-entity</value>
+ </entry>
+ <entry>
+ <key>hibernate.cache.region.jbc2.cfg.query</key>
+ <value>local-query</value>
+ </entry-->
+ <!--entry>
+ <key>hibernate.dialect</key>
+ <value>org.hibernate.dialect.HSQLDialect</value>
+ </entry-->
+ <entry>
+ <key>hibernate.jndi.java.naming.factory.initial</key>
+ <value>org.jnp.interfaces.NamingContextFactory</value>
+ </entry>
+ <entry>
+ <key>hibernate.jndi.java.naming.factory.url.pkgs</key>
+ <value>org.jboss.naming:org.jnp.interfaces</value>
+ </entry>
+ <entry>
+ <key>hibernate.bytecode.use_reflection_optimizer</key>
+ <value>false</value>
+ </entry>
+ <!-- I don't think this is honored, but EJB3Deployer uses it -->
+ <entry>
+ <key>hibernate.bytecode.provider</key>
+ <value>javassist</value>
+ </entry>
</map>
</property>
</bean>
Deleted: trunk/ejb3/src/resources/META-INF/persistence.properties
===================================================================
--- trunk/ejb3/src/resources/META-INF/persistence.properties 2008-11-26 04:12:52 UTC (rev 81606)
+++ trunk/ejb3/src/resources/META-INF/persistence.properties 2008-11-26 04:14:41 UTC (rev 81607)
@@ -1,17 +0,0 @@
-hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.connection.release_mode=after_statement
-#hibernate.transaction.flush_before_completion=false
-#hibernate.transaction.auto_close_session=false
-#hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
-#hibernate.hbm2ddl.auto=create-drop
-#hibernate.hbm2ddl.auto=create
-hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
-# Clustered cache with TreeCache
-#hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook
-#hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache
-#hibernate.dialect=org.hibernate.dialect.HSQLDialect
-hibernate.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-hibernate.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-hibernate.bytecode.use_reflection_optimizer=false
-# I don't think this is honored, but EJB3Deployer uses it
-hibernate.bytecode.provider=javassist
\ No newline at end of file
Modified: trunk/testsuite/imports/sections/ejb3.xml
===================================================================
--- trunk/testsuite/imports/sections/ejb3.xml 2008-11-26 04:12:52 UTC (rev 81606)
+++ trunk/testsuite/imports/sections/ejb3.xml 2008-11-26 04:14:41 UTC (rev 81607)
@@ -29,15 +29,24 @@
</jar>
</target>
- <target name="_jars-ejb3" depends="jbas6161,jbas6239">
- <mkdir dir="${build.lib}" />
+ <!-- This issue affected the ejb3 AS module -->
+ <target name="ejbthree1597" depends="compile">
+ <mkdir dir="${build.lib}"/>
+ <jar destfile="${build.lib}/ejbthree1597.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/test/ejb3/ejbthree1597/*.class"></fileset>
+ <fileset dir="${source.resources}/ejb3/ejbthree1597" includes="**"></fileset>
+ </jar>
+ </target>
+
+ <target name="_jars-ejb3" depends="jbas6161,jbas6239,ejbthree1597">
+ <mkdir dir="${build.lib}" />
- <!-- A jar with a simple ejb3 session -->
- <jar destfile="${build.lib}/simple-session.jar">
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/ejb3/basic/**" />
- </fileset>
- </jar>
-
- </target>
+ <!-- A jar with a simple ejb3 session -->
+ <jar destfile="${build.lib}/simple-session.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/ejb3/basic/**" />
+ </fileset>
+ </jar>
+ </target>
+
</project>
Added: trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettings.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettings.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettings.java 2008-11-26 04:14:41 UTC (rev 81607)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ejb3.ejbthree1597;
+
+import javax.ejb.Remote;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+ at Remote
+public interface PersistenceUnitSettings
+{
+ String getCacheProvider();
+
+ String getTransactionManagerLookup();
+
+ String getConnectionReleaseMode();
+
+ boolean isFlushBeforeCompletionEnabled();
+
+ boolean isAutoCloseSessionEnabled();
+
+ String getQueryTranslatorFactory();
+
+ boolean isAutoCreateSchema();
+ boolean isAutoDropSchema();
+ boolean isAutoUpdateSchema();
+ boolean isAutoValidateSchema();
+
+ String getDialect();
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettingsBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettingsBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/PersistenceUnitSettingsBean.java 2008-11-26 04:14:41 UTC (rev 81607)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ejb3.ejbthree1597;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.hibernate.cache.RegionFactory;
+import org.hibernate.cfg.Settings;
+import org.hibernate.engine.SessionImplementor;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+ at Stateless(mappedName="ejb3/ejbthree1597/PersistenceUnitSettings")
+public class PersistenceUnitSettingsBean implements PersistenceUnitSettings
+{
+ @PersistenceContext
+ private EntityManager em;
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#getCacheProvider()
+ */
+ public String getCacheProvider()
+ {
+ RegionFactory factory = this.settings().getRegionFactory();
+
+ try
+ {
+ // Extract CacheProvider from RegionFactoryCacheProviderBridge
+ return factory.getClass().getMethod("getCacheProvider").invoke(factory).getClass().getName();
+ }
+ catch (Exception e)
+ {
+ return factory.getClass().getName();
+ }
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#getTransactionManagerLookup()
+ */
+ public String getTransactionManagerLookup()
+ {
+ return this.settings().getTransactionManagerLookup().getClass().getName();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#getConnectionReleaseMode()
+ */
+ public String getConnectionReleaseMode()
+ {
+ return this.settings().getConnectionReleaseMode().toString();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#getDialect()
+ */
+ public String getDialect()
+ {
+ return this.settings().getDialect().getClass().getName();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#getQueryTranslatorFactory()
+ */
+ public String getQueryTranslatorFactory()
+ {
+ return this.settings().getQueryTranslatorFactory().getClass().getName();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isAutoCloseSessionEnabled()
+ */
+ public boolean isAutoCloseSessionEnabled()
+ {
+ return this.settings().isAutoCloseSessionEnabled();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isAutoCreateSchema()
+ */
+ public boolean isAutoCreateSchema()
+ {
+ return this.settings().isAutoCreateSchema();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isAutoDropSchema()
+ */
+ public boolean isAutoDropSchema()
+ {
+ return this.settings().isAutoDropSchema();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isAutoUpdateSchema()
+ */
+ public boolean isAutoUpdateSchema()
+ {
+ return this.settings().isAutoUpdateSchema();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isAutoValidateSchema()
+ */
+ public boolean isAutoValidateSchema()
+ {
+ return this.settings().isAutoValidateSchema();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings#isFlushBeforeCompletionEnabled()
+ */
+ public boolean isFlushBeforeCompletionEnabled()
+ {
+ return this.settings().isFlushBeforeCompletionEnabled();
+ }
+
+ private Settings settings()
+ {
+ SessionImplementor session = (SessionImplementor) this.em.getDelegate();
+ return session.getFactory().getSettings();
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/unit/PersistenceUnitSettingsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/unit/PersistenceUnitSettingsUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/ejbthree1597/unit/PersistenceUnitSettingsUnitTestCase.java 2008-11-26 04:14:41 UTC (rev 81607)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ejb3.ejbthree1597.unit;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.ejb3.ejbthree1597.PersistenceUnitSettings;
+
+/**
+ * Validates that EntityManager is created using the expected default settings.
+ *
+ * @author Paul Ferraro
+ */
+public class PersistenceUnitSettingsUnitTestCase extends JBossTestCase
+{
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(PersistenceUnitSettingsUnitTestCase.class, "ejbthree1597.jar");
+ }
+
+ public PersistenceUnitSettingsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testDefaultSettings() throws Exception
+ {
+ InitialContext ctx = this.getInitialContext();
+ PersistenceUnitSettings settings = (PersistenceUnitSettings) ctx.lookup("ejb3/ejbthree1597/PersistenceUnitSettings");
+
+ assertEquals("org.hibernate.cache.HashtableCacheProvider", settings.getCacheProvider());
+ assertEquals("org.hibernate.transaction.JBossTransactionManagerLookup", settings.getTransactionManagerLookup());
+ assertEquals("after_statement", settings.getConnectionReleaseMode());
+ assertEquals("org.hibernate.dialect.HSQLDialect", settings.getDialect());
+ assertEquals("org.hibernate.hql.ast.ASTQueryTranslatorFactory", settings.getQueryTranslatorFactory());
+ assertFalse(settings.isAutoCloseSessionEnabled());
+ assertFalse(settings.isAutoCreateSchema());
+ assertFalse(settings.isAutoDropSchema());
+ assertFalse(settings.isAutoUpdateSchema());
+ assertFalse(settings.isAutoValidateSchema());
+ assertFalse(settings.isFlushBeforeCompletionEnabled());
+ }
+}
Added: trunk/testsuite/src/resources/ejb3/ejbthree1597/META-INF/persistence.xml
===================================================================
--- trunk/testsuite/src/resources/ejb3/ejbthree1597/META-INF/persistence.xml (rev 0)
+++ trunk/testsuite/src/resources/ejb3/ejbthree1597/META-INF/persistence.xml 2008-11-26 04:14:41 UTC (rev 81607)
@@ -0,0 +1,7 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+
+ <persistence-unit name="ejbthree1597">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ </persistence-unit>
+
+</persistence>
More information about the jboss-cvs-commits
mailing list