protected ContainsAnyOf(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.entrySet = new Configs().getEntrySet(config); }
protected ContainsAnyOf(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); this.entrySet = new Configs().getEntrySet(config); }
public AbstractAddValuesCommand(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); 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())); } } }
public AbstractAddValuesCommand(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { super(builder, config, parent, child, context); 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())); } } }
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())); } } this.renderedConfig = config.root().render(); }
public Contains(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())); } } this.renderedConfig = config.root().render(); }
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())); } } this.renderedConfig = config.root().render(); }
public Contains(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())); } } this.renderedConfig = config.root().render(); }
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(); }
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(); }
public SolrLocator(Config config, MorphlineContext context) { this(context); this.config = config; Configs configs = new Configs(); collectionName = configs.getString(config, "collection", null); zkHost = configs.getString(config, "zkHost", null); solrHomeDir = configs.getString(config, "solrHomeDir", null); solrUrl = configs.getString(config, "solrUrl", null); batchSize = configs.getInt(config, "batchSize", batchSize); LOG.trace("Constructed solrLocator: {}", this); configs.validateArguments(config); }
public SolrLocator(Config config, MorphlineContext context) { this(context); this.config = config; Configs configs = new Configs(); collectionName = configs.getString(config, "collection", null); zkHost = configs.getString(config, "zkHost", null); solrHomeDir = configs.getString(config, "solrHomeDir", null); solrUrl = configs.getString(config, "solrUrl", null); batchSize = configs.getInt(config, "batchSize", batchSize); LOG.trace("Constructed solrLocator: {}", this); configs.validateArguments(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()); } }
@Test public void testEmptyStringThrowsSyntaxError() throws Exception { Config config = ConfigFactory.parseString("foo : \"\""); try { new Configs().getTimeUnit(config, "foo"); fail(); } catch (IllegalArgumentException e) { ; // expected } }
@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); }
@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())); }
@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); }
@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); }
@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()); assertTrue(pattern.matcher("2007-03-01T13:00:00+01").matches()); assertFalse(pattern.matcher("2007-03-01T13:00:00Z+01:00").matches()); }
@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()); assertTrue(pattern.matcher("2007-03-01T13:00:00+01").matches()); assertFalse(pattern.matcher("2007-03-01T13:00:00Z+01:00").matches()); }