Examples of echoBack()


Examples of org.apache.commons.proxy.util.Echo.echoBack()

{
    public void testMethodInvocation() throws Exception
    {
        InvocationHandlerTester tester = new InvocationHandlerTester();
        final Echo echo = ( Echo ) new JavassistProxyFactory().createInvokerProxy( new InvocationHandlerAdapter( tester ), new Class[] { Echo.class } );
        echo.echoBack( "hello" );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.method );
        assertSame( echo, tester.proxy );
        assertNotNull( tester.arguments );
        assertEquals( 1, tester.arguments.length );
        assertEquals( "hello", tester.arguments[0] );
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

    }

    public void testWithAbstractSuperclass()
    {
        final Echo echo = ( Echo )factory.createDelegatorProxy( new ConstantProvider( new EchoImpl() )new Class[] { AbstractEcho.class } );
        assertEquals( "hello", echo.echoBack( "hello" ) );
        assertEquals( "helloworld", echo.echoBack( "hello", "world" ) );
    }

    public void testCanProxy()
    {
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

    public void testWithAbstractSuperclass()
    {
        final Echo echo = ( Echo )factory.createDelegatorProxy( new ConstantProvider( new EchoImpl() )new Class[] { AbstractEcho.class } );
        assertEquals( "hello", echo.echoBack( "hello" ) );
        assertEquals( "helloworld", echo.echoBack( "hello", "world" ) );
    }

    public void testCanProxy()
    {
        assertTrue( factory.canProxynew Class[] { Echo.class } ) );
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

    public void testProxiesWithClashingFinalMethodInSuperclass()
    {
        final Class[] proxyClasses = new Class[]{Echo.class, FinalMethodEcho.class};
        Echo proxy = ( Echo )factory.createDelegatorProxy( new ConstantProvider( new EchoImpl() ), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );

        proxy = ( Echo )factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );

        proxy = ( Echo )factory.createInvokerProxy( new NullInvoker(), proxyClasses );
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

        final Class[] proxyClasses = new Class[]{Echo.class, FinalMethodEcho.class};
        Echo proxy = ( Echo )factory.createDelegatorProxy( new ConstantProvider( new EchoImpl() ), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );

        proxy = ( Echo )factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );

        proxy = ( Echo )factory.createInvokerProxy( new NullInvoker(), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );
    }
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

        proxy = ( Echo )factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );

        proxy = ( Echo )factory.createInvokerProxy( new NullInvoker(), proxyClasses );
        assertEquals( "final", proxy.echoBack("echo") );
    }

    public void testDelegatorWithMultipleSuperclasses()
    {
        try
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

        final OneShotExecutor executor = new OneShotExecutor();
        final Echo proxy = ( Echo ) new CglibProxyFactory()
                .createInterceptorProxy( impl, new ExecutorInterceptor( executor ), new Class[] { Echo.class } );
        try
        {
            proxy.echoBack( "hello" );
            fail();
        }
        catch( IllegalArgumentException e )
        {
        }
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

    {
        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy( new EchoImpl(),
                                                                                         new MethodInterceptorAdapter( new SuffixMethodInterceptor(
                                                                                                 " suffix" ) ),
                                                                                         new Class[]{ Echo.class } );
        assertEquals( "message suffix", proxy.echoBack( "message" ) );
    }

    public void testMethodInvocationImplementation() throws Exception
    {
        final InterceptorTester tester = new InterceptorTester();
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

        assertNotNull( tester.invocation.getArguments() );
        assertEquals( 0, tester.invocation.getArguments().length );
        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getMethod() );
        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getStaticPart() );
        assertEquals( target, tester.invocation.getThis() );
        proxy.echoBack( "Hello" );
        assertNotNull( tester.invocation.getArguments() );
        assertEquals( 1, tester.invocation.getArguments().length );
        assertEquals( "Hello", tester.invocation.getArguments()[0] );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getMethod() );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getStaticPart() );
View Full Code Here

Examples of org.apache.commons.proxy.util.Echo.echoBack()

        assertNotNull( tester.invocation.getArguments() );
        assertEquals( 1, tester.invocation.getArguments().length );
        assertEquals( "Hello", tester.invocation.getArguments()[0] );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getMethod() );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getStaticPart() );
        proxy.echoBack( "Hello", "World" );
        assertNotNull( tester.invocation.getArguments() );
        assertEquals( 2, tester.invocation.getArguments().length );
        assertEquals( "Hello", tester.invocation.getArguments()[0] );
        assertEquals( "World", tester.invocation.getArguments()[1] );
        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class, String.class } ), tester.invocation.getMethod() );
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.