Package org.apache.commons.proxy.util

Examples of org.apache.commons.proxy.util.EchoImpl


*/
public class TestInterceptorChain extends TestCase
{
    public void testWithSingleInterceptor()
    {
        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new SuffixInterceptor( "a" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl()new Class[] { Echo.class } ).getObject();
        assertEquals( "messagea", echo.echoBack( "message" ) );
    }
View Full Code Here


        assertEquals( "messagea", echo.echoBack( "message" ) );
    }

    public void testWithMultipleInterceptors()
    {
        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new SuffixInterceptor( "a" ), new SuffixInterceptor( "b" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl()new Class[] { Echo.class } ).getObject();
        assertEquals( "messageba", echo.echoBack( "message" ) );
    }
View Full Code Here

    protected void setUp() throws Exception
    {
        logMock = mock( Log.class );
        echo = ( Echo ) new CglibProxyFactory()
                .createInterceptorProxy( new EchoImpl(), new LoggingInterceptor( ( Log ) logMock.proxy() ),
                                         new Class[]{ Echo.class } );
    }
View Full Code Here

    public void testWhenLoggingDisabled()
    {
        logMock = mock( Log.class );
        echo = ( Echo ) new CglibProxyFactory()
                .createInterceptorProxy( new EchoImpl(), new LoggingInterceptor( ( Log ) logMock.proxy() ),
                                         new Class[]{ Echo.class } );
        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( false ) );
        echo.echoBack( "Hello" );

    }
View Full Code Here

*/
public class TestFilteredInterceptor extends TestCase
{
    public void testFilterAccepts()
    {
        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new FilteredInterceptor( new SuffixInterceptor( "a" ), new SimpleFilter( new String[] { "echoBack" } ) ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
        assertEquals( "messagea", echo.echoBack( "message" ) );
    }
View Full Code Here

        assertEquals( "messagea", echo.echoBack( "message" ) );
    }

    public void testFilterDenies()
    {
        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new FilteredInterceptor( new SuffixInterceptor( "a" ), new SimpleFilter() ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
        assertEquals( "message", echo.echoBack( "message" ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.proxy.util.EchoImpl

Copyright © 2018 www.massapicom. 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.