[
https://issues.apache.org/jira/browse/METRON-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042867#comment-16042867
]
ASF GitHub Bot commented on METRON-987:
---------------------------------------
Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/609#discussion_r120921756
--- Diff:
metron-platform/metron-enrichment/src/test/java/org/apache/metron/enrichment/adapters/stellar/StellarAdapterTest.java
---
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.metron.enrichment.adapters.stellar;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.metron.common.configuration.StellarEnrichmentTest;
+import org.apache.metron.common.configuration.enrichment.EnrichmentConfig;
+import
org.apache.metron.common.configuration.enrichment.handler.ConfigHandler;
+import org.apache.metron.common.dsl.Context;
+import org.apache.metron.common.dsl.MapVariableResolver;
+import org.apache.metron.common.dsl.VariableResolver;
+import org.apache.metron.common.stellar.StellarProcessor;
+import org.apache.metron.common.utils.JSONUtils;
+import org.json.simple.JSONObject;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StellarAdapterTest extends StellarEnrichmentTest {
+ StellarProcessor processor = new StellarProcessor();
+
+ private JSONObject enrich(JSONObject message, String field,
ConfigHandler handler) {
+ VariableResolver resolver = new MapVariableResolver(message);
+ return StellarAdapter.process( message
+ , handler
+ , field
+ , 1000l
--- End diff --
Out of my personality preference, can you make this 1000L, so I don't look
at it again and think it's 10001?
> Allow stellar enrichments to be specified by a list as well as a map
> --------------------------------------------------------------------
>
> Key: METRON-987
> URL: https://issues.apache.org/jira/browse/METRON-987
> Project: Metron
> Issue Type: Improvement
> Reporter: Casey Stella
> Assignee: Casey Stella
>
> Currently, stellar enrichments are specified by a map associating fields with
> the stellar expressions associated with the fields. There is a significant
> downside here in that you cannot update previously assigned fields. For
> instance, the following cannot be represented currently:
> {code}
> "fieldMap": {
> ...
> "stellar" : {
> "config" : {
> "hostname" : "if ENDS_WITH(hostname, '.') then CHOP(hostname) else
> hostname",
> "hostname" : "TO_LOWER(hostname)"
> }
> }
> }
> {code}
> A consequent of this deficiency is that we also cannot use temporary
> variables and unset them after their use inside an enrichment group.
> The proposed change is to allow users to use lists of strings representing
> stellar expression assignments with the same syntax as the Stellar REPL.
> This would be as an alternative to maps, but the map syntax would also be
> supported for legacy.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)