Package org.papoose.core.mock

Examples of org.papoose.core.mock.MockStore


public class PapooseTest
{
    @Test
    public void test() throws Exception
    {
        Papoose poo = new Papoose(new MockStore(), new ScheduledThreadPoolExecutor(10), new Properties());

        poo.start();

        try
        {
View Full Code Here


    @Before
    public void setUp()
    {
        executorService = new ThreadPoolExecutor(5, 5, 60, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>());
        mockFramework = new Papoose(new MockStore(), executorService, new Properties());
    }
View Full Code Here

    @Test
    public void test() throws Exception
    {
        final long earlyTimestamp = System.currentTimeMillis();
        Store fileStore = new MockStore();
        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.papoose-test-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"));

        papoose.getBundleManager().resolve(bundle);

        papoose.stop();

        fileStore.removeBundleStore(1);
    }
View Full Code Here

TOP

Related Classes of org.papoose.core.mock.MockStore

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.