Examples of CglibProxyFactory


Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

public class FailoverToyExample {

    public static void packageOverviewExample1() {
        Format[] formats = new Format[]{
                NumberFormat.getInstance(), DateFormat.getDateInstance(), new MessageFormat("{1}, {0}"),};
        Format format = (Format)Failover.object(Format.class, new CglibProxyFactory(), formats, RuntimeException.class);
        System.out.println("Format a date: " + format.format(new Date()));
        System.out.println("Format a message: " + format.format(new String[]{"John", "Doe"}));
        System.out.println("Format a number: " + format.format(new Integer(42)));
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

* @author Jörg Schaible
*/
public class CglibMulticastTest extends ProxyTestCase {

    protected ProxyFactory createProxyFactory() {
        return new CglibProxyFactory();
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

*/
public class NullToyExample {

    public static void packageOverviewExample1() {
        try {
            ProxyFactory factory = new CglibProxyFactory();
            File file = (File)Null.object(File.class, factory);
            System.out.println("Length is: " + file.length());
            System.out.println("Exists: " + file.exists());
            System.out.println("Array is empty: " + file.list().length);
            System.out.println("toURL returns null, since URL is final: " + (file.toURL() == null));
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

/**
* @author Aslak Hellesøy
*/
public class CglibHotSwappingTest extends ProxyTestCase {
    protected ProxyFactory createProxyFactory() {
        return new CglibProxyFactory();
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

            public Object decorateResult(Object proxy, Method method, Object[] args, Object result) {
                System.out.println(" ==> " + result);
                return result;
            }
        }, new CglibProxyFactory());
        decoratedFile.exists();
        decoratedFile.isFile();
        decoratedFile.isDirectory();
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

import java.util.List;


public class CglibEchoingTest extends ProxyTestCase {
    protected ProxyFactory createProxyFactory() {
        return new CglibProxyFactory();
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    public static void packageOverviewExample3() {
        File workingDir = new File(".");
        List files = Arrays.asList(workingDir.list());
        Object multicast = Multicasting.object(
                new Class[]{File.class, List.class}, new CglibProxyFactory(), new Object[]{workingDir, files});
        System.out.println("Current working directory: " + ((File)multicast).getAbsolutePath());
        System.out.println("Files in working directory: " + ((List)multicast).size());
    }
View Full Code Here

Examples of org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.CgLibProxyFactory

import org.osgi.service.blueprint.container.ComponentDefinitionException;

public class AbstractServiceReferenceTest {
    @Test
    public void testCglibProxySingleTargetClass() {
        CgLibProxyFactory sut = new CgLibProxyFactory();
        Class<?> result = sut.getTargetClass(new Class<?>[] {ArrayList.class});
        assertEquals(ArrayList.class, result);
    }
View Full Code Here

Examples of org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.CgLibProxyFactory

        assertEquals(ArrayList.class, result);
    }
   
    @Test
    public void testCglibProxyMultipleTargetClasses() {
        CgLibProxyFactory sut = new CgLibProxyFactory();
        Class<?> result = sut.getTargetClass(new Class<?>[] {AbstractList.class, ArrayList.class});
        assertEquals(ArrayList.class, result);
       
        result = sut.getTargetClass(new Class<?>[] {ArrayList.class, AbstractList.class});
        assertEquals(ArrayList.class, result);
    }
View Full Code Here

Examples of org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.CgLibProxyFactory

        assertEquals(ArrayList.class, result);
    }
   
    @Test(expected=ComponentDefinitionException.class)
    public void testCglibProxyIncompatibleTargetClasses() {
        CgLibProxyFactory sut = new CgLibProxyFactory();
        sut.getTargetClass(new Class<?>[] {LinkedList.class, ArrayList.class});       
    }
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.