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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations