[jboss-cvs] JBossAS SVN: r74438 - projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 11 19:46:37 EDT 2008
Author: ALRubinger
Date: 2008-06-11 19:46:37 -0400 (Wed, 11 Jun 2008)
New Revision: 74438
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/FirstBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SecondBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleSessionBean.java
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleStatefulBean.java
Log:
[EJBTHREE-1241] Make security5 test deployable
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/FirstBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/FirstBean.java 2008-06-11 23:23:00 UTC (rev 74437)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/FirstBean.java 2008-06-11 23:46:37 UTC (rev 74438)
@@ -27,7 +27,6 @@
import javax.ejb.Stateless;
import javax.naming.InitialContext;
-
//$Id$
/**
@@ -38,30 +37,31 @@
*/
@Stateless
- at Local(SimpleSessionInterface.class)
+ at Local(SimpleSessionInterfaceLocal.class)
@RunAs("InternalRole")
public class FirstBean extends SimpleSessionBean
-{
+{
private InitialContext context = null;
-
- @RolesAllowed({"InternalRole"})
+
+ @RolesAllowed(
+ {"InternalRole"})
public String echo(String arg)
- {
+ {
SimpleSessionInterface ssi = null;
try
- {
+ {
context = new InitialContext();
String jndiName = "SecondBean/local";
- ssi = (SimpleSessionInterface)context.lookup(jndiName);
- }
- catch(Exception e)
+ ssi = (SimpleSessionInterface) context.lookup(jndiName);
+ }
+ catch (Exception e)
{
throw new RuntimeException(e);
}
String str = ssi.echo(arg);
- System.out.println("RESPONSE FROM SECOND BEAN="+str);
- if(str.equals(arg) == false)
- throw new IllegalStateException("Second Bean returned:"+str);
+ System.out.println("RESPONSE FROM SECOND BEAN=" + str);
+ if (str.equals(arg) == false)
+ throw new IllegalStateException("Second Bean returned:" + str);
return arg;
- }
+ }
}
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SecondBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SecondBean.java 2008-06-11 23:23:00 UTC (rev 74437)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SecondBean.java 2008-06-11 23:46:37 UTC (rev 74438)
@@ -24,7 +24,6 @@
import javax.annotation.security.RolesAllowed;
import javax.ejb.Local;
import javax.ejb.Stateless;
-import javax.naming.InitialContext;
//$Id$
@@ -35,14 +34,16 @@
* @since Aug 20, 2007
* @version $Revision$
*/
- at Local(SimpleSessionInterface.class)
- at RolesAllowed({"InternalRole"})
+ at Local(SimpleSessionInterfaceLocal.class)
+ at RolesAllowed(
+{"InternalRole"})
@Stateless
public class SecondBean extends SimpleSessionBean
-{
- @RolesAllowed({"InternalRole"})
+{
+ @RolesAllowed(
+ {"InternalRole"})
public String echo(String arg)
{
- return arg;
+ return arg;
}
}
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleSessionBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleSessionBean.java 2008-06-11 23:23:00 UTC (rev 74437)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleSessionBean.java 2008-06-11 23:46:37 UTC (rev 74438)
@@ -39,40 +39,42 @@
* @since Aug 16, 2007
* @version $Revision$
*/
- at Stateless(name="SimpleStatelessBean")
- at Remote
+ at Stateless(name = "SimpleStatelessBean")
+ at Remote(SimpleSessionInterfaceRemote.class)
@RunAs("InternalRole")
-public class SimpleSessionBean implements SimpleSessionInterface
-{
- @Resource SessionContext sessionContext;
-
- @RolesAllowed({"Echo"})
+public class SimpleSessionBean implements SimpleSessionInterfaceRemote
+{
+ @Resource
+ SessionContext sessionContext;
+
+ @RolesAllowed(
+ {"Echo"})
public String echo(String arg)
{
SimpleSessionInterface ssi = null;
try
- {
+ {
InitialContext context = new InitialContext();
String jndiName = "FirstBean/local";
- ssi = (SimpleSessionInterface)context.lookup(jndiName);
- }
- catch(Exception e)
+ ssi = (SimpleSessionInterface) context.lookup(jndiName);
+ }
+ catch (Exception e)
{
throw new RuntimeException(e);
}
String str = ssi.echo(arg);
- if(str.equals(arg) == false)
- throw new IllegalStateException("First Bean returned:"+str);
- return arg;
- }
-
+ if (str.equals(arg) == false)
+ throw new IllegalStateException("First Bean returned:" + str);
+ return arg;
+ }
+
public Principal echoCallerPrincipal()
{
- return sessionContext.getCallerPrincipal();
+ return sessionContext.getCallerPrincipal();
}
-
+
public boolean isCallerInRole(String roleName)
{
return sessionContext.isCallerInRole(roleName);
- }
+ }
}
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleStatefulBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleStatefulBean.java 2008-06-11 23:23:00 UTC (rev 74437)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/security5/SimpleStatefulBean.java 2008-06-11 23:46:37 UTC (rev 74438)
@@ -28,7 +28,7 @@
import javax.annotation.security.RunAs;
import javax.ejb.Remote;
import javax.ejb.SessionContext;
-import javax.ejb.Stateful;
+import javax.ejb.Stateful;
import javax.naming.InitialContext;
//$Id$
@@ -40,7 +40,7 @@
* @version $Revision$
*/
@Stateful(name="SimpleStatefulBean")
- at Remote
+ at Remote(SimpleSessionInterfaceRemote.class)
@RunAs("InternalRole")
public class SimpleStatefulBean implements SimpleSessionInterface
{
More information about the jboss-cvs-commits
mailing list