Package org.springframework.core

Examples of org.springframework.core.InfrastructureProxy


        Object proxy = proxyFactory.getProxy();
        assertTrue(proxy instanceof List);
        assertFalse(proxy instanceof ArrayList);
        assertTrue(proxy instanceof InfrastructureProxy);
       
        InfrastructureProxy iproxy = (InfrastructureProxy) proxy;
        final Object wrappedObject = iproxy.getWrappedObject();
        System.out.println(wrappedObject);
        assertTrue(wrappedObject instanceof ArrayList);
    }   
View Full Code Here


      ImportedOsgiServiceProxy refAware = (ImportedOsgiServiceProxy) result;

      assertTrue(doesMapContainsDictionary(dict,
        OsgiServiceReferenceUtils.getServicePropertiesAsMap(refAware.getServiceReference())));

      InfrastructureProxy targetAware = (InfrastructureProxy) result;
      assertEquals(date, targetAware.getWrappedObject());
    }
    finally {
      if (reg != null)
        reg.unregister();
    }
View Full Code Here

  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

  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

  }

  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

        return (reference == ref ? service : super.getService(reference));
      }
    };

    proxyCreator = createProxyCreator(ctx, classes);
    InfrastructureProxy proxy = (InfrastructureProxy) proxyCreator.createServiceProxy(ref).proxy;
    assertEquals(service, proxy.getWrappedObject());
    InfrastructureProxy anotherProxy = (InfrastructureProxy) proxyCreator.createServiceProxy(new MockServiceReference()).proxy;
    assertFalse(proxy.equals(anotherProxy));
    assertFalse(anotherProxy.getWrappedObject().equals(proxy.getWrappedObject()));
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.InfrastructureProxy

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.