Search in sources :

Example 1 with MemberSelector

use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.

the class MemberSelectorsTest method testAndMemberSelector.

@Test
public void testAndMemberSelector() {
    when(member.localMember()).thenReturn(true);
    MemberSelector selector = MemberSelectors.and(LOCAL_MEMBER_SELECTOR, LITE_MEMBER_SELECTOR);
    assertFalse(selector.select(member));
    verify(member).localMember();
    verify(member).isLiteMember();
}
Also used : MemberSelector(com.hazelcast.cluster.MemberSelector) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with MemberSelector

use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.

the class MemberSelectorsTest method testOrMemberSelector3.

@Test
public void testOrMemberSelector3() {
    when(member.localMember()).thenReturn(true);
    when(member.isLiteMember()).thenReturn(true);
    MemberSelector selector = MemberSelectors.or(LOCAL_MEMBER_SELECTOR, LITE_MEMBER_SELECTOR);
    assertTrue(selector.select(member));
    verify(member).localMember();
    verify(member, never()).isLiteMember();
}
Also used : MemberSelector(com.hazelcast.cluster.MemberSelector) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with MemberSelector

use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.

the class MemberSelectorsTest method testOrMemberSelector4.

@Test
public void testOrMemberSelector4() {
    when(member.isLiteMember()).thenReturn(true);
    MemberSelector selector = MemberSelectors.or(LOCAL_MEMBER_SELECTOR, LITE_MEMBER_SELECTOR);
    assertTrue(selector.select(member));
    verify(member).localMember();
    verify(member).isLiteMember();
}
Also used : MemberSelector(com.hazelcast.cluster.MemberSelector) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with MemberSelector

use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.

the class MemberSelectorsTest method testAndMemberSelector2.

@Test
public void testAndMemberSelector2() {
    MemberSelector selector = MemberSelectors.and(LOCAL_MEMBER_SELECTOR, LITE_MEMBER_SELECTOR);
    assertFalse(selector.select(member));
    verify(member).localMember();
    verify(member, never()).isLiteMember();
}
Also used : MemberSelector(com.hazelcast.cluster.MemberSelector) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 5 with MemberSelector

use of com.hazelcast.cluster.MemberSelector in project hazelcast by hazelcast.

the class ClientExecutorServiceExecuteTest method testExecuteOnMembers_withSelector.

@Test
public void testExecuteOnMembers_withSelector() {
    IExecutorService service = client.getExecutorService(randomString());
    String mapName = randomString();
    MemberSelector selector = new SelectAllMembers();
    service.executeOnMembers(new MapPutRunnable(mapName), selector);
    IMap map = client.getMap(mapName);
    assertSizeEventually(CLUSTER_SIZE, map);
}
Also used : IMap(com.hazelcast.map.IMap) MemberSelector(com.hazelcast.cluster.MemberSelector) MapPutRunnable(com.hazelcast.client.executor.tasks.MapPutRunnable) SelectAllMembers(com.hazelcast.client.test.executor.tasks.SelectAllMembers) IExecutorService(com.hazelcast.core.IExecutorService) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MemberSelector (com.hazelcast.cluster.MemberSelector)23 Test (org.junit.Test)20 QuickTest (com.hazelcast.test.annotation.QuickTest)17 IExecutorService (com.hazelcast.core.IExecutorService)11 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)10 SelectAllMembers (com.hazelcast.client.test.executor.tasks.SelectAllMembers)8 Member (com.hazelcast.cluster.Member)8 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)8 MapPutRunnable (com.hazelcast.client.executor.tasks.MapPutRunnable)6 MultiExecutionCallback (com.hazelcast.core.MultiExecutionCallback)5 CountDownLatch (java.util.concurrent.CountDownLatch)4 AppendCallable (com.hazelcast.client.test.executor.tasks.AppendCallable)3 ExecutionCallback (com.hazelcast.core.ExecutionCallback)3 IMap (com.hazelcast.map.IMap)3 Callable (java.util.concurrent.Callable)3 MapPutPartitionAwareRunnable (com.hazelcast.client.executor.tasks.MapPutPartitionAwareRunnable)2 MapPutPartitionAwareCallable (com.hazelcast.client.test.executor.tasks.MapPutPartitionAwareCallable)2 NullCallable (com.hazelcast.client.test.executor.tasks.NullCallable)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2