Exemplo n.º 1
0
  @Test
  public void ignoreNonNumericValues() throws IOException {
    StatsDWriter2 writer = new StatsDWriter2(ImmutableList.<String>of(), "root", "c", false, 1L);

    StringWriter out = new StringWriter();
    writer.write(out, dummyServer(), dummyQuery(), singleTrueResult());

    assertThat(out.toString()).isEmpty();
  }
Exemplo n.º 2
0
  @Test
  public void nonNumericValuesAsKey() throws IOException {
    StatsDWriter2 writer = new StatsDWriter2(ImmutableList.<String>of(), "root", "g", true, 1L);

    StringWriter out = new StringWriter();
    writer.write(out, dummyServer(), dummyQuery(), singleTrueResult());

    assertThat(out.toString())
        .isEqualTo("root.host_example_net_4321.VerboseMemory.Verbose.true:1|g\n");
  }
Exemplo n.º 3
0
  @Test
  public void writeNumericResult() throws IOException {
    StatsDWriter2 writer = new StatsDWriter2(ImmutableList.<String>of(), "root", "c", false, 1L);

    StringWriter out = new StringWriter();
    writer.write(out, dummyServer(), dummyQuery(), singleNumericResult());

    assertThat(out.toString())
        .isEqualTo(
            "root.host_example_net_4321.ObjectPendingFinalizationCount.ObjectPendingFinalizationCount:10|c\n");
  }
Exemplo n.º 4
0
  @Test
  public void multipleValuesAreSeparatedByNewLine() throws IOException {
    StatsDWriter2 writer = new StatsDWriter2(ImmutableList.<String>of(), "root", "g", true, 1L);

    StringWriter out = new StringWriter();
    writer.write(out, dummyServer(), dummyQuery(), dummyResults());

    assertThat(out.toString())
        .isEqualTo(
            "root.host_example_net_4321.ObjectPendingFinalizationCount.ObjectPendingFinalizationCount:10|g\n"
                + "root.host_example_net_4321.VerboseMemory.Verbose.true:1|g\n"
                + "root.host_example_net_4321.VerboseMemory.Verbose.false:1|g\n");
  }