use of org.jgroups.protocols.tom.MessageID in project JGroups by belaban.
the class TOA_UnitTest method testMessageFromPreviousViewAlive.
public void testMessageFromPreviousViewAlive() {
Address b = Util.createRandomAddress("B");
// view {4|A,B}
setView(localAddress, 4, localAddress, b);
ToaHeader header = ToaHeader.newDataMessageHeader(new MessageID(b, 1), 3);
Message message = newMessage(header, b, localAddress);
// message from node B to A from view 3.
// message is accepted
toa.up(message);
assertProposedMessageSent(0);
assertFirstMessage(0, false);
header = ToaHeader.newFinalMessageHeader(new MessageID(b, 1), 1);
message = newMessage(header, b, localAddress);
// final message
toa.up(message);
assertFirstMessage(1, true);
assertDownMessagesEmpty();
assertUpMessagesEmpty();
}
use of org.jgroups.protocols.tom.MessageID in project JGroups by belaban.
the class TOA_UnitTest method testMessageBeforeFirstView.
public void testMessageBeforeFirstView() {
Address b = Util.createRandomAddress("B");
ToaHeader header = ToaHeader.newDataMessageHeader(new MessageID(b, 1), 1);
Message message = newMessage(header, b, localAddress);
// message from node B to A.
// no view is installed yet.
// message should be accepted
toa.up(message);
assertProposedMessageSent(0);
assertFirstMessage(0, false);
header = ToaHeader.newFinalMessageHeader(new MessageID(b, 1), 1);
message = newMessage(header, b, localAddress);
// final message
// no view installed yet
toa.up(message);
assertFirstMessage(1, true);
assertDownMessagesEmpty();
assertUpMessagesEmpty();
}
use of org.jgroups.protocols.tom.MessageID in project JGroups by belaban.
the class TOA_UnitTest method testSameSequenceNumberMessage.
public void testSameSequenceNumberMessage() {
Address b = Util.createRandomAddress("B");
setInitialView(localAddress, localAddress, b);
// it increments it to 10
sequenceNumberManager().update(9);
ToaHeader header = ToaHeader.newDataMessageHeader(new MessageID(b, 1), 1);
header.setSequencerNumber(10);
Message message = newMessage(header, b, localAddress);
// Message from member C. it isn't in the view and the message should be discarded.
toa.up(message);
assertFirstMessage(10, false);
assertEquals(11, sequenceNumberManager().get());
assertProposedMessageSent(10);
header = ToaHeader.newFinalMessageHeader(new MessageID(b, 1), 15);
message = newMessage(header, b, localAddress);
toa.up(message);
assertFirstMessage(15, true);
assertEquals(16, sequenceNumberManager().get());
assertDownMessagesEmpty();
assertUpMessagesEmpty();
}
use of org.jgroups.protocols.tom.MessageID in project JGroups by belaban.
the class TOA_UnitTest method testMessageFromNewView.
public void testMessageFromNewView() {
Address b = Util.createRandomAddress("B");
// view {1|A}
setInitialView(localAddress, localAddress);
ToaHeader header = ToaHeader.newDataMessageHeader(new MessageID(b, 1), 2);
Message message = newMessage(header, b, localAddress);
// message from node B to A from view 2.
// B isn't in the view but the message is accepted
toa.up(message);
assertProposedMessageSent(0);
assertFirstMessage(0, false);
// view {2|A,B}
// message is kept
setView(localAddress, 2, localAddress, b);
assertFirstMessage(0, false);
header = ToaHeader.newFinalMessageHeader(new MessageID(b, 1), 1);
message = newMessage(header, b, localAddress);
// final message
toa.up(message);
assertFirstMessage(1, true);
assertDownMessagesEmpty();
assertUpMessagesEmpty();
}
use of org.jgroups.protocols.tom.MessageID in project JGroups by belaban.
the class TOA_UnitTest method testDataMessageFromNonMember.
public void testDataMessageFromNonMember() {
Address b = Util.createRandomAddress("B");
Address c = Util.createRandomAddress("C");
setInitialView(localAddress, localAddress, b);
ToaHeader header = ToaHeader.newDataMessageHeader(new MessageID(c, 1), 1);
Message message = newMessage(header, c, localAddress);
// Message from member C. it isn't in the view and the message should be discarded.
toa.up(message);
assertEquals("Deliver Manager doesn't have an empty list", Collections.emptyList(), deliveryManager().getAllMessages());
assertDownMessagesEmpty();
assertUpMessagesEmpty();
}