assertTrue(proxy instanceof ImportedOsgiServiceProxy);
assertTrue(proxy instanceof InfrastructureProxy);
}
public void testTargetProxy() throws Exception {
final MockServiceReference ref = new MockServiceReference();
final Object service = new Object();
MockBundleContext ctx = new MockBundleContext() {
public ServiceReference getServiceReference(String clazz) {
return ref;
}
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[] { ref };
}
public Object getService(ServiceReference reference) {
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()));
}