[jboss-cvs] JBossAS SVN: r84451 - in projects/jpa/trunk/deployers: src/main/java/org/jboss/jpa/deployment and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 19 06:55:31 EST 2009


Author: wolfc
Date: 2009-02-19 06:55:30 -0500 (Thu, 19 Feb 2009)
New Revision: 84451

Added:
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbjpa10/
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbjpa10/ExplodedJarTestCase.java
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/lib/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/lib/common.jar
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/lib/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/lib/common.jar
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/META-INF/
   projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/META-INF/persistence.xml
Modified:
   projects/jpa/trunk/deployers/pom.xml
   projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java
   projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/PersistenceTestCase.java
Log:
JBJPA-10: upgraded to deployers 2.2.0 and fixed exploded jar deployment

Modified: projects/jpa/trunk/deployers/pom.xml
===================================================================
--- projects/jpa/trunk/deployers/pom.xml	2009-02-19 10:40:16 UTC (rev 84450)
+++ projects/jpa/trunk/deployers/pom.xml	2009-02-19 11:55:30 UTC (rev 84451)
@@ -1,4 +1,9 @@
-<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">
+<!--
+  vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.jboss.jpa</groupId>
     <artifactId>jboss-jpa-build</artifactId>
@@ -17,6 +22,10 @@
     See EJB 3 JPA chapter 6 and 7.
   </description>
   
+  <properties>
+    <version.org.jboss.deployers>2.2.0-SNAPSHOT</version.org.jboss.deployers>
+  </properties>
+
   <dependencies>
     <!-- For 'mocking' a TransactionManager we use JBossTS -->
     <dependency>
@@ -54,15 +63,15 @@
       <version>1.0.5.GA</version>
       <scope>test</scope>
     </dependency>
-  	<dependency>
+    <dependency>
       <groupId>org.jboss.deployers</groupId>
       <artifactId>jboss-deployers-vfs</artifactId>
-      <version>2.0.0.CR2</version>
+      <version>${version.org.jboss.deployers}</version>
     </dependency>
-  	<dependency>
+    <dependency>
       <groupId>org.jboss.deployers</groupId>
       <artifactId>jboss-deployers-vfs-spi</artifactId>
-      <version>2.0.0.CR2</version>
+      <version>${version.org.jboss.deployers}</version>
     </dependency>
     <dependency>
       <groupId>org.jboss.metadata</groupId>

Modified: projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java
===================================================================
--- projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java	2009-02-19 10:40:16 UTC (rev 84450)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java	2009-02-19 11:55:30 UTC (rev 84451)
@@ -195,8 +195,13 @@
       {
          try
          {
-            URL url = di.getFile("").toURL();
-            return new URL(url, jar);
+            VirtualFile deploymentUnitFile = di.getFile("");
+            VirtualFile parent = deploymentUnitFile.getParent();
+            VirtualFile baseDir = (parent != null ? parent : deploymentUnitFile);
+            VirtualFile jarFile = baseDir.getChild(jar);
+            if(jarFile == null)
+               throw new RuntimeException("could not find child '" + jar + "' on '" + baseDir + "'");
+            return jarFile.toURL();
          }
          catch (Exception e1)
          {

Modified: projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/PersistenceTestCase.java
===================================================================
--- projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/PersistenceTestCase.java	2009-02-19 10:40:16 UTC (rev 84450)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/PersistenceTestCase.java	2009-02-19 11:55:30 UTC (rev 84451)
@@ -68,10 +68,26 @@
       deploy(url);
    }
    
+   protected void deploy(String root, String deploymentName) throws DeploymentException, IOException 
+   {
+      URL url = getClass().getResource(root);
+      if(url == null)
+         throw new IllegalArgumentException("Can't find resource '" + root + "'");
+      deploy(url, deploymentName);
+   }
+   
    protected static void deploy(URL url) throws DeploymentException, IOException
    {
       VirtualFile file = VFS.getRoot(url);
       VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
       delegate.getMainDeployer().deploy(deployment);      
    }
+   
+   protected static void deploy(URL rootURL, String deploymentName) throws DeploymentException, IOException
+   {
+      VFS context = VFS.getVFS(rootURL);
+      VirtualFile file = context.getRoot().getChild(deploymentName);
+      VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+      delegate.getMainDeployer().deploy(deployment);      
+   }
 }

Added: projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbjpa10/ExplodedJarTestCase.java
===================================================================
--- projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbjpa10/ExplodedJarTestCase.java	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbjpa10/ExplodedJarTestCase.java	2009-02-19 11:55:30 UTC (rev 84451)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jpa.deployers.test.jbjpa10;
+
+import org.jboss.jpa.deployers.test.common.PersistenceTestCase;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ExplodedJarTestCase extends PersistenceTestCase
+{
+   @Test
+   public void testDeploy() throws Exception
+   {
+      deploy("/org/jboss/jpa/deployers/test/jbjpa10/pu", "persistence.jar");
+   }
+}

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/lib/common.jar
===================================================================
(Binary files differ)


Property changes on: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/lib/common.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/lib/common.jar
===================================================================
(Binary files differ)


Property changes on: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/lib/common.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/META-INF/persistence.xml
===================================================================
--- projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/META-INF/persistence.xml	                        (rev 0)
+++ projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbjpa10/pu/persistence.jar/META-INF/persistence.xml	2009-02-19 11:55:30 UTC (rev 84451)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
+   <persistence-unit name="exploded">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <jar-file>lib/common.jar</jar-file>
+      <properties>
+          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>




More information about the jboss-cvs-commits mailing list