Package org.kitesdk.morphline.base

Examples of org.kitesdk.morphline.base.Configs


      "\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 }" +
      "\n }}";

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

      "\n }" +
      "\n }}";

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

public class GrokDictionaryTest extends Assert {

  @Test
  public void testGrokISO8601() {
    String str = "{ dictionaryFiles : [target/test-classes/grok-dictionaries/grok-patterns] }";
    GrokDictionaries dicts = new GrokDictionaries(ConfigFactory.parseString(str), new Configs());
    Pattern pattern = dicts.compileExpression("%{TIMESTAMP_ISO8601:timestamp}");
    assertTrue(pattern.matcher("2007-03-01T13:00:00").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00Z").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00+01:00").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00+0100").matches());
View Full Code Here

  }

  @Test
  public void testResourceLoad() {
    String str = "{ dictionaryResources : [grok-dictionaries/grok-patterns] }";
    GrokDictionaries dicts = new GrokDictionaries(ConfigFactory.parseString(str), new Configs());
    Pattern pattern = dicts.compileExpression("%{TIMESTAMP_ISO8601:timestamp}");
    assertTrue(pattern.matcher("2007-03-01T13:00:00").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00Z").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00+01:00").matches());
    assertTrue(pattern.matcher("2007-03-01T13:00:00+0100").matches());
View Full Code Here

   
    public Translate(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);     
      this.fieldName = getConfigs().getString(config, "field");
      Config dict = getConfigs().getConfig(config, "dictionary");
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(dict)) {
        dictionary.put(entry.getKey(), entry.getValue());
      }
      this.fallback = getConfigs().getString(config, "fallback", null);
      validateArguments();
    }
View Full Code Here

      for (String capture : getConfigs().getStringList(config, ExtractingParams.CAPTURE_ELEMENTS, Collections.<String>emptyList())) {
        cellParams.put(ExtractingParams.CAPTURE_ELEMENTS, capture);
      }
      Config fmapConfig = getConfigs().getConfig(config, "fmap", null);
      if (fmapConfig != null) {
        for (Map.Entry<String, Object> entry : new Configs().getEntrySet(fmapConfig)) {
          cellParams.put(ExtractingParams.MAP_PREFIX + entry.getKey(), entry.getValue().toString());
        }
      }
      String captureAttributes = getConfigs().getString(config, ExtractingParams.CAPTURE_ATTRIBUTES, null);
      if (captureAttributes != null) {
View Full Code Here

      TimeUnit defaultDurationUnit = getConfigs().getTimeUnit(config, "defaultDurationUnit", TimeUnit.MILLISECONDS);
      TimeUnit defaultRateUnit = getConfigs().getTimeUnit(config, "defaultRateUnit", TimeUnit.SECONDS);
     
      Map<String, TimeUnit> durationUnits =  Maps.newHashMap();
      Config durationUnitsConfig = getConfigs().getConfig(config, "durationUnits", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(durationUnitsConfig)) {
        TimeUnit unit = new Configs().getTimeUnit(entry.getValue().toString());
        durationUnits.put(entry.getKey(), unit);
      }     
      Map<String, TimeUnit> rateUnits =  Maps.newHashMap();
      Config rateUnitsConfig = getConfigs().getConfig(config, "rateUnits", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(rateUnitsConfig)) {
        TimeUnit unit = new Configs().getTimeUnit(entry.getValue().toString());
        rateUnits.put(entry.getKey(), unit);
      }           
      this.domain = getConfigs().getString(config, "domain", "metrics");     
      validateArguments();
     
View Full Code Here

    public Grok(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);
     
      GrokDictionaries dict = new GrokDictionaries(config, getConfigs());
      Config exprConfig = getConfigs().getConfig(config, "expressions", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(exprConfig)) {
        String expr = entry.getValue().toString();
        this.regexes.put(entry.getKey(), dict.compileExpression(expr).matcher(""));
      }
      this.firstKey = (regexes.size() == 0 ? null : regexes.entrySet().iterator().next().getKey());
View Full Code Here

    private final Set<Map.Entry<String, Object>> entrySet;
    private final String renderedConfig; // cached value
   
    public Equals(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);     
      this.entrySet = new Configs().getEntrySet(config);
      for (Map.Entry<String, Object> entry : entrySet) {
        if (!(entry.getValue() instanceof Collection)) {
          entry.setValue(new FieldExpression(entry.getValue().toString(), getConfig()));       
        }
      }
View Full Code Here

TOP

Related Classes of org.kitesdk.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.