@Test
  public void testModuleDelegatesToFramework() throws Exception {
    ModuleIdentifier identifierF = ModuleIdentifier.create("framework");
    ModuleSpec.Builder specBuilderF = ModuleSpec.build(identifierF);
    PathFilter importFilter = getSystemFilter();
    PathFilter exportFilter = PathFilters.acceptAll();
    specBuilderF.addDependency(
        DependencySpec.createSystemDependencySpec(importFilter, exportFilter, getSystemPaths()));
    importFilter = PathFilters.in(getFrameworkPaths());
    exportFilter = PathFilters.acceptAll();
    FrameworkLocalLoader localLoader = new FrameworkLocalLoader(Bundle.class.getClassLoader());
    specBuilderF.addDependency(
        DependencySpec.createLocalDependencySpec(
            importFilter, exportFilter, localLoader, getFrameworkPaths()));
    addModuleSpec(specBuilderF.create());

    ModuleIdentifier identifierA = ModuleIdentifier.create("moduleA");
    ModuleSpec.Builder specBuilderA = ModuleSpec.build(identifierA);
    VirtualFileResourceLoader resourceLoaderA = new VirtualFileResourceLoader(virtualFileA);
    specBuilderA.addResourceRoot(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoaderA));
    specBuilderA.addDependency(DependencySpec.createModuleDependencySpec(identifierF));
    specBuilderA.addDependency(DependencySpec.createLocalDependencySpec());
    addModuleSpec(specBuilderA.create());

    assertLoadClass(identifierA, "org.osgi.framework.Bundle");
    assertLoadClass(identifierA, "javax.security.auth.x500.X500Principal");
  }
  @Test
  public void testAvailableFrameworkModule() throws Exception {
    ModuleIdentifier identifierF = ModuleIdentifier.create("framework");
    ModuleSpec.Builder specBuilderF = ModuleSpec.build(identifierF);
    PathFilter importFilter = PathFilters.in(getFrameworkPaths());
    PathFilter exportFilter = PathFilters.acceptAll();
    FrameworkLocalLoader localLoader = new FrameworkLocalLoader(Bundle.class.getClassLoader());
    specBuilderF.addDependency(
        DependencySpec.createLocalDependencySpec(
            importFilter, exportFilter, localLoader, getFrameworkPaths()));
    addModuleSpec(specBuilderF.create());

    assertLoadClass(identifierF, "org.osgi.framework.Bundle");
    assertLoadClassFail(identifierF, "javax.security.auth.x500.X500Principal");
  }
 private PathFilter getSystemFilter() {
   return PathFilters.in(getSystemPaths());
 }