Package com.thoughtworks.proxy.factory

Examples of com.thoughtworks.proxy.factory.CglibProxyFactory$CGLIBInvocationHandlerAdapter


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


        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

        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

    }

    // 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

    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

    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

    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

* @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

            assertNotNull(o);
        }
    }

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

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

Related Classes of com.thoughtworks.proxy.factory.CglibProxyFactory$CGLIBInvocationHandlerAdapter

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.