[jboss-cvs] JBossAS SVN: r104387 - trunk/testsuite/src/main/org/jboss/test/aop/nonjunit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat May 1 07:24:40 EDT 2010
Author: smarlow at redhat.com
Date: 2010-05-01 07:24:40 -0400 (Sat, 01 May 2010)
New Revision: 104387
Modified:
trunk/testsuite/src/main/org/jboss/test/aop/nonjunit/ClusterCacheTester.java
Log:
JBAS-7872 Update ClusterCacheTester to use JMXConnectorFactory instead of RMIAdaptor for cluster unit testing.
Modified: trunk/testsuite/src/main/org/jboss/test/aop/nonjunit/ClusterCacheTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/nonjunit/ClusterCacheTester.java 2010-05-01 11:18:53 UTC (rev 104386)
+++ trunk/testsuite/src/main/org/jboss/test/aop/nonjunit/ClusterCacheTester.java 2010-05-01 11:24:40 UTC (rev 104387)
@@ -23,12 +23,13 @@
import javax.naming.InitialContext;
-import org.jboss.test.JBossTestCase;
-import junit.framework.Test;
import java.net.InetAddress;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
import javax.management.ObjectName;
-import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
-import java.util.Properties;
+import java.util.HashMap;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.List;
@@ -41,19 +42,22 @@
public class ClusterCacheTester
{
- static RMIAdaptor server1;
- static RMIAdaptor server2;
+ static MBeanServerConnection server1;
+ static MBeanServerConnection server2;
public static void main(String args[] ) throws Exception
{
String serverName = InetAddress.getLocalHost().getHostName();
- String connectorName = "jmx:" + serverName + ":rmi";
- RMIAdaptor server1 = (RMIAdaptor)new InitialContext().lookup(connectorName);
+ String serverURL = "service:jmx:rmi:///jndi/rmi://" + serverName +":1090/jmxrmi";
+ JMXServiceURL url = new JMXServiceURL(serverURL);
+ JMXConnector jmxc = JMXConnectorFactory.connect(url, new HashMap());
+ MBeanServerConnection server1 = jmxc.getMBeanServerConnection();
- Properties p = new Properties();
- p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
- p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
- p.put(Context.PROVIDER_URL, "localhost:11099");
- RMIAdaptor server2 = (RMIAdaptor)new InitialContext(p).lookup(connectorName);
+ // TODO: get the port from binding service
+ serverURL = "service:jmx:rmi:///jndi/rmi://" + serverName +":1190/jmxrmi";
+ url = new JMXServiceURL(serverURL);
+ jmxc = JMXConnectorFactory.connect(url, new HashMap());
+ server2 = jmxc.getMBeanServerConnection();
+
ObjectName testerName = new ObjectName("jboss.aop:name=CacheTester");
int baseAge = 32;
More information about the jboss-cvs-commits
mailing list