Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockServiceReference


    assertEquals("proxy should be equal to itself", proxy, proxy);
  }

  public void testServiceReferenceProxy() throws Exception {
    Date date = new Date(123);
    ServiceReference ref = new MockServiceReference(classInterfaces);
    services.put(ref, date);

    Object proxy = proxyCreator.createServiceProxy(ref).proxy;
    assertTrue(proxy instanceof ImportedOsgiServiceProxy);
    ServiceReferenceProxy referenceProxy = ((ImportedOsgiServiceProxy) proxy).getServiceReference();
View Full Code Here


  public void testServiceReferenceProxyEquality() throws Exception {

    Date date = new Date(123);

    ServiceReference ref = new MockServiceReference(classInterfaces);
    services.put(ref, date);

    Object proxy = proxyCreator.createServiceProxy(ref).proxy;
    Object proxy2 = proxyCreator.createServiceProxy(ref).proxy;
View Full Code Here

  private ServiceReference reference;
  private Map map;


  protected void setUp() throws Exception {
    reference = new MockServiceReference();
    createMap();
  }
View Full Code Here

  }

  public void testContainsKeyObject() {
    Properties prop = new Properties();
    prop.setProperty("joe", "satriani");
    reference = new MockServiceReference(new MockBundle(), prop, null);
    createMap();
    assertTrue(map.containsKey("joe"));
  }
View Full Code Here

  }

  public void testContainsValueObject() {
    Properties prop = new Properties();
    prop.setProperty("joe", "satriani");
    reference = new MockServiceReference(new MockBundle(), prop, null);
    createMap();
    assertTrue(map.containsValue("satriani"));
  }
View Full Code Here

  }

  public void testEntrySet() {
    Properties prop = new Properties();
    prop.setProperty("joe", "satriani");
    reference = new MockServiceReference(new MockBundle(), prop, null);
    createMap();
    Set entries = map.entrySet();
    assertNotNull(entries);

    for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
View Full Code Here

  }

  public void testGetObject() {
    Properties prop = new Properties();
    prop.setProperty("joe", "satriani");
    reference = new MockServiceReference(new MockBundle(), prop, null);
    createMap();
    assertEquals("satriani", map.get("joe"));
  }
View Full Code Here

  }

  public void testMoreInterfacesAvailable() throws Exception {
    String[] extraClasses = new String[] { Cloneable.class.getName(), Runnable.class.getName() };

    MockServiceReference ref = new MockServiceReference(addExtraIntfs(extraClasses));

    Class[] clazzes = proxyCreator.discoverProxyClasses(ref);
    assertTrue(containsClass(clazzes, Cloneable.class));
    assertTrue(containsClass(clazzes, Runnable.class));
    assertTrue(containsClass(clazzes, Serializable.class));
View Full Code Here

  }

  public void testNonVisibleOrInvalidInterfacesFound() throws Exception {
    String[] extraClasses = new String[] { "a", "nonExistingClass" };

    MockServiceReference ref = new MockServiceReference(addExtraIntfs(extraClasses));

    Class[] clazzes = proxyCreator.discoverProxyClasses(ref);
    assertEquals(2, clazzes.length);
    assertTrue(containsClass(clazzes, Serializable.class));
    assertTrue(containsClass(clazzes, Comparable.class));
View Full Code Here

  }

  public void testParentInterfaces() throws Exception {
    String[] extraClasses = new String[] { SupportedValuesAttribute.class.getName(), LabeledEnum.class.getName() };

    MockServiceReference ref = new MockServiceReference(addExtraIntfs(extraClasses));
    Class[] clazzes = proxyCreator.discoverProxyClasses(ref);
    assertEquals(2, clazzes.length);
    assertTrue(containsClass(clazzes, LabeledEnum.class));
    assertFalse(containsClass(clazzes, Comparable.class));
    assertTrue(containsClass(clazzes, SupportedValuesAttribute.class));
View Full Code Here

TOP

Related Classes of org.springframework.osgi.mock.MockServiceReference

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.