Package org.mule.api.store

Examples of org.mule.api.store.ListableObjectStore


    public void expirationIntervalWithLowTTL() throws Exception
    {
        int maxEntries = 5;
        int entryTTL = 10;
        int expirationInterval = 100;
        final ListableObjectStore os = objectStoreFactory.createObjectStore("myOs", maxEntries, entryTTL, expirationInterval);

        for (int i = 0; i < maxEntries; i++)
        {
            os.store(i,i);
        }

        PollingProber prober = new PollingProber(1000, expirationInterval);
        prober.check(new JUnitProbe()
        {
            @Override
            public boolean test() throws Exception
            {
                return os.allKeys().isEmpty();
            }

            @Override
            public String describeFailure()
            {
View Full Code Here


    @Test
    public void expirationIntervalWithHighTTLPersistentObjectStore() throws Exception
    {
        int maxEntries = 5;
        int entryTTL = 10000;
        ListableObjectStore os = objectStoreFactory.createObjectStore("myOs", maxEntries, entryTTL,100);

        for (int i = 0; i < maxEntries; i++)
        {
            os.store(i,i);
        }

        os.store(OBJECT_KEY, OBJECT_KEY_VALUE_1);

        Thread.sleep(entryTTL/5);

        assertThat(os.allKeys().size(), is(maxEntries));

        for (int i = 1; i < maxEntries; i++)
        {
            assertThat(os.contains(i), is(true));
        }

        assertThat(os.contains(OBJECT_KEY), is(true));
    }
View Full Code Here

    public void onlySizeBoundedObjectStore() throws Exception
    {
        final int maxEntries = 5;
        final int entryTTL = UNBOUNDED;

        final ListableObjectStore os = objectStoreFactory.createObjectStore("myOs", maxEntries, entryTTL, 1000);

        for (int i = 0; i < maxEntries + 1; i++)
        {
            os.store(i, i);
        }

        PollingProber prober = new PollingProber(5000000, 1000);
        prober.check(new JUnitProbe()
        {
            @Override
            public boolean test() throws Exception
            {
                assertThat(os.allKeys().size(), is(maxEntries));

                for (int i = 1; i < maxEntries +1; i++)
                {
                    assertThat(os.contains(i), is(true));
                }

                return true;
            }
View Full Code Here

    }

    @Test
    public void storeUsingBigKey() throws Exception
    {
        ListableObjectStore os = objectStoreFactory.createObjectStore("myOs");
        StringBuilder bigKey = new StringBuilder();
        for (int i = 0; i < 50; i++)
        {
            bigKey.append("abcdefghijklmnopqrstuvwxyz");
        }
        os.store(bigKey.toString(),1);
        assertThat((Integer) os.retrieve(bigKey.toString()), Is.is(1));
    }
View Full Code Here

TOP

Related Classes of org.mule.api.store.ListableObjectStore

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.