コード例 #1
0
  @Test
  public void testExecuteOnAllMembers() {
    final IExecutorService service = client.getExecutorService(randomString());
    final String mapName = randomString();

    service.executeOnAllMembers(new MapPutRunnable(mapName));

    final IMap map = client.getMap(mapName);
    assertTrueEventually(
        new AssertTask() {
          public void run() throws Exception {
            assertEquals(CLUSTER_SIZE, map.size());
          }
        });
  }
コード例 #2
0
  @Test
  public void testExecuteOnMembers_withEmptyCollection() {
    final IExecutorService service = client.getExecutorService(randomString());
    final String mapName = randomString();
    final Collection collection = new ArrayList();

    service.executeOnMembers(new MapPutRunnable(mapName), collection);

    final IMap map = client.getMap(mapName);
    assertTrueEventually(
        new AssertTask() {
          public void run() throws Exception {
            assertTrue(map.isEmpty());
          }
        });
  }
コード例 #3
0
  @Test
  public void testExecuteOnMember() {
    final IExecutorService service = client.getExecutorService(randomString());
    final String mapName = randomString();

    final Member member = instance1.getCluster().getLocalMember();
    final String targetUuid = member.getUuid();

    service.executeOnMember(new MapPutRunnable(mapName), member);

    final IMap map = client.getMap(mapName);
    assertTrueEventually(
        new AssertTask() {
          public void run() throws Exception {
            assertTrue(map.containsKey(targetUuid));
          }
        });
  }
コード例 #4
0
  @Test
  public void testExecuteOnMembers() {
    final IExecutorService service = client.getExecutorService(randomString());
    final String mapName = randomString();
    final Collection collection = new ArrayList();
    final Member member1 = instance1.getCluster().getLocalMember();
    final Member member3 = instance3.getCluster().getLocalMember();
    collection.add(member1);
    collection.add(member3);

    service.executeOnMembers(new MapPutRunnable(mapName), collection);

    final IMap map = client.getMap(mapName);
    assertTrueEventually(
        new AssertTask() {
          public void run() throws Exception {
            assertTrue(map.containsKey(member1.getUuid()));
            assertTrue(map.containsKey(member3.getUuid()));
          }
        });
  }
コード例 #5
0
 @Test(expected = NullPointerException.class)
 public void testExecute_whenTaskNull() {
   IExecutorService service = client.getExecutorService(randomString());
   service.execute(null);
 }
コード例 #6
0
 @AfterClass
 public static void destroy() {
   client.shutdown();
   Hazelcast.shutdownAll();
 }
コード例 #7
0
 @Test(expected = IllegalArgumentException.class)
 public void testExecuteOnMembers_whenSelectorNull() {
   IExecutorService service = client.getExecutorService(randomString());
   MemberSelector selector = null;
   service.executeOnMembers(new MapPutRunnable("task"), selector);
 }
コード例 #8
0
 @Test(expected = NullPointerException.class)
 public void testExecuteOnMembers_WhenCollectionNull() {
   IExecutorService service = client.getExecutorService(randomString());
   Collection collection = null;
   service.executeOnMembers(new MapPutRunnable("task"), collection);
 }
コード例 #9
0
 @Test(expected = NullPointerException.class)
 public void testExecuteOnMember_WhenMemberNull() {
   IExecutorService service = client.getExecutorService(randomString());
   service.executeOnMember(new MapPutRunnable("map"), null);
 }