@Test
public void test() throws Exception
{
final long earlyTimestamp = System.currentTimeMillis();
Store fileStore = new FileStore(testDirectory);
Papoose papoose = new Papoose("org.acme.osgi.0", fileStore, new ScheduledThreadPoolExecutor(10), new Properties());
papoose.start();
File testBundle = new File("./target/bundle.jar");
String location = testBundle.toURI().normalize().toString();
BundleContext context = papoose.getSystemBundleContext();
Bundle bundle = context.installBundle(location);
Assert.assertEquals(1, bundle.getBundleId());
Assert.assertEquals(location, bundle.getLocation());
Assert.assertTrue(earlyTimestamp < bundle.getLastModified());
Dictionary headers = bundle.getHeaders("en");
Assert.assertEquals("org.papoose.test-support.bundle", headers.get("Bundle-SymbOLicName"));
headers = bundle.getHeaders("en");
Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
headers = bundle.getHeaders();
Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
headers = bundle.getHeaders(null);
Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
headers = bundle.getHeaders("en_US");
Assert.assertEquals("bundle_en", headers.get("L10N-Bundle"));
headers = bundle.getHeaders("fr");
Assert.assertEquals("bundle_fr", headers.get("L10N-Bundle"));
headers = bundle.getHeaders("fr_FR");
Assert.assertEquals("bundle_fr_FR", headers.get("L10N-Bundle"));
headers = bundle.getHeaders("");
Assert.assertEquals("%bundle", headers.get("L10N-Bundle"));
headers = bundle.getHeaders("en");
Assert.assertEquals("no translation for this entry", headers.get("L10N-NoTranslation"));
bundle.start();
long bundleId = bundle.getBundleId();
papoose.stop();
fileStore.removeBundleStore(bundleId);
}