@Test
  public void testBundle() throws DeploymentException, IOException {
    StubBundleContext bundleContext = new StubBundleContext();
    StubBundleContext userRegionBundleContext = new StubBundleContext();
    expect(this.osgiFramework.getBundleContext()).andReturn(bundleContext).anyTimes();
    expect(this.repository.get(isA(String.class), isA(String.class), isA(VersionRange.class)))
        .andReturn(this.artifactDescriptor);
    expect(this.artifactDescriptor.getUri()).andReturn(this.bundleURI);
    expect(this.artifactDescriptor.getVersion()).andReturn(new Version(1, 2, 3));
    expect(this.artifactDescriptor.getRepositoryName()).andReturn(TEST_BUNDLE_REPOSITORY_NAME);

    replayMocks();

    StandardArtifactIdentityDeterminer artifactIdentityDeterminer =
        new StandardArtifactIdentityDeterminer(testArtifactBridges);

    StandardInstallArtifactRefreshHandler refreshHelper =
        new StandardInstallArtifactRefreshHandler(installEnvironmentFactory, refreshPipeline);

    bundleContext.registerService(
        InstallArtifactTreeFactory.class.getName(),
        new BundleInstallArtifactTreeFactory(
            this.osgiFramework,
            bundleContext,
            refreshHelper,
            this.bundleStarter,
            this.tracingService,
            this.packageAdminUtil,
            userRegionBundleContext,
            new MockEventLogger(),
            null),
        null);

    this.installArtifactFactory =
        new StandardInstallArtifactTreeInclosure(
            this.artifactStorageFactory,
            bundleContext,
            this.repository,
            new MockEventLogger(),
            artifactIdentityDeterminer);

    ArtifactSpecification specification =
        new ArtifactSpecification("bundle", "a", new VersionRange("2.0.0"));
    InstallArtifact installArtifact =
        this.installArtifactFactory.createInstallTree(specification).getValue();
    assertNotNull(installArtifact);
    assertEquals(TEST_BUNDLE_REPOSITORY_NAME, installArtifact.getRepositoryName());
    assertTrue(installArtifact instanceof BundleInstallArtifact);
    BundleInstallArtifact bundleInstallArtifact = (BundleInstallArtifact) installArtifact;
    assertEquals(
        "a", bundleInstallArtifact.getBundleManifest().getBundleSymbolicName().getSymbolicName());

    verifyMocks();
    resetMocks();
  }
  @Test
  public void testNoBSNBundleImplicitTypeAndVersion() throws DeploymentException {
    StubBundleContext bundleContext = new StubBundleContext();
    StubBundleContext userRegionBundleContext = new StubBundleContext();
    expect(this.osgiFramework.getBundleContext()).andReturn(bundleContext).anyTimes();

    replayMocks();

    StandardArtifactIdentityDeterminer artifactIdentityDeterminer =
        new StandardArtifactIdentityDeterminer(testArtifactBridges);

    StandardInstallArtifactRefreshHandler refreshHelper =
        new StandardInstallArtifactRefreshHandler(installEnvironmentFactory, refreshPipeline);

    bundleContext.registerService(
        InstallArtifactTreeFactory.class.getName(),
        new BundleInstallArtifactTreeFactory(
            this.osgiFramework,
            bundleContext,
            refreshHelper,
            this.bundleStarter,
            this.tracingService,
            this.packageAdminUtil,
            userRegionBundleContext,
            new MockEventLogger(),
            null),
        null);

    this.installArtifactFactory =
        new StandardInstallArtifactTreeInclosure(
            this.artifactStorageFactory,
            bundleContext,
            this.repository,
            new MockEventLogger(),
            artifactIdentityDeterminer);

    Tree<InstallArtifact> installArtifactTree =
        this.installArtifactFactory.createInstallTree(
            new File("src/test/resources/artifacts/nobsn.jar"));
    InstallArtifact installArtifact = installArtifactTree.getValue();
    assertNotNull(installArtifact);
    assertTrue(installArtifact instanceof BundleInstallArtifact);
    assertEquals("nobsn", installArtifact.getName());
    assertEquals(new Version("0"), installArtifact.getVersion());

    verifyMocks();
    resetMocks();
  }
 public boolean refresh(InstallArtifact installArtifact) {
     Tree<InstallArtifact> tree = installArtifact.getTree();
     
     boolean refreshed = true;
     try {
         this.refreshPipeline.process(tree, this.installEnvironmentFactory.createInstallEnvironment(installArtifact));
     } catch (UnableToSatisfyBundleDependenciesException _) {
         refreshed = false;
     } catch (DeploymentException _) {
         refreshed = false;
     }
     return refreshed;
 }