Search in sources :

Example 16 with MethodCall

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

the class MethodCallTest method testSIGNATURE.

public static void testSIGNATURE() 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 17 with MethodCall

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

the class MethodCallTest method testMarshallingID.

public void testMarshallingID() throws Exception {
    MethodCall mc = new MethodCall((short) 1, true, Boolean.FALSE, 322649, 3.24, (float) 54.345, new byte[] { 'b', 'e', 'l', 'a' }, new String[] { "Bela", "Michelle" });
    MethodCall call2 = marshalAndUnmarshal(mc);
    System.out.println("call2 = " + call2);
    mc = new MethodCall((short) 1, true, Boolean.FALSE, 322649, 3.24, (float) 54.345, new byte[] { 'b', 'e', 'l', 'a' }, new String[] { "Bela", "Michelle" });
    call2 = marshalAndUnmarshal(mc);
    System.out.println("call2 = " + call2);
    mc = new MethodCall((short) 2);
    call2 = marshalAndUnmarshal(mc);
    System.out.println("call2 = " + call2);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 18 with MethodCall

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

the class MethodCallTest method testMarshalling2.

public static void testMarshalling2() throws Exception {
    Address addr = Util.createRandomAddress("A");
    MethodCall call = new MethodCall("foo", new Object[] { "hello", 23, addr }, new Class[] { String.class, int.class, Address.class });
    MethodCall m = marshalAndUnmarshal(call);
    System.out.println("m = " + m);
}
Also used : Address(org.jgroups.Address) MethodCall(org.jgroups.blocks.MethodCall)

Example 19 with MethodCall

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

the class MethodCallTest method testMarshallingTYPES.

public static void testMarshallingTYPES() throws Exception {
    MethodCall mc = new MethodCall("call", new Object[] { true, Boolean.FALSE, 322649, 3.24, (float) 54.345, new byte[] { 'b', 'e', 'l', 'a' }, new String[] { "Bela", "Michelle" } }, new Class<?>[] { boolean.class, Boolean.class, int.class, double.class, float.class, byte[].class, String[].class });
    MethodCall call2 = marshalAndUnmarshal(mc);
    System.out.println("call2 = " + call2);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 20 with MethodCall

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

the class MethodCallTest method testMETHOD.

public static void testMETHOD() throws Exception {
    Method method = Target.class.getMethod("someMethod", String.class);
    MethodCall methodCall = new MethodCall(method, "abc");
    Target target = new Target();
    Object result = methodCall.invoke(target);
    Assert.assertEquals("ABC", result);
}
Also used : Method(java.lang.reflect.Method) 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