[jboss-cvs] JBossAS SVN: r72016 - in trunk/testsuite: src/main/org/jboss/test/deployers and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 11 07:47:58 EDT 2008


Author: alex.loubyansky at jboss.com
Date: 2008-04-11 07:47:58 -0400 (Fri, 11 Apr 2008)
New Revision: 72016

Added:
   trunk/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java
   trunk/testsuite/src/resources/deployers/ear-altdd/
   trunk/testsuite/src/resources/deployers/ear-altdd/META-INF/
   trunk/testsuite/src/resources/deployers/ear-altdd/META-INF/application.xml
   trunk/testsuite/src/resources/deployers/ear-altdd/bean1-altdd.xml
Modified:
   trunk/testsuite/imports/sections/deployers.xml
   trunk/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
   trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1.java
   trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1Remote.java
   trunk/testsuite/src/resources/deployers/bean1/META-INF/ejb-jar.xml
Log:
JBDEPLOY-27

Modified: trunk/testsuite/imports/sections/deployers.xml
===================================================================
--- trunk/testsuite/imports/sections/deployers.xml	2008-04-11 11:27:21 UTC (rev 72015)
+++ trunk/testsuite/imports/sections/deployers.xml	2008-04-11 11:47:58 UTC (rev 72016)
@@ -187,6 +187,16 @@
             <include name="testdeployers-mbean1.sar"/>
          </fileset>
       </jar>
+
+      <!-- EAR with alternative DDs -->
+      <jar destfile="${build.lib}/testdeployers-ear-altdd.ear">
+         <fileset dir="${build.resources}/deployers/ear-altdd">
+            <include name="**/*.xml"/>
+         </fileset>
+         <fileset dir="${build.lib}">
+            <include name="testdeployers-bean1ejb.jar"/>
+         </fileset>
+      </jar>
       
       <!-- Ear without application.xml -->
       <jar destfile="${build.lib}/testdeployers-ear-noappxml.ear">

Modified: trunk/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java	2008-04-11 11:27:21 UTC (rev 72015)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/AbstractDeploymentTest.java	2008-04-11 11:47:58 UTC (rev 72016)
@@ -41,6 +41,7 @@
 public class AbstractDeploymentTest extends JBossTestCase
 {
    public static final String ear1Deployment = "testdeployers-ear1.ear";
+   public static final String earAltDDDeployment = "testdeployers-ear-altdd.ear";
    public static final String ear1DeploymentUnpacked = "unpacked-ear1.ear";
    public static final String ear2DeploymentUnpacked = "unpacked-ear2.ear";
    public static final String earNoAppXml = "testdeployers-ear-noappxml.ear";

Added: trunk/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/ear/test/EARAltDDDeploymentUnitTestCase.java	2008-04-11 11:47:58 UTC (rev 72016)
@@ -0,0 +1,76 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.test.deployers.ear.test;
+
+import java.util.HashSet;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.deployers.AbstractDeploymentTest;
+import org.jboss.test.deployers.ejb.bean1.Bean1Home;
+import org.jboss.test.deployers.ejb.bean1.Bean1Remote;
+
+/**
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 66915 $
+ */
+public class EARAltDDDeploymentUnitTestCase extends AbstractDeploymentTest
+{
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(EARAltDDDeploymentUnitTestCase.class, earAltDDDeployment);
+   }
+
+   public EARAltDDDeploymentUnitTestCase(String test)
+   {
+      super(test);
+   }
+
+   public void testEARDeployment() throws Exception
+   {
+/* TODO: this doesn't work currently
+ * java.io.NotSerializableException: java.io.ByteArrayInputStream
+ * ...
+    at org.jboss.test.deployers.AbstractDeploymentTest.invokeMainDeployer(AbstractDeploymentTest.java:80)
+    at org.jboss.test.deployers.AbstractDeploymentTest.getDeploymentUnit(AbstractDeploymentTest.java:111)
+    at org.jboss.test.deployers.AbstractDeploymentTest.assertDeployed(AbstractDeploymentTest.java:86)
+    at org.jboss.test.deployers.ear.test.EARAltDDDeploymentUnitTestCase.testEARDeployment(EARAltDDDeploymentUnitTestCase.java:58)
+
+      final HashSet<String> expected = new HashSet<String>();
+      expected.add(earAltDDDeployment);
+      expected.add(bean1Deployment);
+      
+      DeploymentUnit topInfo = assertDeployed(earAltDDDeployment);
+      CheckExpectedDeploymentInfoVisitor visitor = new CheckExpectedDeploymentInfoVisitor(expected);
+      visitor.start(topInfo);
+      assertTrue("Expected subdeployments: " + expected, expected.isEmpty());
+*/      
+      Object o = new InitialContext().lookup("Bean1EJB");
+      Bean1Home home = (Bean1Home) PortableRemoteObject.narrow(o, Bean1Home.class);
+      Bean1Remote bean = home.create();
+      assertEquals("bean1-altdd.xml", bean.getEnvEntry("dd-file"));
+   }
+}

