Search in sources :

Example 16 with FlakeIdGeneratorConfig

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

the class FlakeIdGeneratorProxyTest method initialize.

public void initialize(FlakeIdGeneratorConfig config) {
    ILogger logger = mock(ILogger.class);
    clusterService = mock(ClusterService.class);
    NodeEngine nodeEngine = mock(NodeEngine.class);
    FlakeIdGeneratorService service = mock(FlakeIdGeneratorService.class);
    when(nodeEngine.getLogger(FlakeIdGeneratorProxy.class)).thenReturn(logger);
    when(nodeEngine.isRunning()).thenReturn(true);
    config.setName("foo");
    when(nodeEngine.getConfig()).thenReturn(new Config().addFlakeIdGeneratorConfig(config));
    when(nodeEngine.getClusterService()).thenReturn(clusterService);
    Address address = null;
    try {
        address = new Address("127.0.0.1", 5701);
    } catch (UnknownHostException e) {
    // no-op
    }
    when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl(address, MemberVersion.UNKNOWN, true, UUID.randomUUID()));
    UUID source = nodeEngine.getLocalMember().getUuid();
    gen = new FlakeIdGeneratorProxy("foo", nodeEngine, service, source);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ClusterService(com.hazelcast.internal.cluster.ClusterService) Address(com.hazelcast.cluster.Address) UnknownHostException(java.net.UnknownHostException) Config(com.hazelcast.config.Config) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) ILogger(com.hazelcast.logging.ILogger) UUID(java.util.UUID)

Example 17 with FlakeIdGeneratorConfig

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

the class DynamicConfigTest method assertConfigurationsEqualOnAllMembers.

private void assertConfigurationsEqualOnAllMembers(FlakeIdGeneratorConfig config) {
    for (HazelcastInstance instance : members) {
        FlakeIdGeneratorConfig registeredConfig = instance.getConfig().getFlakeIdGeneratorConfig(config.getName());
        assertEquals(config, registeredConfig);
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig)

Aggregations

FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)17 Test (org.junit.Test)6 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)5 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 Config (com.hazelcast.config.Config)5 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)5 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 ListConfig (com.hazelcast.config.ListConfig)5 MapConfig (com.hazelcast.config.MapConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 PNCounterConfig (com.hazelcast.config.PNCounterConfig)5 QueueConfig (com.hazelcast.config.QueueConfig)5 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)5 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)5 RingbufferConfig (com.hazelcast.config.RingbufferConfig)5 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)5 SetConfig (com.hazelcast.config.SetConfig)5 TopicConfig (com.hazelcast.config.TopicConfig)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)4