[jboss-cvs] JBossAS SVN: r82174 - in trunk/testsuite/src: resources/cluster/invokerha/META-INF and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 9 21:56:27 EST 2008
Author: bstansberry at jboss.com
Date: 2008-12-09 21:56:27 -0500 (Tue, 09 Dec 2008)
New Revision: 82174
Modified:
trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAService.java
trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAServiceMBean.java
trunk/testsuite/src/resources/cluster/invokerha/META-INF/jboss-service.xml
Log:
[JBAS-6284] Change test to ensure invoke() isn't available from target service
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAService.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAService.java 2008-12-10 02:47:52 UTC (rev 82173)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAService.java 2008-12-10 02:56:27 UTC (rev 82174)
@@ -21,113 +21,15 @@
*/
package org.jboss.test.cluster.invokerha;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.Principal;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
import org.jboss.ha.jmx.HAServiceMBeanSupport;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.MarshalledInvocation;
import org.jboss.logging.Logger;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.system.Registry;
public class HAService
extends HAServiceMBeanSupport
- implements HAServiceRemote, HAServiceMBean
+ implements HAServiceMBean
{
private static final Logger log = Logger.getLogger(HAService.class);
-
- private int count = 0;
- private Map marshalledInvocationMapping;
-
- public void startService()
- throws Exception
- {
- super.startService();
-
- // Calulate method hashes for remote invocation
- Method[] methods = HAServiceRemote.class.getMethods();
- HashMap tmpMap = new HashMap(methods.length);
- for(int m = 0; m < methods.length; m ++)
- {
- Method method = methods[m];
- Long hash = new Long(MarshalledInvocation.calculateHash(method));
- tmpMap.put(hash, method);
- }
- marshalledInvocationMapping = Collections.unmodifiableMap(tmpMap);
-
- // Place our ObjectName hash into the Registry so invokers can resolve it
- Registry.bind(new Integer(serviceName.hashCode()), serviceName);
- }
-
- public void stopService()
- throws Exception
- {
- super.stopService();
-
- // No longer available to the invokers
- Registry.unbind(new Integer(serviceName.hashCode()));
- }
-
- /**
- * Expose the client mapping
- */
- public Map getMethodMap()
- {
- return marshalledInvocationMapping;
- }
-
- /**
- * This is the "remote" entry point
- */
- public Object invoke(Invocation invocation)
- throws Exception
- {
- log.info("Invoked");
-
- // Invoked remotely, inject method resolution
- if (invocation instanceof MarshalledInvocation)
- {
- MarshalledInvocation mi = (MarshalledInvocation) invocation;
- mi.setMethodMap(marshalledInvocationMapping);
- }
- Method method = invocation.getMethod();
- Object[] args = invocation.getArguments();
-
- log.info("Invocation of " + method);
-
- // Setup any security context (only useful if something checks it, this impl doesn't)
- Principal principal = invocation.getPrincipal();
- Object credential = invocation.getCredential();
- SecurityAssociation.setPrincipal(principal);
- SecurityAssociation.setCredential(credential);
-
- // Dispatch the invocation
- try
- {
- return method.invoke(this, args);
- }
- catch(InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if( t instanceof Exception )
- throw (Exception) t;
- else
- throw new UndeclaredThrowableException(t, method.toString());
- }
- finally
- {
- // Clear the security context
- SecurityAssociation.clear();
- }
- }
-
// Implementation of remote methods
public String hello()
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAServiceMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAServiceMBean.java 2008-12-10 02:47:52 UTC (rev 82173)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/HAServiceMBean.java 2008-12-10 02:56:27 UTC (rev 82174)
@@ -21,17 +21,10 @@
*/
package org.jboss.test.cluster.invokerha;
-import java.util.Map;
-import org.jboss.invocation.Invocation;
-
public interface HAServiceMBean
- extends org.jboss.ha.jmx.HAServiceMBean
-{
- // For remoting
- Map getMethodMap();
- Object invoke(Invocation invocation) throws Exception;
-
+ extends org.jboss.ha.jmx.HAServiceMBean, HAServiceRemote
+{
boolean getSendRemoteLifecycleNotifications();
void setSendRemoteLifecycleNotifications(boolean send);
Modified: trunk/testsuite/src/resources/cluster/invokerha/META-INF/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/invokerha/META-INF/jboss-service.xml 2008-12-10 02:47:52 UTC (rev 82173)
+++ trunk/testsuite/src/resources/cluster/invokerha/META-INF/jboss-service.xml 2008-12-10 02:56:27 UTC (rev 82174)
@@ -18,6 +18,9 @@
<!-- The target MBean -->
<depends optional-attribute-name="TargetName">jboss.test:service=HAService</depends>
+
+ <!-- Directly invoke the target method, not invoke() -->
+ <attribute name="InvokeTargetMethod">true</attribute>
<!-- Where to bind the proxy -->
<attribute name="JndiName">jmx/HAService</attribute>
@@ -60,6 +63,9 @@
<attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
<depends optional-attribute-name="TargetName">jboss.test:service=HAService,type=unifiedha</depends>
+
+ <!-- Directly invoke the target method, not invoke() -->
+ <attribute name="InvokeTargetMethod">true</attribute>
<attribute name="JndiName">jmx/HAServiceUnified</attribute>
@@ -98,6 +104,9 @@
<attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
<depends optional-attribute-name="TargetName">jboss.test:service=HAService,type=pooledha</depends>
+
+ <!-- Directly invoke the target method, not invoke() -->
+ <attribute name="InvokeTargetMethod">true</attribute>
<attribute name="JndiName">jmx/HAServicePooled</attribute>
More information about the jboss-cvs-commits
mailing list