[jboss-cvs] JBossAS SVN: r92253 - projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1738/unit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 12 03:18:48 EDT 2009
Author: ALRubinger
Date: 2009-08-12 03:18:48 -0400 (Wed, 12 Aug 2009)
New Revision: 92253
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1738/unit/SecurityContextInServiceStartTestCase.java
Log:
[EJBTHREE-1738][JBAS-6362] Add a test case to show that redeployment of @Service with @SecurityDomain succeeds
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1738/unit/SecurityContextInServiceStartTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1738/unit/SecurityContextInServiceStartTestCase.java 2009-08-12 06:38:39 UTC (rev 92252)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1738/unit/SecurityContextInServiceStartTestCase.java 2009-08-12 07:18:48 UTC (rev 92253)
@@ -53,6 +53,11 @@
*/
private static final Logger log = Logger.getLogger(SecurityContextInServiceStartTestCase.class);
+ /**
+ * Name of the deployment
+ */
+ private static final String NAME_DEPLOYMENT = "ejbthree1738.jar";
+
//------------------------------------------------------------------------||
// Instance Members ------------------------------------------------------||
//------------------------------------------------------------------------||
@@ -83,7 +88,7 @@
*/
public static Test suite() throws Exception
{
- return getDeploySetup(SecurityContextInServiceStartTestCase.class, "ejbthree1738.jar");
+ return getDeploySetup(SecurityContextInServiceStartTestCase.class, NAME_DEPLOYMENT);
}
//------------------------------------------------------------------------||
@@ -124,6 +129,35 @@
Assert.assertEquals("The obtained value was incorrect", ProtectedLocalBusiness.VALUE, valueFromStart);
}
+ /**
+ * Ensures a bean with a @SecurityDomain may be redeployed
+ *
+ * JBAS-6362
+ *
+ * @throws Exception
+ */
+ public void testBeanOnRedeploy() throws Throwable
+ {
+
+ // Redeploy
+ redeploy(NAME_DEPLOYMENT);
+
+ // Log in as some user (with "unauthorized" role)
+ SecurityClient client = SecurityClientFactory.getSecurityClient();
+ client.setSimple("someuser", "password");
+ client.login();
+
+ // Get the bean
+ final RunAsRemoteBusiness bean = this.getBean();
+
+ // Get the value from a protected service lookup; the @RunAs should change the role used to "authorized"
+ final String valueFromBusinessInvocation = bean.getValueFromProtectedService();
+ // Ensure the value is correct
+ Assert
+ .assertEquals("The obtained value was incorrect", ProtectedLocalBusiness.VALUE, valueFromBusinessInvocation);
+
+ }
+
//------------------------------------------------------------------------||
// Internal Helper Methods -----------------------------------------------||
//------------------------------------------------------------------------||
More information about the jboss-cvs-commits
mailing list