NIFI-1376 Fixed checkstyle errors

This commit is contained in:
Richard Miskin 2016-01-09 22:15:00 +00:00 committed by Mark Payne
parent 13c6aeec95
commit 43b4cb728a
5 changed files with 46 additions and 17 deletions

View File

@ -7,15 +7,31 @@ import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.Marker; import org.slf4j.Marker;
/*
* 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.
*/
/** /**
* Implementation of SLF4J logger that records every log message and provides a mechanism * Implementation of SLF4J logger that records every log message and provides a mechanism
* to retrieve them. * to retrieve them.
* *
*/ */
public class CapturingLogger implements Logger { public class CapturingLogger implements Logger {
private final Logger logger; private final Logger logger;
private List<LogMessage> traceMessages = new ArrayList<>(); private List<LogMessage> traceMessages = new ArrayList<>();
private List<LogMessage> debugMessages = new ArrayList<>(); private List<LogMessage> debugMessages = new ArrayList<>();
private List<LogMessage> infoMessages = new ArrayList<>(); private List<LogMessage> infoMessages = new ArrayList<>();
@ -40,7 +56,7 @@ public class CapturingLogger implements Logger {
public List<LogMessage> getErrorMessages() { public List<LogMessage> getErrorMessages() {
return Collections.unmodifiableList(errorMessages); return Collections.unmodifiableList(errorMessages);
} }
@Override @Override
public String getName() { public String getName() {
return logger.getName(); return logger.getName();
@ -191,8 +207,6 @@ public class CapturingLogger implements Logger {
logger.debug(marker, msg, t); logger.debug(marker, msg, t);
} }
// INFO // INFO
@Override @Override
public boolean isInfoEnabled() { public boolean isInfoEnabled() {

View File

@ -1,3 +1,19 @@
/*
* 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; package org.apache.nifi.util;
import org.slf4j.Marker; import org.slf4j.Marker;
@ -13,7 +29,7 @@ public class LogMessage {
this.throwable = t; this.throwable = t;
this.args = args; this.args = args;
} }
public Marker getMarker() { public Marker getMarker() {
return marker; return marker;
} }

View File

@ -31,35 +31,35 @@ public class MockProcessorLog implements ProcessorLog {
this.logger = new CapturingLogger(LoggerFactory.getLogger(component.getClass())); this.logger = new CapturingLogger(LoggerFactory.getLogger(component.getClass()));
this.component = component; this.component = component;
} }
/** /**
* @return a {@link List} of all TRACE level messages recorded by this {@link Logger}. * @return a {@link List} of all TRACE level messages recorded by this {@link Logger}.
*/ */
public List<LogMessage> getTraceMessages() { public List<LogMessage> getTraceMessages() {
return logger.getTraceMessages(); return logger.getTraceMessages();
} }
/** /**
* @return a {@link List} of all DEBUG level messages recorded by this {@link Logger}. * @return a {@link List} of all DEBUG level messages recorded by this {@link Logger}.
*/ */
public List<LogMessage> getDebugMessages() { public List<LogMessage> getDebugMessages() {
return logger.getDebugMessages(); return logger.getDebugMessages();
} }
/** /**
* @return a {@link List} of all INFO level messages recorded by this {@link Logger}. * @return a {@link List} of all INFO level messages recorded by this {@link Logger}.
*/ */
public List<LogMessage> getInfoMessages() { public List<LogMessage> getInfoMessages() {
return logger.getInfoMessages(); return logger.getInfoMessages();
} }
/** /**
* @return a {@link List} of all WARN level messages recorded by this {@link Logger}. * @return a {@link List} of all WARN level messages recorded by this {@link Logger}.
*/ */
public List<LogMessage> getWarnMessages() { public List<LogMessage> getWarnMessages() {
return logger.getWarnMessages(); return logger.getWarnMessages();
} }
/** /**
* @return a {@link List} of all ERROR level messages recorded by this {@link Logger}. * @return a {@link List} of all ERROR level messages recorded by this {@link Logger}.
*/ */

View File

@ -62,7 +62,6 @@ import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.controller.queue.QueueSize; import org.apache.nifi.controller.queue.QueueSize;
import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.ProcessSessionFactory; import org.apache.nifi.processor.ProcessSessionFactory;
import org.apache.nifi.processor.Processor; import org.apache.nifi.processor.Processor;
import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.Relationship;
@ -771,13 +770,13 @@ public class StandardProcessorTestRunner implements TestRunner {
public void clearProvenanceEvents() { public void clearProvenanceEvents() {
sharedState.clearProvenanceEvents(); sharedState.clearProvenanceEvents();
} }
public MockProcessorLog getLogger() { public MockProcessorLog getLogger() {
return logger; return logger;
} }
public MockProcessorLog getControllerServiceLogger(final String identifier) { public MockProcessorLog getControllerServiceLogger(final String identifier) {
return controllerServiceLoggers.get(identifier); return controllerServiceLoggers.get(identifier);
} }
} }

View File

@ -824,7 +824,7 @@ public interface TestRunner {
* Clears the Provenance Events that have been emitted by the Processor * Clears the Provenance Events that have been emitted by the Processor
*/ */
void clearProvenanceEvents(); void clearProvenanceEvents();
/** /**
* Returns the {@link MockProcessorLog} that is used by the Processor under test. * Returns the {@link MockProcessorLog} that is used by the Processor under test.
* @return the logger * @return the logger
@ -833,7 +833,7 @@ public interface TestRunner {
/** /**
* Returns the {@link MockProcessorLog} that is used by the specified controller service. * Returns the {@link MockProcessorLog} that is used by the specified controller service.
* *
* @param identifier a controller service identifier * @param identifier a controller service identifier
* @return the logger * @return the logger
*/ */