Search in sources :

Example 11 with GroupConfig

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

the class XmlClientConfigBuilderTest method testGroupConfig.

@Test
public void testGroupConfig() {
    final GroupConfig groupConfig = clientConfig.getGroupConfig();
    assertEquals("dev", groupConfig.getName());
    assertEquals("dev-pass", groupConfig.getPassword());
}
Also used : GroupConfig(com.hazelcast.config.GroupConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest)

Example 12 with GroupConfig

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

the class ProxyEqualityTest method setup.

@Before
public void setup() throws Exception {
    Config config = new Config();
    String groupAName = "GroupA";
    config.getGroupConfig().setName(groupAName);
    hazelcastFactoryGroupA.newHazelcastInstance(config);
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.setGroupConfig(new GroupConfig(config.getGroupConfig().getName()));
    client1GroupA = hazelcastFactoryGroupA.newHazelcastClient(clientConfig);
    client2GroupA = hazelcastFactoryGroupA.newHazelcastClient(clientConfig);
    //setup Group B
    config = new Config();
    String groupBName = "GroupB";
    config.getGroupConfig().setName(groupBName);
    hazelcastFactoryGroupB.newHazelcastInstance(config);
    clientConfig = new ClientConfig();
    clientConfig.setGroupConfig(new GroupConfig(config.getGroupConfig().getName()));
    client1GroupB = hazelcastFactoryGroupB.newHazelcastClient(clientConfig);
}
Also used : GroupConfig(com.hazelcast.config.GroupConfig) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Before(org.junit.Before)

Example 13 with GroupConfig

use of com.hazelcast.config.GroupConfig in project tutorials by eugenp.

the class NativeClient method main.

public static void main(String[] args) throws InterruptedException {
    ClientConfig config = new ClientConfig();
    GroupConfig groupConfig = config.getGroupConfig();
    groupConfig.setName("dev");
    groupConfig.setPassword("dev-pass");
    HazelcastInstance hazelcastInstanceClient = HazelcastClient.newHazelcastClient(config);
    IMap<Long, String> map = hazelcastInstanceClient.getMap("data");
    for (Entry<Long, String> entry : map.entrySet()) {
        System.out.println(String.format("Key: %d, Value: %s", entry.getKey(), entry.getValue()));
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) GroupConfig(com.hazelcast.config.GroupConfig) ClientConfig(com.hazelcast.client.config.ClientConfig)

Example 14 with GroupConfig

use of com.hazelcast.config.GroupConfig in project eventapis by kloiasoft.

the class InMemoryComponents method config.

@Bean
public Config config() {
    Config config = new Config();
    List<MapIndexConfig> indexes = Arrays.asList(new MapIndexConfig("startTime", true), new MapIndexConfig("operationState", true));
    config.addMapConfig(new MapConfig().setTimeToLiveSeconds(OPERATIONS_MAX_TTL_INSEC).setMapIndexConfigs(indexes).setName(OPERATIONS_MAP_NAME));
    config.addMapConfig(new MapConfig().setMapIndexConfigs(indexes).setMaxSizeConfig(new MaxSizeConfig(evictFreePercentage, MaxSizeConfig.MaxSizePolicy.FREE_HEAP_PERCENTAGE)).setEvictionPolicy(EvictionPolicy.LRU).setName(OPERATIONS_MAP_HISTORY_NAME));
    config.addMapConfig(new MapConfig().setName(TOPICS_MAP_NAME));
    /*
        config.setExecutorConfigs(Collections.singletonMap("default",new ExecutorConfig("default",2)));
        config.setProperty("hazelcast.event.thread.count","2");
        config.setProperty("hazelcast.operation.generic.thread.count","2");
        config.setProperty("hazelcast.operation.thread.count","2");
        config.setProperty("hazelcast.io.thread.count","1");
        config.setProperty("hazelcast.logging.type", "slf4j");
        */
    GroupConfig groupConfig = config.getGroupConfig();
    groupConfig.setName(hazelcastGrid);
    groupConfig.setPassword(hazelcastPassword);
    if (inMemoryConfig != null) {
        config.getNetworkConfig().getJoin().setMulticastConfig(inMemoryConfig);
    }
    if (inMemoryInterfacesConfig != null) {
        config.getNetworkConfig().setInterfaces(inMemoryInterfacesConfig);
    }
    if (inMemoryUserCodeDeploymentConfig != null)
        config.setUserCodeDeploymentConfig(inMemoryUserCodeDeploymentConfig);
    config.setGroupConfig(groupConfig);
    config.setInstanceName(artifactId);
    return config;
}
Also used : MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapIndexConfig(com.hazelcast.config.MapIndexConfig) GroupConfig(com.hazelcast.config.GroupConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) GroupConfig(com.hazelcast.config.GroupConfig) MapConfig(com.hazelcast.config.MapConfig) MapConfig(com.hazelcast.config.MapConfig) Bean(org.springframework.context.annotation.Bean)

Aggregations

GroupConfig (com.hazelcast.config.GroupConfig)14 ClientConfig (com.hazelcast.client.config.ClientConfig)5 Config (com.hazelcast.config.Config)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)2 ClientSecurityConfig (com.hazelcast.client.config.ClientSecurityConfig)1 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)1 ExecutorConfig (com.hazelcast.config.ExecutorConfig)1 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)1 MapConfig (com.hazelcast.config.MapConfig)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 MemberGroupConfig (com.hazelcast.config.MemberGroupConfig)1 MulticastConfig (com.hazelcast.config.MulticastConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)1