[seam-commits] Seam SVN: r13715 - in modules/persistence/trunk: api and 37 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Sep 2 21:01:20 EDT 2010
Author: swd847
Date: 2010-09-02 21:01:19 -0400 (Thu, 02 Sep 2010)
New Revision: 13715
Added:
modules/persistence/trunk/tests-base/
modules/persistence/trunk/tests-base/pom.xml
modules/persistence/trunk/tests-base/src/
modules/persistence/trunk/tests-base/src/main/
modules/persistence/trunk/tests-base/src/main/java/
modules/persistence/trunk/tests-base/src/main/java/org/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/EntityInjectionTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HibernateSearchTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HotelNameProducer.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextCreatedEventTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeInterceptorTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeManagedBean.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionInterceptorTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionManagedBean.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedObject.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/UserTransactionTestBase.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ArtifactNames.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/DontRollBackException.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/EntityManagerProvider.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/HelloService.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/Hotel.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/IndexedHotel.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextObserver.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextProvider.java
modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/MavenArtifactResolver.java
modules/persistence/trunk/tests-base/src/main/resources/
modules/persistence/trunk/tests-base/src/test/
modules/persistence/trunk/tests-base/src/test/java/
modules/persistence/trunk/tests-base/src/test/resources/
modules/persistence/trunk/tests-jboss/
modules/persistence/trunk/tests-jboss/pom.xml
modules/persistence/trunk/tests-jboss/src/
modules/persistence/trunk/tests-jboss/src/main/
modules/persistence/trunk/tests-jboss/src/main/java/
modules/persistence/trunk/tests-jboss/src/main/resources/
modules/persistence/trunk/tests-jboss/src/test/
modules/persistence/trunk/tests-jboss/src/test/java/
modules/persistence/trunk/tests-jboss/src/test/java/org/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/EntityInjectionTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/JbossHibernateSearchTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextCreatedEventTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextELTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextFlushModeTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionAttributeInterceptorTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionInterceptorTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionScopedTest.java
modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/UserTransactionTest.java
modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/
modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/jndi.properties
modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/seam-transactions-test-ds.xml
modules/persistence/trunk/tests-jboss/src/test/resources/
modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/
modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/orm.xml
modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-orm.xml
modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-search.xml
modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence.xml
modules/persistence/trunk/tests-jboss/src/test/resources/arquillian.xml
Removed:
modules/persistence/trunk/impl/src/test/java/org/
modules/persistence/trunk/impl/src/test/resources-jbossas/
modules/persistence/trunk/impl/src/test/resources/META-INF/
modules/persistence/trunk/impl/src/test/resources/arquillian.xml
Modified:
modules/persistence/trunk/api/pom.xml
modules/persistence/trunk/impl/pom.xml
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java
modules/persistence/trunk/pom.xml
Log:
refactor test structure into multi module configuration
Modified: modules/persistence/trunk/api/pom.xml
===================================================================
--- modules/persistence/trunk/api/pom.xml 2010-09-02 21:20:44 UTC (rev 13714)
+++ modules/persistence/trunk/api/pom.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -34,6 +34,12 @@
<type>pom</type>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
Modified: modules/persistence/trunk/impl/pom.xml
===================================================================
--- modules/persistence/trunk/impl/pom.xml 2010-09-02 21:20:44 UTC (rev 13714)
+++ modules/persistence/trunk/impl/pom.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -146,6 +146,9 @@
<profiles>
<profile>
<id>jbossas-managed-60</id>
+ <activation>
+
+ </activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
@@ -373,9 +376,9 @@
</profiles>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/persistence/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/persistence/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/Seam/modules/persistence/trunk</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/persistence/trunk/impl</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/persistence/trunk/impl</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/persistence/trunk/impl</url>
</scm>
</project>
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2010-09-02 21:20:44 UTC (rev 13714)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -29,6 +29,7 @@
{
private static Logger log = LoggerFactory.getLogger(HibernatePersistenceProvider.class);
+ private static Class<?> FULL_TEXT_SESSION;
private static Method FULL_TEXT_SESSION_CONSTRUCTOR;
private static Method FULL_TEXT_ENTITYMANAGER_CONSTRUCTOR;
private static Class<?> FULL_TEXT_ENTITYMANAGER;
@@ -59,6 +60,7 @@
log.debug("org.hibernate.search.Search.getFullTextSession(Session) not found, trying deprecated method name createFullTextSession");
FULL_TEXT_SESSION_CONSTRUCTOR = searchClass.getDeclaredMethod("createFullTextSession", Session.class);
}
+ FULL_TEXT_SESSION = Reflections.classForName("org.hibernate.search.FullTextSession");
Class<?> jpaSearchClass = Reflections.classForName("org.hibernate.search.jpa.Search");
try
{
@@ -270,6 +272,15 @@
return (Set) Collections.singleton(FULL_TEXT_ENTITYMANAGER);
}
+ public Set<Class<?>> getAdditionalSessionInterfaces()
+ {
+ if (FULL_TEXT_SESSION == null)
+ {
+ return Collections.emptySet();
+ }
+ return (Set) Collections.singleton(FULL_TEXT_SESSION);
+ }
+
/**
* Occurs when Hibernate is in the classpath, but this particular
* EntityManager is not from Hibernate
Deleted: modules/persistence/trunk/impl/src/test/resources/arquillian.xml
===================================================================
--- modules/persistence/trunk/impl/src/test/resources/arquillian.xml 2010-09-02 21:20:44 UTC (rev 13714)
+++ modules/persistence/trunk/impl/src/test/resources/arquillian.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<arquillian xmlns="http://jboss.com/arquillian"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gfembedded="urn:arq:org.jboss.arquillian.glassfish.embedded30"
- xmlns:gfremote="urn:arq:org.jboss.arquillian.container.glassfish.remote30"
- xmlns:jbossmanaged="urn:arq:org.jboss.arquillian.container.jbossas.managed_6">
-
- <engine>
- <deploymentExportPath>/tmp/</deploymentExportPath>
- </engine>
-
- <gfremote:container>
- <gfremote:remoteServerHttpPort>7070</gfremote:remoteServerHttpPort>
- </gfremote:container>
-
- <gfembedded:container>
- <gfembedded:sunResourcesXml>src/test/resources-glassfish/sun-resources.xml</gfembedded:sunResourcesXml>
- </gfembedded:container>
- <jbossmanaged:container>
- <javaVmArguments>-Xmx512m -XX:MaxPermSize=256m</javaVmArguments>
- </jbossmanaged:container>
-</arquillian>
Modified: modules/persistence/trunk/pom.xml
===================================================================
--- modules/persistence/trunk/pom.xml 2010-09-02 21:20:44 UTC (rev 13714)
+++ modules/persistence/trunk/pom.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -27,11 +28,17 @@
<modules>
<module>api</module>
<module>impl</module>
+ <module>tests-base</module>
</modules>
<properties>
<seam.version>3.0.0.b01</seam.version>
<jboss-javaee6-spec.version>1.0.0.Beta4</jboss-javaee6-spec.version>
+ <weld.extensions.version>1.0.0-SNAPSHOT</weld.extensions.version>
+ <hibernate.search.version>3.2.1.Final</hibernate.search.version>
+ <arquillian.version>1.0.0.Alpha3</arquillian.version>
+ <jboss.server.manager.version>1.0.3.GA</jboss.server.manager.version>
+ <jboss-as-client.version>6.0.0.20100721-M4</jboss-as-client.version>
</properties>
<dependencyManagement>
@@ -45,28 +52,83 @@
<type>pom</type>
</dependency>
- <!-- Need to use dependencyManagement to override org.jboss.seam:seam for submodules -->
+ <!--
+ Need to use dependencyManagement to override
+ org.jboss.seam:seam for submodules
+ -->
<dependency>
<groupId>org.jboss.seam.persistence</groupId>
<artifactId>seam-persistence-api</artifactId>
<version>${project.version}</version>
</dependency>
-
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>${jboss-javaee6-spec.version}</version>
- <type>pom</type>
- <scope>provided</scope>
- </dependency>
-
+
<dependency>
<groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-tests-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>${weld.extensions.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <version>${hibernate.search.version}</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss-javaee6-spec.version}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
<artifactId>seam-persistence</artifactId>
<version>${project.version}</version>
</dependency>
-
+
+ <!-- Arquillian -->
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-managed-6</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-6</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <!-- Jboss dependencies -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>${jboss.server.manager.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>${jboss-as-client.version}</version>
+ <type>pom</type>
+ </dependency>
</dependencies>
+
</dependencyManagement>
<profiles>
@@ -130,7 +192,27 @@
</pluginRepository>
</pluginRepositories>
</profile>
-
+ <profile>
+ <!-- all tests using managed containers -->
+ <id>all</id>
+ <modules>
+ <module>tests-jboss</module>
+ </modules>
+ </profile>
+ <profile>
+ <!-- jboss remote profile-->
+ <id>jbossas-remote-6</id>
+ <modules>
+ <module>tests-jboss</module>
+ </modules>
+ </profile>
+ <profile>
+ <!-- jboss managed profile-->
+ <id>jbossas-managed-6</id>
+ <modules>
+ <module>tests-jboss</module>
+ </modules>
+ </profile>
</profiles>
<developers>
Property changes on: modules/persistence/trunk/tests-base
___________________________________________________________________
Name: svn:ignore
+ .classpath
.settings
.project
Added: modules/persistence/trunk/tests-base/pom.xml
===================================================================
--- modules/persistence/trunk/tests-base/pom.xml (rev 0)
+++ modules/persistence/trunk/tests-base/pom.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,141 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>seam-persistence-parent</artifactId>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-tests-base</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Persistence Test Base</name>
+
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
+
+ <dependencies>
+ <!-- all scopes are listed as provided, so the sub modules can pull in what they actually need -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.interceptor</groupId>
+ <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!--
+ skip unit test run, tests to be executed during
+ integration-test
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/persistence/trunk/tests-base</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/persistence/trunk/tests-base</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/persistence/trunk/tests-base</url>
+ </scm>
+
+</project>
+
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/EntityInjectionTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/EntityInjectionTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/EntityInjectionTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.jboss.seam.transactions.test.util.IndexedHotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests that injection is working for JPA entities
+ *
+ * @author Stuart Douglas
+ *
+ */
+
+public class EntityInjectionTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { HibernateSearchTestBase.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class, EntityInjectionTestBase.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @Inject
+ EntityManagerFactory emf;
+
+ @Test
+ public void testInjectionIntoEntity() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ EntityManager em = null;
+ try
+ {
+ em = emf.createEntityManager();
+ transaction.begin();
+ em.joinTransaction();
+ Hotel h = new Hotel("Hilton", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+ em.close();
+ transaction.begin();
+ em = emf.createEntityManager();
+ em.joinTransaction();
+
+ h = (Hotel) em.createQuery("select h from Hotel h where h.name='Hilton'").getSingleResult();
+ Assert.assertTrue(h.isInitalizerCalled());
+ Assert.assertEquals(h.sayHello(), "Hello");
+ }
+ finally
+ {
+ em.close();
+ transaction.rollback();
+ }
+
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HibernateSearchTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HibernateSearchTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HibernateSearchTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import javax.inject.Inject;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.hibernate.search.jpa.FullTextEntityManager;
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.IndexedHotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class HibernateSearchTestBase
+{
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { HibernateSearchTestBase.class, IndexedHotel.class, ManagedPersistenceContextProvider.class, HelloService.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @Inject
+ FullTextEntityManager em;
+
+ @Test
+ public void testFullTextEntityManager() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ Assert.assertTrue(em instanceof FullTextEntityManager);
+ }
+
+ @Test
+ public void testSearchingForHotel() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException, ParseException
+ {
+ transaction.begin();
+ IndexedHotel h = new IndexedHotel("Hilton", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+
+ transaction.begin();
+ h = new IndexedHotel("Other Hotel", "Real St ", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+
+ transaction.begin();
+ String[] fields = new String[] { "name" };
+ MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
+ org.apache.lucene.search.Query query = parser.parse("Other");
+
+ // wrap Lucene query in a javax.persistence.Query
+ javax.persistence.Query persistenceQuery = em.createFullTextQuery(query, IndexedHotel.class);
+ IndexedHotel hotel = (IndexedHotel) persistenceQuery.getSingleResult();
+ Assert.assertTrue(hotel.getName().equals("Other Hotel"));
+ transaction.commit();
+
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HotelNameProducer.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HotelNameProducer.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/HotelNameProducer.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,14 @@
+package org.jboss.seam.persistence.test;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class HotelNameProducer
+{
+ @Produces
+ @Named("hotelName")
+ public String getHotelName()
+ {
+ return "Hilton";
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextCreatedEventTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextCreatedEventTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextCreatedEventTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.FlushModeType;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextObserver;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Test;
+
+public class ManagedPersistenceContextCreatedEventTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { ManagedPersistenceContextCreatedEventTestBase.class, ManagedPersistenceContextObserver.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @Inject
+ EntityManager em;
+
+ @Inject
+ ManagedPersistenceContextObserver observer;
+
+ @Test
+ public void testSMPCCreationObserved() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ em.isOpen(); // need to make a call on the EM to force creation
+
+ Assert.assertTrue(observer.isObserverRun());
+ Assert.assertEquals(FlushModeType.COMMIT, em.getFlushMode());
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagedPersistenceContextELTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { ManagedPersistenceContextELTestBase.class, Hotel.class, ManagedPersistenceContextProvider.class, HotelNameProducer.class, HelloService.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @Inject
+ EntityManager em;
+
+ @Test
+ public void testELInInquery() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ transaction.begin();
+ Hotel h = new Hotel("Hilton", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+
+ transaction.begin();
+ h = new Hotel("Other Hotel", "Real St ", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+
+ transaction.begin();
+ Hotel hilton = (Hotel) em.createQuery("select h from Hotel h where h.name=#{hotelName}").getSingleResult();
+ Assert.assertTrue(hilton.getName().equals("Hilton"));
+ Assert.assertTrue(hilton.getAddress().equals("Fake St"));
+ transaction.commit();
+
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.hibernate.FlushMode;
+import org.hibernate.Session;
+import org.jboss.seam.persistence.FlushModeManager;
+import org.jboss.seam.persistence.FlushModeType;
+import org.jboss.seam.persistence.ManagedPersistenceContext;
+import org.jboss.seam.persistence.PersistenceContexts;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Test;
+
+public class ManagedPersistenceContextFlushModeTestBase
+{
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { ManagedPersistenceContextFlushModeTestBase.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class };
+ }
+
+ @Inject
+ FlushModeManager manager;
+
+ @Inject
+ EntityManager em;
+
+ @Inject
+ ManagedPersistenceContext context;
+
+ @Inject
+ PersistenceContexts pc;
+
+ @Inject
+ BeanManager bm;
+
+ @Test
+ public void testPersistenceContextDefaultFlushMode() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ manager.setFlushModeType(FlushModeType.MANUAL);
+ Assert.assertEquals(FlushMode.MANUAL, ((Session) em.getDelegate()).getFlushMode());
+ }
+
+ @Test
+ public void testChangedTouchedPersistenceContextFlushMode()
+ {
+ try
+ {
+ em.setFlushMode(javax.persistence.FlushModeType.AUTO);
+ pc.changeFlushMode(FlushModeType.MANUAL);
+ Assert.assertEquals(FlushMode.MANUAL, ((Session) em.getDelegate()).getFlushMode());
+ }
+ finally
+ {
+ em.setFlushMode(javax.persistence.FlushModeType.AUTO);
+ }
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.jboss.seam.transactions.test.util.ManagedPersistenceContextProvider;
+import org.junit.Test;
+
+public class ManagedPersistenceContextTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { ManagedPersistenceContextTestBase.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @Inject
+ EntityManager em;
+
+ @Test
+ public void testManagedPsersistenceContext() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ transaction.begin();
+ Hotel h = new Hotel("test", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+
+ transaction.begin();
+ h = new Hotel("test2", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.rollback();
+
+ transaction.begin();
+ List<Hotel> hotels = em.createQuery("select h from Hotel h").getResultList();
+ Assert.assertTrue(hotels.size() == 1);
+ transaction.rollback();
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeInterceptorTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeInterceptorTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeInterceptorTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.TransactionRequiredException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.DontRollBackException;
+import org.jboss.seam.transactions.test.util.EntityManagerProvider;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.junit.Test;
+
+/**
+ * Tests the @TransactionAttribute interceptor for non ee beans.
+ *
+ * TODO: refactor the tests to share a common superclass
+ *
+ * @author stuart
+ *
+ */
+public class TransactionAttributeInterceptorTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { TransactionAttributeInterceptorTestBase.class, TransactionAttributeManagedBean.class, HelloService.class, Hotel.class, EntityManagerProvider.class, DontRollBackException.class };
+ }
+
+ @Inject
+ TransactionAttributeManagedBean bean;
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @PersistenceContext
+ EntityManager em;
+
+ @Test
+ public void testTransactionInterceptor() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ bean.addHotel();
+ assertHotels(1);
+ try
+ {
+ bean.failToAddHotel();
+ }
+ catch (Exception e)
+ {
+ }
+ assertHotels(1);
+ try
+ {
+ bean.addHotelWithApplicationException();
+ }
+ catch (DontRollBackException e)
+ {
+ }
+ assertHotels(2);
+ }
+
+ @Test(expected = TransactionRequiredException.class)
+ public void testTransactionInterceptorMethodOverrides()
+ {
+ bean.tryAndAddHotelWithNoTransaction();
+ }
+
+ public void assertHotels(int count) throws NotSupportedException, SystemException
+ {
+ transaction.begin();
+ em.joinTransaction();
+ List<Hotel> hotels = em.createQuery("select h from Hotel h").getResultList();
+ Assert.assertTrue("Wrong number of hotels: " + hotels.size(), hotels.size() == count);
+ transaction.rollback();
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeManagedBean.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeManagedBean.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionAttributeManagedBean.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.transactions.test.util.DontRollBackException;
+import org.jboss.seam.transactions.test.util.Hotel;
+
+ at TransactionAttribute(TransactionAttributeType.REQUIRED)
+public class TransactionAttributeManagedBean
+{
+
+ @Inject
+ EntityManager entityManager;
+
+ public void addHotel()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ }
+
+ public void failToAddHotel()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test2", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ throw new RuntimeException("Roll back transaction");
+ }
+
+ public void addHotelWithApplicationException() throws DontRollBackException
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test3", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ throw new DontRollBackException();
+ }
+
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void tryAndAddHotelWithNoTransaction()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test3", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionInterceptorTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionInterceptorTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionInterceptorTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.TransactionRequiredException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.DontRollBackException;
+import org.jboss.seam.transactions.test.util.EntityManagerProvider;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.junit.Test;
+
+/**
+ * Tests the @Transactional interceptor
+ *
+ * TODO: refactor the tests to share a common superclass
+ *
+ * @author stuart
+ *
+ */
+public class TransactionInterceptorTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { TransactionInterceptorTestBase.class, TransactionManagedBean.class, HelloService.class, Hotel.class, EntityManagerProvider.class, DontRollBackException.class };
+ }
+
+ @Inject
+ TransactionManagedBean bean;
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @PersistenceContext
+ EntityManager em;
+
+ @Test
+ public void testTransactionInterceptor() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ bean.addHotel();
+ assertHotels(1);
+ try
+ {
+ bean.failToAddHotel();
+ }
+ catch (Exception e)
+ {
+ }
+ assertHotels(1);
+ try
+ {
+ bean.addHotelWithApplicationException();
+ }
+ catch (DontRollBackException e)
+ {
+ }
+ assertHotels(2);
+ }
+
+ @Test(expected = TransactionRequiredException.class)
+ public void testTransactionInterceptorMethodOverrides()
+ {
+ bean.tryAndAddHotelWithNoTransaction();
+ }
+
+ public void assertHotels(int count) throws NotSupportedException, SystemException
+ {
+ transaction.begin();
+ em.joinTransaction();
+ List<Hotel> hotels = em.createQuery("select h from Hotel h").getResultList();
+ Assert.assertTrue("Wrong number of hotels: " + hotels.size(), hotels.size() == count);
+ transaction.rollback();
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionManagedBean.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionManagedBean.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionManagedBean.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.persistence.transaction.TransactionPropagation;
+import org.jboss.seam.persistence.transaction.Transactional;
+import org.jboss.seam.transactions.test.util.DontRollBackException;
+import org.jboss.seam.transactions.test.util.Hotel;
+
+ at Transactional(TransactionPropagation.REQUIRED)
+public class TransactionManagedBean
+{
+
+ @Inject
+ EntityManager entityManager;
+
+ public void addHotel()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ }
+
+ public void failToAddHotel()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test2", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ throw new RuntimeException("Roll back transaction");
+ }
+
+ public void addHotelWithApplicationException() throws DontRollBackException
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test3", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ throw new DontRollBackException();
+ }
+
+ @Transactional(TransactionPropagation.NEVER)
+ public void tryAndAddHotelWithNoTransaction()
+ {
+ entityManager.joinTransaction();
+ Hotel h = new Hotel("test3", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ entityManager.persist(h);
+ entityManager.flush();
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedObject.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedObject.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedObject.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import org.jboss.seam.persistence.transaction.TransactionScoped;
+
+ at TransactionScoped
+public class TransactionScopedObject
+{
+ int value = 0;
+
+ public int getValue()
+ {
+ return value;
+ }
+
+ public void setValue(int value)
+ {
+ this.value = value;
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/TransactionScopedTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.junit.Test;
+
+public class TransactionScopedTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { TransactionScopedTestBase.class, Hotel.class, HelloService.class, TransactionScopedObject.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @PersistenceUnit
+ EntityManagerFactory emf;
+
+ @Inject
+ TransactionScopedObject transactionScopedObject;
+
+ @Test
+ public void transactionScopeTest() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ transaction.begin();
+ transactionScopedObject.setValue(10);
+ Assert.assertTrue(transactionScopedObject.getValue() == 10);
+ transaction.commit();
+
+ transaction.begin();
+ Assert.assertTrue(transactionScopedObject.getValue() == 0);
+ transactionScopedObject.setValue(20);
+ Assert.assertTrue(transactionScopedObject.getValue() == 20);
+ transaction.rollback();
+
+ transaction.begin();
+ Assert.assertTrue(transactionScopedObject.getValue() == 0);
+ transaction.rollback();
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/UserTransactionTestBase.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/UserTransactionTestBase.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/persistence/transactions/test/UserTransactionTestBase.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transactions.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
+import org.jboss.seam.persistence.transaction.SeamTransaction;
+import org.jboss.seam.transactions.test.util.HelloService;
+import org.jboss.seam.transactions.test.util.Hotel;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class UserTransactionTestBase
+{
+
+ public static Class<?>[] getTestClasses()
+ {
+ return new Class[] { UserTransactionTestBase.class, Hotel.class, HelloService.class };
+ }
+
+ @Inject
+ @DefaultTransaction
+ SeamTransaction transaction;
+
+ @PersistenceContext
+ EntityManager em;
+
+ @Test
+ public void userTransactionTest() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ {
+ transaction.begin();
+ em.joinTransaction();
+ Hotel h = new Hotel("test", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.commit();
+ em.clear();
+
+ transaction.begin();
+ em.joinTransaction();
+ h = new Hotel("test2", "Fake St", "Wollongong", "NSW", "2518", "Australia");
+ em.persist(h);
+ em.flush();
+ transaction.rollback();
+ em.clear();
+
+ transaction.begin();
+ em.joinTransaction();
+ List<Hotel> hotels = em.createQuery("select h from Hotel h").getResultList();
+ Assert.assertTrue(hotels.size() == 1);
+ transaction.rollback();
+ em.clear();
+
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ArtifactNames.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ArtifactNames.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ArtifactNames.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,12 @@
+package org.jboss.seam.transactions.test.util;
+
+public class ArtifactNames
+{
+ public static final String WELD_EXTENSIONS = "org.jboss.weld:weld-extensions";
+ public static final String SEAM_PERSISTENCE_API = "org.jboss.seam.persistence:seam-persistence-api";
+ public static final String SEAM_PERSISTENCE_IMPL = "org.jboss.seam.persistence:seam-persistence-impl";
+ public static final String HIBERNATE_SEARCH = "org.hibernate:hibernate-search";
+ public static final String LUCENE_CORE = "org.apache.lucene:lucene-core";
+ public static final String LUCENE_ANALYZERS = "org.apache.lucene:lucene-analyzers";
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/DontRollBackException.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/DontRollBackException.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/DontRollBackException.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,9 @@
+package org.jboss.seam.transactions.test.util;
+
+import javax.ejb.ApplicationException;
+
+ at ApplicationException(rollback = false)
+public class DontRollBackException extends Exception
+{
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/EntityManagerProvider.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/EntityManagerProvider.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/EntityManagerProvider.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class EntityManagerProvider
+{
+ @PersistenceContext
+ @Produces
+ EntityManager em;
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/HelloService.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/HelloService.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/HelloService.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+public class HelloService
+{
+ public String sayHello()
+ {
+ return "Hello";
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/Hotel.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/Hotel.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/Hotel.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.inject.Inject;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.jboss.weld.extensions.core.Veto;
+
+/**
+ * <p>
+ * <strong>Hotel</strong> is the model/entity class that represents a hotel.
+ * </p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+ at Entity
+ at Table(name = "hotel")
+ at Veto
+public class Hotel implements Serializable
+{
+ private Long id;
+ private String name;
+ private String address;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ private Integer stars;
+ private BigDecimal price;
+
+ @Inject
+ private HelloService helloService;
+
+ private boolean initalizerCalled = false;
+
+ public Hotel()
+ {
+ }
+
+ @Inject
+ public void create()
+ {
+ initalizerCalled = true;
+ }
+
+ public String sayHello()
+ {
+ return helloService.sayHello();
+ }
+
+ public Hotel(final String name, final String address, final String city, final String state, final String zip, final String country)
+ {
+ this.name = name;
+ this.address = address;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ this.country = country;
+ }
+
+ public Hotel(final int price, final int stars, final String name, final String address, final String city, final String state, final String zip, final String country)
+ {
+ this.price = new BigDecimal(price);
+ this.stars = stars;
+ this.name = name;
+ this.address = address;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ this.country = country;
+ }
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(final Long id)
+ {
+ this.id = id;
+ }
+
+ @Size(max = 50)
+ @NotNull
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ @Size(max = 100)
+ @NotNull
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(final String address)
+ {
+ this.address = address;
+ }
+
+ @Size(max = 40)
+ @NotNull
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(final String city)
+ {
+ this.city = city;
+ }
+
+ @Size(min = 3, max = 6)
+ @NotNull
+ public String getZip()
+ {
+ return zip;
+ }
+
+ public void setZip(final String zip)
+ {
+ this.zip = zip;
+ }
+
+ @Size(min = 2, max = 10)
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(final String state)
+ {
+ this.state = state;
+ }
+
+ @Size(min = 2, max = 40)
+ @NotNull
+ public String getCountry()
+ {
+ return country;
+ }
+
+ public void setCountry(final String country)
+ {
+ this.country = country;
+ }
+
+ @Min(1)
+ @Max(5)
+ public Integer getStars()
+ {
+ return stars;
+ }
+
+ public void setStars(final Integer stars)
+ {
+ this.stars = stars;
+ }
+
+ @Column(precision = 6, scale = 2)
+ public BigDecimal getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(final BigDecimal price)
+ {
+ this.price = price;
+ }
+
+ @Transient
+ public String getLocation()
+ {
+ return city + ", " + state + ", " + country;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+ }
+
+ @Transient
+ public boolean isInitalizerCalled()
+ {
+ return initalizerCalled;
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/IndexedHotel.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/IndexedHotel.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/IndexedHotel.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,236 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.inject.Inject;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.Store;
+import org.jboss.weld.extensions.core.Veto;
+
+/**
+ * <p>
+ * <strong>Hotel</strong> is the model/entity class that represents a hotel.
+ * </p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+ at Entity
+ at Table(name = "hotel")
+ at Indexed
+ at Veto
+public class IndexedHotel implements Serializable
+{
+ private Long id;
+ private String name;
+ private String address;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ private Integer stars;
+ private BigDecimal price;
+
+ @Inject
+ private HelloService helloService;
+
+ private boolean initalizerCalled = false;
+
+ public IndexedHotel()
+ {
+ }
+
+ @Inject
+ public void create()
+ {
+ initalizerCalled = true;
+ }
+
+ public String sayHello()
+ {
+ return helloService.sayHello();
+ }
+
+ public IndexedHotel(final String name, final String address, final String city, final String state, final String zip, final String country)
+ {
+ this.name = name;
+ this.address = address;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ this.country = country;
+ }
+
+ public IndexedHotel(final int price, final int stars, final String name, final String address, final String city, final String state, final String zip, final String country)
+ {
+ this.price = new BigDecimal(price);
+ this.stars = stars;
+ this.name = name;
+ this.address = address;
+ this.city = city;
+ this.state = state;
+ this.zip = zip;
+ this.country = country;
+ }
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(final Long id)
+ {
+ this.id = id;
+ }
+
+ @Size(max = 50)
+ @NotNull
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ @Size(max = 100)
+ @NotNull
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(final String address)
+ {
+ this.address = address;
+ }
+
+ @Size(max = 40)
+ @NotNull
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(final String city)
+ {
+ this.city = city;
+ }
+
+ @Size(min = 3, max = 6)
+ @NotNull
+ public String getZip()
+ {
+ return zip;
+ }
+
+ public void setZip(final String zip)
+ {
+ this.zip = zip;
+ }
+
+ @Size(min = 2, max = 10)
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(final String state)
+ {
+ this.state = state;
+ }
+
+ @Size(min = 2, max = 40)
+ @NotNull
+ public String getCountry()
+ {
+ return country;
+ }
+
+ public void setCountry(final String country)
+ {
+ this.country = country;
+ }
+
+ @Min(1)
+ @Max(5)
+ public Integer getStars()
+ {
+ return stars;
+ }
+
+ public void setStars(final Integer stars)
+ {
+ this.stars = stars;
+ }
+
+ @Column(precision = 6, scale = 2)
+ public BigDecimal getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(final BigDecimal price)
+ {
+ this.price = price;
+ }
+
+ @Transient
+ public String getLocation()
+ {
+ return city + ", " + state + ", " + country;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+ }
+
+ @Transient
+ public boolean isInitalizerCalled()
+ {
+ return initalizerCalled;
+ }
+
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextObserver.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextObserver.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextObserver.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Default;
+import javax.persistence.FlushModeType;
+
+import org.jboss.seam.persistence.SeamManagedPersistenceContextCreated;
+
+ at ApplicationScoped
+public class ManagedPersistenceContextObserver
+{
+ private boolean observerRun = false;
+
+ public void observe(@Observes @Default SeamManagedPersistenceContextCreated event)
+ {
+ observerRun = true;
+ event.getEntityManager().setFlushMode(FlushModeType.COMMIT);
+ }
+
+ public boolean isObserverRun()
+ {
+ return observerRun;
+ }
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextProvider.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextProvider.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/ManagedPersistenceContextProvider.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.transactions.test.util;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+import org.jboss.seam.persistence.SeamManaged;
+
+public class ManagedPersistenceContextProvider
+{
+ @PersistenceUnit
+ @RequestScoped
+ @Produces
+ @SeamManaged
+ EntityManagerFactory emf;
+}
Added: modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/MavenArtifactResolver.java
===================================================================
--- modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/MavenArtifactResolver.java (rev 0)
+++ modules/persistence/trunk/tests-base/src/main/java/org/jboss/seam/transactions/test/util/MavenArtifactResolver.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,164 @@
+package org.jboss.seam.transactions.test.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Resolves a maven artifact present on the test classpath.
+ *
+ * @author Stuart Douglas
+ *
+ */
+public class MavenArtifactResolver
+{
+
+ public static File resolve(String groupId, String artifactId)
+ {
+ if (groupId == null)
+ {
+ throw new IllegalArgumentException("groupId cannot be null");
+ }
+ if (artifactId == null)
+ {
+ throw new IllegalArgumentException("artifactId cannot be null");
+ }
+ String path = new MavenArtifactResolver(groupId.trim(), artifactId.trim(), System.getProperty("java.class.path"), File.pathSeparatorChar, File.separatorChar).resolve();
+ if (path == null)
+ {
+ throw new IllegalArgumentException("Cannot locate artifact for " + groupId + ":" + artifactId);
+ }
+ return new File(path);
+ }
+
+ public static File resolve(String qualifiedArtifactId)
+ {
+ String[] segments = qualifiedArtifactId.split(":");
+ if (segments.length == 2)
+ {
+ return resolve(segments[0], segments[1]);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unable to parse " + qualifiedArtifactId + " as a groupId:artifactId");
+ }
+ }
+
+ private final String classPathSeparatorRegex;
+ private final char fileSeparator;
+ private final String groupId;
+ private final String artifactId;
+ private final String classPath;
+
+ MavenArtifactResolver(String groupId, String artifactId, String classPath, char pathSeparator, char fileSeparator)
+ {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.classPath = classPath;
+ this.classPathSeparatorRegex = "[^" + pathSeparator + "]*";
+ this.fileSeparator = fileSeparator;
+ }
+
+ String resolve()
+ {
+ Matcher matches = createFullyQualifiedMatcher();
+ if (!matches.find())
+ {
+ matches = createUnqualifiedMatcher();
+ if (!matches.find())
+ {
+ matches = createTargetClassesMatcher();
+ if (!matches.find())
+ {
+ return null;
+ }
+ else
+ {
+ String fileName = scanForArtifact(matches);
+ if (fileName == null)
+ {
+ return null;
+ }
+ else
+ {
+ return fileName;
+ }
+ }
+ }
+ }
+ return matches.group(0);
+ }
+
+ private String scanForArtifact(Matcher targetClassesMatcher)
+ {
+ // Locate all target/classes in classpath and store the path to all files target/
+ List<String> paths = new ArrayList<String>();
+ do
+ {
+ String path = targetClassesMatcher.group();
+ File target = new File(path.substring(0, path.length() - 8));
+ if (target.exists())
+ {
+ if (!target.isDirectory())
+ {
+ throw new IllegalStateException("Found ${project.dir}/target/ but it is not a directory!");
+ }
+ for (File file : target.listFiles())
+ {
+ paths.add(file.getPath());
+ }
+ }
+ }
+ while (targetClassesMatcher.find());
+ return scanForArtifact(paths);
+ }
+
+ String scanForArtifact(List<String> paths)
+ {
+ Pattern pattern = Pattern.compile(artifactId + "-[\\d+\\.]+(?:[\\-\\.]\\p{Alpha}*)?.jar$");
+ for (String path : paths)
+ {
+ if (pattern.matcher(path).find())
+ {
+ return path;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Creates a matcher that returns any fully qualified matches of the form
+ * <code>com/acme/acme-core/1.0/acme-core-1.0.jar</code>. This will match
+ * artifacts on the classpath from the Maven repo.
+ */
+ private Matcher createFullyQualifiedMatcher()
+ {
+ String pathString = groupId.replace('.', fileSeparator) + fileSeparator + artifactId;
+ Pattern p = Pattern.compile(classPathSeparatorRegex + Pattern.quote(pathString) + classPathSeparatorRegex, Pattern.CASE_INSENSITIVE);
+ return p.matcher(classPath);
+ }
+
+ /**
+ * Creates a matcher that returns any unqualified matches of the form
+ * <code>target/acme-foo-1.0.jar</code>. This will match artifacts on the
+ * classpath from the reactor.
+ */
+ private Matcher createUnqualifiedMatcher()
+ {
+ Pattern p = Pattern.compile(classPathSeparatorRegex + Pattern.quote("target" + fileSeparator + artifactId) + classPathSeparatorRegex, Pattern.CASE_INSENSITIVE);
+ return p.matcher(classPath);
+ }
+
+ /**
+ * Creates a matcher that returns any unqualified matches of the form
+ * <code>target/acme-foo-1.0.jar</code>. This locates all
+ *
+ */
+ private Matcher createTargetClassesMatcher()
+ {
+ Pattern p = Pattern.compile(classPathSeparatorRegex + Pattern.quote("target" + fileSeparator + "classes") + classPathSeparatorRegex, Pattern.CASE_INSENSITIVE);
+ return p.matcher(classPath);
+ }
+}
Property changes on: modules/persistence/trunk/tests-jboss
___________________________________________________________________
Name: svn:ignore
+ .project
.settings
.classpath
Added: modules/persistence/trunk/tests-jboss/pom.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/pom.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/pom.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,287 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>seam-persistence-parent</artifactId>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-tests-jboss</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Persistence Jboss Tests</name>
+
+ <properties>
+ <jboss.home>${env.JBOSS_HOME}</jboss.home>
+ <jboss.domain>default</jboss.domain>
+ </properties>
+
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.interceptor</groupId>
+ <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-tests-base</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!--
+ skip unit test run, tests to be executed during
+ integration-test
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>jbossas-managed-6</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-managed-6</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>jboss.home</property>
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>jbossas-remote-6</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-6</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- need for org.jnp.interfaces.NamingContextFactory -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/persistence/trunk/tests-jboss</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/persistence/trunk/tests-jboss</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/persistence/trunk/tests-jboss</url>
+ </scm>
+
+</project>
+
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/EntityInjectionTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/EntityInjectionTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/EntityInjectionTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.EntityInjectionTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests that injection is working for JPA entities
+ *
+ * @author Stuart Douglas
+ *
+ */
+ at RunWith(Arquillian.class)
+public class EntityInjectionTest extends EntityInjectionTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ war.addWebResource("META-INF/persistence-orm.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource("META-INF/orm.xml", "classes/META-INF/orm.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/JbossHibernateSearchTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/JbossHibernateSearchTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/JbossHibernateSearchTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.HibernateSearchTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class JbossHibernateSearchTest extends HibernateSearchTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.HIBERNATE_SEARCH));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.LUCENE_ANALYZERS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.LUCENE_CORE));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence-search.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ war.addWebResource("META-INF/services/org.jboss.seam.persistence.SeamPersistenceProvider", "classes/META-INF/services/org.jboss.seam.persistence.SeamPersistenceProvider");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextCreatedEventTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextCreatedEventTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextCreatedEventTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.ManagedPersistenceContextCreatedEventTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagedPersistenceContextCreatedEventTest extends ManagedPersistenceContextCreatedEventTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextELTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextELTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextELTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.ManagedPersistenceContextELTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagedPersistenceContextELTest extends ManagedPersistenceContextELTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextFlushModeTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextFlushModeTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextFlushModeTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.ManagedPersistenceContextFlushModeTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagedPersistenceContextFlushModeTest extends ManagedPersistenceContextFlushModeTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ war.addWebResource("META-INF/services/org.jboss.seam.persistence.SeamPersistenceProvider", "classes/META-INF/services/org.jboss.seam.persistence.SeamPersistenceProvider");
+ return war;
+ }
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/test/jboss/ManagedPersistenceContextTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.test.ManagedPersistenceContextTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagedPersistenceContextTest extends ManagedPersistenceContextTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionAttributeInterceptorTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionAttributeInterceptorTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionAttributeInterceptorTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transaction.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transaction.TransactionInterceptor;
+import org.jboss.seam.persistence.transactions.test.TransactionAttributeInterceptorTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests the @TransactionAttribute interceptor for non ee beans.
+ *
+ * TODO: refactor the tests to share a common superclass
+ *
+ * @author stuart
+ *
+ */
+ at RunWith(Arquillian.class)
+public class TransactionAttributeInterceptorTest extends TransactionAttributeInterceptorTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(("<beans><interceptors><class>" + TransactionInterceptor.class.getName() + "</class></interceptors></beans>").getBytes()), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionInterceptorTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionInterceptorTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionInterceptorTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt 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.seam.persistence.transaction.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transaction.TransactionInterceptor;
+import org.jboss.seam.persistence.transactions.test.TransactionInterceptorTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests the @Transactional interceptor
+ *
+ * TODO: refactor the tests to share a common superclass
+ *
+ * @author stuart
+ *
+ */
+ at RunWith(Arquillian.class)
+public class TransactionInterceptorTest extends TransactionInterceptorTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(("<beans><interceptors><class>" + TransactionInterceptor.class.getName() + "</class></interceptors></beans>").getBytes()), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionScopedTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionScopedTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/TransactionScopedTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,31 @@
+package org.jboss.seam.persistence.transaction.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transactions.test.TransactionScopedTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class TransactionScopedTest extends TransactionScopedTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/UserTransactionTest.java
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/UserTransactionTest.java (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/java/org/jboss/seam/persistence/transaction/test/jboss/UserTransactionTest.java 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,31 @@
+package org.jboss.seam.persistence.transaction.test.jboss;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.persistence.transactions.test.UserTransactionTestBase;
+import org.jboss.seam.transactions.test.util.ArtifactNames;
+import org.jboss.seam.transactions.test.util.MavenArtifactResolver;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class UserTransactionTest extends UserTransactionTestBase
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ WebArchive war = ShrinkWrap.createDomain().getArchiveFactory().create(WebArchive.class, "test.war");
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
+ war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_IMPL));
+ war.addClasses(getTestClasses());
+ war.addWebResource("META-INF/persistence.xml", "classes/META-INF/persistence.xml");
+ war.addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ war.addWebResource("META-INF/services/javax.enterprise.inject.spi.Extension", "classes/META-INF/services/javax.enterprise.inject.spi.Extension");
+ return war;
+ }
+
+}
Added: modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/orm.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/orm.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/orm.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
+ version="1.0"
+ >
+ <persistence-unit-metadata >
+ <persistence-unit-defaults >
+ <entity-listeners>
+ <entity-listener class="org.jboss.seam.persistence.InjectionEventListener" >
+ <post-load method-name="load" />
+ </entity-listener>
+ </entity-listeners>
+ </persistence-unit-defaults>
+ </persistence-unit-metadata>
+
+</entity-mappings>
\ No newline at end of file
Added: modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-orm.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-orm.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-orm.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="seamPersistencePu">
+ <!--
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ -->
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <mapping-file>META-INF/orm.xml</mapping-file>
+ <class>org.jboss.seam.transactions.test.util.Hotel</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <!-- Properties for Hibernate (default provider for JBoss AS) -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- Only format when you need to debug, because it slows things down -->
+ <property name="hibernate.format_sql" value="false"/>
+
+ <!-- Properties for EclipseLink (default provider for GlassFish) -->
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+ <property name="eclipselink.logging.level" value="FINE"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-search.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-search.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence-search.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="seamPersistencePu">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <class>org.jboss.seam.transactions.test.util.IndexedHotel</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <!-- Properties for Hibernate (default provider for JBoss AS) -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- Only format when you need to debug, because it slows things down -->
+ <property name="hibernate.format_sql" value="false"/>
+ <property name="hibernate.search.default.directory_provider"
+ value="org.hibernate.search.store.RAMDirectoryProvider"/>
+
+ </properties>
+ </persistence-unit>
+</persistence>
Added: modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources/META-INF/persistence.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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_2_0.xsd"
+ version="2.0">
+ <persistence-unit name="seamPersistencePu">
+ <!--
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ -->
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <class>org.jboss.seam.transactions.test.util.Hotel</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <!-- Properties for Hibernate (default provider for JBoss AS) -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- Only format when you need to debug, because it slows things down -->
+ <property name="hibernate.format_sql" value="false"/>
+
+ <!-- Properties for EclipseLink (default provider for GlassFish) -->
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+ <property name="eclipselink.logging.level" value="FINE"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: modules/persistence/trunk/tests-jboss/src/test/resources/arquillian.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources/arquillian.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources/arquillian.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns="http://jboss.com/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gfembedded="urn:arq:org.jboss.arquillian.glassfish.embedded30"
+ xmlns:gfremote="urn:arq:org.jboss.arquillian.container.glassfish.remote30"
+ xmlns:jbossmanaged="urn:arq:org.jboss.arquillian.container.jbossas.managed_6">
+
+ <engine>
+ <deploymentExportPath>/tmp/</deploymentExportPath>
+ </engine>
+
+ <jbossmanaged:container>
+ <javaVmArguments>-Xmx512m -XX:MaxPermSize=256m</javaVmArguments>
+ </jbossmanaged:container>
+</arquillian>
Added: modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/jndi.properties
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/jndi.properties (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/jndi.properties 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Added: modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/seam-transactions-test-ds.xml
===================================================================
--- modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/seam-transactions-test-ds.xml (rev 0)
+++ modules/persistence/trunk/tests-jboss/src/test/resources-jbossas/seam-transactions-test-ds.xml 2010-09-03 01:01:19 UTC (rev 13715)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>jdbc/__default</jndi-name>
+ <use-java-context>false</use-java-context>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ </local-tx-datasource>
+</datasources>
More information about the seam-commits
mailing list