Examples of VoldemortMessageStore


Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    createdTimestamp = messageGroup.getTimestamp();
    updatedTimestamp = messageGroup.getLastModified();
    Assert.assertTrue( updatedTimestamp > createdTimestamp );

    // use another message store instance
    VoldemortMessageStore newStore = createNewStoreClient();

    messageGroup = newStore.getMessageGroup( 1 );
    Assert.assertEquals( 2, messageGroup.size() );
  }
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    Message<?> message = new GenericMessage<String>( "Hello" );
    messageGroup = store.addMessageToGroup( 1, message );
    Assert.assertEquals( 1, messageGroup.size() );

    // use another message store instance
    VoldemortMessageStore newStore = createNewStoreClient();

    messageGroup = newStore.getMessageGroup( 1 );
    Assert.assertEquals( 1, messageGroup.size() );
  }
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    Assert.assertNotSame( messageGroup, messageGroupA );
    Assert.assertEquals( 0, messageGroupA.getMessages().size() );
    Assert.assertEquals( 0, messageGroupA.size() );

    // use another message store instance
    VoldemortMessageStore newStore = createNewStoreClient();

    messageGroup = newStore.getMessageGroup( 1 );

    Assert.assertEquals( 0, messageGroup.getMessages().size() );
    Assert.assertEquals( 0, messageGroup.size() );
  }
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    messageGroup = store.removeMessageFromGroup( 1, message );
    Assert.assertEquals( 2, messageGroup.size() );

    // use another message store instance
    VoldemortMessageStore newStore = createNewStoreClient();

    messageGroup = newStore.getMessageGroup( 1 );
    Assert.assertEquals( 2, messageGroup.size() );
  }
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    store.removeMessageFromGroup( 1, new GenericMessage<String>( "2" ) );
  }

  @Test
  public void testMultipleInstancesOfGroupStore() {
    VoldemortMessageStore store1 = createNewStoreClient();
    VoldemortMessageStore store2 = createNewStoreClient();

    Message<?> message = new GenericMessage<String>( "1" );
    store1.addMessageToGroup( 1, message );
    MessageGroup messageGroup = store2.addMessageToGroup( 1, new GenericMessage<String>( "2" ) );
    Assert.assertEquals( 2, messageGroup.getMessages().size() );

    VoldemortMessageStore store3 = createNewStoreClient();
    messageGroup = store3.removeMessageFromGroup( 1, message );
    Assert.assertEquals( 1, messageGroup.getMessages().size() );
  }
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    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();
View Full Code Here

Examples of org.springframework.integration.voldemort.store.VoldemortMessageStore

    Assert.assertEquals( 2, counter );
  }

  @Test
  public void testConcurrentModifications() throws InterruptedException {
    final VoldemortMessageStore store1 = createNewStoreClient();
    final VoldemortMessageStore store2 = createNewStoreClient();

    final ExecutorService executor = Executors.newCachedThreadPool();
    final Counter errorCounter = new Counter();
    final Random randomGenerator = new Random();
    for ( int i = 0; i < 10; ++i ) {
      executor.execute( new Runnable() {
        public void run() {
          try {
            final Message<?> message = new GenericMessage<Object>( UUID.randomUUID() );
            MessageGroup group = store1.addMessageToGroup( 1, message );

            Thread.sleep( randomGenerator.nextInt( 100 ) );

            group = store2.removeMessageFromGroup( 1, message );
          }
          catch ( Exception e ) {
            errorCounter.increment();
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.