Search in sources :

Example 1 with SingleInstanceDispatcher

use of org.apache.aries.proxy.impl.SingleInstanceDispatcher in project aries by apache.

the class WovenProxyPlusSubclassGeneratorTest method getProxyInstance.

@Override
protected Object getProxyInstance(Class<?> proxyClass, InvocationListener listener) {
    WovenProxy proxy = (WovenProxy) getProxyInstance(proxyClass);
    proxy = proxy.org_apache_aries_proxy_weaving_WovenProxy_createNewProxyInstance(new SingleInstanceDispatcher(proxy), listener);
    return proxy;
}
Also used : WovenProxy(org.apache.aries.proxy.weaving.WovenProxy) SingleInstanceDispatcher(org.apache.aries.proxy.impl.SingleInstanceDispatcher)

Example 2 with SingleInstanceDispatcher

use of org.apache.aries.proxy.impl.SingleInstanceDispatcher in project aries by apache.

the class WovenSubclassGeneratorTest method testCovariant.

/**
   * Test a covariant override method
   */
@Test
public void testCovariant() throws Exception {
    testCallable = new SingleInstanceDispatcher(COVARIANT_CLASS.newInstance());
    Object o = setDelegate(getProxyInstance(getProxyClass(COVARIANT_CLASS)), testCallable);
    Class<?> generatedProxySubclass = o.getClass();
    Method m = generatedProxySubclass.getDeclaredMethod("getCovariant", new Class[] {});
    Object returned = m.invoke(o);
    assertTrue("Object was of wrong type: " + returned.getClass().getSimpleName(), COVARIANT_CLASS.isInstance(returned));
}
Also used : SingleInstanceDispatcher(org.apache.aries.proxy.impl.SingleInstanceDispatcher) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 3 with SingleInstanceDispatcher

use of org.apache.aries.proxy.impl.SingleInstanceDispatcher in project aries by apache.

the class WovenProxyGeneratorTest method getProxyInstance.

@Override
protected Object getProxyInstance(Class<?> proxyClass, InvocationListener listener) {
    WovenProxy proxy = (WovenProxy) getProxyInstance(proxyClass);
    proxy = proxy.org_apache_aries_proxy_weaving_WovenProxy_createNewProxyInstance(new SingleInstanceDispatcher(proxy), listener);
    return proxy;
}
Also used : WovenProxy(org.apache.aries.proxy.weaving.WovenProxy) SingleInstanceDispatcher(org.apache.aries.proxy.impl.SingleInstanceDispatcher)

Example 4 with SingleInstanceDispatcher

use of org.apache.aries.proxy.impl.SingleInstanceDispatcher in project aries by apache.

the class WovenSubclassGeneratorTest method testGenerics.

/**
   * Test a covariant override method
   */
@Test
public void testGenerics() throws Exception {
    testCallable = new SingleInstanceDispatcher(GENERIC_CLASS.newInstance());
    super.testGenerics();
}
Also used : SingleInstanceDispatcher(org.apache.aries.proxy.impl.SingleInstanceDispatcher) Test(org.junit.Test)

Example 5 with SingleInstanceDispatcher

use of org.apache.aries.proxy.impl.SingleInstanceDispatcher in project aries by apache.

the class WovenSubclassGeneratorTest method getProxyInstance.

@Override
protected Object getProxyInstance(Class<?> proxyClass, InvocationListener listener) {
    WovenProxy proxy = (WovenProxy) getProxyInstance(proxyClass);
    proxy = proxy.org_apache_aries_proxy_weaving_WovenProxy_createNewProxyInstance(new SingleInstanceDispatcher(proxy), listener);
    return proxy;
}
Also used : WovenProxy(org.apache.aries.proxy.weaving.WovenProxy) SingleInstanceDispatcher(org.apache.aries.proxy.impl.SingleInstanceDispatcher)

Aggregations

SingleInstanceDispatcher (org.apache.aries.proxy.impl.SingleInstanceDispatcher)5 WovenProxy (org.apache.aries.proxy.weaving.WovenProxy)3 Test (org.junit.Test)2 Method (java.lang.reflect.Method)1