mirror of https://github.com/apache/nifi.git
NIFI-1811 Renaming MockProcessorLogger to MockComponentLogger for consistency. Removing unused imports from ExecuteScript causing checkstyle failures.
This commit is contained in:
parent
372ffb8aa0
commit
1bd2cf0d09
|
@ -22,7 +22,7 @@ import org.apache.nifi.controller.ControllerService;
|
|||
import org.apache.nifi.documentation.ConfigurableComponentInitializer;
|
||||
import org.apache.nifi.documentation.mock.MockConfigurationContext;
|
||||
import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorLogger;
|
||||
import org.apache.nifi.documentation.mock.MockComponentLogger;
|
||||
import org.apache.nifi.documentation.util.ReflectionUtils;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
|
@ -49,7 +49,7 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia
|
|||
try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||
ControllerService controllerService = (ControllerService) component;
|
||||
|
||||
final ComponentLog logger = new MockProcessorLogger();
|
||||
final ComponentLog logger = new MockComponentLogger();
|
||||
final MockConfigurationContext context = new MockConfigurationContext();
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, controllerService, logger, context);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.nifi.components.ConfigurableComponent;
|
|||
import org.apache.nifi.documentation.ConfigurableComponentInitializer;
|
||||
import org.apache.nifi.documentation.mock.MockProcessContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorInitializationContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorLogger;
|
||||
import org.apache.nifi.documentation.mock.MockComponentLogger;
|
||||
import org.apache.nifi.documentation.util.ReflectionUtils;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
|
@ -47,7 +47,7 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
|
|||
Processor processor = (Processor) component;
|
||||
try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||
|
||||
final ComponentLog logger = new MockProcessorLogger();
|
||||
final ComponentLog logger = new MockComponentLogger();
|
||||
final MockProcessContext context = new MockProcessContext();
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, processor, logger, context);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.nifi.annotation.lifecycle.OnShutdown;
|
|||
import org.apache.nifi.components.ConfigurableComponent;
|
||||
import org.apache.nifi.documentation.ConfigurableComponentInitializer;
|
||||
import org.apache.nifi.documentation.mock.MockConfigurationContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorLogger;
|
||||
import org.apache.nifi.documentation.mock.MockComponentLogger;
|
||||
import org.apache.nifi.documentation.mock.MockReportingInitializationContext;
|
||||
import org.apache.nifi.documentation.util.ReflectionUtils;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
|
@ -48,7 +48,7 @@ public class ReportingTaskingInitializer implements ConfigurableComponentInitial
|
|||
try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||
|
||||
final MockConfigurationContext context = new MockConfigurationContext();
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, reportingTask, new MockProcessorLogger(), context);
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, reportingTask, new MockComponentLogger(), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,14 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Stubs out the functionality of a ProcessorLog/ComponentLog so that it can
|
||||
* Stubs out the functionality of a ComponentLog so that it can
|
||||
* be used during initialization of a component.
|
||||
*
|
||||
*/
|
||||
public class MockProcessorLogger implements ComponentLog {
|
||||
public class MockComponentLogger implements ComponentLog {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(MockProcessorLogger.class);
|
||||
.getLogger(MockComponentLogger.class);
|
||||
|
||||
@Override
|
||||
public void warn(String msg, Throwable t) {
|
|
@ -41,7 +41,7 @@ public class MockControllerServiceInitializationContext implements ControllerSer
|
|||
|
||||
@Override
|
||||
public ComponentLog getLogger() {
|
||||
return new MockProcessorLogger();
|
||||
return new MockComponentLogger();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MockProcessorInitializationContext implements ProcessorInitializati
|
|||
|
||||
@Override
|
||||
public ComponentLog getLogger() {
|
||||
return new MockProcessorLogger();
|
||||
return new MockComponentLogger();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,6 +62,6 @@ public class MockReportingInitializationContext implements ReportingInitializati
|
|||
|
||||
@Override
|
||||
public ComponentLog getLogger() {
|
||||
return new MockProcessorLogger();
|
||||
return new MockComponentLogger();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -990,11 +990,11 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R
|
|||
Thread.currentThread().setContextClassLoader(detectedClassLoaderForType);
|
||||
final Class<? extends Processor> processorClass = rawClass.asSubclass(Processor.class);
|
||||
processor = processorClass.newInstance();
|
||||
final ComponentLog processorLogger = new SimpleProcessLogger(identifier, processor);
|
||||
final ProcessorInitializationContext ctx = new StandardProcessorInitializationContext(identifier, processorLogger, this);
|
||||
final ComponentLog componentLogger = new SimpleProcessLogger(identifier, processor);
|
||||
final ProcessorInitializationContext ctx = new StandardProcessorInitializationContext(identifier, componentLogger, this);
|
||||
processor.initialize(ctx);
|
||||
|
||||
LogRepositoryFactory.getRepository(identifier).setLogger(processorLogger);
|
||||
LogRepositoryFactory.getRepository(identifier).setLogger(componentLogger);
|
||||
return processor;
|
||||
} catch (final Throwable t) {
|
||||
throw new ProcessorInstantiationException(type, t);
|
||||
|
|
|
@ -26,9 +26,9 @@ public class StandardProcessorInitializationContext implements ProcessorInitiali
|
|||
private final ComponentLog logger;
|
||||
private final ControllerServiceProvider serviceProvider;
|
||||
|
||||
public StandardProcessorInitializationContext(final String identifier, final ComponentLog processorLog, final ControllerServiceProvider serviceProvider) {
|
||||
public StandardProcessorInitializationContext(final String identifier, final ComponentLog componentLog, final ControllerServiceProvider serviceProvider) {
|
||||
this.identifier = identifier;
|
||||
this.logger = processorLog;
|
||||
this.logger = componentLog;
|
||||
this.serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,28 +16,6 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.hive;
|
||||
|
||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
|
||||
import org.apache.nifi.annotation.behavior.WritesAttribute;
|
||||
import org.apache.nifi.annotation.behavior.WritesAttributes;
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.dbcp.hive.HiveDBCPService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
import org.apache.nifi.processor.io.OutputStreamCallback;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
import org.apache.nifi.util.LongHolder;
|
||||
import org.apache.nifi.util.StopWatch;
|
||||
import org.apache.nifi.util.hive.HiveJdbcCommon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.sql.Connection;
|
||||
|
@ -51,6 +29,28 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
|
||||
import org.apache.nifi.annotation.behavior.WritesAttribute;
|
||||
import org.apache.nifi.annotation.behavior.WritesAttributes;
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.dbcp.hive.HiveDBCPService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
import org.apache.nifi.processor.io.OutputStreamCallback;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
import org.apache.nifi.util.LongHolder;
|
||||
import org.apache.nifi.util.StopWatch;
|
||||
import org.apache.nifi.util.hive.HiveJdbcCommon;
|
||||
|
||||
@EventDriven
|
||||
@InputRequirement(Requirement.INPUT_ALLOWED)
|
||||
@Tags({"hive", "sql", "select", "jdbc", "query", "database"})
|
||||
|
@ -149,7 +149,7 @@ public class SelectHiveQL extends AbstractHiveQLProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final HiveDBCPService dbcpService = context.getProperty(HIVE_DBCP_SERVICE).asControllerService(HiveDBCPService.class);
|
||||
final String selectQuery = context.getProperty(HIVEQL_SELECT_QUERY).evaluateAttributeExpressions(fileToProcess).getValue();
|
||||
final String outputFormat = context.getProperty(HIVEQL_OUTPUT_FORMAT).getValue();
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.kafka.clients.producer.Producer;
|
|||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.apache.kafka.clients.producer.RecordMetadata;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.stream.io.util.StreamDemarcator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -48,7 +48,7 @@ class KafkaPublisher implements Closeable {
|
|||
|
||||
private volatile long ackWaitTime = 30000;
|
||||
|
||||
private volatile ProcessorLog processLog;
|
||||
private volatile ComponentLog processLog;
|
||||
|
||||
/**
|
||||
* Creates an instance of this class as well as the instance of the
|
||||
|
@ -177,10 +177,10 @@ class KafkaPublisher implements Closeable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Will set {@link ProcessorLog} as an additional logger to forward log
|
||||
* Will set {@link ComponentLog} as an additional logger to forward log
|
||||
* messages to NiFi bulletin
|
||||
*/
|
||||
void setProcessLog(ProcessorLog processLog) {
|
||||
void setProcessLog(ComponentLog processLog) {
|
||||
this.processLog = processLog;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -50,7 +50,7 @@ import org.junit.Test;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
public class AbstractKafkaProcessorLifecycelTest {
|
||||
public class AbstractKafkaProcessorLifecycleTest {
|
||||
|
||||
private final static Random random = new Random();
|
||||
|
||||
|
@ -422,7 +422,7 @@ public class AbstractKafkaProcessorLifecycelTest {
|
|||
try {
|
||||
Field loggerField = AbstractSessionFactoryProcessor.class.getDeclaredField("logger");
|
||||
loggerField.setAccessible(true);
|
||||
loggerField.set(this, mock(ProcessorLog.class));
|
||||
loggerField.set(this, mock(ComponentLog.class));
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
|
@ -30,8 +30,6 @@ import javax.script.ScriptException;
|
|||
import javax.script.SimpleBindings;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.annotation.behavior.DynamicProperty;
|
||||
import org.apache.nifi.annotation.behavior.TriggerSerially;
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -57,13 +57,13 @@ import org.apache.nifi.util.StopWatch;
|
|||
import org.apache.nifi.util.StringUtils;
|
||||
|
||||
import com.bazaarvoice.jolt.CardinalityTransform;
|
||||
import com.bazaarvoice.jolt.Shiftr;
|
||||
import com.bazaarvoice.jolt.Removr;
|
||||
import com.bazaarvoice.jolt.Chainr;
|
||||
import com.bazaarvoice.jolt.Defaultr;
|
||||
import com.bazaarvoice.jolt.JsonUtils;
|
||||
import com.bazaarvoice.jolt.Removr;
|
||||
import com.bazaarvoice.jolt.Shiftr;
|
||||
import com.bazaarvoice.jolt.Sortr;
|
||||
import com.bazaarvoice.jolt.Transform;
|
||||
import com.bazaarvoice.jolt.JsonUtils;
|
||||
|
||||
@EventDriven
|
||||
@SideEffectFree
|
||||
|
@ -175,7 +175,7 @@ public class TransformJSON extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final StopWatch stopWatch = new StopWatch(true);
|
||||
|
||||
final byte[] originalContent = new byte[(int) original.getSize()];
|
||||
|
|
Loading…
Reference in New Issue