Assert.assertEquals( 1, messageGroup.getMessages().size() );
}
@Test
public void testIteratorOfMessageGroups() {
VoldemortMessageStore store1 = createNewStoreClient();
VoldemortMessageStore store2 = createNewStoreClient();
store1.addMessageToGroup( 1, new GenericMessage<String>( "1" ) );
store2.addMessageToGroup( 2, new GenericMessage<String>( "2" ) );
store1.addMessageToGroup( 3, new GenericMessage<String>( "3" ) );
store2.addMessageToGroup( 3, new GenericMessage<String>( "3A" ) );
Iterator<MessageGroup> messageGroups = store1.iterator();
int counter = 0;
while ( messageGroups.hasNext() ) {
final MessageGroup group = messageGroups.next();
final String groupId = (String) group.getGroupId();
if ( "1".equals( groupId ) ) {
Assert.assertEquals( 1, group.getMessages().size() );
}
else if ( "2".equals( groupId ) ) {
Assert.assertEquals( 1, group.getMessages().size() );
}
else if ( "3".equals( groupId ) ) {
Assert.assertEquals( 2, group.getMessages().size() );
}
++counter;
}
Assert.assertEquals( 3, counter );
store2.removeMessageGroup( 3 );
messageGroups = store1.iterator();
counter = 0;
while ( messageGroups.hasNext() ) {
messageGroups.next();