Examples of MethodCall


Examples of org.jgroups.blocks.MethodCall

        }
    }


    public void testTypes() {
        MethodCall mc;
        mc=new MethodCall("foo", new Object[]{new Integer(35), "Bela"}, new Class[]{int.class, String.class});
        try {
            Assert.assertEquals(mc.invoke(target), Boolean.TRUE);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

    }



    public void testTypesWithArray() {
        MethodCall mc;
        mc=new MethodCall("bar", new Object[]{new String[]{"one", "two", "three"}, "Bela"},
                          new Class[]{String[].class, String.class});
        try {
            mc.invoke(target);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

        }
    }


    public void testTypesWithNullArgument() {
        MethodCall mc;
        mc=new MethodCall("bar", new Object[]{new String[]{"one", "two", "three"}, null},
                          new Class[]{String[].class, String.class});
        try {
            mc.invoke(target);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

            assert false : t.toString();
        }
    }

    public void testTypesWithNullArgument2() throws Throwable {
        MethodCall mc;
        mc=new MethodCall("bar", new Object[]{new String[]{"one", "two", "three"}, new Object[]{}},
                          new Class[]{String[].class, String.class});
        try {
            mc.invoke(target);
            assert false: "we should not get here as there should be an argument mismatch exception";
        }
        catch(IllegalArgumentException ex) {
            System.out.println("caught IllegalArgumentException - as expected");
        }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

        }
    }


    public void testTypesWithNullArgument3() {
        MethodCall mc;
        mc=new MethodCall("foobar", new Object[]{}, new Class[]{});
        try {
            mc.invoke(target);
        }
        catch(IllegalArgumentException ex) {
            assert true : "this was expected";
        }
        catch(Throwable t) {
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

        }
    }


    public void testTypesWithNullArgument4() {
        MethodCall mc;
        mc=new MethodCall("foobar", null, (Class[])null);
        try {
            mc.invoke(target);
        }
        catch(IllegalArgumentException ex) {
            assert true : "this was expected";
        }
        catch(Throwable t) {
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

        }
    }


    public void testTypesWithNullArgument5() {
        MethodCall mc;
        mc=new MethodCall("foobar", new Object[0], new Class[0]);
        try {
            mc.invoke(target);
        }
        catch(IllegalArgumentException ex) {
            assert true : "this was expected";
        }
        catch(Throwable t) {
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

    }



    public void testSignature() {
        MethodCall mc;
        mc=new MethodCall("foo", new Object[]{new Integer(35), "Bela"},
                          new String[]{int.class.getName(), String.class.getName()});
        try {
            Assert.assertEquals(mc.invoke(target), Boolean.TRUE);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall


    public static void testBufferSize() throws Exception {
        int a=10;
        String b="Bela";
        MethodCall m=new MethodCall("foo", new Object[]{new Integer(a),b}, new Class[]{int.class, String.class});
        ByteArrayOutputStream msg_data=new ByteArrayOutputStream();
        ObjectOutputStream msg_out=new ObjectOutputStream(msg_data);
        m.writeExternal(msg_out);
        msg_out.flush();
        msg_out.close();
        byte[] data=msg_data.toByteArray();
        ByteArrayInputStream msg_in_data=new ByteArrayInputStream(data);
        ObjectInputStream msg_in=new ObjectInputStream(msg_in_data);
        MethodCall m2=new MethodCall();
        m2.readExternal(msg_in);
        System.out.println(m2.getName());
        System.out.println(m2.getArgs().length);
    }
View Full Code Here

Examples of org.jgroups.blocks.MethodCall

        System.out.println(m2.getArgs().length);
    }


    public static void testOLD() throws Throwable {
        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);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.