Search in sources :

Example 1 with PartitionedInMemoryObjectStore

use of org.mule.runtime.core.internal.store.PartitionedInMemoryObjectStore in project mule by mulesoft.

the class ManagedStoresTestCase method testPartitionableInMemoryStore.

@Test
public void testPartitionableInMemoryStore() throws ObjectStoreException, RegistrationException, InterruptedException {
    getRegistry().registerObject(BASE_IN_MEMORY_OBJECT_STORE_KEY, new PartitionedInMemoryObjectStore<String>());
    ObjectStoreManager manager = getRegistry().lookupObject(OBJECT_STORE_MANAGER);
    ObjectStore<String> store = manager.createObjectStore("inMemoryPart2", unmanagedTransient());
    assertTrue(store instanceof ObjectStorePartition);
    ObjectStore<String> baseStore = ((ObjectStorePartition<String>) store).getBaseStore();
    assertTrue(baseStore instanceof PartitionedInMemoryObjectStore);
    testObjectStore(store);
    testObjectStoreExpiry(manager, "inMemoryExpPart2", ObjectStoreSettings.builder().persistent(false).entryTtl(500L).expirationInterval(200L).build());
    testObjectStoreMaxEntries(manager, "inMemoryMaxPart2", ObjectStoreSettings.builder().persistent(false).maxEntries(10).entryTtl(10000L).expirationInterval(200L).build());
}
Also used : ObjectStoreManager(org.mule.runtime.api.store.ObjectStoreManager) PartitionedInMemoryObjectStore(org.mule.runtime.core.internal.store.PartitionedInMemoryObjectStore) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ObjectStoreManager (org.mule.runtime.api.store.ObjectStoreManager)1 PartitionedInMemoryObjectStore (org.mule.runtime.core.internal.store.PartitionedInMemoryObjectStore)1