Search in sources :

Example 16 with PartitionService

use of com.hazelcast.partition.PartitionService in project hazelcast by hazelcast.

the class ClientMigrationListenerTest method testRemoveMigrationListener_whenNonExistingRegistrationId.

@Test
public void testRemoveMigrationListener_whenNonExistingRegistrationId() {
    hazelcastFactory.newHazelcastInstance();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    PartitionService partitionService = client.getPartitionService();
    boolean result = partitionService.removeMigrationListener(UuidUtil.newUnsecureUUID());
    assertFalse(result);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.partition.PartitionService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) PartitionMigrationListenerTest(com.hazelcast.partition.PartitionMigrationListenerTest)

Example 17 with PartitionService

use of com.hazelcast.partition.PartitionService in project hazelcast by hazelcast.

the class ClientMigrationListenerTest method testRemoveMigrationListener_whenNullListener.

@Test(expected = NullPointerException.class)
public void testRemoveMigrationListener_whenNullListener() {
    hazelcastFactory.newHazelcastInstance();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    PartitionService partitionService = client.getPartitionService();
    partitionService.removeMigrationListener(null);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.partition.PartitionService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) PartitionMigrationListenerTest(com.hazelcast.partition.PartitionMigrationListenerTest)

Example 18 with PartitionService

use of com.hazelcast.partition.PartitionService in project hazelcast by hazelcast.

the class ClientMigrationListenerTest method testAddMigrationListener_whenListenerRegisteredTwice.

@Test
public void testAddMigrationListener_whenListenerRegisteredTwice() {
    hazelcastFactory.newHazelcastInstance();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    PartitionService partitionService = client.getPartitionService();
    MigrationListener listener = mock(MigrationListener.class);
    UUID id1 = partitionService.addMigrationListener(listener);
    UUID id2 = partitionService.addMigrationListener(listener);
    assertNotEquals(id1, id2);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.partition.PartitionService) UUID(java.util.UUID) MigrationListener(com.hazelcast.partition.MigrationListener) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) PartitionMigrationListenerTest(com.hazelcast.partition.PartitionMigrationListenerTest)

Example 19 with PartitionService

use of com.hazelcast.partition.PartitionService in project hazelcast by hazelcast.

the class PartitionServiceProxyTest method testGetPartition.

@Test
public void testGetPartition() {
    String key = "Key";
    PartitionService clientPartitionService = client.getPartitionService();
    Partition clientPartition = clientPartitionService.getPartition(key);
    PartitionService serverPartitionService = server.getPartitionService();
    Partition serverPartition = serverPartitionService.getPartition(key);
    assertEquals(clientPartition.getPartitionId(), serverPartition.getPartitionId());
}
Also used : Partition(com.hazelcast.partition.Partition) PartitionService(com.hazelcast.partition.PartitionService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 20 with PartitionService

use of com.hazelcast.partition.PartitionService in project hazelcast by hazelcast.

the class PartitionServiceProxyTest method testGetPartitions.

@Test
public void testGetPartitions() {
    PartitionService clientPartitionService = client.getPartitionService();
    Set<Partition> clientPartitions = clientPartitionService.getPartitions();
    PartitionService serverPartitionService = server.getPartitionService();
    Set<Partition> serverPartitions = serverPartitionService.getPartitions();
    assertEquals(clientPartitions.size(), serverPartitions.size());
}
Also used : Partition(com.hazelcast.partition.Partition) PartitionService(com.hazelcast.partition.PartitionService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

PartitionService (com.hazelcast.partition.PartitionService)20 Partition (com.hazelcast.partition.Partition)13 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 IPartition (com.hazelcast.internal.partition.IPartition)5 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)5 Member (com.hazelcast.cluster.Member)4 PartitionMigrationListenerTest (com.hazelcast.partition.PartitionMigrationListenerTest)4 Cluster (com.hazelcast.cluster.Cluster)3 UUID (java.util.UUID)3 Config (com.hazelcast.config.Config)2 MigrationListener (com.hazelcast.partition.MigrationListener)2 HashSet (java.util.HashSet)2 Endpoint (com.hazelcast.cluster.Endpoint)1 MapConfig (com.hazelcast.config.MapConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 PartitionIdSet (com.hazelcast.internal.util.collection.PartitionIdSet)1 IntervalFunction (com.hazelcast.jet.retry.IntervalFunction)1