Github user jtstorck commented on a diff in the pull request:
https://github.com/apache/nifi/pull/778#discussion_r73537740
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java
---
@@ -258,6 +264,28 @@ public void testURLClassLoaderGetConnection() throws
ClassNotFoundException, Mal
DriverManager.deregisterDriver(shim);
}
+ @Test
+ public void testPropertiesUseVariableRegistry() throws
InitializationException, SQLException {
+ final VariableRegistry variableRegistry =
mock(VariableRegistry.class);
+
given(variableRegistry.getVariableValue("databaseurl")).willReturn("jdbc:derby:"
+ DB_LOCATION + ";create=true");
+
given(variableRegistry.getVariableValue("drivername")).willReturn("org.apache.derby.jdbc.EmbeddedDriver");
+
given(variableRegistry.getVariableValue("username")).willReturn("tester");
+
given(variableRegistry.getVariableValue("password")).willReturn("testerp");
+
+ final TestRunner runner =
TestRunners.newTestRunner(mock(org.apache.nifi.processor.Processor.class),
variableRegistry);
+ final DBCPConnectionPool service = new DBCPConnectionPool();
+ runner.addControllerService("dbcpService", service);
+
+ runner.setProperty(service, DBCPConnectionPool.DATABASE_URL,
"${databaseurl}");
+ runner.setProperty(service, DBCPConnectionPool.DB_DRIVERNAME,
"${drivername}");
+ runner.setProperty(service, DBCPConnectionPool.DB_USER,
"${username}");
+ runner.setProperty(service, DBCPConnectionPool.DB_PASSWORD,
"${password}");
+
+ runner.enableControllerService(service);
+
+
then(variableRegistry).should(times(4)).getVariableValue(anyString());
--- End diff --
I agree. Also, one of the changes I made to the AbstractHadoopProcessor is
to enable the checking of evaluateAttributeExpressions() if the Directory
property enables EL. I'll remove the mocking usage from the tests I already
modified.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---