Examples of CglibProxyFactory


Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    /**
     * {@inheritDoc}
     */
    protected ComponentAdapter prepSER_isSerializable(MutablePicoContainer picoContainer) {
        return new AssimilatingComponentAdapter(Touchable.class, new InstanceComponentAdapter(
                CompatibleTouchable.class, new CompatibleTouchable()), new CglibProxyFactory());
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

        assertTrue(collection instanceof List);
        assertFalse(collection instanceof ArrayList);
    }

    public void testComponentRegisteredWithInterfaceKeyOnlyImplementsThatInterfaceUsingCGLIBProxyfactory() {
        DefaultPicoContainer pico = new DefaultPicoContainer(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(), new CglibProxyFactory()));
        pico.registerComponentImplementation(Collection.class, ArrayList.class);
        Object collection = pico.getComponentInstance(Collection.class);
        assertTrue(collection instanceof Collection);
        assertFalse(collection instanceof List);
        assertFalse(collection instanceof ArrayList);
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

        assertFalse(collection instanceof List);
        assertFalse(collection instanceof ArrayList);
    }

    public void testComponentRegisteredWithOtherKeyImplementsAllInterfacesUsingCGLIBProxyFactory() {
        DefaultPicoContainer pico = new DefaultPicoContainer(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(), new CglibProxyFactory()));
        pico.registerComponentImplementation("list", ArrayList.class);
        Object collection = pico.getComponentInstance("list");
        assertTrue(collection instanceof Collection);
        assertTrue(collection instanceof List);
        assertTrue(collection instanceof ArrayList);
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    }

    // TODO: Fails with versions of cglib >= 2.0.1
    public void testShouldBeAbleToHandleMutualDependenciesWithoutInterfaceImplSeparation() {
        MutablePicoContainer pico = new DefaultPicoContainer(new CachingComponentAdapterFactory(new HotSwappingComponentAdapterFactory(new ConstructorInjectionComponentAdapterFactory(),
                new CglibProxyFactory())));

        pico.registerComponentImplementation(Yin.class);
        pico.registerComponentImplementation(Yang.class);

        Yin yin = (Yin) pico.getComponentInstance(Yin.class);
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    super(type, name, new StubInvocationHandler(name));
  }
 
    /** get the mocked instance */
    public Object proxy() {
        return new CglibProxyFactory().createProxy(new Class[] {getType()}, new ExpectationHandlerDelegate());
    }
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    public static Mock mockClass(final Class type, final String name) {
      if (type.getDeclaringClass() != null && !Modifier.isStatic(type.getModifiers())) {
            throw new IllegalArgumentException("cannot mock non-static inner class " + type.getName());
        }
     
        return (Mock) new CglibProxyFactory().createProxy(new Class[]{type, Mock.class, ExpectationRegistry.class},
                new Invoker() {
        final ClassMockObject mock = new ClassMockObject(type, name);

            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                try {
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

    public static Test suite() {
        TestSuite suite = new TestSuite("Test for com.thoughtworks.proxy");

        // Tests based on ProxyTestCase with different factories
        suite.addTest(createProxyFactorySuite(new StandardProxyFactory(), "Standard"));
        suite.addTest(createProxyFactorySuite(new CglibProxyFactory(), "Cglib"));

        // CGLIB-specific tests
        suite.addTestSuite(CglibProxyFactoryTest.class);
        suite.addTestSuite(CglibEchoingTest.class);
        suite.addTestSuite(CglibHotSwappingTest.class);
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

* @author Jörg Schaible
*/
public class EchoToyExample {

    public static void packageOverviewExample1() {
        Map map = (Map)Echoing.object(Map.class, new HashMap(), new CglibProxyFactory());
        map.put("Date", new Date());
        map.put("File", new File("."));
        try {
            Iterator iter = map.keySet().iterator();
            while (true) {
View Full Code Here

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

            assertNotNull(o);
        }
    }

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

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory

public class HotSwapToyExample {

    public static void packageOverviewExample1() {
        ByteArrayOutputStream outStreamOdd = new ByteArrayOutputStream();
        ByteArrayOutputStream outStreamEven = new ByteArrayOutputStream();
        OutputStream out = (OutputStream)HotSwapping.object(OutputStream.class, new CglibProxyFactory(), null);
        PrintWriter writer = new PrintWriter(out);
        for (int i = 0; i < 10; ++i) {
            Swappable swappable = (Swappable)out;
            if (i % 2 > 0) {
                swappable.hotswap(outStreamEven);
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.