[jboss-cvs] JBossAS SVN: r63115 - in trunk/ejb3: src/test/org/jboss/ejb3/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 17 09:30:30 EDT 2007
Author: wolfc
Date: 2007-05-17 09:30:30 -0400 (Thu, 17 May 2007)
New Revision: 63115
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBRemote.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/unit/CheckORBTestCase.java
Modified:
trunk/ejb3/build-test.xml
Log:
EJBTHREE-967: unit test
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-05-17 13:29:42 UTC (rev 63114)
+++ trunk/ejb3/build-test.xml 2007-05-17 13:30:30 UTC (rev 63115)
@@ -1986,6 +1986,13 @@
<build-simple-jar name="ejbthree963"/>
</target>
+ <target name="ejbthree967"
+ description="Builds a simple jar files."
+ depends="compile-classes">
+
+ <build-simple-jar name="ejbthree967"/>
+ </target>
+
<target name="jaxws"
description="Builds a simple jar."
depends="compile-classes">
@@ -3304,7 +3311,7 @@
<target name="jars" depends="appclient, tck5sec, invalidtxmdb, descriptortypo, libdeployment, homeinterface, timestampentity, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader,
circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440,
ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree921, ejbthree936, ejbthree939,
- ejbthree953, ejbthree957, ejbthree959, ejbthree963,
+ ejbthree953, ejbthree957, ejbthree959, ejbthree963, ejbthree967,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
securitydomain, enventry,
jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -4159,6 +4166,9 @@
<antcall target="test" inheritRefs="true">
<param name="test" value="ejbthree963"/>
</antcall>
+ <antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree967"/>
+ </antcall>
</target>
<target name="entity-tests" depends="init" description="Execute all tests">
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBBean.java 2007-05-17 13:30:30 UTC (rev 63115)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.ejbthree967;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.PortableServer.POA;
+
+/**
+ * This beans checks both methods of getting an ORB.
+ *
+ * @author carlo
+ *
+ */
+ at Stateless
+public class CheckORBBean implements CheckORBRemote
+{
+ @Resource
+ private ORB orb;
+
+ public void checkForInjectedORB()
+ {
+ if(this.orb == null)
+ throw new IllegalStateException("ORB was not injected");
+ checkORB(orb);
+ }
+
+ public void checkForORBInEnvironment()
+ {
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ ORB orb = (ORB) ctx.lookup("java:comp/ORB");
+ checkORB(orb);
+ }
+ catch(NamingException e)
+ {
+ throw new IllegalStateException("Can't lookup java:comp/ORB", e);
+ }
+ }
+
+ private void checkORB(ORB orb)
+ {
+ try
+ {
+ POA poa = (POA) orb.resolve_initial_references("RootPOA");
+ if(poa == null)
+ throw new IllegalStateException("RootPOA is null");
+ }
+ catch (InvalidName e)
+ {
+ throw new IllegalStateException("Can't resolve RootPOA", e);
+ }
+ }
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBRemote.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/CheckORBRemote.java 2007-05-17 13:30:30 UTC (rev 63115)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.ejbthree967;
+
+import javax.ejb.Remote;
+
+/**
+ * @author carlo
+ *
+ */
+ at Remote
+public interface CheckORBRemote
+{
+ void checkForInjectedORB();
+
+ void checkForORBInEnvironment();
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/unit/CheckORBTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/unit/CheckORBTestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree967/unit/CheckORBTestCase.java 2007-05-17 13:30:30 UTC (rev 63115)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.ejbthree967.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree967.CheckORBRemote;
+import org.jboss.test.JBossTestCase;
+
+
+/**
+ * Test if an ORB can be properly located (EJB3 16.13).
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CheckORBTestCase extends JBossTestCase
+{
+
+ public CheckORBTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testEnvironment() throws Exception
+ {
+ CheckORBRemote bean = (CheckORBRemote) getInitialContext().lookup("CheckORBBean/remote");
+ bean.checkForORBInEnvironment();
+ }
+
+ public void testInjection() throws Exception
+ {
+ CheckORBRemote bean = (CheckORBRemote) getInitialContext().lookup("CheckORBBean/remote");
+ bean.checkForInjectedORB();
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(CheckORBTestCase.class, "ejbthree967.jar");
+ }
+
+}
More information about the jboss-cvs-commits
mailing list