Package com.cloudera.cdk.morphline.base

Examples of com.cloudera.cdk.morphline.base.Configs


 
  @Test
  public void testEmptyStringThrowsSyntaxError() throws Exception {
    Config config = ConfigFactory.parseString("foo : \"\"");
    try {
      new Configs().getTimeUnit(config, "foo");
      fail();
    } catch (IllegalArgumentException e) {
      ; // expected
    }
  }
View Full Code Here


  }
 
  @Test
  public void testValidateArgumentsWithoutQuotes() throws Exception {
    Config config = ConfigFactory.parseString("{ foo : bar, see : you.there.soon }");
    Configs configs = new Configs();
    assertEquals("bar", configs.getString(config, "foo"));
    assertEquals("you.there.soon", configs.getString(config, "see"));
    configs.validateArguments(config);   
  }
View Full Code Here

  }
 
  @Test
  public void testValidateArgumentsWithQuotes() throws Exception {
    Config config = ConfigFactory.parseString("{ foo : bar, \"see\" : \"you.there.soon.~!@#$%^&*()_+=-\" }");
    Configs configs = new Configs();
    assertEquals("bar", configs.getString(config, "foo"));
    assertEquals("you.there.soon.~!@#$%^&*()_+=-", configs.getString(config, "see"));
    configs.validateArguments(config);   
  }
View Full Code Here

    assertNameValueEquals(trimQuote(key), trimQuote(value), config);
    assertNameValueEquals2(trimQuote(key), trimQuote(value), config);
  }
 
  private void assertNameValueEquals(String key, String value, Config config) {
    for (Map.Entry<String, Object> entry : new Configs().getEntrySet(config)) {
      assertEquals(key, entry.getKey());
      assertEquals(value, entry.getValue());
    }
  }
View Full Code Here

      } else {
        this.codecFactory = CodecFactory.fromString(codec);
      }
     
      Config metadataConfig = getConfigs().getConfig(config, "metadata", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(metadataConfig)) {
        this.metadata.put(entry.getKey(), entry.getValue().toString());
      }
     
      validateArguments();
    }
View Full Code Here

 
  private final Set<Map.Entry<String, Object>> entrySet;
 
  public AbstractAddValuesCommand(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
    super(builder, config, parent, child, context);     
    entrySet = new Configs().getEntrySet(config);
  }
View Full Code Here

 
  @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 \"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()));
    assertFalse(filter.matches("boo", new Timer()));
View Full Code Here

      "\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

TOP

Related Classes of com.cloudera.cdk.morphline.base.Configs

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.