[jboss-cvs] JBossAS SVN: r100476 - in projects/ejb3/trunk/testsuite: src/test/java/org/jboss/ejb3/test and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 5 05:53:42 EST 2010


Author: wolfc
Date: 2010-02-05 05:53:42 -0500 (Fri, 05 Feb 2010)
New Revision: 100476

Added:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Bean.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Remote.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21RemoteHome.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/Secured21ViewTestCase.java
   projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/
   projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/roles.properties
   projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/users.properties
Modified:
   projects/ejb3/trunk/testsuite/build-test.xml
Log:
EJBTHREE-1995: integration test

Modified: projects/ejb3/trunk/testsuite/build-test.xml
===================================================================
--- projects/ejb3/trunk/testsuite/build-test.xml	2010-02-05 10:38:25 UTC (rev 100475)
+++ projects/ejb3/trunk/testsuite/build-test.xml	2010-02-05 10:53:42 UTC (rev 100476)
@@ -4205,6 +4205,16 @@
 	      <build-simple-jar name="ejbthree1926"/>
 	</target>
     	
+   <target name="ejbthree1995">
+      <mkdir dir="${build.lib}"/>
+      <jar jarfile="${build.lib}/ejbthree1995.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ejbthree1995/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/ejbthree1995"/>
+      </jar>
+   </target>
+
    <target name="jars" depends="removedislocal, statelesscreation, defaultremotebindings, localfromremote, clusteredjms, concurrentnaming, propertyreplacement, persistenceunits, appclient, tck5sec, invalidtxmdb, descriptortypo, libdeployment, homeinterface, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader,
       concurrent,
       circulardependency, jsp, timerdependency, servicedependency, stateless14, webservices, ear, ejbthree440,
@@ -4227,6 +4237,7 @@
       ejbthree1504, ejbthree1530, ejbthree1624, ejbthree1647,ejbthree1738,
       ejbthree1852,
       ejbthree1889,
+      ejbthree1995,
    	  jaxws, jbas4489, epcpropagation, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
       securitydomain, enventry, security5,
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -5060,6 +5071,9 @@
          <param name="test" value="ejbthree1889"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1995"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="statelesscreation"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Bean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Bean.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Bean.java	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.ejb3.test.ejbthree1995;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+
+import javax.annotation.Resource;
+import javax.ejb.Init;
+import javax.ejb.RemoteHome;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+import java.security.Principal;
+
+/**
+ * An EJB 3 bean exposing an EJB 2.1 view.
+ * 
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Stateful
+ at SecurityDomain(value="other",unauthenticatedPrincipal="anonymous")
+ at RemoteHome(SecuredGreeter21RemoteHome.class)
+public class SecuredGreeter21Bean
+{
+   @Resource
+   private SessionContext ctx;
+   
+   private String name;
+   private String user;
+
+   @Init
+   public void init(String name)
+   {
+      Principal caller = ctx.getCallerPrincipal();
+      this.name = name;
+      this.user = caller.getName();
+   }
+
+   public String sayHi()
+   {
+      return "Hi " + name + " (" + user + ")";
+   }
+}


Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Bean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Remote.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Remote.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Remote.java	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.ejb3.test.ejbthree1995;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public interface SecuredGreeter21Remote extends EJBObject
+{
+   String sayHi();
+}


Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21Remote.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21RemoteHome.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21RemoteHome.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21RemoteHome.java	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.ejb3.test.ejbthree1995;
+
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public interface SecuredGreeter21RemoteHome extends EJBHome
+{
+   SecuredGreeter21Remote create(String name);
+}


Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/SecuredGreeter21RemoteHome.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/Secured21ViewTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/Secured21ViewTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/Secured21ViewTestCase.java	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, 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.ejb3.test.ejbthree1995.unit;
+
+import junit.framework.Test;
+import org.jboss.ejb3.test.common.EJB3TestCase;
+import org.jboss.ejb3.test.ejbthree1995.SecuredGreeter21Remote;
+import org.jboss.ejb3.test.ejbthree1995.SecuredGreeter21RemoteHome;
+import org.jboss.security.client.SecurityClient;
+import org.jboss.security.client.SecurityClientFactory;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class Secured21ViewTestCase extends EJB3TestCase
+{
+   public Secured21ViewTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testAnonymous() throws Exception
+   {
+      SecuredGreeter21RemoteHome home = lookup("SecuredGreeter21Bean/home", SecuredGreeter21RemoteHome.class);
+      SecuredGreeter21Remote bean = home.create("testAnonymous");
+      String result = bean.sayHi();
+      assertEquals("Hi testAnonymous (anonymous)", result);
+   }
+
+   public void testSomebody() throws Exception
+   {
+      SecurityClient client = SecurityClientFactory.getSecurityClient();
+      client.setSimple("ejbthree1995", "password");
+      client.login();
+
+      try
+      {
+         SecuredGreeter21RemoteHome home = lookup("SecuredGreeter21Bean/home", SecuredGreeter21RemoteHome.class);
+         SecuredGreeter21Remote bean = home.create("testSomebody");
+         String result = bean.sayHi();
+         assertEquals("Hi testSomebody (ejbthree1995)", result);
+      }
+      finally
+      {
+         client.logout();
+      }
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(Secured21ViewTestCase.class, "ejbthree1995.jar");
+   }
+}


Property changes on: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1995/unit/Secured21ViewTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/roles.properties
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/roles.properties	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/roles.properties	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1 @@
+ejbthree1995=tester
\ No newline at end of file

Added: projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/users.properties
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/users.properties	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/resources/test/ejbthree1995/users.properties	2010-02-05 10:53:42 UTC (rev 100476)
@@ -0,0 +1 @@
+ejbthree1995=password
\ No newline at end of file




More information about the jboss-cvs-commits mailing list