Package org.springframework.xd.test.fixtures

Examples of org.springframework.xd.test.fixtures.CounterSink


  }

  @Test
  public void testJdbcSourceNoUpdateStatement() throws Exception {
    JdbcSource jdbcSource = newJdbcSource().fixedDelay(1);
    CounterSink counter = metrics().newCounterSink();

    String streamname = generateStreamName().replace("-", "_");

    jdbcSource.getJdbcTemplate().update(String.format("create table %s (seen INT, name VARCHAR(32))", streamname));
    jdbcSource.getJdbcTemplate().update(String.format("insert into %s (seen, name) values (0, 'eric')", streamname));
View Full Code Here


  }

  @Test
  public void testJdbcSourceWithUpdateStatement() throws Exception {
    JdbcSource jdbcSource = newJdbcSource().fixedDelay(1);
    CounterSink counter = metrics().newCounterSink();

    String streamname = generateStreamName().replace("-", "_");

    jdbcSource.getJdbcTemplate().update(String.format("create table %s (seen INT, name VARCHAR(32))", streamname));
    jdbcSource.getJdbcTemplate().update(String.format("insert into %s (seen, name) values (0, 'eric')", streamname));
View Full Code Here

  private HttpSource httpSource;

  @Test
  public void testSimpleCounter() throws Exception {
    httpSource = newHttpSource();
    CounterSink counter = metrics().newCounterSink();
    stream().create(generateStreamName(), "%s | %s", httpSource, counter);

    httpSource.postData("one");
    httpSource.postData("one");
    httpSource.postData("two");
View Full Code Here

    httpSource = newHttpSource();

    // Create counter object, but don't use its toString
    // in stream def. Instead, we know it should be named like
    // the streamname.
    CounterSink counter = metrics().newCounterSink(streamName);
    stream().create(streamName, "%s | counter", httpSource);
    httpSource.postData("one");
    assertThat(counter, eventually(hasValue("1")));
  }
View Full Code Here

  }

  @Test
  public void testSftpSource() {
    String streamName = generateStreamName();
    CounterSink counter = metrics().newCounterSink(streamName);
    stream().create(streamName, "sftp --user=%s --password=%s --port=%s --remoteDir=%s --localDir=%s | %s",
        server.getUser(), server.getPassword(), server.getPort(), server.getSourceSftpDirectory(),
        server.getTargetLocalDirectory(), counter);
    assertThat(counter, eventually(hasValue("2")));
  }
View Full Code Here

  }

  @Test
  public void testSftpSourceWithFileNamePattern() {
    String streamName = generateStreamName();
    CounterSink counter = metrics().newCounterSink(streamName);
    stream().create(streamName,
        "sftp --user=%s --password=%s --port=%s --remoteDir=%s --localDir=%s --pattern=%s | %s",
        server.getUser(), server.getPassword(), server.getPort(), server.getSourceSftpDirectory(),
        server.getTargetLocalDirectory(), "*.txt", counter);
    assertThat(counter, eventually(hasValue("1")));
View Full Code Here

  }

  @Test
  public void testSftpSourceWithFileNameRegexPattern() {
    String streamName = generateStreamName();
    CounterSink counter = metrics().newCounterSink(streamName);
    stream().create(streamName,
        "sftp --user=%s --password=%s --port=%s --remoteDir=%s --localDir=%s --regexPattern=%s | %s",
        server.getUser(), server.getPassword(), server.getPort(), server.getSourceSftpDirectory(),
        server.getTargetLocalDirectory(), "'" + "(\\w+)\\.(txt|text)$" + "'", counter);
    assertThat(counter, eventually(hasValue("2")));
View Full Code Here

  public MetricsTemplate(JLineShellComponent shell) {
    this.shell = shell;
  }

  public CounterSink newCounterSink(String name) {
    return remember(new CounterSink(shell, name));
  }
View Full Code Here

  public CounterSink newCounterSink(String name) {
    return remember(new CounterSink(shell, name));
  }

  public CounterSink newCounterSink() {
    return remember(new CounterSink(shell, randomName()));
  }
View Full Code Here

  }

  @Test
  public void benchmark() throws Exception {
    HttpSource source = newHttpSource();
    CounterSink sink = metrics().newCounterSink();
    stream().create(
        generateStreamName(),
        "%s | aggregator --store=%s --count=%d --aggregation=T(org.springframework.util.StringUtils).collectionToDelimitedString(#this.![payload],' ') --timeout=500000%s | %s ",
        source, storeName, MESSAGES_PER_GROUP,
        streamDynamicPart, sink);
View Full Code Here

TOP

Related Classes of org.springframework.xd.test.fixtures.CounterSink

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.