Examples of InfrastructureOsgiProxyAdvice


Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

      advices.add(tcclAdvice);

    // 4. add the infrastructure proxy
    // but first create the dispatcher since we need
    ServiceInvoker dispatcherInterceptor = createDispatcherInterceptor(reference);
    Advice infrastructureMixin = new InfrastructureOsgiProxyAdvice(dispatcherInterceptor);

    advices.add(infrastructureMixin);
    advices.add(dispatcherInterceptor);

    return new ProxyPlusCallback(ProxyUtils.createProxy(getInterfaces(reference), null, classLoader, bundleContext,
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

  public void testSpringInfrastructureProxyOnImportersWithTheSameRef() throws Exception {
    Object service = new Object();
    ServiceInvoker invokerA = new ServiceStaticInterceptor(createObjectTrackingBundleContext(service), ref);
    ServiceInvoker invokerB = new ServiceStaticInterceptor(createObjectTrackingBundleContext(service), ref);
    InfrastructureProxy proxyA = new InfrastructureOsgiProxyAdvice(invokerA);
    InfrastructureProxy proxyB = new InfrastructureOsgiProxyAdvice(invokerB);

    // though this is not normal, we want the interceptors to be different to make sure the wrapped object
    // gets properly delegated
    assertFalse("invokers should not be equal (they have different bundle contexts)", invokerA.equals(invokerB));
    assertFalse("proxies should not be equal", proxyA.equals(proxyB));
    assertSame(proxyA.getWrappedObject(), proxyB.getWrappedObject());
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

  public void testSpringInfrastructureProxyOnImportersWithDifferentRefs() throws Exception {
    Object service = new Object();
    BundleContext ctx = createObjectTrackingBundleContext(service);
    ServiceInvoker invokerA = new ServiceStaticInterceptor(ctx, new MockServiceReference());
    ServiceInvoker invokerB = new ServiceStaticInterceptor(ctx, new MockServiceReference());
    InfrastructureProxy proxyA = new InfrastructureOsgiProxyAdvice(invokerA);
    InfrastructureProxy proxyB = new InfrastructureOsgiProxyAdvice(invokerB);

    assertFalse("invokers should not be equal (they have different service references)", invokerA.equals(invokerB));
    assertFalse("proxies should not be equal", proxyA.equals(proxyB));
    assertFalse("target objects should not be equal", proxyA.getWrappedObject().equals(proxyB.getWrappedObject()));
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

  }

  public void testNakedTargetPropertyReturnedByTheInfrastructureProxy() throws Exception {
    Object service = new Object();
    ServiceInvoker invoker = new ServiceStaticInterceptor(createObjectTrackingBundleContext(service), ref);
    InfrastructureProxy proxy = new InfrastructureOsgiProxyAdvice(invoker);
    assertSame(TestUtils.invokeMethod(invoker, "getTarget", null), proxy.getWrappedObject());
    assertSame(service, proxy.getWrappedObject());
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

    assertSame(TestUtils.invokeMethod(invoker, "getTarget", null), proxy.getWrappedObject());
    assertSame(service, proxy.getWrappedObject());
  }

  public void testEqualityBetweenInfrastructureProxies() throws Exception {
    Advice interceptorA1 = new InfrastructureOsgiProxyAdvice(new ServiceStaticInterceptor(bundleContext, ref));
    Advice interceptorB1 = new InfrastructureOsgiProxyAdvice(new ServiceStaticInterceptor(bundleContext, ref));

    assertEquals("interceptors should be equal", interceptorA1, interceptorB1);
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.internal.aop.InfrastructureOsgiProxyAdvice

    assertEquals("interceptors should be equal", interceptorA1, interceptorB1);
  }

  public void testNonEqualityBetweenInfrastructureProxies() throws Exception {
    Advice interceptorA1 = new InfrastructureOsgiProxyAdvice(new ServiceStaticInterceptor(bundleContext, ref));
    Advice interceptorB1 = new InfrastructureOsgiProxyAdvice(createInterceptorWOServiceRequired());

    assertFalse("interceptors should not be equal", interceptorA1.equals(interceptorB1));
  }
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.