[jboss-cvs] JBossAS SVN: r75762 - in projects/jpa/trunk/deployers: src/main/java/org/jboss/jpa/deployment and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 14 06:10:50 EDT 2008
Author: wolfc
Date: 2008-07-14 06:10:50 -0400 (Mon, 14 Jul 2008)
New Revision: 75762
Added:
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/jbcts822/
projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbcts822/JarFileTestCase.java
projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/
projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/
projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/META-INF/
projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/META-INF/persistence.xml
Modified:
projects/jpa/trunk/deployers/pom.xml
projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java
Log:
JBCTS-822: fixed NPE on getRelativeURL
Modified: projects/jpa/trunk/deployers/pom.xml
===================================================================
--- projects/jpa/trunk/deployers/pom.xml 2008-07-14 10:09:39 UTC (rev 75761)
+++ projects/jpa/trunk/deployers/pom.xml 2008-07-14 10:10:50 UTC (rev 75762)
@@ -3,7 +3,7 @@
<groupId>org.jboss.jpa</groupId>
<artifactId>jboss-jpa-build</artifactId>
<relativePath>../build/pom.xml</relativePath>
- <version>0.1.0</version>
+ <version>0.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -96,4 +96,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
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 2008-07-14 10:09:39 UTC (rev 75761)
+++ projects/jpa/trunk/deployers/src/main/java/org/jboss/jpa/deployment/PersistenceUnitDeployment.java 2008-07-14 10:10:50 UTC (rev 75762)
@@ -187,7 +187,7 @@
{
try
{
- URL url = getDeployment().getDeploymentUnit().getFile("").toURL();
+ URL url = di.getFile("").toURL();
return new URL(url, jar);
}
catch (Exception e1)
Added: 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 (rev 0)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/common/PersistenceTestCase.java 2008-07-14 10:10:50 UTC (rev 75762)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jpa.deployers.test.common;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.jpa.deployers.test.deployment.DeploymentTestCase;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * A base for persistence test cases.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public abstract class PersistenceTestCase
+{
+ private static MainDeployerTestDelegate delegate;
+
+ @AfterClass
+ public static void afterClass() throws Exception
+ {
+ delegate.tearDown();
+ }
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ delegate = new MainDeployerTestDelegate(DeploymentTestCase.class);
+ delegate.setUp();
+
+ delegate.deploy("/org/jboss/jpa/deployers/test/common/jndi-beans.xml");
+ delegate.deploy("/org/jboss/jpa/deployers/test/common/jbossts-beans.xml");
+ delegate.deploy("/org/jboss/jpa/deployers/test/deployment/derby-beans.xml");
+ //delegate.deploy("/org/jboss/jpa/deployers/test/deployment/DeploymentTestCase.xml");
+ }
+
+ protected void deploy(String spec) throws DeploymentException, IOException
+ {
+ URL url = getClass().getResource(spec);
+ VirtualFile file = VFS.getRoot(url);
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
+ delegate.getMainDeployer().deploy(deployment);
+ }
+}
Added: projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbcts822/JarFileTestCase.java
===================================================================
--- projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbcts822/JarFileTestCase.java (rev 0)
+++ projects/jpa/trunk/deployers/src/test/java/org/jboss/jpa/deployers/test/jbcts822/JarFileTestCase.java 2008-07-14 10:10:50 UTC (rev 75762)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jpa.deployers.test.jbcts822;
+
+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 JarFileTestCase extends PersistenceTestCase
+{
+ /**
+ * Just make sure that getRelativeURL doesn't throw a NPE.
+ */
+ @Test
+ public void test1() throws Exception
+ {
+ deploy("/org/jboss/jpa/deployers/test/jbcts822/pu");
+ }
+}
Added: projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/META-INF/persistence.xml
===================================================================
--- projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/META-INF/persistence.xml (rev 0)
+++ projects/jpa/trunk/deployers/src/test/resources/org/jboss/jpa/deployers/test/jbcts822/pu/META-INF/persistence.xml 2008-07-14 10:10:50 UTC (rev 75762)
@@ -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="jbcts822">
+ <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