NIFI-633 removing dependency on nifi-framework, creating MockProcessorLogger

This commit is contained in:
danbress 2015-06-03 07:11:25 -04:00
parent c0570fb395
commit fa7aa80891
5 changed files with 172 additions and 10 deletions

View File

@ -30,10 +30,6 @@
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-properties</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-framework-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-processor-utils</artifactId>

View File

@ -19,7 +19,6 @@ package org.apache.nifi.documentation.mock;
import org.apache.nifi.controller.ControllerServiceInitializationContext;
import org.apache.nifi.controller.ControllerServiceLookup;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.SimpleProcessLogger;
/**
* A Mock ControllerServiceInitializationContext so that ControllerServices can
@ -41,7 +40,7 @@ public class MockControllerServiceInitializationContext implements ControllerSer
@Override
public ComponentLog getLogger() {
return new SimpleProcessLogger(getIdentifier(), getIdentifier());
return new MockProcessorLogger();
}
}

View File

@ -19,7 +19,6 @@ package org.apache.nifi.documentation.mock;
import org.apache.nifi.controller.ControllerServiceLookup;
import org.apache.nifi.logging.ProcessorLog;
import org.apache.nifi.processor.ProcessorInitializationContext;
import org.apache.nifi.processor.SimpleProcessLogger;
/**
* A Mock ProcessorInitializationContext that can be used so that Processors can
@ -36,7 +35,7 @@ public class MockProcessorInitializationContext implements ProcessorInitializati
@Override
public ProcessorLog getLogger() {
return new SimpleProcessLogger(getIdentifier(), getIdentifier());
return new MockProcessorLogger();
}
@Override

View File

@ -0,0 +1,169 @@
/*
* 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.documentation.mock;
import org.apache.nifi.logging.ProcessorLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Stubs out the functionality of a ProcessorLog/ComponentLog so that it can
* be used during initialization of a component.
*
*/
public class MockProcessorLogger implements ProcessorLog {
private static final Logger logger = LoggerFactory
.getLogger(MockProcessorLogger.class);
@Override
public void warn(String msg, Throwable t) {
logger.warn(msg, t);
}
@Override
public void warn(String msg, Object[] os) {
logger.warn(msg, os);
}
@Override
public void warn(String msg, Object[] os, Throwable t) {
logger.warn(msg, os);
logger.warn("", t);
}
@Override
public void warn(String msg) {
logger.warn(msg);
}
@Override
public void trace(String msg, Throwable t) {
logger.trace(msg, t);
}
@Override
public void trace(String msg, Object[] os) {
logger.trace(msg, os);
}
@Override
public void trace(String msg) {
logger.trace(msg);
}
@Override
public void trace(String msg, Object[] os, Throwable t) {
logger.trace(msg, os);
logger.trace("", t);
}
@Override
public boolean isWarnEnabled() {
return logger.isWarnEnabled();
}
@Override
public boolean isTraceEnabled() {
return logger.isTraceEnabled();
}
@Override
public boolean isInfoEnabled() {
return logger.isInfoEnabled();
}
@Override
public boolean isErrorEnabled() {
return logger.isErrorEnabled();
}
@Override
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
}
@Override
public void info(String msg, Throwable t) {
logger.info(msg, t);
}
@Override
public void info(String msg, Object[] os) {
logger.info(msg, os);
}
@Override
public void info(String msg) {
logger.info(msg);
}
@Override
public void info(String msg, Object[] os, Throwable t) {
logger.trace(msg, os);
logger.trace("", t);
}
@Override
public String getName() {
return logger.getName();
}
@Override
public void error(String msg, Throwable t) {
logger.error(msg, t);
}
@Override
public void error(String msg, Object[] os) {
logger.error(msg, os);
}
@Override
public void error(String msg) {
logger.error(msg);
}
@Override
public void error(String msg, Object[] os, Throwable t) {
logger.error(msg, os);
logger.error("", t);
}
@Override
public void debug(String msg, Throwable t) {
logger.debug(msg, t);
}
@Override
public void debug(String msg, Object[] os) {
logger.debug(msg, os);
}
@Override
public void debug(String msg, Object[] os, Throwable t) {
logger.debug(msg, os);
logger.debug("", t);
}
@Override
public void debug(String msg) {
logger.debug(msg);
}
}

View File

@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.nifi.controller.ControllerServiceLookup;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.SimpleProcessLogger;
import org.apache.nifi.reporting.ReportingInitializationContext;
import org.apache.nifi.scheduling.SchedulingStrategy;
@ -63,6 +62,6 @@ public class MockReportingInitializationContext implements ReportingInitializati
@Override
public ComponentLog getLogger() {
return new SimpleProcessLogger(getIdentifier(), getIdentifier());
return new MockProcessorLogger();
}
}