@Test
public void testAggregatorWithShutdown() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortMessageStoreAggregationTest-context.xml", getClass() );
MessageChannel input = context.getBean( "inputChannel", MessageChannel.class );
QueueChannel output = context.getBean( "outputChannel", QueueChannel.class );
Message<?> message1 = MessageBuilder.withPayload( "1" )
.setSequenceNumber( 1 ).setSequenceSize( 3 ).setCorrelationId( 1 ).build();
Message<?> message2 = MessageBuilder.withPayload( "2" )
.setSequenceNumber( 2 ).setSequenceSize( 3 ).setCorrelationId( 1 ).build();
input.send( message1 );
Assert.assertNull( output.receive( 1000 ) );
input.send( message2 );
Assert.assertNull( output.receive( 1000 ) );
context.close();
context = new ClassPathXmlApplicationContext( "VoldemortMessageStoreAggregationTest-context.xml", getClass() );
input = context.getBean( "inputChannel", MessageChannel.class );
output = context.getBean( "outputChannel", QueueChannel.class );
Message<?> message3 = MessageBuilder.withPayload( "3" )
.setSequenceNumber( 3 ).setSequenceSize( 3 ).setCorrelationId( 1 ).build();
input.send( message3 );
Assert.assertNotNull( output.receive( 1000 ) );
context.close();
}