expect(bundleContext.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
replay(bundleContext, installedBundle);
FeaturesServiceImpl svc = new FeaturesServiceImpl();
svc.setBundleContext(bundleContext);
svc.addRepository(uri);
Repository[] repositories = svc.listRepositories();
assertNotNull(repositories);
assertEquals(1, repositories.length);
assertNotNull(repositories[0]);
Feature[] features = repositories[0].getFeatures();
assertNotNull(features);
assertEquals(1, features.length);
assertNotNull(features[0]);
assertEquals("f1", features[0].getName());
assertNotNull(features[0].getDependencies());
assertEquals(0, features[0].getDependencies().size());
assertNotNull(features[0].getBundles());
assertEquals(1, features[0].getBundles().size());
assertEquals(name, features[0].getBundles().get(0).getLocation());
assertTrue(features[0].getBundles().get(0).isStart());
verify(bundleContext, installedBundle);
reset(bundleContext, installedBundle);
expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
expect(bundleContext.installBundle(isA(String.class),
isA(InputStream.class))).andReturn(installedBundle);
expect(installedBundle.getBundleId()).andReturn(12345L);
expect(installedBundle.getBundleId()).andReturn(12345L);
expect(installedBundle.getBundleId()).andReturn(12345L);
expect(bundleContext.getBundle(12345L)).andReturn(installedBundle);
expect(installedBundle.getHeaders()).andReturn(new Hashtable());
installedBundle.start();
expect(bundleContext.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
replay(bundleContext, installedBundle);
svc.installFeature("f1", FeatureImpl.DEFAULT_VERSION, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
Feature[] installed = svc.listInstalledFeatures();
assertEquals(1, installed.length);
assertEquals("f1", installed[0].getName());
}