User: user57
Date: 01/07/30 23:14:06
Modified: src/main/org/jboss/test/security/test Tag: jboss_buildmagic
TestEJBSpec.java
Log:
o updated from HEAD
Revision Changes Path
No revision
No revision
1.10.2.1 +39 -14 jbosstest/src/main/org/jboss/test/security/test/TestEJBSpec.java
Index: TestEJBSpec.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/test/TestEJBSpec.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- TestEJBSpec.java 2001/07/14 16:02:43 1.10
+++ TestEJBSpec.java 2001/07/31 06:14:06 1.10.2.1
@@ -1,8 +1,10 @@
package org.jboss.test.security.test;
import java.io.IOException;
+import java.net.InetAddress;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
@@ -19,10 +21,12 @@
import org.jboss.test.security.interfaces.StatelessSession;
import org.jboss.test.security.interfaces.StatelessSessionHome;
+import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.jboss.jmx.interfaces.RMIConnector;
import org.jboss.test.util.AppCallbackHandler;
import org.jboss.test.util.Deploy;
@@ -30,14 +34,14 @@
deployment unit. These test the basic role based access model.
@author [EMAIL PROTECTED]
- @version $Revision: 1.10 $
+ @version $Revision: 1.10.2.1 $
*/
public class TestEJBSpec
extends TestCase
{
static String username = "scott";
static char[] password = "echoman".toCharArray();
- static String QUEUE_FACTORY = "QueueConnectionFactory";
+ static String QUEUE_FACTORY = "ConnectionFactory";
LoginContext lc;
boolean loggedIn;
@@ -293,21 +297,42 @@
}
}
+ private static void flushAuthCache() throws Exception
+ {
+ String serverName = InetAddress.getLocalHost().getHostName();
+ String connectorName = "jmx:" +serverName+ ":rmi";
+ RMIConnector server = (RMIConnector) new
InitialContext().lookup(connectorName);
+ ObjectName jaasMgr = new ObjectName("Security:name=JaasSecurityManager");
+ // Ask the deployer for the getWarDeployerName
+ Object[] params = {"other"};
+ String[] signature = {"java.lang.String"};
+ String warDeployerName = (String) server.invoke(jaasMgr,
+ "flushAuthenticationCache", params, signature);
+ }
+
/**
* Setup the test suite.
*/
- public static Test suite() {
+ public static Test suite()
+ {
TestSuite suite = new TestSuite();
-
- // add a test case to deploy our support applications
- String filename = "security-spec.jar";
- suite.addTest(new Deploy.Deployer(filename));
-
suite.addTest(new TestSuite(TestEJBSpec.class));
-
- // add a test case to undeploy our support applications
- suite.addTest(new Deploy.Undeployer(filename));
-
- return suite;
- }
+
+ final String filename = "security-spec.jar";
+
+ // Create an initializer for the test suite
+ TestSetup wrapper= new TestSetup(suite)
+ {
+ protected void setUp() throws Exception
+ {
+ Deploy.deploy(filename);
+ flushAuthCache();
+ }
+ protected void tearDown() throws Exception
+ {
+ Deploy.undeploy(filename);
+ }
+ };
+ return wrapper;
+ }
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development