Modified: trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1.java	2008-04-11 11:27:21 UTC (rev 72015)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1.java	2008-04-11 11:47:58 UTC (rev 72016)
@@ -21,9 +21,14 @@
   */
 package org.jboss.test.deployers.ejb.bean1;
 
+import java.rmi.RemoteException;
+
 import javax.ejb.CreateException;
+import javax.ejb.EJBException;
 import javax.ejb.SessionBean;
 import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 public class Bean1 implements SessionBean
 {
@@ -49,4 +54,16 @@
    public void setSessionContext(SessionContext ctx)
    {
    }
+   
+   public Object getEnvEntry(String name) throws RemoteException
+   {
+      try
+      {
+         return new InitialContext().lookup("java:/comp/env/" + name);
+      }
+      catch (NamingException e)
+      {
+         throw new EJBException(e);
+      }
+   }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1Remote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1Remote.java	2008-04-11 11:27:21 UTC (rev 72015)
+++ trunk/testsuite/src/main/org/jboss/test/deployers/ejb/bean1/Bean1Remote.java	2008-04-11 11:47:58 UTC (rev 72016)
@@ -21,9 +21,11 @@
   */
 package org.jboss.test.deployers.ejb.bean1;
 
+import java.rmi.RemoteException;
+
 import javax.ejb.EJBObject;
 
 public interface Bean1Remote extends EJBObject
 {
-
+   Object getEnvEntry(String name) throws RemoteException;
 }

Modified: trunk/testsuite/src/resources/deployers/bean1/META-INF/ejb-jar.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/bean1/META-INF/ejb-jar.xml	2008-04-11 11:27:21 UTC (rev 72015)
+++ trunk/testsuite/src/resources/deployers/bean1/META-INF/ejb-jar.xml	2008-04-11 11:47:58 UTC (rev 72016)
@@ -16,6 +16,11 @@
          <ejb-class>org.jboss.test.deployers.ejb.bean1.Bean1</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Bean</transaction-type>
+         <env-entry>
+            <env-entry-name>dd-file</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>ejb-jar.xml</env-entry-value>
+         </env-entry>
       </session>
    </enterprise-beans>
 </ejb-jar>

Added: trunk/testsuite/src/resources/deployers/ear-altdd/META-INF/application.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/ear-altdd/META-INF/application.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/deployers/ear-altdd/META-INF/application.xml	2008-04-11 11:47:58 UTC (rev 72016)
@@ -0,0 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<application version="1.4"
+             xmlns="http://java.sun.com/xml/ns/j2ee" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
+                                 http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
+>
+
+   <display-name>EAR Deployment Test</display-name>
+
+   <module><ejb>testdeployers-bean1ejb.jar</ejb></module>
+
+</application>
+

Added: trunk/testsuite/src/resources/deployers/ear-altdd/bean1-altdd.xml
===================================================================
--- trunk/testsuite/src/resources/deployers/ear-altdd/bean1-altdd.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/deployers/ear-altdd/bean1-altdd.xml	2008-04-11 11:47:58 UTC (rev 72016)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ejb-jar version="2.1"
+         xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
+                             http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+      >
+   <enterprise-beans>
+      <!-- Session Beans -->
+         <session>
+         <description>JUnit Session Bean Test Runner</description>
+         <ejb-name>Bean1EJB</ejb-name>
+         <home>org.jboss.test.deployers.ejb.bean1.Bean1Home</home>
+         <remote>org.jboss.test.deployers.ejb.bean1.Bean1Remote</remote>
+         <ejb-class>org.jboss.test.deployers.ejb.bean1.Bean1</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Bean</transaction-type>
+         <env-entry>
+            <env-entry-name>dd-file</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>bean1-altdd.xml</env-entry-value>
+         </env-entry>
+      </session>
+   </enterprise-beans>
+</ejb-jar>




More information about the jboss-cvs-commits mailing list