Package org.springframework.xd.shell.command.fixtures

Examples of org.springframework.xd.shell.command.fixtures.HttpSource


    assertThat(sink, eventually(hasContentsThat(equalTo("123"))));
  }

  @Test
  public void testDestroyTap() {
    HttpSource source = newHttpSource();
    String streamName = generateStreamName();
    String tapName = generateStreamName();
    stream().create(streamName, "%s | log", source);
    stream().create(tapName, "%s > %s", getTapName(streamName), generateQueueName());
    stream().destroyStream(streamName);
View Full Code Here


  }

  @Test
  public void testUsingPlaceholdersInsideStreamDefinition() {
    String streamName = generateStreamName();
    HttpSource source = newHttpSource();
    FileSink sink = newFileSink().binary(true);

    stream().create(streamName, "%s | transform --expression=\"'${xd.stream.name}'\" | %s", source, sink);

    source.ensureReady().postData("whatever");
    assertThat(sink, eventually(hasContentsThat(equalTo(streamName))));
  }
View Full Code Here

    disposables.add(mailSink);
    return mailSink;
  }

  protected HttpSource newHttpSource() {
    return new HttpSource(getShell());
  }
View Full Code Here

  protected HttpSource newHttpSource() {
    return new HttpSource(getShell());
  }

  protected HttpSource newHttpSource(int port) {
    return new HttpSource(getShell(), port);
  }
View Full Code Here

  @Test
  public void testRedisTopicExpressionSink() throws InterruptedException {
    String topicName = "testTopicExpression";
    CountDownLatch latch = new CountDownLatch(1);
    setupMessageListener(latch, topicName);
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --topicExpression='''%s'''", httpSource,
        topicName);
    Thread.sleep(1000);
    final String stringToPost = "test";
    httpSource.ensureReady().postData(stringToPost);
    latch.await(3, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
    container.stop();
  }
View Full Code Here

  @Test
  public void testRedisTopicSink() throws InterruptedException {
    String topicName = "testTopic";
    CountDownLatch latch = new CountDownLatch(1);
    setupMessageListener(latch, topicName);
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --topic=%s", httpSource, topicName);
    Thread.sleep(1000);
    final String stringToPost = "test";
    httpSource.ensureReady().postData(stringToPost);
    latch.await(3, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
    container.stop();
  }
View Full Code Here

  @Test
  public void testRedisQueueExpressionSink() throws InterruptedException {
    final String listName = "testListExpression";
    final String stringToPost = "test";
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --queueExpression='''%s'''", httpSource, listName);
    Thread.sleep(1000);
    httpSource.ensureReady().postData(stringToPost);
    byte[] leftPop = (byte[]) createTemplate().boundListOps(listName).leftPop(5, TimeUnit.SECONDS);
    Assert.assertEquals(stringToPost, new String(leftPop));
  }
View Full Code Here

  @Test
  public void testRedisQueueSink() throws InterruptedException {
    final String listName = "testList";
    final String stringToPost = "test";
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --queue=%s", httpSource, listName);
    Thread.sleep(1000);
    httpSource.ensureReady().postData(stringToPost);
    byte[] leftPop = (byte[]) createTemplate().boundListOps(listName).leftPop(5, TimeUnit.SECONDS);
    Assert.assertEquals(stringToPost, new String(leftPop));
  }
View Full Code Here

  @Test
  public void testRedisStoreExpressionSink() throws InterruptedException {
    final String setName = "testSetExpression";
    final String stringToPost = "test";
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --keyExpression='''%s''' --collectionType='SET'", httpSource,
        setName);
    Thread.sleep(1000);
    httpSource.ensureReady().postData(stringToPost);
    byte[] popped = (byte[]) createTemplate().boundSetOps(setName).pop();
    Assert.assertEquals(stringToPost, new String(popped));
  }
View Full Code Here

  @Test
  public void testRedisStoreSink() throws InterruptedException {
    final String setName = "testSet";
    final String stringToPost = "test";
    final HttpSource httpSource = newHttpSource();
    stream().create(generateStreamName(), "%s | redis --key=%s --collectionType='SET'", httpSource,
        setName);
    Thread.sleep(1000);
    httpSource.ensureReady().postData(stringToPost);
    byte[] popped = (byte[]) createTemplate().boundSetOps(setName).pop();
    Assert.assertEquals(stringToPost, new String(popped));
  }
View Full Code Here

TOP

Related Classes of org.springframework.xd.shell.command.fixtures.HttpSource

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.