Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundleContext


    catch (IllegalArgumentException iae) {
    }
  }

  public void testDeploySuccesful() throws Exception {
    BundleContext bc = new MockBundleContext();

    final Bundle bnd = new MockBundle();
    final String ctxPath = "/context";
    final Boolean[] started = new Boolean[1];
View Full Code Here


      protected WarDeployment createDeployment(Bundle bundle, String contextPath) throws Exception {
        throw creationException;
      }
    };

    deployer.setBundleContext(new MockBundleContext());
    deployer.afterPropertiesSet();
    try {
      deployer.deploy(null, null);
      fail("should have thrown exception");
    }
View Full Code Here

      protected void startDeployment(WarDeployment deployment) throws Exception {
        throw creationException;
      }
    };
    deployer.setBundleContext(new MockBundleContext());
    deployer.afterPropertiesSet();
    try {
      deployer.deploy(null, null);
      fail("should have thrown exception");
    }
View Full Code Here

    mc.replay();

    registrationCounter = 0;
    unregistrationCounter = 0;

    BundleContext bundleContext = new MockBundleContext() {

      // always return a ConfigurationAdmin
      public Object getService(ServiceReference reference) {
        return new MockConfigurationAdmin() {
View Full Code Here

    DummyListenerServiceSignature.UNBIND_CALLS = 0;

    DummyListenerServiceSignature2.BIND_CALLS = 0;
    DummyListenerServiceSignature2.UNBIND_CALLS = 0;

    BundleContext bundleContext = new MockBundleContext() {

      // service reference already registered
      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return new ServiceReference[0];
      }
View Full Code Here

    configMock.expectAndReturn(cfg.getProperties(), config, MockControl.ONE_OR_MORE);

    adminControl.replay();
    configMock.replay();

    bundleContext = new MockBundleContext() {

      // add Configuration admin support
      public Object getService(ServiceReference reference) {
        return admin;
      }
View Full Code Here

  public void testCustomizeApplicationContextServiceProperties() {
    String ns = "foo";
    context.setNamespace(ns);
    Map props = new HashMap();
    context.setBundleContext(new MockBundleContext());
    context.customizeApplicationContextServiceProperties(props);
    assertEquals(ns, props.get("org.springframework.web.context.namespace"));
  }
View Full Code Here

    assertEquals(ns, props.get("org.springframework.web.context.namespace"));
  }

  public void testSetServletContextWOBundleContext() {
    servletContext = new MockServletContext();
    BundleContext bc = new MockBundleContext();
    servletContext.setAttribute(OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE, bc);
    context.setServletContext(servletContext);
    assertSame(servletContext, context.getServletContext());
    assertSame(bc, context.getBundleContext());
  }
View Full Code Here

    assertSame(bc, context.getBundleContext());
  }

  public void testSetServletContextWOBundleContextWithParent() throws Exception {
    servletContext = new MockServletContext();
    BundleContext bc = new MockBundleContext();
    ConfigurableOsgiBundleApplicationContext parent = new OsgiBundleXmlApplicationContext();
    parent.setBundleContext(bc);
    context.setParent(parent);
    context.setServletContext(servletContext);
    assertSame(servletContext, context.getServletContext());
View Full Code Here

    assertSame(servletContext, context.getServletContext());
  }

  public void testSetServletConfig() {
    ServletContext servletContext = new MockServletContext();
    BundleContext bc = new MockBundleContext();
    servletContext.setAttribute(OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE, bc);
    ServletConfig servletConfig = new MockServletConfig(servletContext);
    context.setServletConfig(servletConfig);
    assertSame(bc, context.getBundleContext());
  }
View Full Code Here

TOP

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

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.