aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1680218 [2/5] - in /aries/trunk/jpa: ./ examples/ examples/tasklist-blueprint/ examples/tasklist-blueprint/src/ examples/tasklist-blueprint/src/main/ examples/tasklist-blueprint/src/main/java/ examples/tasklist-blueprint/src/main/java/org/...
Date Tue, 19 May 2015 09:47:53 GMT
Added: aries/trunk/jpa/examples/tasklist-model/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/examples/tasklist-model/pom.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/examples/tasklist-model/pom.xml (added)
+++ aries/trunk/jpa/examples/tasklist-model/pom.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+        <groupId>org.apache.aries.jpa.example</groupId>
+        <artifactId>org.apache.aries.jpa.example.parent</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+    <artifactId>org.apache.aries.jpa.example.tasklist.model</artifactId>
+    <name>Apache Aries JPA example tasklist model</name>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+                        <!-- Needed for runtime enhancement -->
+                        <Import-Package>*, org.hibernate.proxy,
+                            javassist.util.proxy</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/Task.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/Task.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/Task.java (added)
+++ aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/Task.java Tue May 19 09:47:49 2015
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.jpa.example.tasklist.model;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Entity
+@XmlRootElement
+public class Task {
+    @Id
+    Integer id;
+    String title;
+    String description;
+    Date dueDate;
+    boolean finished;
+    
+    
+    public Task() {
+    }
+    
+
+    public Task(Integer id, String title, String description) {
+        super();
+        this.id = id;
+        this.title = title;
+        this.description = description;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = new Integer(id);
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getDueDate() {
+        return dueDate;
+    }
+
+    public void setDueDate(Date dueDate) {
+        this.dueDate = dueDate;
+    }
+
+    public boolean isFinished() {
+        return finished;
+    }
+
+    public void setFinished(boolean finished) {
+        this.finished = finished;
+    }
+
+}
\ No newline at end of file

Copied: aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/TaskService.java (from r1680054, aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/NLS.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/TaskService.java?p2=aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/TaskService.java&p1=aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/NLS.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/NLS.java (original)
+++ aries/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/TaskService.java Tue May 19 09:47:49 2015
@@ -16,11 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.jpa.container.context.impl;
+package org.apache.aries.jpa.example.tasklist.model;
 
-import org.apache.aries.util.nls.MessageUtil;
+import java.util.Collection;
 
-public class NLS
-{
-  public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(NLS.class, "org.apache.aries.jpa.container.context.nls.jpaContainerContextMessages");
-}
\ No newline at end of file
+public interface TaskService {
+	Task getTask(Integer id);
+	void addTask(Task task);
+	void updateTask(Task task);
+	void deleteTask(Integer id);
+	Collection<Task> getTasks();
+}

Added: aries/trunk/jpa/examples/tasklist-model/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/examples/tasklist-model/src/main/resources/META-INF/persistence.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/examples/tasklist-model/src/main/resources/META-INF/persistence.xml (added)
+++ aries/trunk/jpa/examples/tasklist-model/src/main/resources/META-INF/persistence.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0" 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">
+    
+    <persistence-unit name="tasklist" transaction-type="JTA">
+        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+        
+        <!-- Only used when transaction-type=JTA -->
+        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)</jta-data-source>
+        
+        <!-- Only used when transaction-type=RESOURCE_LOCAL -->
+        <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)</non-jta-data-source>
+        <properties>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+        </properties>
+    </persistence-unit>
+
+</persistence>

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/.gitignore (from r1680054, aries/trunk/jpa/jpa-container-testbundle/.gitignore)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/.gitignore?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/.gitignore&p1=aries/trunk/jpa/jpa-container-testbundle/.gitignore&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/LICENSE (from r1680054, aries/trunk/jpa/jpa-container-testbundle/LICENSE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/LICENSE?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/LICENSE&p1=aries/trunk/jpa/jpa-container-testbundle/LICENSE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/NOTICE (from r1680054, aries/trunk/jpa/jpa-container-testbundle/NOTICE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/NOTICE?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/NOTICE&p1=aries/trunk/jpa/jpa-container-testbundle/NOTICE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/pom.xml (from r1680054, aries/trunk/jpa/jpa-container-advancedtestbundle/pom.xml)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/pom.xml?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/pom.xml&p1=aries/trunk/jpa/jpa-container-advancedtestbundle/pom.xml&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-advancedtestbundle/pom.xml (original)
+++ aries/trunk/jpa/itests/jpa-container-advancedtestbundle/pom.xml Tue May 19 09:47:49 2015
@@ -33,6 +33,7 @@
     <version>1.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
     <name>Test Bundle for Aries JPA Container advanced iTests</name>
+    <description>For load time weaving and annotation scanning tests</description>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-advancedtestbundle</connection>

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/Car.java (from r1680054, aries/trunk/jpa/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/Car.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/Car.java?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/Car.java&p1=aries/trunk/jpa/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/Car.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/packageinfo (from r1680054, aries/trunk/jpa/jpa-container-testbundle/src/main/java/org/apache/aries/jpa/container/itest/entities/packageinfo)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/packageinfo?p2=aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/java/org/apache/aries/jpa/container/advanced/itest/bundle/entities/packageinfo&p1=aries/trunk/jpa/jpa-container-testbundle/src/main/java/org/apache/aries/jpa/container/itest/entities/packageinfo&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Added: aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/resources/META-INF/persistence.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/resources/META-INF/persistence.xml (added)
+++ aries/trunk/jpa/itests/jpa-container-advancedtestbundle/src/main/resources/META-INF/persistence.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<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="test-unit" transaction-type="JTA">
+        <description>Test persistence unit for the JPA Container advanced iTests</description>
+        <properties>
+            <property name="javax.persistence.jdbc.driver"
+                value="org.apache.derby.jdbc.EmbeddedDriver-pool-xa" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:TEST;create=true" />
+
+            <!-- These properties are creating the database on the fly. We 
+                are using them to avoid the tests having to create a database -->
+
+            <property name="openjpa.jdbc.SynchronizeMappings"
+                value="buildSchema(ForeignKeys=true)" />
+            <property name="openjpa.jdbc.DBDictionary" value="derby" />
+
+            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+            <property name="hibernate.dialect"
+                value="org.hibernate.dialect.DerbyTenSevenDialect" />
+    <!--         <property name="hibernate.hbm2ddl.auto" value="create-drop" /> -->
+        </properties>
+    </persistence-unit>
+
+</persistence>

Copied: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/.gitignore (from r1680054, aries/trunk/jpa/jpa-container-advancedtestbundle/.gitignore)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/.gitignore?p2=aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/.gitignore&p1=aries/trunk/jpa/jpa-container-advancedtestbundle/.gitignore&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/LICENSE (from r1680054, aries/trunk/jpa/jpa-blueprint-testbundle/LICENSE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/LICENSE?p2=aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/LICENSE&p1=aries/trunk/jpa/jpa-blueprint-testbundle/LICENSE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/NOTICE (from r1680054, aries/trunk/jpa/jpa-container-testbundle-eclipselink/NOTICE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/NOTICE?p2=aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/NOTICE&p1=aries/trunk/jpa/jpa-container-testbundle-eclipselink/NOTICE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Added: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/pom.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/pom.xml (added)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/pom.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.aries.jpa.itest</groupId>
+        <artifactId>org.apache.aries.jpa.itest.parent</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.aries.jpa.container.itest.bundle.blueprint</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries JPA test bundle blueprint integration</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.0-api</artifactId>
+            <version>1.0.1.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.transaction</groupId>
+            <artifactId>org.apache.aries.transaction.blueprint</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.jpa</groupId>
+            <artifactId>org.apache.aries.jpa.api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.aries.jpa.itest.testbundle.*</Export-Package>
+                        <!-- Dynamic import to for hibernate enhancement 
+                            to make sure it also works in eclipselink -->
+                        <DynamicImport-Package>org.hibernate.proxy,
+                            javassist.util.proxy</DynamicImport-Package>
+                        <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <description>Testing blueprint integration with EntityManager, EntityManagerFactory and EmSupplier injection.
+Also testing declarative transactions</description>
+</project>

Copied: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/entities/Car.java (from r1680054, aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/entities/Car.java?p2=aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/entities/Car.java&p1=aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/entities/Car.java (original)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/entities/Car.java Tue May 19 09:47:49 2015
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.jpa.blueprint.itest.entities;
+package org.apache.aries.jpa.itest.testbundle.entities;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;

Copied: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/CarService.java (from r1680054, aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/DestroyCallback.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/CarService.java?p2=aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/CarService.java&p1=aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/DestroyCallback.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/quiesce/impl/DestroyCallback.java (original)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/CarService.java Tue May 19 09:47:49 2015
@@ -16,11 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.jpa.container.quiesce.impl;
+package org.apache.aries.jpa.itest.testbundle.service;
 
-/**
- * An asynchronous callback for destroying something
- */
-public interface DestroyCallback {
-  public void callback();
+import java.util.Collection;
+
+import org.apache.aries.jpa.itest.testbundle.entities.Car;
+
+public interface CarService {
+	Car getCar(String id);
+	void addCar(Car car);
+	Collection<Car> getCars();
+	void updateCar(Car car);
+	void deleteCar(String id);
 }

Added: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceImpl.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceImpl.java (added)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceImpl.java Tue May 19 09:47:49 2015
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.jpa.itest.testbundle.service.impl;
+
+import java.util.Collection;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.aries.jpa.itest.testbundle.entities.Car;
+import org.apache.aries.jpa.itest.testbundle.service.CarService;
+
+
+public class CarServiceImpl implements CarService {
+
+	@PersistenceContext(unitName="test_unit_blueprint")
+	EntityManager em;
+	
+	@Override
+	public Car getCar(String id) {
+		return em.find(Car.class, id);
+	}
+
+	@Override
+	public void addCar(Car car) {
+		em.persist(car);
+		em.flush();
+	}
+
+	public Collection<Car> getCars() {
+		return em.createQuery("select c from Car c", Car.class)
+			.getResultList();
+	}
+
+	@Override
+	public void updateCar(Car car) {
+		em.persist(car);
+	}
+
+	@Override
+	public void deleteCar(String id) {
+		em.remove(getCar(id));
+	}
+
+	public void setEm(EntityManager em) {
+		this.em = em;
+	}
+	
+}

Added: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceWithSupplierImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceWithSupplierImpl.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceWithSupplierImpl.java (added)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/java/org/apache/aries/jpa/itest/testbundle/service/impl/CarServiceWithSupplierImpl.java Tue May 19 09:47:49 2015
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.jpa.itest.testbundle.service.impl;
+
+import java.util.Collection;
+
+import javax.persistence.PersistenceContext;
+
+import org.apache.aries.jpa.itest.testbundle.entities.Car;
+import org.apache.aries.jpa.itest.testbundle.service.CarService;
+import org.apache.aries.jpa.supplier.EmSupplier;
+
+public class CarServiceWithSupplierImpl implements CarService {
+
+	Collection<String> colours;
+
+	@PersistenceContext(unitName = "test_unit_blueprint")
+	EmSupplier em;
+
+	@Override
+	public Car getCar(String id) {
+		return em.get().find(Car.class, id);
+	}
+
+	@Override
+	public void addCar(Car car) {
+		em.get().persist(car);
+		em.get().flush();
+	}
+
+	public Collection<Car> getCars() {
+		return em.get().createQuery("select c from Car c", Car.class)
+				.getResultList();
+	}
+
+	@Override
+	public void updateCar(Car car) {
+		em.get().persist(car);
+	}
+
+	@Override
+	public void deleteCar(String id) {
+		em.get().remove(getCar(id));
+	}
+
+	public void setEm(EmSupplier em) {
+		this.em = em;
+	}
+
+}

Added: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/META-INF/persistence.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/META-INF/persistence.xml (added)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/META-INF/persistence.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+	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">
+
+	<persistence-unit name="test_unit_blueprint" transaction-type="JTA">
+		<description>Test persistence unit for the Blueprint test</description>
+
+		<properties>
+            <property name="javax.persistence.jdbc.driver"
+                value="org.apache.derby.jdbc.EmbeddedDriver-pool-xa" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:TEST;create=true" />
+
+            <!-- These properties are creating the database on the fly. We 
+                are using them to avoid the tests having to create a database -->
+
+            <property name="openjpa.jdbc.SynchronizeMappings"
+                value="buildSchema(ForeignKeys=true)" />
+            <property name="openjpa.jdbc.DBDictionary" value="derby" />
+
+            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+            <property name="hibernate.dialect"
+                value="org.hibernate.dialect.DerbyTenSevenDialect" />
+            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+        </properties>
+	</persistence-unit>
+    
+</persistence>

Added: aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/config.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/config.xml (added)
+++ aries/trunk/jpa/itests/jpa-container-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/config.xml Tue May 19 09:47:49 2015
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+	xmlns:jpa="http://aries.apache.org/xmlns/jpan/v1.0.0"
+	xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+	<jpa:enable />
+
+	<service ref="carService" interface="org.apache.aries.jpa.itest.testbundle.service.CarService">
+	</service>
+	<bean id="carService" class="org.apache.aries.jpa.itest.testbundle.service.impl.CarServiceWithSupplierImpl">
+		<tx:transaction method="*" value="Required" />
+	</bean>
+    
+</blueprint>
+

Copied: aries/trunk/jpa/itests/jpa-container-itest/LICENSE (from r1680054, aries/trunk/jpa/jpa-container-testbundle-eclipselink/LICENSE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/LICENSE?p2=aries/trunk/jpa/itests/jpa-container-itest/LICENSE&p1=aries/trunk/jpa/jpa-container-testbundle-eclipselink/LICENSE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-itest/NOTICE (from r1680054, aries/trunk/jpa/jpa-container-itest/NOTICE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/NOTICE?p2=aries/trunk/jpa/itests/jpa-container-itest/NOTICE&p1=aries/trunk/jpa/jpa-container-itest/NOTICE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-itest/pom.xml (from r1680054, aries/trunk/jpa/jpa-container-itest/pom.xml)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/pom.xml?p2=aries/trunk/jpa/itests/jpa-container-itest/pom.xml&p1=aries/trunk/jpa/jpa-container-itest/pom.xml&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/pom.xml (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/pom.xml Tue May 19 09:47:49 2015
@@ -30,8 +30,8 @@
 
     <groupId>org.apache.aries.jpa</groupId>
     <artifactId>org.apache.aries.jpa.container.itest</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
-    <name>Aries JPA iTests</name>
+    <version>2.0.0-SNAPSHOT</version>
+    <name>Apache Aries JPA iTests</name>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-itest</connection>
@@ -40,14 +40,16 @@
     </scm>
 
     <properties>
-        <exam.version>3.4.0</exam.version>
+        <exam.version>4.5.0</exam.version>
         <url.version>1.6.0</url.version>
         <hibernate42.version>4.2.15.Final</hibernate42.version>
+        <hibernate43.version>4.2.15.Final</hibernate43.version>
         <ant.bundle.version>1.8.2_2</ant.bundle.version>
         <antlr.bundle.version>2.7.7_5</antlr.bundle.version>
         <dom4j.bundle.version>1.6.1_5</dom4j.bundle.version>
         <serp.bundle.version>1.14.1_1</serp.bundle.version>
         <eclipselink.version>2.5.2</eclipselink.version>
+        <openjpa.version>2.3.0</openjpa.version>
     </properties>
 
     <dependencies>
@@ -67,6 +69,12 @@
             <version>5.0.0</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.configadmin</artifactId>
+            <version>1.8.4</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.aries</groupId>
             <artifactId>org.apache.aries.util</artifactId>
             <version>1.0.0</version>
@@ -99,7 +107,7 @@
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.core</artifactId>
-            <version>1.1.0</version>
+            <version>1.4.3</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -113,25 +121,25 @@
         <dependency>
             <artifactId>org.apache.aries.jpa.api</artifactId>
             <groupId>org.apache.aries.jpa</groupId>
-            <version>1.0.3-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.jpa</groupId>
             <artifactId>org.apache.aries.jpa.container</artifactId>
-            <version>1.0.3-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.jpa</groupId>
-            <artifactId>org.apache.aries.jpa.container.context</artifactId>
-            <version>1.0.5-SNAPSHOT</version>
+            <artifactId>org.apache.aries.jpa.support</artifactId>
+            <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.jpa</groupId>
-            <artifactId>org.apache.aries.jpa.blueprint.aries</artifactId>
-            <version>1.0.5-SNAPSHOT</version>
+            <artifactId>org.apache.aries.jpa.blueprint</artifactId>
+            <version>2.0.0-SNAPSHOT</version>
             <!--<scope>test</scope> -->
         </dependency>
 
@@ -153,7 +161,7 @@
         <dependency>
             <groupId>org.apache.openjpa</groupId>
             <artifactId>openjpa</artifactId>
-            <version>2.3.0</version>
+            <version>${openjpa.version}</version>
             <scope>test</scope>
         </dependency>
 
@@ -305,11 +313,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.aries.jpa</groupId>
-            <artifactId>org.apache.aries.jpa.blueprint.itest.bundle</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <groupId>org.apache.aries.jpa.itest</groupId>
+            <artifactId>org.apache.aries.jpa.container.itest.bundle.blueprint</artifactId>
+            <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.aries.jpa.itest</groupId>
+            <artifactId>org.apache.aries.jpa.container.itest.bundle.blueprint</artifactId>
+            <version>2.0.0-SNAPSHOT</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.aries.quiesce</groupId>
@@ -380,7 +393,13 @@
         <dependency>
             <groupId>org.ops4j.pax.jdbc</groupId>
             <artifactId>pax-jdbc-derby</artifactId>
-            <version>0.3.0</version>
+            <version>0.6.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.jdbc</groupId>
+            <artifactId>pax-jdbc-pool-dbcp2</artifactId>
+            <version>0.6.0-SNAPSHOT</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/EclipseLinkWeavingAndAnnotationScanningTest.java Tue May 19 09:47:49 2015
@@ -15,38 +15,32 @@
  */
 package org.apache.aries.jpa.advanced.features.itest;
 
-import org.apache.aries.jpa.container.PersistenceUnitConstants;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+
 import org.apache.aries.jpa.container.advanced.itest.bundle.entities.Car;
 import org.eclipse.persistence.internal.weaving.PersistenceWeaved;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-import java.util.Arrays;
-
-import javax.persistence.EntityManagerFactory;
-
 public class EclipseLinkWeavingAndAnnotationScanningTest extends JPAWeavingAndAnnotationScanningTest {
     @Configuration
     public Option[] eclipseLinkConfig() {
-        return options(        
-            baseOptions(),
-            ariesJpa21(),
-            eclipseLink(),
-            testBundleAdvanced()          
-        );
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa21(), //
+            eclipseLink(), //
+            derbyDSF(), //
+            testBundleAdvanced()
+        };
     }
-    
+
     @Test
     public void testClassIsWoven() throws Exception {
-      context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
-      
-      Thread.sleep(200);
-      assertTrue("Not PersistenceCapable", Arrays.asList(Car.class.getInterfaces())
-          .contains(PersistenceWeaved.class));
+        assertTrue("Not PersistenceCapable",
+                   Arrays.asList(Car.class.getInterfaces()).contains(PersistenceWeaved.class));
     }
-	
+
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/JPAWeavingAndAnnotationScanningTest.java Tue May 19 09:47:49 2015
@@ -17,31 +17,40 @@ package org.apache.aries.jpa.advanced.fe
 
 import static org.junit.Assert.assertEquals;
 
+import javax.inject.Inject;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
+import javax.transaction.UserTransaction;
 
 import org.apache.aries.jpa.container.advanced.itest.bundle.entities.Car;
 import org.apache.aries.jpa.itest.AbstractJPAItest;
 import org.junit.Test;
+import org.ops4j.pax.exam.util.Filter;
 
 public abstract class JPAWeavingAndAnnotationScanningTest extends AbstractJPAItest {
+    @Inject
+    UserTransaction transaction;
 
-	@Test
-	public void testAnnotatedClassFound() throws Exception {
-		EntityManagerFactory emf = getEMF(TEST_UNIT);
-		EntityManager em = emf.createEntityManager();
-		em.getTransaction().begin();
-
-		Car c = new Car();
-		c.setColour("Blue");
-		c.setNumberPlate("AB11CDE");
-		c.setNumberOfSeats(7);
-		c.setEngineSize(1900);
-		em.persist(c);
-
-		em.getTransaction().commit();
-
-		assertEquals(7, em.find(Car.class, "AB11CDE").getNumberOfSeats());
-	}
+    @Inject
+    @Filter("(osgi.unit.name=" + TEST_UNIT + ")")
+    EntityManagerFactory emf;
+
+    @Test
+    public void testAnnotatedClassFound() throws Exception {
+        EntityManager em = emf.createEntityManager();
+        transaction.begin();
+
+        Car c = new Car();
+        c.setColour("Blue");
+        c.setNumberPlate("AB11CDE");
+        c.setNumberOfSeats(7);
+        c.setEngineSize(1900);
+        em.persist(c);
+
+        transaction.commit();
+
+        assertEquals(7, em.find(Car.class, "AB11CDE").getNumberOfSeats());
+        em.close();
+    }
 
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/advanced/features/itest/OpenjpaWeavingAndAnnotationScanningTest.java Tue May 19 09:47:49 2015
@@ -16,7 +16,6 @@
 package org.apache.aries.jpa.advanced.features.itest;
 
 import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.options;
 
 import java.util.Arrays;
 
@@ -29,25 +28,22 @@ import org.ops4j.pax.exam.Option;
 // TODO The Test persistence unit does not seem to be created. Reenable when this works 
 public class OpenjpaWeavingAndAnnotationScanningTest extends JPAWeavingAndAnnotationScanningTest {
 
-	@Configuration
-	public Option[] openjpaConfig() {
-		return options(
-				baseOptions(),
-				openJpa(),
-				derbyDataSourceFactory(),
-				ariesJpa20(),
-				transactionWrapper(),
-
-				testBundleAdvanced()
-				);
-	}
-
-	@Test
-	public void testClassIsWoven() throws Exception {
-		showBundles();
-		getEMF(TEST_UNIT);
-		assertTrue("Not PersistenceCapable", Arrays.asList(Car.class.getInterfaces())
-				.contains(PersistenceCapable.class));
-	}
+    @Configuration
+    public Option[] openjpaConfig() {
+        return new Option[] {
+            baseOptions(), //
+            openJpa(), //
+            derbyDSF(), //
+            ariesJpa20(), //
+            transactionWrapper(), //
+            testBundleAdvanced(), //
+        };
+    }
+
+    @Test
+    public void testClassIsWoven() throws Exception {
+        assertTrue("Not PersistenceCapable",
+                   Arrays.asList(Car.class.getInterfaces()).contains(PersistenceCapable.class));
+    }
 
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java Tue May 19 09:47:49 2015
@@ -13,37 +13,46 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.aries.jpa.context.itest;
+package org.apache.aries.jpa.blueprint.aries.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
+import javax.inject.Inject;
 
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.spi.PersistenceProvider;
-
-import org.apache.aries.itest.RichBundleContext;
 import org.apache.aries.jpa.itest.AbstractJPAItest;
+import org.apache.aries.jpa.itest.testbundle.entities.Car;
+import org.apache.aries.jpa.itest.testbundle.service.CarService;
+import org.junit.Assert;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
-public class EclipseLinkStartupTest extends AbstractJPAItest {
+public class BlueprintTest extends AbstractJPAItest {
+    @Inject
+    CarService carService;
 
     @Test
-    public void testContextCreationWithStartingBundle() throws Exception {
-        RichBundleContext context = context();
-        // wait for the Eclipselink provider to come up
-        context.getService(PersistenceProvider.class);
-        context.getBundleByName("org.apache.aries.jpa.container.itest.bundle.eclipselink").start();
-        context.getService(EntityManagerFactory.class);
+    public void testAddQuery() throws Exception {
+        resolveBundles();
+        Car c = new Car();
+        c.setColour("Blue");
+        c.setNumberPlate("AB11CDE");
+        c.setNumberOfSeats(7);
+        c.setEngineSize(1900);
+
+        carService.addCar(c);
+
+        Car car2 = carService.getCar("AB11CDE");
+        Assert.assertEquals(c.getNumberPlate(), car2.getNumberPlate());
     }
 
     @Configuration
     public Option[] configuration() {
-        return options(//
-                baseOptions(),//
-                ariesJpa21(),//
-                eclipseLink(),//
-                testBundleEclipseLink().noStart()//
-        );
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa20(), //
+            hibernate(), //
+            derbyDSF(), //
+            testBundleBlueprint(),
+            //debug()
+        };
     }
 }

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EMFBuilderTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EMFBuilderTest.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EMFBuilderTest.java (added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EMFBuilderTest.java Tue May 19 09:47:49 2015
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.jpa.container.itest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.aries.jpa.container.itest.entities.Car;
+import org.apache.aries.jpa.itest.AbstractJPAItest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.osgi.service.jpa.EntityManagerFactoryBuilder;
+
+public class EMFBuilderTest extends AbstractJPAItest {
+    @Inject
+    EntityManagerFactoryBuilder emfBuilder;
+    
+    @Test
+    public void testBuilder() throws Exception {
+        Map<String, Object> props = new HashMap<String, Object>();
+        EntityManagerFactory emf = emfBuilder.createEntityManagerFactory(props);
+        EntityManager em = emf.createEntityManager();
+        em.getTransaction().begin();
+        Car c = new Car();
+        c.setColour("Blue");
+        c.setNumberPlate("AB11CDE");
+        c.setNumberOfSeats(7);
+        c.setEngineSize(1900);
+        em.persist(c);
+        em.flush();
+        em.getTransaction().commit();
+        Car c2 = em.find(Car.class, "AB11CDE");
+        Assert.assertEquals(7, c2.getNumberOfSeats());
+        em.close();
+        emf.close();
+    }
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa20(), //
+            transactionWrapper(), //
+            hibernate(), //
+            testDs(),
+            testBundle()
+        };
+    }
+
+}

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EclipseLinkStartupTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EclipseLinkStartupTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EclipseLinkStartupTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkStartupTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/EclipseLinkStartupTest.java Tue May 19 09:47:49 2015
@@ -13,14 +13,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.aries.jpa.context.itest;
+package org.apache.aries.jpa.container.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
-
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.spi.PersistenceProvider;
-
-import org.apache.aries.itest.RichBundleContext;
 import org.apache.aries.jpa.itest.AbstractJPAItest;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
@@ -30,20 +24,19 @@ public class EclipseLinkStartupTest exte
 
     @Test
     public void testContextCreationWithStartingBundle() throws Exception {
-        RichBundleContext context = context();
-        // wait for the Eclipselink provider to come up
-        context.getService(PersistenceProvider.class);
-        context.getBundleByName("org.apache.aries.jpa.container.itest.bundle.eclipselink").start();
-        context.getService(EntityManagerFactory.class);
+        context().getBundleByName("org.apache.aries.jpa.container.itest.bundle.eclipselink").start();
+        getEMF("script-test-unit");
     }
 
     @Configuration
     public Option[] configuration() {
-        return options(//
-                baseOptions(),//
-                ariesJpa21(),//
-                eclipseLink(),//
-                testBundleEclipseLink().noStart()//
-        );
+        return new Option[] {//
+            baseOptions(),//
+            ariesJpa21(),//
+            eclipseLink(),//
+            derbyDSF(), //
+            testBundleEclipseLink().noStart(),//
+        // debug()
+        };
     }
 }

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerDataSourceFactoryTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerDataSourceFactoryTest.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerDataSourceFactoryTest.java (added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerDataSourceFactoryTest.java Tue May 19 09:47:49 2015
@@ -0,0 +1,115 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.aries.jpa.container.itest;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.UserTransaction;
+
+import org.apache.aries.jpa.container.itest.entities.Car;
+import org.apache.aries.jpa.itest.AbstractJPAItest;
+import org.junit.Test;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.util.Filter;
+
+public class JPAContainerDataSourceFactoryTest extends AbstractJPAItest {
+    private static final String DSF_TEST_UNIT = "dsf-test-unit";
+    private static final String DSF_XA_TEST_UNIT = "dsf-xa-test-unit";
+    
+    @Inject
+    @Filter("(osgi.unit.name=" + DSF_TEST_UNIT + ")")
+    EntityManagerFactory emfDSF;
+    
+    @Inject
+    @Filter("(osgi.unit.name=" + DSF_XA_TEST_UNIT + ")")
+    EntityManagerFactory emfDSFXA;
+    
+
+    @Test
+    public void testDataSourceFactoryLifecycle() throws Exception {
+        EntityManager em = emfDSF.createEntityManager();
+        em.getTransaction().begin();
+        Car c = createCar();
+        em.persist(c);
+        em.getTransaction().commit();
+        em.close();
+
+        assertCarFound(emfDSF);
+
+        em = emfDSF.createEntityManager();
+        em.getTransaction().begin();
+        deleteCar(em, c);
+        em.getTransaction().commit();
+        em.close();
+    }
+
+    @Test
+    public void testDataSourceFactoryXALifecycle() throws Exception {
+        EntityManager em = emfDSFXA.createEntityManager();
+
+        // Use a JTA transaction to show integration
+        UserTransaction ut = context().getService(UserTransaction.class);
+        ut.begin();
+        em.joinTransaction();
+        Car c = createCar();
+        em.persist(c);
+        ut.commit();
+        em.close();
+
+        assertCarFound(emfDSFXA);
+
+        em = emfDSFXA.createEntityManager();
+        ut.begin();
+        em.joinTransaction();
+        deleteCar(em, c);
+        ut.commit();
+        em.close();
+    }
+
+    private Car createCar() {
+        Car c = new Car();
+        c.setNumberPlate("123456");
+        c.setColour("blue");
+        return c;
+    }
+
+    private void deleteCar(EntityManager em, Car c) {
+        c = em.merge(c);
+        em.remove(c);
+    }
+
+    private void assertCarFound(EntityManagerFactory emf) {
+        EntityManager em = emf.createEntityManager();
+        assertEquals("blue", em.find(Car.class, "123456").getColour());
+        em.close();
+    }
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa20(), //
+            derbyDSF(), //
+            hibernate(), //
+            testBundle()
+        };
+    }
+
+}

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerHibernateTest.java Tue May 19 09:47:49 2015
@@ -15,8 +15,6 @@
  */
 package org.apache.aries.jpa.container.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
-
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
@@ -27,9 +25,9 @@ import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
 public class JPAContainerHibernateTest extends AbstractJPAItest {
-    
-	@Test
+    @Test
     public void testCarCreateDelete() throws Exception {
+        resolveBundles();
         EntityManagerFactory emf = getEMF(TEST_UNIT);
         EntityManager em = emf.createEntityManager();
         em.getTransaction().begin();
@@ -39,7 +37,7 @@ public class JPAContainerHibernateTest e
         em.persist(c);
         em.getTransaction().commit();
         em.close();
-        
+
         em = emf.createEntityManager();
         em.getTransaction().begin();
         deleteCar(em, c);
@@ -54,16 +52,13 @@ public class JPAContainerHibernateTest e
 
     @Configuration
     public Option[] configuration() {
-        return options(
-                baseOptions(),
-                ariesJpa20(),
-                transactionWrapper(),
-                testDs(),
-                testBundle(),
-                // It is important to start hibernate after the testDs
-                // as it will access the DataSource when creating the EMF
-                hibernate()
-                );
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa20(), //
+            testBundle(), //
+            transactionWrapper(), //
+            testDs(), //
+            hibernate()
+        };
     }
-
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/OpenJPAContainerTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/OpenJPAContainerTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/OpenJPAContainerTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/OpenJPAContainerTest.java Tue May 19 09:47:49 2015
@@ -15,46 +15,35 @@
  */
 package org.apache.aries.jpa.container.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
 
 import org.apache.aries.jpa.itest.AbstractJPAItest;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
-public class JPAContainerTest extends AbstractJPAItest {
+public class OpenJPAContainerTest extends AbstractJPAItest {
 
-	@Test
-	public void findEntityManagerFactory() throws Exception {
-		getEMF(TEST_UNIT);
-	}
-
-	@Test
-	public void findEntityManagerFactory2() throws Exception {
-		getEMF(BP_TEST_UNIT);
-	}
-
-	@Test
-	public void findEntityManager() throws Exception {
-		getEMF(TEST_UNIT).createEntityManager();
-	}
-
-	@Test
-	public void findEntityManager2() throws Exception {
-		getEMF(BP_TEST_UNIT).createEntityManager();
-	}
-
-	@Configuration
-	public Option[] configuration() {
-		return options(
-				baseOptions(),
-				ariesJpa20(),
-				// Needed for the BP_TEST_UNIT
-				transactionWrapper(),
-				openJpa(),
-				testDs(),
-				testBundle());
+    @Test
+    public void findEntityManagerFactory() throws Exception {
+        EntityManagerFactory emf = getEMF(TEST_UNIT);
+        EntityManager em = emf.createEntityManager();
+        em.close();
+    }
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa20(), //
+            // Needed for the BP_TEST_UNIT
+            transactionWrapper(), //
+            openJpa(), //
+            testDs(), //
+            testBundle()
+        };
 
-	}
+    }
 
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkContextTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkContextTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkContextTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/EclipseLinkContextTest.java Tue May 19 09:47:49 2015
@@ -15,22 +15,20 @@
  */
 package org.apache.aries.jpa.context.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
-
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
-public class OpenjpaContextTest extends JPAContextTest {
+public class EclipseLinkContextTest extends JPAContextTest {
 
     @Configuration
-    public Option[] configuration() {
-        return options( //
-                baseOptions(), //
-                ariesJpa20(), //
-                transactionWrapper(), //
-                openJpa(), //
-                testBundle() //
-        );
+    public Option[] eclipseLinkConfig() {
+        return new Option[] {
+            baseOptions(), //
+            ariesJpa21(), //
+            eclipseLink(), //
+            derbyDSF(), //
+            testBundleAdvanced()
+        };
     }
 
 }

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java?rev=1680218&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java (added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java Tue May 19 09:47:49 2015
@@ -0,0 +1,196 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.aries.jpa.context.itest;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.transaction.UserTransaction;
+
+import org.apache.aries.jpa.container.advanced.itest.bundle.entities.Car;
+import org.apache.aries.jpa.itest.AbstractJPAItest;
+import org.apache.aries.jpa.supplier.EmSupplier;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.ops4j.pax.exam.util.Filter;
+
+public abstract class JPAContextTest extends AbstractJPAItest {
+
+    @Inject
+    UserTransaction ut;
+
+    @Inject
+    @Filter("(osgi.unit.name=test-unit)")
+    EmSupplier emSupplier;
+
+    @Before
+    public void preCall() {
+        emSupplier.preCall();
+    }
+    
+    @After
+    public void postCall() {
+        emSupplier.postCall();
+    }
+    
+    @Test
+    public void testCreateAndChange() throws Exception {
+        resolveBundles();
+        EntityManager em = emSupplier.get();
+        ut.begin();
+        em.joinTransaction();
+        try {
+            deleteCars(em);
+            Car car = new Car();
+            car.setNumberOfSeats(5);
+            car.setEngineSize(1200);
+            car.setColour("blue");
+            car.setNumberPlate("A1AAA");
+            em.persist(car);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            ut.commit();
+        }
+        
+        Car c = em.find(Car.class, "A1AAA");
+        
+        assertEquals(5, c.getNumberOfSeats());
+        assertEquals(1200, c.getEngineSize());
+        assertEquals("blue", c.getColour());
+        
+        ut.begin();
+        try {
+            Car car = em.find(Car.class, "A1AAA");
+            car.setNumberOfSeats(2);
+            car.setEngineSize(2000);
+            car.setColour("red");
+        } finally {
+            ut.commit();
+        }
+        
+        c = em.find(Car.class, "A1AAA");
+        
+        assertEquals(2, c.getNumberOfSeats());
+        assertEquals(2000, c.getEngineSize());
+        assertEquals("red", c.getColour());
+    }
+
+    private void deleteCars(EntityManager em) {
+        Query q = em.createQuery("DELETE from Car c");
+        q.executeUpdate();
+
+        q = em.createQuery("SELECT Count(c) from Car c");
+        assertEquals(0l, q.getSingleResult());
+    }
+
+    @Test
+    public void testQueries() throws Exception {
+        final EntityManager em = emSupplier.get();
+        try {
+            ut.begin();
+            em.joinTransaction();
+            deleteCars(em);
+        } finally {
+            ut.commit();
+        }
+
+        Query countQuery = em.createQuery("SELECT Count(c) from Car c");
+        assertEquals(0l, countQuery.getSingleResult());
+
+        ut.begin();
+        em.joinTransaction();
+        try {
+            Car car = new Car();
+            car.setNumberOfSeats(5);
+            car.setEngineSize(1200);
+            car.setColour("blue");
+            car.setNumberPlate("A1AAA");
+            em.persist(car);
+
+            car = new Car();
+            car.setNumberOfSeats(7);
+            car.setEngineSize(1800);
+            car.setColour("green");
+            car.setNumberPlate("B2BBB");
+            em.persist(car);
+        } finally {
+            ut.commit();
+        }
+
+        assertEquals(2l, countQuery.getSingleResult());
+
+        TypedQuery<Car> carQuery = em.createQuery("Select c from Car c ORDER by c.engineSize",
+                                                         Car.class);
+
+        List<Car> list = carQuery.getResultList();
+        assertEquals(2l, list.size());
+
+        assertEquals(5, list.get(0).getNumberOfSeats());
+        assertEquals(1200, list.get(0).getEngineSize());
+        assertEquals("blue", list.get(0).getColour());
+        assertEquals("A1AAA", list.get(0).getNumberPlate());
+
+        assertEquals(7, list.get(1).getNumberOfSeats());
+        assertEquals(1800, list.get(1).getEngineSize());
+        assertEquals("green", list.get(1).getColour());
+        assertEquals("B2BBB", list.get(1).getNumberPlate());
+
+        ut.begin();
+        em.joinTransaction();
+        try {
+            Car car = em.find(Car.class, "A1AAA");
+            car.setNumberOfSeats(2);
+            car.setEngineSize(2000);
+            car.setColour("red");
+
+            car = em.find(Car.class, "B2BBB");
+            em.remove(car);
+
+            car = new Car();
+            car.setNumberOfSeats(2);
+            car.setEngineSize(800);
+            car.setColour("black");
+            car.setNumberPlate("C3CCC");
+            em.persist(car);
+
+        } finally {
+            ut.commit();
+        }
+
+        assertEquals(2l, countQuery.getSingleResult());
+
+        list = carQuery.getResultList();
+        assertEquals(2l, list.size());
+
+        assertEquals(2, list.get(0).getNumberOfSeats());
+        assertEquals(800, list.get(0).getEngineSize());
+        assertEquals("black", list.get(0).getColour());
+        assertEquals("C3CCC", list.get(0).getNumberPlate());
+
+        assertEquals(2, list.get(1).getNumberOfSeats());
+        assertEquals(2000, list.get(1).getEngineSize());
+        assertEquals("red", list.get(1).getColour());
+        assertEquals("A1AAA", list.get(1).getNumberPlate());
+    }
+
+}

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/OpenjpaContextTest.java Tue May 19 09:47:49 2015
@@ -15,8 +15,6 @@
  */
 package org.apache.aries.jpa.context.itest;
 
-import static org.ops4j.pax.exam.CoreOptions.options;
-
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
@@ -24,13 +22,13 @@ public class OpenjpaContextTest extends
 
     @Configuration
     public Option[] configuration() {
-        return options( //
-                baseOptions(), //
-                ariesJpa20(), //
-                transactionWrapper(), //
-                openJpa(), //
-                testBundle() //
-        );
+        return new Option[] {//
+            baseOptions(), //
+            ariesJpa20(), //
+            openJpa(), //
+            derbyDSF(), //
+            testBundleAdvanced()
+        };
     }
 
 }

Copied: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java (from r1680054, aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java?p2=aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java&p1=aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java Tue May 19 09:47:49 2015
@@ -8,14 +8,9 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
 import static org.ops4j.pax.exam.CoreOptions.when;
 
-import java.util.HashMap;
-
 import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceContextType;
 
 import org.apache.aries.itest.AbstractIntegrationTest;
-import org.apache.aries.jpa.container.PersistenceUnitConstants;
-import org.apache.aries.jpa.container.context.PersistenceContextProvider;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
@@ -32,35 +27,21 @@ public abstract class AbstractJPAItest e
     protected static final String BP_TEST_UNIT = "bp-test-unit";
     protected static final String BP_XA_TEST_UNIT = "bp-xa-test-unit";
     protected static final String TEST_BUNDLE_NAME = "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle";
-    private static final String FILTER_CONTAINER_MANAGED = "(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)";
-    private static final String FILTER_PROXY = "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*)";
-
-    protected void registerClient(String unitName) {
-        PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
-        HashMap<String, Object> props = new HashMap<String, Object>();
-        props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
-        provider.registerContext(unitName, bundleContext.getBundle(), props);
-    }
-
+    
+    /**
+     * TODO check calls to this. Eventually switch to EmSupplier 
+     */
     protected EntityManagerFactory getProxyEMF(String name) {
-        String filter = "(&(osgi.unit.name=" + name + ")" + FILTER_CONTAINER_MANAGED + FILTER_PROXY + ")";
-        return context().getService(EntityManagerFactory.class, filter, 5000);
+        return getEMF(name);
     }
-
+    
     protected EntityManagerFactory getEMF(String name) {
-        return context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=" + name + ")" + FILTER_CONTAINER_MANAGED + ")");
+        return context().getService(EntityManagerFactory.class, "osgi.unit.name=" + name);
     }
 
     @SuppressWarnings("rawtypes")
     protected ServiceReference[] getEMFRefs(String name) throws InvalidSyntaxException {
-        return bundleContext.getAllServiceReferences(EntityManagerFactory.class.getName(), "(&(osgi.unit.name=" + name + ")"
-                + FILTER_CONTAINER_MANAGED + ")");
-    }
-
-    @SuppressWarnings("rawtypes")
-    protected ServiceReference[] getProxyEMFRefs(String name) throws InvalidSyntaxException {
-        return bundleContext.getAllServiceReferences(EntityManagerFactory.class.getName(), "(&(osgi.unit.name=" + name + ")"
-                + FILTER_CONTAINER_MANAGED + FILTER_PROXY + ")");
+        return bundleContext.getAllServiceReferences(EntityManagerFactory.class.getName(), "(osgi.unit.name=" + name + ")");
     }
     
     private MavenArtifactProvisionOption mvnBundle(String groupId, String artifactId) {
@@ -81,9 +62,13 @@ public abstract class AbstractJPAItest e
                 // logging (logProfile)
                 systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
                 when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + localRepo))
-//               , vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
+                //,
                 );
     }
+    
+    protected Option debug() {
+        return vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
+    }
 
     private Option ariesJpaInternal() {
         return composite(
@@ -93,31 +78,27 @@ public abstract class AbstractJPAItest e
                                + "javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stax,javax.xml.transform.stream,javax.xml.validation,javax.xml.ws,javax.xml.ws.handler,javax.xml.ws.handler.soap,javax.xml.ws.http,javax.xml.ws.soap,javax.xml.ws.spi,javax.xml.xpath,org.ietf.jgss,org.omg.CORBA,org.omg.CORBA.DynAnyPackage,org.omg.CORBA.ORBPackage,org.omg.CORBA.TypeCodePackage,org.omg.CORBA.portable,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable,org.omg.CosNaming,org.omg.CosNaming.NamingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dynamic,org.omg.DynamicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.DynAnyPackage,org.omg.IOP,org.omg.IOP.CodecFactoryPackage,org.omg.IOP.CodecPackage,org.omg.Messaging,org.omg.PortableInterceptor,org.omg.PortableInterceptor.ORBInitInfoPackage,org.omg.PortableServer,org.omg.PortableServer.CurrentPackage,org.omg.PortableServer.POAManagerPackage,org.omg.PortableServer.POAPackage,org.omg.P
 ortableServer.ServantLocatorPackage,org.omg.PortableServer.portable,org.omg.SendingContext,org.omg.stub.java.rmi,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.dom.css,org.w3c.dom.events,org.w3c.dom.html,org.w3c.dom.ls,org.w3c.dom.ranges,org.w3c.dom.stylesheets,org.w3c.dom.traversal,org.w3c.dom.views,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers"),
                 
                 mvnBundle("org.ow2.asm", "asm-all"),
+                mvnBundle("org.apache.felix", "org.apache.felix.configadmin"),
 
                 mvnBundle("org.apache.aries.proxy", "org.apache.aries.proxy.api"),
                 mvnBundle("org.apache.aries.proxy", "org.apache.aries.proxy.impl"),
-
+                mvnBundle("org.apache.aries", "org.apache.aries.util"),
+                
                 mvnBundle("org.apache.aries.jndi", "org.apache.aries.jndi.api"),
                 mvnBundle("org.apache.aries.jndi", "org.apache.aries.jndi.core"),
                 mvnBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url"),
 
-                mvnBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api"),
-                mvnBundle("org.apache.aries", "org.apache.aries.util"),
-
                 mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.api"),
                 mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.core"),
-
+                
                 mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api"),
                 mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container"),
-                mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container.context"),
-                mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.blueprint.aries"),
+                mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.support"),
+                mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.blueprint"),
 
                 mvnBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
                 mvnBundle("org.apache.aries.transaction", "org.apache.aries.transaction.manager"),
-
-                mvnBundle("commons-lang", "commons-lang"),
-                mvnBundle("commons-collections", "commons-collections"),
-                mvnBundle("commons-pool", "commons-pool"),
+                mvnBundle("org.apache.aries.transaction", "org.apache.aries.transaction.blueprint"),
 
                 mvnBundle("org.apache.derby", "derby")
         );
@@ -126,7 +107,6 @@ public abstract class AbstractJPAItest e
     protected Option ariesJpa20() {
         return composite(
                 ariesJpaInternal(),
-                mvnBundle("org.osgi", "org.osgi.enterprise"),
                 mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec", "1.1")
                 );
     }
@@ -156,6 +136,10 @@ public abstract class AbstractJPAItest e
 
     protected Option openJpa() {
         return composite(
+                mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.cglib"), //
+                mvnBundle("commons-pool", "commons-pool"), //
+                mvnBundle("commons-lang", "commons-lang"), //
+                mvnBundle("commons-collections", "commons-collections"), //
                 mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.serp"),
                 mvnBundle("org.apache.geronimo.specs", "geronimo-servlet_2.5_spec"),
                 mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-dbcp"),
@@ -184,17 +168,25 @@ public abstract class AbstractJPAItest e
     protected Option testDs() {
         return mvnBundle("org.apache.aries.transaction", "org.apache.aries.transaction.testds");
     }
-
-    protected MavenArtifactProvisionOption derbyDataSourceFactory() {
-        return mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-derby");
+    
+    protected Option derbyDSF() {
+        return composite(
+                mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-derby"), //
+                mvnBundle("org.apache.commons", "commons-pool2"), //
+                mvnBundle("commons-logging", "commons-logging"), //
+                mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.cglib"), //
+                mvnBundle("org.apache.commons", "commons-dbcp2"), //
+                mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-pool-common"), //
+                mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-pool-dbcp2") //
+            );
     }
-
+    
     protected MavenArtifactProvisionOption testBundle() {
         return mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container.itest.bundle");
     }
 
     protected MavenArtifactProvisionOption testBundleBlueprint() {
-        return mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.blueprint.itest.bundle");
+        return mvnBundle("org.apache.aries.jpa.itest", "org.apache.aries.jpa.container.itest.bundle.blueprint");
     }
 
     protected MavenArtifactProvisionOption testBundleEclipseLink() {

Copied: aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/LICENSE (from r1680054, aries/trunk/jpa/jpa-container-itest/LICENSE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/LICENSE?p2=aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/LICENSE&p1=aries/trunk/jpa/jpa-container-itest/LICENSE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/NOTICE (from r1680054, aries/trunk/jpa/jpa-container-context/NOTICE)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/NOTICE?p2=aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/NOTICE&p1=aries/trunk/jpa/jpa-container-context/NOTICE&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
    (empty)

Copied: aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/pom.xml (from r1680054, aries/trunk/jpa/jpa-container-testbundle-eclipselink/pom.xml)
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/pom.xml?p2=aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/pom.xml&p1=aries/trunk/jpa/jpa-container-testbundle-eclipselink/pom.xml&r1=1680054&r2=1680218&rev=1680218&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-testbundle-eclipselink/pom.xml (original)
+++ aries/trunk/jpa/itests/jpa-container-testbundle-eclipselink/pom.xml Tue May 19 09:47:49 2015
@@ -32,7 +32,7 @@
     <artifactId>org.apache.aries.jpa.container.itest.bundle.eclipselink</artifactId>
     <version>1.0.3-SNAPSHOT</version>
     <packaging>bundle</packaging>
-    <name>Test Bundle for Aries JPA Container iTests Eclipselink</name>
+    <name>Apache Aries JPA test bundle Eclipselink</name>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-testbundle-eclipselink</connection>
@@ -101,4 +101,5 @@
         </plugins>
     </build>
 
+    <description>For testing static weaving and scripts for database setup with EclipseLink</description>
 </project>



Mime
View raw message