Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundle


        List<ServiceReference> list = new ArrayList<ServiceReference>();
        try {
            String[] beanNames = applicationContext.getBeanNamesForType(Class.forName(clazz));
            if (beanNames != null && beanNames.length > 0) {
                for (String beanName : beanNames) {
                    list.add(new MockServiceReference(new MockBundle(beanName)));
                }
            }
        } catch (ClassNotFoundException e) {
            log.error("Error loading class name " + clazz + ": ", e);
        }
View Full Code Here


    bundle = null;
    scanner = null;
  }

  public void testBundleWithNoWebXmlAndNoSuitableLocation() throws Exception {
    bundle = new MockBundle() {

      public Enumeration findEntries(String path, String filePattern, boolean recurse) {
        return null;
      }
View Full Code Here

    assertFalse(scanner.isWar(bundle));
  }

  public void testBundleWithNoLocation() throws Exception {
    bundle = new MockBundle() {

      public String getLocation() {
        return null;
      }
    };
View Full Code Here

    };
    assertFalse(scanner.isWar(bundle));
  }

  public void testBundleWithProperExtension() throws Exception {
    bundle = new MockBundle() {

      public String getLocation() {
        return "petclinic.war";
      }
    };
View Full Code Here

    };
    assertTrue(scanner.isWar(bundle));
  }

  public void testBundleWithLongLocation() throws Exception {
    bundle = new MockBundle() {

      public String getLocation() {
        return "initial@reference:file:petclinic.war";
      }
    };
View Full Code Here

    assertTrue(scanner.isWar(bundle));
  }

  public void testExpandedBundleLocation() throws Exception {

    bundle = new MockBundle() {

      public String getLocation() {
        return "initial@reference:file:petclinic.war/";
      }
    };
View Full Code Here

    };
    assertTrue(scanner.isWar(bundle));
  }

  public void testWebInfEntryFromRoot() throws Exception {
    bundle = new MockBundle() {

      public Enumeration findEntries(String path, String filePattern, boolean recurse) {
        assertEquals("/", path);
        assertEquals("WEB-INF", filePattern);
        assertEquals(false, recurse);
View Full Code Here

    assertTrue(scanner.isWar(bundle));
  }

  public void testWebInfEntry() throws Exception {
    bundle = new MockBundle() {

      public Enumeration findEntries(String path, String filePattern, boolean recurse) {
        // return null the first time around
        if ("/".equals(path))
          return null;
View Full Code Here

    MockControl bundleContextControl = MockControl.createControl(BundleContext.class);
    BundleContext context = (BundleContext) bundleContextControl.getMock();
    // platform determination

    // extracting bundle id from bundle
    bundleContextControl.expectAndReturn(context.getBundle(), new MockBundle());

    // look for existing resolved bundles
    bundleContextControl.expectAndReturn(context.getBundles(), new Bundle[0], 2);

    // register namespace and entity resolving service
View Full Code Here

    this.listener.start(ctx);

    Dictionary hdrs = new Hashtable();
    hdrs.put(ConfigUtils.SPRING_CONTEXT_HEADER, "bla bla");
    MockBundle anotherBundle = new MockBundle(hdrs);
    anotherBundle.setBundleId(1);

    BundleEvent event = new BundleEvent(BundleEvent.STARTED, anotherBundle);

    BundleListener listener = (BundleListener) ctx.getBundleListeners().iterator().next();
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.