incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r999012 - in /incubator/aries/trunk/jpa: jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/ jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/ jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa...
Date Mon, 20 Sep 2010 17:14:00 GMT
Author: timothyjward
Date: Mon Sep 20 17:13:59 2010
New Revision: 999012

URL: http://svn.apache.org/viewvc?rev=999012&view=rev
Log:
ARIES-413 - Blueprint JPA integration: itests and bug fixes for constructor/factory injection
of JPA resources

Added:
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection2.xml
Modified:
    incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/jpa.xml
    incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
    incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
    incubator/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java

Modified: incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/jpa.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/jpa.xml?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/jpa.xml
(original)
+++ incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/OSGI-INF/blueprint/jpa.xml
Mon Sep 20 17:13:59 2010
@@ -23,8 +23,12 @@
             
   <service ref="namespaceHandler" interface="org.apache.aries.blueprint.NamespaceHandler">
     <service-properties>
-      <entry key="osgi.service.blueprint.namespace" 
-             value="http://aries.apache.org/xmlns/jpa/v1.0.0"/>
+      <entry key="osgi.service.blueprint.namespace">
+        <array value-type="java.net.URI">
+          <value>http://aries.apache.org/xmlns/jpa/v1.0.0</value>
+          <value>http://aries.apache.org/xmlns/jpa/v1.1.0</value>
+        </array>
+      </entry>
     </service-properties>
   </service>
   

Modified: incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd
(original)
+++ incubator/aries/trunk/jpa/jpa-blueprint-aries/src/main/resources/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd
Mon Sep 20 17:13:59 2010
@@ -17,13 +17,13 @@
     limitations under the License.
 
 -->
-<xsd:schema xmlns="http://aries.apache.org/xmlns/jpa/v1.0.0"
+<xsd:schema xmlns="http://aries.apache.org/xmlns/jpa/v1.1.0"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:osgi="http://www.osgi.org/xmlns/blueprint/v1.0.0"
             targetNamespace="http://aries.apache.org/xmlns/jpa/v1.1.0"
             elementFormDefault="qualified"
             attributeFormDefault="unqualified"
-            version="1.0.0">
+            version="1.1.0">
 
     <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0"/>
 

Modified: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
(original)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/java/org/apache/aries/jpa/blueprint/itest/JPATestBean.java
Mon Sep 20 17:13:59 2010
@@ -27,6 +27,18 @@ public class JPATestBean {
   
   private EntityManager persistenceContext;
   
+  private EntityManagerFactory constructorEMF;
+  
+  private EntityManager constructorEM;
+
+  public JPATestBean(EntityManagerFactory constructorEMF,
+      EntityManager constructorEM) {
+    this.constructorEMF = constructorEMF;
+    this.constructorEM = constructorEM;
+  }
+  
+  public JPATestBean() {  }
+  
   public void setPersistenceUnit(EntityManagerFactory emf) {
     persistenceUnit = emf;
   }
@@ -51,4 +63,19 @@ public class JPATestBean {
     return true;
   }
   
+  /**
+   * @return True if we sucessfully called a method on the EMF
+   */
+  public boolean constructorPUnitAvailable() {
+    constructorEMF.isOpen();
+    return true;
+  }
+  
+  /**
+   * @return True if we sucessfully called a method on the EM
+   */
+  public boolean constructorPContextAvailable() {
+    constructorEM.isOpen();
+    return true;
+  }
 }

Modified: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
(original)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection.xml
Mon Sep 20 17:13:59 2010
@@ -23,6 +23,9 @@
             xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
   
   <service interface="org.apache.aries.jpa.blueprint.itest.JPATestBean">
+    <service-properties>
+       <entry key="version" value="1.0.0"/>
+    </service-properties>
     <bean class="org.apache.aries.jpa.blueprint.itest.JPATestBean">
       <jpa:unit property="persistenceUnit" unitname="test-unit"/>
       <jpa:context property="persistenceContext" unitname="test-context"/>

Added: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection2.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection2.xml?rev=999012&view=auto
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection2.xml
(added)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/blueprint/injection2.xml
Mon Sep 20 17:13:59 2010
@@ -0,0 +1,40 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <service interface="org.apache.aries.jpa.blueprint.itest.JPATestBean">
+    <service-properties>
+       <entry key="version" value="1.1.0"/>
+    </service-properties>
+    
+    <bean class="org.apache.aries.jpa.blueprint.itest.JPATestBean">
+      <!-- Constructor Args -->
+      <jpa:unit unitname="test-unit2"/>
+      <jpa:context unitname="test-context2"/>
+      
+      <jpa:unit property="persistenceUnit" unitname="test-unit"/>
+      <jpa:context property="persistenceContext" unitname="test-context"/>
+    </bean>
+  </service>
+            
+</blueprint>
\ No newline at end of file

Modified: incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
(original)
+++ incubator/aries/trunk/jpa/jpa-blueprint-testbundle/src/main/resources/OSGI-INF/persistence/persistence.xml
Mon Sep 20 17:13:59 2010
@@ -32,4 +32,14 @@
     <class>org.apache.aries.jpa.blueprint.itest.entities.Car</class>
     <exclude-unlisted-classes/>
   </persistence-unit>
+    <persistence-unit name="test-unit2" transaction-type="JTA">
+    <description>Test persistence unit for the JPA Blueprint integration iTest</description>
+    <class>org.apache.aries.jpa.blueprint.itest.entities.Car</class>
+    <exclude-unlisted-classes/>
+  </persistence-unit>
+  <persistence-unit name="test-context2" transaction-type="JTA">
+    <description>Test persistence context for the JPA Integration iTest</description>
+    <class>org.apache.aries.jpa.blueprint.itest.entities.Car</class>
+    <exclude-unlisted-classes/>
+  </persistence-unit>
 </persistence>

Modified: incubator/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java?rev=999012&r1=999011&r2=999012&view=diff
==============================================================================
--- incubator/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java
(original)
+++ incubator/aries/trunk/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/JPAInjectionTest.java
Mon Sep 20 17:13:59 2010
@@ -49,7 +49,18 @@ public class JPAInjectionTest {
  
   @Test
   public void findResources() throws Exception {
-    JPATestBean bean = getOsgiService(JPATestBean.class);
+    JPATestBean bean = getOsgiService(JPATestBean.class, "(version=1.0.0)", DEFAULT_TIMEOUT);
+    
+    assertTrue("No persistence unit injection", bean.pUnitAvailable());
+    assertTrue("No persistence context injection", bean.pContextAvailable());
+  }
+  
+  @Test
+  public void findResources_110() throws Exception {
+    JPATestBean bean = getOsgiService(JPATestBean.class, "(version=1.1.0)", DEFAULT_TIMEOUT);
+    
+    assertTrue("No constructor unit injection", bean.constructorPUnitAvailable());
+    assertTrue("No constructor context injection", bean.constructorPContextAvailable());
     
     assertTrue("No persistence unit injection", bean.pUnitAvailable());
     assertTrue("No persistence context injection", bean.pContextAvailable());



Mime
View raw message