Package org.springframework.xd.dirt.test.sink

Examples of org.springframework.xd.dirt.test.sink.NamedChannelSink


    StreamDefinition mqtt2 = new StreamDefinition("mqtt2", "mqtt --topics=foo > queue:mqttsink");
    integrationSupport.createAndDeployStream(mqtt1);
    integrationSupport.createAndDeployStream(mqtt2);

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(integrationSupport.messageBus()).createNamedChannelSource("queue:mqttsource");
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(integrationSupport.messageBus()).createNamedChannelSink("queue:mqttsink");

    Thread.sleep(1000);
    source.sendPayload("hello");
    Object result = sink.receivePayload(1000);

    assertEquals("hello", result);
    source.unbind();
    sink.unbind();
  }
View Full Code Here


    MessageBus bus = integrationSupport.messageBus();

    SingleNodeNamedChannelSinkFactory sinkFactory = new SingleNodeNamedChannelSinkFactory(bus);

    NamedChannelSink bar1sink = sinkFactory.createNamedChannelSink("queue:bar1");
    NamedChannelSink bar2sink = sinkFactory.createNamedChannelSink("queue:bar2");
    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(bus).createNamedChannelSource(TOPIC_FOO);

    source.sendPayload("hello");

    final Object bar1 = bar1sink.receivePayload(10000);
    final Object bar2 = bar2sink.receivePayload(10000);
    assertEquals("hello", bar1);
    assertEquals("hello", bar2);

    source.unbind();
    bar1sink.unbind();
    bar2sink.unbind();
  }
View Full Code Here

    integrationSupport.createAndDeployStream(tapDefinition);

    MessageBus bus = integrationSupport.messageBus();

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(bus).createNamedChannelSource("queue:source");
    NamedChannelSink streamSink = new SingleNodeNamedChannelSinkFactory(bus).createNamedChannelSink("queue:sink");
    NamedChannelSink tapSink = new SingleNodeNamedChannelSinkFactory(bus).createNamedChannelSink("queue:tap");

    source.send(new GenericMessage<String>("Dracarys!"));

    Message<?> m1;
    int count1 = 0;
    String result1 = null;
    while ((m1 = streamSink.receive(1000)) != null) {
      count1++;
      result1 = (String) m1.getPayload();
    }

    Message<?> m2;
    int count2 = 0;
    String result2 = null;
    while ((m2 = tapSink.receive(1000)) != null) {
      count2++;
      result2 = (String) m2.getPayload();
    }

    assertEquals("DRACARYS!", result1);
    assertEquals(1, count1);

    assertEquals("DR.C.RYS!", result2);
    assertEquals(1, count2);

    source.unbind();
    streamSink.unbind();
    tapSink.unbind();
    integrationSupport.undeployAndDestroyStream(streamDefinition);
    integrationSupport.undeployAndDestroyStream(tapDefinition);
  }
View Full Code Here

    MessageBus bus = testMessageBus != null ? testMessageBus : integrationSupport.messageBus();
    assertNotNull(bus);

    SingleNodeNamedChannelSinkFactory sinkFactory = new SingleNodeNamedChannelSinkFactory(bus);

    NamedChannelSink foosink = sinkFactory.createNamedChannelSink(QUEUE_FOO);
    NamedChannelSink barsink = sinkFactory.createNamedChannelSink(QUEUE_BAR);

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(bus).createNamedChannelSource(QUEUE_ROUTE);

    source.sendPayload("a");
    source.sendPayload("b");

    final Object fooPayload = foosink.receivePayload(10000);
    final Object barPayload = barsink.receivePayload(10000);

    assertEquals("a", fooPayload);
    assertEquals("b", barPayload);

    source.unbind();
    foosink.unbind();
    barsink.unbind();
  }
View Full Code Here

    integrationSupport.createAndDeployStream(testStream);

    MessageBus messageBus = integrationSupport.messageBus();

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(messageBus).createNamedChannelSource("queue:producer");
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(messageBus).createNamedChannelSink("queue:consumer");

    source.sendPayload("ping");
    String result = (String) sink.receivePayload(5000);
    assertEquals(expected, result);

    source.unbind();
    sink.unbind();

    assertTrue("stream " + testStream.getName() + "not undeployed",
        integrationSupport.undeployAndDestroyStream(testStream));
    application.close();
  }
View Full Code Here

    integrationSupport.createAndDeployStream(testStream);

    MessageBus messageBus = integrationSupport.messageBus();

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(messageBus).createNamedChannelSource("queue:producer");
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(messageBus).createNamedChannelSink("queue:consumer");

    source.sendPayload("hello");
    String result = (String) sink.receivePayload(RECEIVE_TIMEOUT);
    assertEquals("HELLO", result);

    source.sendPayload("a");
    result = (String) sink.receivePayload(RECEIVE_TIMEOUT);
    assertNull(result);

    source.unbind();
    sink.unbind();

    assertTrue("stream " + testStream.getName() + "not undeployed",
        integrationSupport.undeployAndDestroyStream(testStream));
  }
View Full Code Here

    SingleNodeProcessingChainProducer chain = chainProducer(application, "dateToDateTime", processingChainUnderTest);

    StreamDefinition tap = new StreamDefinition("testtap", "tap:stream:dateToDateTime.0 > queue:tap");
    integrationSupport.createAndDeployStream(tap);
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(integrationSupport.messageBus()).createNamedChannelSink("queue:tap");

    chain.sendPayload(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

    Object payload = sink.receivePayload(RECEIVE_TIMEOUT);
    assertNotNull(payload);
    assertTrue(payload instanceof DateTime);

    integrationSupport.undeployAndDestroyStream(tap);
    chain.destroy();
View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.test.sink.NamedChannelSink

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.