[jboss-cvs] JBossAS SVN: r105336 - in projects/jpa/trunk/mcint/src: main/resources and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 28 12:33:36 EDT 2010


Author: jaikiran
Date: 2010-05-28 12:33:35 -0400 (Fri, 28 May 2010)
New Revision: 105336

Added:
   projects/jpa/trunk/mcint/src/main/resources/
   projects/jpa/trunk/mcint/src/main/resources/META-INF/
   projects/jpa/trunk/mcint/src/main/resources/META-INF/jboss-beans.xml
Modified:
   projects/jpa/trunk/mcint/src/test/java/org/jboss/jpa/mcint/test/annotations/unit/AnnotationsTestCase.java
   projects/jpa/trunk/mcint/src/test/resources/conf/bootstrap/jpa-annotations.xml
Log:
JBJPA-28 Add a jboss-beans.xml to ship along with the jar

Added: projects/jpa/trunk/mcint/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- projects/jpa/trunk/mcint/src/main/resources/META-INF/jboss-beans.xml	                        (rev 0)
+++ projects/jpa/trunk/mcint/src/main/resources/META-INF/jboss-beans.xml	2010-05-28 16:33:35 UTC (rev 105336)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="PersistenceUnitAnnotationPlugin" class="org.jboss.jpa.mcint.kernel.plugins.annotations.PersistenceUnitAnnotationPlugin"/>   
+</deployment>

Modified: projects/jpa/trunk/mcint/src/test/java/org/jboss/jpa/mcint/test/annotations/unit/AnnotationsTestCase.java
===================================================================
--- projects/jpa/trunk/mcint/src/test/java/org/jboss/jpa/mcint/test/annotations/unit/AnnotationsTestCase.java	2010-05-28 16:02:16 UTC (rev 105335)
+++ projects/jpa/trunk/mcint/src/test/java/org/jboss/jpa/mcint/test/annotations/unit/AnnotationsTestCase.java	2010-05-28 16:33:35 UTC (rev 105336)
@@ -23,6 +23,7 @@
 
 import static org.junit.Assert.assertNotNull;
 
+import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 
@@ -45,6 +46,16 @@
 {
    private static MicroContainerTestHelper delegate;
    
+   /**
+    * basedir (set through Maven)
+    */
+   protected static final File BASEDIR = new File(System.getProperty("basedir"));
+
+   /**
+    * Target directory
+    */
+   protected static final File TARGET_DIRECTORY = new File(BASEDIR, "target");
+   
    @AfterClass
    public static void afterClass() throws Exception
    {
@@ -62,6 +73,17 @@
       
       delegate.validate();
       
+      // we could have just looked up a jboss-beans.xml through the classloader,
+      // but that wouldn't have guaranteed that the classloader would pick up this 
+      // project's jboss-beans.xml. Hence this java.io.File based approach
+      File jpaMcIntJBossBeansXML = new File(TARGET_DIRECTORY, "classes/META-INF/jboss-beans.xml");
+      if (!jpaMcIntJBossBeansXML.exists())
+      {
+         throw new IllegalStateException("Could not find jboss-beans.xml under target/classes/META-INF of this project");
+      }
+      // deploy our jboss-beans.xml
+      deploy(jpaMcIntJBossBeansXML.toURI().toURL());
+      // now deploy the other test resources 
       deploy("/org/jboss/jpa/mcint/test/annotations");
    }
    

Modified: projects/jpa/trunk/mcint/src/test/resources/conf/bootstrap/jpa-annotations.xml
===================================================================
--- projects/jpa/trunk/mcint/src/test/resources/conf/bootstrap/jpa-annotations.xml	2010-05-28 16:02:16 UTC (rev 105335)
+++ projects/jpa/trunk/mcint/src/test/resources/conf/bootstrap/jpa-annotations.xml	2010-05-28 16:33:35 UTC (rev 105336)
@@ -3,6 +3,5 @@
    <!-- FIXME: move to another xml -->
    <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.mcint.test.common.DummyPersistenceUnitDependencyResolver"/>
    
-   <!-- FIXME: move to META-INF/jboss-beans.xml -->
-   <bean name="org.jboss.jpa.mcint.annotations.PersistenceUnit" class="org.jboss.jpa.mcint.kernel.plugins.annotations.PersistenceUnitAnnotationPlugin"/>
+   
 </deployment>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list