Search in sources :

Example 21 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testOLD.

public static void testOLD() throws Exception {
    MethodCall methodCall = new MethodCall("someMethod", new Object[] { "abc" }, new Class[] { String.class });
    Target target = new Target();
    Object result = methodCall.invoke(target);
    Assert.assertEquals("ABC", result);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 22 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testInheritanceTYPES.

public static void testInheritanceTYPES() throws Exception {
    MethodCall methodCall = new MethodCall("someMethod", new Object[] { "abc" }, new Class[] { String.class });
    TargetSubclass target = new TargetSubclass();
    Object result = methodCall.invoke(target);
    Assert.assertEquals("ABC", result);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 23 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testInheritanceSIGNATURE.

public static void testInheritanceSIGNATURE() throws Exception {
    MethodCall methodCall = new MethodCall("someMethod", new Object[] { "abc" }, new Class[] { String.class });
    TargetSubclass target = new TargetSubclass();
    Object result = methodCall.invoke(target);
    Assert.assertEquals("ABC", result);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 24 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testMethod.

public void testMethod() throws Exception {
    Method m = TargetClass.class.getMethod("foo", int.class, String.class);
    MethodCall mc = new MethodCall(m, 22, "Bela");
    Assert.assertEquals(mc.invoke(target), Boolean.TRUE);
}
Also used : Method(java.lang.reflect.Method) MethodCall(org.jgroups.blocks.MethodCall)

Example 25 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testOverriddenForTYPES.

/**
 * This tests whether overriden methods are correctly identified and invoked.
 */
public static void testOverriddenForTYPES() throws Exception {
    MethodCall methodCall = new MethodCall("overriddenMethod", new Object[] { "abc" }, new Class[] { String.class });
    TargetSubclass target = new TargetSubclass();
    Object result = methodCall.invoke(target);
    Assert.assertEquals("TargetSubclassABC", result);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Aggregations

MethodCall (org.jgroups.blocks.MethodCall)31 RequestOptions (org.jgroups.blocks.RequestOptions)9 Method (java.lang.reflect.Method)6 Address (org.jgroups.Address)5 RpcDispatcher (org.jgroups.blocks.RpcDispatcher)5 Rsp (org.jgroups.util.Rsp)3 SiteMaster (org.jgroups.protocols.relay.SiteMaster)2 RspList (org.jgroups.util.RspList)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 JChannel (org.jgroups.JChannel)1 AdditionalJmxObjects (org.jgroups.jmx.AdditionalJmxObjects)1 RELAY2 (org.jgroups.protocols.relay.RELAY2)1 Route (org.jgroups.protocols.relay.Route)1 Protocol (org.jgroups.stack.Protocol)1 Average (org.jgroups.util.Average)1 AfterMethod (org.testng.annotations.AfterMethod)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Test (org.testng.annotations.Test)1