[
https://issues.apache.org/jira/browse/NIFI-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15402417#comment-15402417
]
ASF GitHub Bot commented on NIFI-2208:
--------------------------------------
Github user YolandaMDavis commented on a diff in the pull request:
https://github.com/apache/nifi/pull/754#discussion_r73013984
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/util/TestFileBasedVariableRegistry.java
---
@@ -0,0 +1,45 @@
+/*
+ * 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.nifi.util;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import org.apache.nifi.registry.VariableDescriptor;
+import org.apache.nifi.registry.VariableRegistry;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+public class TestFileBasedVariableRegistry {
+
+ @Test
+ public void testCreateCustomVariableRegistry() {
+ final Path fooPath =
Paths.get("src/test/resources/TestVariableRegistry/foobar.properties");
+ final Path testPath =
Paths.get("src/test/resources/TestVariableRegistry/test.properties");
+ Path[] paths = {fooPath, testPath};
+ final String vendorUrl = System.getProperty("java.vendor.url");
+ VariableRegistry variableRegistry = new
FileBasedVariableRegistry(paths);
+ final Map<VariableDescriptor, String> variables =
variableRegistry.getVariableMap();
+ assertTrue(variables.containsKey(new
VariableDescriptor("fake.property.3")));
+ assertEquals(vendorUrl,
variableRegistry.getVariableValue("java.vendor.url"));
+ assertEquals("test me out 3, test me out 4",
variableRegistry.getVariableValue("fake.property.3"));
+ }
--- End diff --
Just would recommend some negative tests e.g. file doesn't exist no errors
> Support Custom Properties in Expression Language - 1.x baseline
> ---------------------------------------------------------------
>
> Key: NIFI-2208
> URL: https://issues.apache.org/jira/browse/NIFI-2208
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Mark Payne
> Assignee: Yolanda M. Davis
> Priority: Blocker
> Fix For: 1.0.0
>
>
> NIFI-1974 addressed this for the 0.x baseline but the PR does not apply
> cleanly to the 1.x baseline. Creating a separate JIRA for 1.x so that we can
> close out NIFI-1974 since 0.7.0 is ready to be released.
> The VariableRegistry is:
> - User defined properties
> - System Properties (at startup)
> - OS Environment Variables (at startup)
> Then for substitution the values can be replaced using the following logic in
> the following order
> 1) Any supplied attribute maps (in order)
> 2) If flow file supplied then its properties
> 3) If flow file supplied then its attributes
> 4) Variable Registry (and its ordering as shown above).
> Finally the following processor properties should be enabled to support
> expression language:
> Put HDFS/Get HDFS/List HDFS
> - Directory property
> ConsumeJMS/PublishJMS
> - Destination Name property
> MS Connection Factory Provider
> -MQ ConnectionFactory Implementation (fqn classname)
> -MQ client library path
> -Broker URI
> DBCP Connection Pool:
> -Database Connection URL
> -Database Driver Class Name
> -DB Driver jar url
> -DB username
> -DB password
> ConvertCSVToAvro
> -add EL support for the following property
> -csv charset
> -and below...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)