Examples of PollableChannel


Examples of org.springframework.integration.channel.PollableChannel

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelB");
        Message message = new StringMessage(MESSAGE_BODY);
        requestChannel.send(message);

        PollableChannel responseChannel = (PollableChannel) applicationContext.getBean("channelC");
        Message responseMessage = responseChannel.receive();
        String result = (String) responseMessage.getPayload();

        assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);
    }
View Full Code Here

Examples of org.springframework.integration.channel.PollableChannel

    }

    public void testSendingTwoWayMessageWithMessageAddress() throws Exception {

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelD");
        PollableChannel responseChannel = (PollableChannel) applicationContext.getBean("channelC");
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put(MessageHeaders.RETURN_ADDRESS, responseChannel);
        GenericMessage<String> message = new GenericMessage<String>(MESSAGE_BODY, headers);
        requestChannel.send(message);

        Message responseMessage = responseChannel.receive();
        String result = (String) responseMessage.getPayload();

        assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);
    }
View Full Code Here

Examples of org.springframework.integration.channel.PollableChannel

import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.message.Message;

public class CamelSourceAdapterTest extends SpringTestSupport {
    public void testSendingOneWayMessage() throws Exception {
        PollableChannel channelA = (PollableChannel) applicationContext.getBean("channelA");
        template.sendBody("direct:OneWay", "Willem");
        Message message = channelA.receive();
        assertEquals("We should get the message from channelA", message.getPayload(), "Willem");

    }
View Full Code Here

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

Examples of org.springframework.integration.core.PollableChannel

    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

Examples of org.springframework.integration.core.PollableChannel

    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

Examples of org.springframework.integration.core.PollableChannel

    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

Examples of org.springframework.integration.core.PollableChannel

  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

Examples of org.springframework.integration.core.PollableChannel

    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

Examples of org.springframework.integration.core.PollableChannel

 
  @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
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.