Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundle


  }

  public void testNullSafeToStringServiceReference() throws Exception {
    String symName = "symName";

    MockBundle bundle = new MockBundle(symName);
    Properties props = new Properties();
    String header = "HEADER";
    String value = "VALUE";
    props.put(header, value);
    MockServiceReference ref = new MockServiceReference(bundle, props, null);
View Full Code Here


   * (non-Javadoc)
   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    OsgiBundleUtilsTest.state = Bundle.UNINSTALLED;
    bundle = new MockBundle() {
      public int getState() {
        return state;
      }
    };
  }
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

    assertNull("Should be unable to resolve namespace", this.namespacePlugins.resolve("http://org.xyz"));
    assertNull("Should be unable to resolve entity", this.namespacePlugins.resolveEntity("pub-id", "sys-id"));
  }

  public void testCanResolveNamespaceFromBundleAfterAddingPlugin() throws IOException, SAXException {
    Bundle b = new MockBundle();
    this.namespacePlugins.addHandler(b);
    NamespaceHandler handler = this.namespacePlugins.resolve("http://www.springframework.org/schema/testme");
    assertNotNull("should find handler", handler);
    assertTrue("should be TestHandler", handler instanceof TestHandler);
  }
View Full Code Here

    assertNotNull("should find handler", handler);
    assertTrue("should be TestHandler", handler instanceof TestHandler);
  }

  public void testCantResolveNamespaceAfterRemovingPlugin() throws IOException, SAXException {
    Bundle b = new MockBundle();
    this.namespacePlugins.addHandler(b);
    this.namespacePlugins.removeHandler(b);
    assertNull("Should be unable to resolve namespace",
      this.namespacePlugins.resolve("http://www.springframework.org/schema/testme"));
  }
View Full Code Here

    assertNull("Should be unable to resolve namespace",
      this.namespacePlugins.resolve("http://www.springframework.org/schema/testme"));
  }

  public void testCanResolveEntityAfterAddingPlugin() throws IOException, SAXException {
    Bundle b = new MockBundle();
    this.namespacePlugins.addHandler(b);
    InputSource resolver = this.namespacePlugins.resolveEntity("public-id",
      "http://www.springframework.org/schema/beans/testme.xsd");
    assertNotNull("Should find resolver", resolver);
  }
View Full Code Here

      "http://www.springframework.org/schema/beans/testme.xsd");
    assertNotNull("Should find resolver", resolver);
  }

  public void testCantResolveEntityAfterRemovingPlugin() throws IOException, SAXException {
    Bundle b = new MockBundle();
    this.namespacePlugins.addHandler(b);
    this.namespacePlugins.removeHandler(b);
    InputSource resolver = this.namespacePlugins.resolveEntity("public-id",
      "http://www.springframework.org/schema/beans/testme.xsd");
    assertNull("Should be unable to resolve entity", resolver);
View Full Code Here

TOP

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

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.