Search in sources :

Example 1 with AbstractProxyManager

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

the class ReferencesTest method testWiring.

public void testWiring() throws Exception {
    ComponentDefinitionRegistryImpl registry = parse("/test-references.xml");
    ProxyManager proxyManager = new AbstractProxyManager() {

        @Override
        protected Object createNewProxy(Bundle bundle, Collection<Class<?>> classes, Callable<Object> objectCallable, InvocationListener invocationListener) throws UnableToProxyException {
            return new Object();
        }

        @Override
        protected InvocationHandler getInvocationHandler(Object o) {
            return null;
        }

        @Override
        protected boolean isProxyClass(Class<?> aClass) {
            return false;
        }
    };
    Repository repository = new TestBlueprintContainer(registry, proxyManager).getRepository();
    repository.create("refItf");
    try {
        repository.create("refClsErr");
        fail("Should have failed");
    } catch (ComponentDefinitionException e) {
    }
    repository.create("refClsOk");
}
Also used : Repository(org.apache.aries.blueprint.di.Repository) AbstractProxyManager(org.apache.aries.proxy.impl.AbstractProxyManager) ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException) Bundle(org.osgi.framework.Bundle) InvocationListener(org.apache.aries.proxy.InvocationListener) AbstractProxyManager(org.apache.aries.proxy.impl.AbstractProxyManager) ProxyManager(org.apache.aries.proxy.ProxyManager) Collection(java.util.Collection) ComponentDefinitionRegistryImpl(org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl) Callable(java.util.concurrent.Callable)

Aggregations

Collection (java.util.Collection)1 Callable (java.util.concurrent.Callable)1 Repository (org.apache.aries.blueprint.di.Repository)1 ComponentDefinitionRegistryImpl (org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl)1 InvocationListener (org.apache.aries.proxy.InvocationListener)1 ProxyManager (org.apache.aries.proxy.ProxyManager)1 AbstractProxyManager (org.apache.aries.proxy.impl.AbstractProxyManager)1 Bundle (org.osgi.framework.Bundle)1 ComponentDefinitionException (org.osgi.service.blueprint.container.ComponentDefinitionException)1