Package com.typesafe.config

Examples of com.typesafe.config.Config


public class PatternMetricFilterTest extends Assert {
 
  @Test
  public void testCompletelyEmpty() throws Exception {
    String str = "{}";
    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
  }
View Full Code Here


  }
 
  @Test
  public void testEmpty() throws Exception {
    String str = "{ metricFilter : {} }";
    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertNotSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
    assertTrue(filter.toString().length() > 0);
  }
View Full Code Here

      "\n excludes : { # if missing defaults to match none" +
      "\n \"literal:foo.bar\" : \"glob:*\"" +
      "\n \"literal:boo\" : \"glob:*Timer\"" +
      "\n }}}";

    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertNotSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
    assertTrue(filter.matches("boo", new Counter()));
    assertFalse(filter.matches("foo.bar", new Counter()));
View Full Code Here

      "\n includes : { " +
      "\n \"literal:foo\" : \"glob:*\"" +
      "\n }" +
      "\n }}";

    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertNotSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
    assertFalse(filter.matches("boo", new Counter()));
    assertTrue(filter.toString().length() > 0);
View Full Code Here

      "\n includes : { " +
      "\n \"*\" : \"*\"" +
      "\n }" +
      "\n }}";

    Config config = ConfigFactory.parseString(str);
    MetricFilter filter = PatternMetricFilter.parse(new Configs(), config);
    assertNotSame(filter, MetricFilter.ALL);
    assertTrue(filter.matches("foo", new Counter()));
    assertTrue(filter.matches("boo", new Counter()));
    assertTrue(filter.toString().length() > 0);
View Full Code Here

      "\n includes : { " +
      "\n \"unRecognizedType:foo\" : \"glob:*\"" +
      "\n }" +
      "\n }}";

    Config config = ConfigFactory.parseString(str);
    try {
      PatternMetricFilter.parse(new Configs(), config);
      fail();
    } catch (MorphlineCompilationException e) {
      ; // expected
View Full Code Here

      "\n includes : { " +
      "\n \"ILLEGAL\" : \"glob:*\"" +
      "\n }" +
      "\n }}";

    Config config = ConfigFactory.parseString(str);
    try {
      PatternMetricFilter.parse(new Configs(), config);
      fail();
    } catch (MorphlineCompilationException e) {
      ; // expected
View Full Code Here

  public void testParseVariables() throws Exception {
    System.setProperty("ENV_ZK_HOST", "zk.foo.com:2181/solr");
    System.setProperty("ENV_SOLR_URL", "http://foo.com:8983/solr/myCollection");
    System.setProperty("ENV_SOLR_LOCATOR", "{ collection : collection1 }");
    try {
      Config override = ConfigFactory.parseString("SOLR_LOCATOR : { collection : fallback } ");
      Config config = parse("test-morphlines/parseVariables", override);
      //System.out.println(config.root().render());
    } finally {
      System.clearProperty("ENV_ZK_HOST");
      System.clearProperty("ENV_SOLR_URL")
      System.clearProperty("ENV_SOLR_LOCATOR");
View Full Code Here

    assertEquals(Lists.newArrayList(), collector.getRecords());
  }
 
  @Test
  public void testJavaCompilationException() throws Exception {
    Config config = parse("test-morphlines/javaCompilationException");   
    try {
      createMorphline(config);
      fail();
    } catch (MorphlineCompilationException e) {
      assertTrue(e.getMessage().startsWith("Cannot compile script"));
View Full Code Here

    assertSame(record, collector.getFirstRecord());   
  }
 
  @Test
  public void testFindReplace() throws Exception {
    Config override = ConfigFactory.parseString("replaceFirst : false");
    morphline = createMorphline("test-morphlines/findReplace", override);   
    Record record = new Record();
    record.put("text", "hello ic world ic");
    Record expected = new Record();
    expected.put("text", "hello I see world I see");
View Full Code Here

TOP

Related Classes of com.typesafe.config.Config

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.