Search in sources :

Example 1 with MapConfig

use of com.hazelcast.config.MapConfig in project cas by apereo.

the class HazelcastTicketRegistryConfiguration method buildHazelcastMapConfigurations.

private Map<String, MapConfig> buildHazelcastMapConfigurations(final TicketCatalog ticketCatalog) {
    final Map<String, MapConfig> mapConfigs = new HashMap<>();
    final Collection<TicketDefinition> definitions = ticketCatalog.findAll();
    definitions.forEach(t -> {
        final MapConfig mapConfig = createMapConfig(t);
        LOGGER.debug("Created Hazelcast map configuration for [{}]", t);
        mapConfigs.put(t.getProperties().getStorageName(), mapConfig);
    });
    return mapConfigs;
}
Also used : HashMap(java.util.HashMap) TicketDefinition(org.apereo.cas.ticket.TicketDefinition) MapConfig(com.hazelcast.config.MapConfig)

Example 2 with MapConfig

use of com.hazelcast.config.MapConfig in project cas by apereo.

the class ProvidedHazelcastInstanceConfigurationTests method hazelcastInstanceIsCreatedNormally.

@Test
public void hazelcastInstanceIsCreatedNormally() throws Exception {
    assertNotNull(this.hzInstance);
    final Config config = this.hzInstance.getConfig();
    assertTrue(config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
    assertEquals(Arrays.asList("127.0.0.1"), config.getNetworkConfig().getJoin().getTcpIpConfig().getMembers());
    assertFalse(config.getNetworkConfig().isPortAutoIncrement());
    assertEquals(5801, config.getNetworkConfig().getPort());
    final MapConfig mapConfig = config.getMapConfig("tickets-from-external-config");
    assertNotNull(mapConfig);
    assertEquals(20000, mapConfig.getMaxIdleSeconds());
    assertEquals(EvictionPolicy.LFU, mapConfig.getEvictionPolicy());
    assertEquals(99, mapConfig.getEvictionPercentage());
}
Also used : MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class ClientAggregatorsSpecTest method getMapWithNodeCount.

@Override
protected <K, V> IMap<K, V> getMapWithNodeCount(int nodeCount, boolean parallelAccumulation) {
    if (nodeCount < 1) {
        throw new IllegalArgumentException("node count < 1");
    }
    MapConfig mapConfig = new MapConfig().setName("aggr").setInMemoryFormat(inMemoryFormat);
    Config config = new Config().setProperty(PARTITION_COUNT.getName(), String.valueOf(nodeCount)).setProperty(AGGREGATION_ACCUMULATION_PARALLEL_EVALUATION.getName(), String.valueOf(parallelAccumulation)).addMapConfig(mapConfig);
    factory = new TestHazelcastFactory();
    for (int i = 0; i < nodeCount; i++) {
        factory.newHazelcastInstance(config);
    }
    HazelcastInstance instance = factory.newHazelcastClient();
    return instance.getMap("aggr");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) MapConfig(com.hazelcast.config.MapConfig)

Example 4 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class ClientMapAggregateTest method getMapWithNodeCount.

public <K, V> IMap<K, V> getMapWithNodeCount(int nodeCount) {
    if (nodeCount < 1) {
        throw new IllegalArgumentException("node count < 1");
    }
    factory = new TestHazelcastFactory();
    Config config = new Config();
    config.setProperty("hazelcast.partition.count", "3");
    MapConfig mapConfig = new MapConfig();
    mapConfig.setName("aggr");
    mapConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
    config.addMapConfig(mapConfig);
    factory.newInstances(config, nodeCount);
    client = factory.newHazelcastClient();
    return client.getMap("aggr");
}
Also used : Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) MapConfig(com.hazelcast.config.MapConfig)

Example 5 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class ClientMapUnboundReturnValuesTestSupport method getMapWithNodeCount.

private <K, V> IMap<K, V> getMapWithNodeCount(int nodeCount, Config config) {
    String mapName = UUID.randomUUID().toString();
    MapConfig mapConfig = new MapConfig();
    mapConfig.setName(mapName);
    mapConfig.setAsyncBackupCount(0);
    mapConfig.setBackupCount(0);
    config.addMapConfig(mapConfig);
    while (nodeCount > 1) {
        hazelcastFactory.newHazelcastInstance(config);
        nodeCount--;
    }
    HazelcastInstance node = hazelcastFactory.newHazelcastInstance(config);
    return node.getMap(mapName);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

MapConfig (com.hazelcast.config.MapConfig)178 Config (com.hazelcast.config.Config)123 HazelcastInstance (com.hazelcast.core.HazelcastInstance)78 Test (org.junit.Test)75 QuickTest (com.hazelcast.test.annotation.QuickTest)68 ParallelTest (com.hazelcast.test.annotation.ParallelTest)62 MapStoreConfig (com.hazelcast.config.MapStoreConfig)43 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)41 NearCacheConfig (com.hazelcast.config.NearCacheConfig)27 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)26 MapIndexConfig (com.hazelcast.config.MapIndexConfig)20 QuorumConfig (com.hazelcast.config.QuorumConfig)19 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)18 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)16 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 BeforeClass (org.junit.BeforeClass)10 AssertTask (com.hazelcast.test.AssertTask)9