You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by oz...@apache.org on 2016/04/17 21:54:53 UTC

nifi git commit: NIFI-1738 - Repair logger names for ControllerStatusReportingTask

Repository: nifi
Updated Branches:
  refs/heads/master ad56f1f85 -> 1a57b37dc


NIFI-1738 - Repair logger names for ControllerStatusReportingTask

NIFI-1738 amending this commit with tests provided by @jvwing
This closes #334


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/1a57b37d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/1a57b37d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/1a57b37d

Branch: refs/heads/master
Commit: 1a57b37dc9b3d7d3cbfd41d7a7f6f152b7a6dac2
Parents: ad56f1f
Author: Hejki <he...@me.com>
Authored: Thu Apr 7 13:20:26 2016 +0200
Committer: Oleg Zhurakousky <ol...@suitcase.io>
Committed: Sun Apr 17 15:53:13 2016 -0400

----------------------------------------------------------------------
 .../ControllerStatusReportingTask.java          |  4 +-
 .../TestControllerStatusReportingTask.java      | 46 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/1a57b37d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java
index 49cb9de..7980bf3 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java
@@ -53,8 +53,8 @@ public class ControllerStatusReportingTask extends AbstractReportingTask {
             .defaultValue("true")
             .build();
 
-    private static final Logger processorLogger = LoggerFactory.getLogger(ControllerStatusReportingTask.class + ".Processors");
-    private static final Logger connectionLogger = LoggerFactory.getLogger(ControllerStatusReportingTask.class + ".Connections");
+    private static final Logger processorLogger = LoggerFactory.getLogger(ControllerStatusReportingTask.class.getName() + ".Processors");
+    private static final Logger connectionLogger = LoggerFactory.getLogger(ControllerStatusReportingTask.class.getName() + ".Connections");
 
     private static final String PROCESSOR_LINE_FORMAT_NO_DELTA = "| %1$-30.30s | %2$-36.36s | %3$-24.24s | %4$10.10s | %5$19.19s | %6$19.19s | %7$12.12s | %8$13.13s | %9$5.5s | %10$12.12s |\n";
     private static final String PROCESSOR_LINE_FORMAT_WITH_DELTA = "| %1$-30.30s | %2$-36.36s | %3$-24.24s | %4$10.10s | %5$43.43s | %6$43.43s | %7$28.28s | %8$30.30s | %9$14.14s | %10$28.28s |\n";

http://git-wip-us.apache.org/repos/asf/nifi/blob/1a57b37d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/TestControllerStatusReportingTask.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/TestControllerStatusReportingTask.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/TestControllerStatusReportingTask.java
new file mode 100644
index 0000000..30092a1
--- /dev/null
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/TestControllerStatusReportingTask.java
@@ -0,0 +1,46 @@
+/*
+ * 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.controller;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.Field;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+
+public class TestControllerStatusReportingTask {
+
+    @Test
+    public void testProcessorLoggerName() throws Exception {
+        Logger processorLogger = getLogger("processorLogger");
+        assertEquals("org.apache.nifi.controller.ControllerStatusReportingTask.Processors", processorLogger.getName());
+    }
+
+    @Test
+    public void testConnectionLoggerName() throws Exception {
+        Logger connectionLogger = getLogger("connectionLogger");
+        assertEquals("org.apache.nifi.controller.ControllerStatusReportingTask.Connections",
+                connectionLogger.getName());
+    }
+
+    private static Logger getLogger(String fieldName) throws Exception {
+        Field f = ControllerStatusReportingTask.class.getField(fieldName);
+        f.setAccessible(true);
+        return (Logger) f.get(null);
+    }
+}
\ No newline at end of file