Examples of CustomAggregator


Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test
  public void test_createCustomAggregator()
  {
    CustomAggregator aggregator = AggregatorFactory.createCustomAggregator("foobar", "\"foo\": 10");

    assertThat(aggregator.getName(), equalTo("foobar"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"foobar\",\"foo\": 10}"));
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test
  public void test_createDivAggregator()
  {
    CustomAggregator aggregator = AggregatorFactory.createDivAggregator(60);

    assertThat(aggregator.getName(), equalTo("div"));
    assertThat(aggregator.toJson(), equalTo("{\"name\":\"div\",\"divisor\":60.0}"));
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

public class CustomAggregatorTest
{
  @Test(expected = NullPointerException.class)
  public void test_NullName_invalid()
  {
    new CustomAggregator(null, "json");
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test(expected = IllegalArgumentException.class)
  public void test_EmptyName_invalid()
  {
    new CustomAggregator("", "json");
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test(expected = NullPointerException.class)
  public void test_NullJSON_invalid()
  {
    new CustomAggregator("name", null);
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test(expected = IllegalArgumentException.class)
  public void test_EmptyJSON_invalid()
  {
    new CustomAggregator("name", "");
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

  }

  @Test
  public void test()
  {
    CustomAggregator aggregator = new CustomAggregator("testAggregator", "{\"property1\":\"value1\", \"property2\": \"value2\"}");

    assertThat(aggregator.toJson(), equalTo("{\"name\":\"testAggregator\",{\"property1\":\"value1\", \"property2\": \"value2\"}}"));
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

   * @return div aggregator
   */
  public static CustomAggregator createDivAggregator(double divisor)
  {
    checkArgument(divisor != 0, "Divisor cannot be zero.");
    return new CustomAggregator("div", "\"divisor\":" + divisor);
  }
View Full Code Here

Examples of org.kairosdb.client.builder.aggregator.CustomAggregator

   * @param json aggregator JSON fragment
   * @return customer aggregator
   */
  public static CustomAggregator createCustomAggregator(String name, String json)
  {
    return new CustomAggregator(name, json);
  }
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.