[jboss-cvs] JBossAS SVN: r108515 - branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/security/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 12 01:57:41 EDT 2010
Author: pskopek at redhat.com
Date: 2010-10-12 01:57:40 -0400 (Tue, 12 Oct 2010)
New Revision: 108515
Modified:
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
Log:
Possibility to disable one test added.
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java 2010-10-11 21:58:44 UTC (rev 108514)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java 2010-10-12 05:57:40 UTC (rev 108515)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.security.test;
+import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.rmi.AccessException;
import java.rmi.ServerException;
@@ -100,37 +101,26 @@
log.info("+++ testSecurityDomain, domain=spec-test");
MBeanServerConnection conn = getServer();
ObjectName secMgrName = new ObjectName("jboss.security:service=JaasSecurityManager");
- log.info("X0");
JaasSecurityManagerServiceMBean secMgr = (JaasSecurityManagerServiceMBean) MBeanServerInvocationHandler
.newProxyInstance(conn, secMgrName, JaasSecurityManagerServiceMBean.class, false);
- log.info("X1");
// Test the spec-test security domain
String domain = "spec-test";
SimplePrincipal user = new SimplePrincipal("scott");
- log.info("X1-1");
boolean isValid = secMgr.isValid(domain, user, password);
- log.info("X1-2");
assertTrue("scott password is echoman", isValid);
- log.info("X1-3");
HashSet testRole = new HashSet();
- log.info("X1-4");
testRole.add(new SimplePrincipal("Echo"));
- log.info("X1-5");
- boolean hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- log.info("X1-6");
+ boolean hasRole;
+ hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
assertTrue("scott has Echo role", hasRole);
- log.info("X1-7");
testRole.clear();
- log.info("X1-8");
testRole.add(new SimplePrincipal("EchoLocal"));
- log.info("X2");
hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
assertTrue("scott has EchoLocal role", hasRole);
testRole.clear();
testRole.add(new SimplePrincipal("ProjectUser"));
hasRole = secMgr.doesUserHaveRole(domain, user, password, testRole);
- log.info("X3");
assertTrue("scott has ProjectUser role", hasRole);
isValid = secMgr.isValid(domain, user, "badpass".toCharArray());
@@ -995,13 +985,31 @@
}
}
+ private static TestSuite fillTestSuiteConditionally(Class clazz) {
+
+ TestSuite suite = new TestSuite();
+
+ String disabledMethods = System.getProperty("cc.disabled.test.methods" ,"");
+
+ for (Method method: clazz.getMethods()) {
+ String name = method.getName();
+ if (disabledMethods.indexOf(name) == -1 && name.startsWith("test")) {
+ suite.addTest(TestSuite.createTest(clazz, name));
+ }
+ }
+
+ return suite;
+
+ }
+
/**
* Setup the test suite.
*/
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(EJBSpecUnitTestCase.class));
+ //suite.addTest(new TestSuite(EJBSpecUnitTestCase.class));
+ suite = fillTestSuiteConditionally(EJBSpecUnitTestCase.class);
// Create an initializer for the test suite
TestSetup wrapper = new JBossTestSetup(suite)
More information about the jboss-cvs-commits
mailing list