use of org.apache.geode.distributed.internal.HighPriorityAckedMessage in project geode by apache.
the class GMSMembershipManagerJUnitTest method testSendMessage.
@Test
public void testSendMessage() throws Exception {
HighPriorityAckedMessage m = new HighPriorityAckedMessage();
m.setRecipient(mockMembers[0]);
manager.start();
manager.started();
manager.installView(new NetView(myMemberId, 1, members));
Set<InternalDistributedMember> failures = manager.send(m);
verify(messenger).send(m);
if (failures != null) {
assertEquals(0, failures.size());
}
}
use of org.apache.geode.distributed.internal.HighPriorityAckedMessage in project geode by apache.
the class GMSMembershipManagerJUnitTest method testDirectChannelSendFailureToOneRecipient.
@Test
public void testDirectChannelSendFailureToOneRecipient() throws Exception {
setUpDirectChannelMock();
HighPriorityAckedMessage m = new HighPriorityAckedMessage();
InternalDistributedMember[] recipients = new InternalDistributedMember[] { mockMembers[2], mockMembers[3] };
m.setRecipients(Arrays.asList(recipients));
Set<InternalDistributedMember> failures = manager.directChannelSend(recipients, m, null);
ConnectExceptions exception = new ConnectExceptions();
exception.addFailure(recipients[0], new Exception("testing"));
when(dc.send(any(GMSMembershipManager.class), any(mockMembers.getClass()), any(DistributionMessage.class), anyInt(), anyInt())).thenThrow(exception);
failures = manager.directChannelSend(recipients, m, null);
assertTrue(failures != null);
assertEquals(1, failures.size());
assertEquals(recipients[0], failures.iterator().next());
}
use of org.apache.geode.distributed.internal.HighPriorityAckedMessage in project geode by apache.
the class GMSMembershipManagerJUnitTest method testSendToEmptyListIsRejected.
@Test
public void testSendToEmptyListIsRejected() throws Exception {
InternalDistributedMember[] emptyList = new InternalDistributedMember[0];
HighPriorityAckedMessage m = new HighPriorityAckedMessage();
m.setRecipient(mockMembers[0]);
manager.start();
manager.started();
manager.installView(new NetView(myMemberId, 1, members));
Set<InternalDistributedMember> failures = manager.send(null, m, null);
verify(messenger, never()).send(m);
reset(messenger);
failures = manager.send(emptyList, m, null);
verify(messenger, never()).send(m);
}
use of org.apache.geode.distributed.internal.HighPriorityAckedMessage in project geode by apache.
the class GMSMembershipManagerJUnitTest method testDirectChannelSendFailureToAll.
@Test
public void testDirectChannelSendFailureToAll() throws Exception {
setUpDirectChannelMock();
HighPriorityAckedMessage m = new HighPriorityAckedMessage();
InternalDistributedMember[] recipients = new InternalDistributedMember[] { mockMembers[2], mockMembers[3] };
m.setRecipients(Arrays.asList(recipients));
Set<InternalDistributedMember> failures = manager.directChannelSend(recipients, m, null);
when(dc.send(any(GMSMembershipManager.class), any(mockMembers.getClass()), any(DistributionMessage.class), anyInt(), anyInt())).thenReturn(0);
when(stopper.isCancelInProgress()).thenReturn(Boolean.TRUE);
try {
manager.directChannelSend(recipients, m, null);
fail("expected directChannelSend to throw an exception");
} catch (DistributedSystemDisconnectedException expected) {
}
}
Aggregations