use of com.hazelcast.internal.cluster.impl.operations.MembersUpdateOp in project hazelcast by hazelcast.
the class MembershipUpdateTest method memberReceives_memberUpdateNotContainingItself.
@Test
public void memberReceives_memberUpdateNotContainingItself() throws Exception {
Config config = new Config();
config.setProperty(MEMBER_LIST_PUBLISH_INTERVAL_SECONDS.getName(), String.valueOf(Integer.MAX_VALUE));
HazelcastInstance hz1 = factory.newHazelcastInstance(config);
HazelcastInstance hz2 = factory.newHazelcastInstance(config);
HazelcastInstance hz3 = factory.newHazelcastInstance(config);
assertClusterSizeEventually(3, hz2);
Node node = getNode(hz1);
ClusterServiceImpl clusterService = node.getClusterService();
MembershipManager membershipManager = clusterService.getMembershipManager();
MembersView membersView = MembersView.createNew(membershipManager.getMemberListVersion() + 1, asList(membershipManager.getMember(getAddress(hz1)), membershipManager.getMember(getAddress(hz2))));
Operation memberUpdate = new MembersUpdateOp(membershipManager.getMember(getAddress(hz3)).getUuid(), membersView, clusterService.getClusterTime(), null, true);
memberUpdate.setCallerUuid(node.getThisUuid());
Future<Object> future = node.getNodeEngine().getOperationService().invokeOnTarget(null, memberUpdate, getAddress(hz3));
try {
future.get();
fail("Membership update should fail!");
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof IllegalArgumentException);
}
}
Aggregations