Search in sources :

Example 26 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.

the class DefaultCacheContainerTestCase method getCacheConfiguration.

@Test
public void getCacheConfiguration() {
    Configuration config = new ConfigurationBuilder().build();
    when(this.manager.getCacheConfiguration("cache")).thenReturn(config);
    Configuration result = this.subject.getCacheConfiguration("cache");
    assertSame(config, result);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) Configuration(org.infinispan.configuration.cache.Configuration) Test(org.junit.Test)

Example 27 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.

the class ConfigurationServiceConfigurator method get.

@Override
public Configuration get() {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    this.consumer.accept(builder);
    // Auto-enable simple cache optimization if cache is local, on-heap, non-transactional, and non-persistent, and statistics are disabled
    builder.simpleCache((builder.clustering().cacheMode() == CacheMode.LOCAL) && (builder.memory().storage() == StorageType.HEAP) && !builder.transaction().transactionMode().isTransactional() && builder.persistence().stores().isEmpty() && !builder.statistics().create().enabled());
    builder.encoding().mediaType(builder.memory().storage() == StorageType.OFF_HEAP ? this.container.get().getCacheManagerConfiguration().serialization().marshaller().mediaType().toString() : MediaType.APPLICATION_OBJECT_TYPE);
    Configuration configuration = builder.build();
    EmbeddedCacheManager container = this.container.get();
    container.defineConfiguration(this.cacheName, configuration);
    return configuration;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) Configuration(org.infinispan.configuration.cache.Configuration) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 28 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.

the class StoreServiceConfigurator method get.

@Override
public PersistenceConfiguration get() {
    B builder = new ConfigurationBuilder().persistence().passivation(this.passivation).addStore(this.builderClass).fetchPersistentState(this.fetchState).maxBatchSize(this.maxBatchSize).preload(this.preload).purgeOnStartup(this.purge).shared(this.shared).withProperties(this.properties);
    this.accept(builder);
    return builder.async().read(this.async.get()).persistence().create();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) AbstractStoreConfigurationBuilder(org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder)

Example 29 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project gora by apache.

the class SimulationDriver method createCacheManagers.

@Override
public void createCacheManagers() throws Throwable {
    ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false));
    create(numberOfNodes, builder);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder)

Example 30 with ConfigurationBuilder

use of org.infinispan.configuration.cache.ConfigurationBuilder in project gora by apache.

the class SimulationDriver method create.

// Helpers
protected void create(int nnodes, ConfigurationBuilder defaultBuilder) {
    // Start Hot Rod servers at each site.
    for (int j = 0; j < nnodes; j++) {
        GlobalConfigurationBuilder gbuilder = GlobalConfigurationBuilder.defaultClusteredBuilder();
        Transport transport = gbuilder.transport().getTransport();
        gbuilder.transport().transport(transport);
        gbuilder.transport().clusterName("test");
        startHotRodServer(gbuilder, defaultBuilder, j + 1);
    }
    // Create appropriate caches at each node.
    ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false));
    builder.indexing().index(Index.LOCAL).addProperty("default.directory_provider", "ram").addProperty("hibernate.search.default.exclusive_index_use", "true").addProperty("hibernate.search.default.indexmanager", "near-real-time").addProperty("hibernate.search.default.indexwriter.ram_buffer_size", "128").addProperty("lucene_version", "LUCENE_CURRENT");
    builder.clustering().hash().numOwners(1);
    builder.jmxStatistics().enable();
    builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
    Configuration configuration = builder.build();
    for (int j = 0; j < nnodes; j++) {
        for (String name : cacheNames) {
            manager(j).defineConfiguration(name, configuration);
            manager(j).getCache(name, true);
        }
    }
    // Verify that default caches are started.
    for (int j = 0; j < nnodes; j++) {
        assert manager(j).getCache() != null;
    }
    // Verify that the default caches is running.
    for (int j = 0; j < nnodes; j++) {
        blockUntilCacheStatusAchieved(manager(j).getCache(), ComponentStatus.RUNNING, 10000);
    }
    for (int j = 0; j < nnodes; j++) {
        if (j != 0)
            connectionString += ";";
        connectionString += server(j).getHost() + ":" + server(j).getPort();
    }
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) HotRodTestingUtil.hotRodCacheConfiguration(org.infinispan.server.hotrod.test.HotRodTestingUtil.hotRodCacheConfiguration) Configuration(org.infinispan.configuration.cache.Configuration) Transport(org.infinispan.remoting.transport.Transport)

Aggregations

ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)53 Configuration (org.infinispan.configuration.cache.Configuration)24 Test (org.junit.Test)19 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)14 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)12 ClusteringConfigurationBuilder (org.infinispan.configuration.cache.ClusteringConfigurationBuilder)7 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)7 Properties (java.util.Properties)6 Map (java.util.Map)5 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)5 TimestampsRegionImpl (org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl)5 BeforeClass (org.junit.BeforeClass)5 AdvancedCache (org.infinispan.AdvancedCache)4 BackupConfigurationBuilder (org.infinispan.configuration.cache.BackupConfigurationBuilder)4 CacheMode (org.infinispan.configuration.cache.CacheMode)4 SitesConfigurationBuilder (org.infinispan.configuration.cache.SitesConfigurationBuilder)3 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)3 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2 CacheProducer (org.commonjava.indy.subsys.infinispan.CacheProducer)2