Package org.springframework.integration.core

Examples of org.springframework.integration.core.PollableChannel


  }
 
  @Test
  public void deletesNestedDirectoriesAndFiles() {
   
    PollableChannel deletionChannel = deletionService.libraryDeletionChannel;
    deletionChannel.send(msg(dir1, set(dir2), set(file1a)));
    deletionChannel.send(FINISHED_MESSAGE);
   
    deletionService.receive();
    deletionService.updateLibrary();
   
    assertEquals(set(file1b), presenceDao.getFiles(dir1));
View Full Code Here


    Thread.sleep(3);
    Scrobble scrobble2 = new Scrobble(user1, track1, false);

    Message message1 = new GenericMessage<Scrobble>(scrobble1);
    Message message2 = new GenericMessage<Scrobble>(scrobble2);
    PollableChannel scrobbleChannel = mock(PollableChannel.class);
    when(scrobbleChannel.receive()).thenReturn(message1, message2, null);
   
    scrobbleService.setScrobbleChannel(scrobbleChannel);
    scrobbleService.receive();
   
    assertNotNull(scrobbleService.userScrobbles);
View Full Code Here

    assertFalse(scrobble1.getStartTime().equals(scrobble2.getStartTime()));
   
    Message message1 = new GenericMessage<Scrobble>(scrobble1);
    Message message2 = new GenericMessage<Scrobble>(scrobble2);
    PollableChannel scrobbleChannel = mock(PollableChannel.class);
    when(scrobbleChannel.receive()).thenReturn(message1, message2, null);
   
    scrobbleService.setScrobbleChannel(scrobbleChannel);
    scrobbleService.receive();
   
    assertNotNull(scrobbleService.userScrobbles);
View Full Code Here

    Scrobble scrobble1 = new Scrobble(user1, track1, false);
    Scrobble scrobble2 = new Scrobble(user2, track1, false);

    Message message1 = new GenericMessage<Scrobble>(scrobble1);
    Message message2 = new GenericMessage<Scrobble>(scrobble2);
    PollableChannel scrobbleChannel = mock(PollableChannel.class);
    when(scrobbleChannel.receive()).thenReturn(message1, message2, null);
   
    scrobbleService.setScrobbleChannel(scrobbleChannel);
    scrobbleService.receive();
   
    assertNotNull(scrobbleService.userScrobbles);
View Full Code Here

  public void scrobblerIgnoresTooNewSubmissions() throws ApplicationException {

    Scrobble scrobble = new Scrobble(user1, track1, false);

    Message message = new GenericMessage<Scrobble>(scrobble);
    PollableChannel scrobbleChannel = mock(PollableChannel.class);
    when(scrobbleChannel.receive()).thenReturn(message, (Message) null);

    scrobbleService.setScrobbleChannel(scrobbleChannel);
    scrobbleService.receive();

    scrobbleService.scrobbleTracks();
View Full Code Here

    when(presenceDao.getSubdirectories(dir1)).thenReturn(set(dir2));
    presenceService.setLibraryPresenceDao(presenceDao);

    file2b.setSize(file2.getSize() + 1);
   
    PollableChannel presenceChannel = presenceService.libraryPresenceChannel;
    presenceChannel.send(LibraryUtil.msg(dir1, set(dir2), set(file1, file2b)));
    presenceChannel.send(FINISHED_MESSAGE);
   
    presenceService.receive();
   
    Message<?> additionMessage, deletionMessage;
    assertNotNull(additionMessage = presenceService.libraryMetadataChannel.receive());
View Full Code Here

 
  @Test
  public void addsNestedDirectoriesAndFiles() {
    additionService.clearImport();
   
    PollableChannel additionChannel = additionService.libraryAdditionChannel;
    additionChannel.send(msg(dir2, new HashSet<String>(), set(file2a)));
    additionChannel.send(msg(dir1, set(dir2), set(file1a, file1b)));
    additionChannel.send(msg(null, set(dir1), new HashSet<File>()));
    additionChannel.send(FINISHED_MESSAGE);
   
    additionService.receive();
    additionService.updateLibrary();
   
    assertEquals(set(file1a, file1b), presenceDao.getFiles(dir1));
View Full Code Here

public class ObjectKeyTest extends BaseFunctionalTestCase {
  @Test
  public void testReceiveMessageByObjectKey() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "ObjectKeyTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "objectStoreClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Car.CarId carId = new Car.CarId( 1 );
    final Car car = new Car( carId, "Ford Mustang" );
    storeClient.put( carId, car );

    // when
    final Message<Car> received = (Message<Car>) inboundChannel.receive();

    // then
    Assert.assertEquals( car, received.getPayload() );

    context.close();
View Full Code Here

   */
  @Test
  public void testReceiveMessageKey() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortInboundAdapterTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "storeClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Person lukasz = new Person( "lukasz", "Lukasz", "Antoniak" );
    storeClient.put( lukasz.getId(), lukasz );

    // when
    final Message<Person> received = (Message<Person>) inboundChannel.receive();

    // then
    Assert.assertEquals( lukasz, received.getPayload() );

    context.close();
View Full Code Here

   */
  @Test
  public void testReceiveMessageExpr() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortInboundAdapterTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "storeClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Person kinga = new Person( "kinga", "Kinga", "Mroz" );
    storeClient.put( kinga.getId(), kinga );

    // when
    final Message<Versioned<Person>> received = (Message<Versioned<Person>>) inboundChannel.receive();

    // then
    final Versioned found = storeClient.get( kinga.getId() );
    Assert.assertEquals( found, received.getPayload() );

View Full Code Here

TOP

Related Classes of org.springframework.integration.core.PollableChannel

Copyright © 2018 www.massapicom. 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.