Search in sources :

Example 1 with DummyInMemoryStoreConfigurationBuilder

use of org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder in project infinispan by infinispan.

the class InvalidationPreloadTest method testPreloadOnStart.

public void testPreloadOnStart() throws PersistenceException {
    ConfigurationBuilder configuration = new ConfigurationBuilder();
    configuration.clustering().cacheMode(CacheMode.INVALIDATION_SYNC);
    configuration.transaction().transactionMode(transactionMode());
    DummyInMemoryStoreConfigurationBuilder dimsConfiguration = configuration.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class);
    dimsConfiguration.storeName(getTestName()).preload(true).shared(shared);
    EmbeddedCacheManager cm1 = addClusterEnabledCacheManager(TestDataSCI.INSTANCE, configuration, new TransportFlags().withFD(false));
    Cache<String, String> c1 = cm1.getCache();
    c1.put("k" + 0, "v" + 0);
    assertKeys(c1);
    cm1.stop();
    EmbeddedCacheManager cm2 = addClusterEnabledCacheManager(TestDataSCI.INSTANCE, configuration, new TransportFlags().withFD(false));
    Cache<String, String> c2 = cm2.getCache();
    assertKeys(c2);
    if (shared) {
        EmbeddedCacheManager cm3 = addClusterEnabledCacheManager(TestDataSCI.INSTANCE, configuration, new TransportFlags().withFD(false));
        Cache<String, String> c3 = cm3.getCache();
        assertKeys(c3);
    }
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) TransportFlags(org.infinispan.test.fwk.TransportFlags) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 2 with DummyInMemoryStoreConfigurationBuilder

use of org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder in project infinispan by infinispan.

the class AsyncStoreTest method createStore.

private InitializationContext createStore() throws PersistenceException {
    ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
    DummyInMemoryStoreConfigurationBuilder dummyCfg = builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).storeName(AsyncStoreTest.class.getName()).segmented(false);
    dummyCfg.async().enable();
    InitializationContext ctx = PersistenceMockUtil.createContext(getClass(), builder.build(), marshaller);
    DummyInMemoryStore underlying = new DummyInMemoryStore();
    store = new AsyncNonBlockingStore(underlying);
    CompletionStages.join(store.start(ctx));
    return ctx;
}
Also used : AsyncNonBlockingStore(org.infinispan.persistence.async.AsyncNonBlockingStore) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) DummyInMemoryStore(org.infinispan.persistence.dummy.DummyInMemoryStore) InitializationContext(org.infinispan.persistence.spi.InitializationContext) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)

Example 3 with DummyInMemoryStoreConfigurationBuilder

use of org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder in project infinispan by infinispan.

the class StateTransferDistSharedCacheLoaderFunctionalTest method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager(String cacheName) {
    configurationBuilder.persistence().clearStores();
    DummyInMemoryStoreConfigurationBuilder dimcs = new DummyInMemoryStoreConfigurationBuilder(configurationBuilder.persistence());
    if (sharedCacheLoader.get()) {
        dimcs.storeName(getClass().getName());
    } else {
        dimcs.storeName(getClass().getName() + id++);
    }
    dimcs.fetchPersistentState(false).purgeOnStartup(false).shared(sharedCacheLoader.get()).preload(true);
    configurationBuilder.persistence().passivation(false).addStore(dimcs).fetchPersistentState(fetchPersistentState.get());
    // Want to enable eviction, but don't actually evict anything
    configurationBuilder.memory().size(INSERTION_COUNT * 10);
    EmbeddedCacheManager cm = addClusterEnabledCacheManager(sci, configurationBuilder, new TransportFlags().withMerge(true));
    cm.defineConfiguration(cacheName, configurationBuilder.build());
    return cm;
}
Also used : TransportFlags(org.infinispan.test.fwk.TransportFlags) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 4 with DummyInMemoryStoreConfigurationBuilder

use of org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder in project infinispan by infinispan.

the class WriteSkewWithPersistenceTest method createConfigurationBuilder.

@Override
protected ConfigurationBuilder createConfigurationBuilder() {
    ConfigurationBuilder configurationBuilder = super.createConfigurationBuilder();
    configurationBuilder.persistence().addStore(new DummyInMemoryStoreConfigurationBuilder(configurationBuilder.persistence()));
    configurationBuilder.clustering().hash().groups().enabled();
    return configurationBuilder;
}
Also used : DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)

Example 5 with DummyInMemoryStoreConfigurationBuilder

use of org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder in project infinispan by infinispan.

the class StoreAsBinaryTest method testStores.

/**
 * Run this on a separate cache as it creates and stops stores, which might affect other tests.
 */
public void testStores() {
    ConfigurationBuilder cacheCofig = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false);
    cacheCofig.memory().storageType(StorageType.BINARY);
    DummyInMemoryStoreConfigurationBuilder dimcs = new DummyInMemoryStoreConfigurationBuilder(cacheCofig.persistence());
    dimcs.storeName(getClass().getSimpleName());
    cacheCofig.persistence().addStore(dimcs);
    defineConfigurationOnAllManagers("replSync2", cacheCofig);
    waitForClusterToForm("replSync2");
    Cache<Object, Object> cache1 = cache(0, "replSync2");
    Cache<Object, Object> cache2 = cache(1, "replSync2");
    CountMarshallingPojo pojo = new CountMarshallingPojo(POJO_NAME, 1);
    cache1.put("key", pojo);
    assertEquals(pojo, cache2.get("key"));
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) CountMarshallingPojo(org.infinispan.test.data.CountMarshallingPojo) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)

Aggregations

DummyInMemoryStoreConfigurationBuilder (org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)11 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)8 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)4 DummyInMemoryStore (org.infinispan.persistence.dummy.DummyInMemoryStore)3 TransportFlags (org.infinispan.test.fwk.TransportFlags)2 AsyncNonBlockingStore (org.infinispan.persistence.async.AsyncNonBlockingStore)1 PersistenceManager (org.infinispan.persistence.manager.PersistenceManager)1 InitializationContext (org.infinispan.persistence.spi.InitializationContext)1 Person (org.infinispan.query.test.Person)1 CountMarshallingPojo (org.infinispan.test.data.CountMarshallingPojo)1