Search in sources :

Example 6 with WovenProxy

use of org.apache.aries.proxy.weaving.WovenProxy 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)

Example 7 with WovenProxy

use of org.apache.aries.proxy.weaving.WovenProxy in project aries by apache.

the class WeavingProxyTest method checkProxyFinalMethods.

/**
   * This method checks that we correctly proxy a class with final methods.
   */
@Test
public void checkProxyFinalMethods() throws Exception {
    Bundle b = bundleContext.getBundle();
    Callable<Object> c = new TestCallable();
    Collection<Class<?>> classes = new ArrayList<Class<?>>();
    Runnable r = new Runnable() {

        public final void run() {
        }
    };
    classes.add(r.getClass());
    Object o = mgr.createDelegatingProxy(b, classes, c, r);
    if (!!!(o instanceof WovenProxy))
        fail("Proxy should be woven!");
}
Also used : WovenProxy(org.apache.aries.proxy.weaving.WovenProxy) Bundle(org.osgi.framework.Bundle) ArrayList(java.util.ArrayList) WovenClass(org.osgi.framework.hooks.weaving.WovenClass) Test(org.junit.Test)

Aggregations

WovenProxy (org.apache.aries.proxy.weaving.WovenProxy)7 ArrayList (java.util.ArrayList)3 SingleInstanceDispatcher (org.apache.aries.proxy.impl.SingleInstanceDispatcher)3 Test (org.junit.Test)3 Bundle (org.osgi.framework.Bundle)3 WovenClass (org.osgi.framework.hooks.weaving.WovenClass)3 Serializable (java.io.Serializable)1 Callable (java.util.concurrent.Callable)1 UnableToProxyException (org.apache.aries.proxy.UnableToProxyException)1 ProxyWeavingController (org.apache.aries.proxy.weavinghook.ProxyWeavingController)1 WeavingHelper (org.apache.aries.proxy.weavinghook.WeavingHelper)1