mirror of https://github.com/apache/nifi.git
NIFI-1738 - Repair logger names for ControllerStatusReportingTask
NIFI-1738 amending this commit with tests provided by @jvwing This closes #334
This commit is contained in:
parent
ad56f1f853
commit
1a57b37dc9
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue