public class StandardProcessorTestRunner extends Object implements TestRunner
Modifier and Type | Class and Description |
---|---|
private class |
StandardProcessorTestRunner.RunProcessor |
Modifier and Type | Field and Description |
---|---|
private MockProcessContext |
context |
private Map<String,MockProcessorLog> |
controllerServiceLoggers |
private Map<String,MockStateManager> |
controllerServiceStateManagers |
private static Set<Class<? extends Annotation>> |
deprecatedMethodAnnotations |
private static Set<Class<? extends Annotation>> |
deprecatedTypeAnnotations |
private MockFlowFileQueue |
flowFileQueue |
private AtomicLong |
idGenerator |
private AtomicInteger |
invocations |
private MockProcessorLog |
logger |
private int |
numThreads |
private Processor |
processor |
private MockStateManager |
processorStateManager |
private MockSessionFactory |
sessionFactory |
private SharedSessionState |
sharedState |
private boolean |
triggerSerially |
Constructor and Description |
---|
StandardProcessorTestRunner(Processor processor) |
Modifier and Type | Method and Description |
---|---|
void |
addConnection(Relationship relationship)
Indicates to the Framework that the configured processor has a connection for the given Relationship.
|
void |
addConnection(String relationshipName)
Indicates to the Framework that the configured processor has a connection for the
Relationship with the given name.
|
void |
addControllerService(String identifier,
ControllerService service)
Adds the given
ControllerService to this TestRunner so that the
configured Processor can access it using the given
identifier . |
void |
addControllerService(String identifier,
ControllerService service,
Map<String,String> properties)
Adds the given
ControllerService to this TestRunner so that the
configured Processor can access it using the given
identifier . |
void |
assertAllFlowFilesTransferred(Relationship relationship)
Asserts that all FlowFiles that were transferred were transferred to the
given relationship
|
void |
assertAllFlowFilesTransferred(Relationship relationship,
int count)
Asserts that all FlowFiles that were transferred were transferred to the
given relationship and that the number of FlowFiles transferred is equal
to
count |
void |
assertAllFlowFilesTransferred(String relationship)
Asserts that all FlowFiles that were transferred were transferred to the
given relationship
|
void |
assertAllFlowFilesTransferred(String relationship,
int count)
Asserts that all FlowFiles that were transferred were transferred to the
given relationship and that the number of FlowFiles transferred is equal
to
count |
void |
assertNotValid()
Assert that the currently configured set of properties/annotation data
are NOT valid
|
void |
assertNotValid(ControllerService service)
Assert that the currently configured set of properties/annotation data
are NOT valid for the given Controller Service.
|
void |
assertPenalizeCount(int count)
Assert that the number of FlowFiles that were penalized is equal to the given count
|
void |
assertQueueEmpty()
Assert that there are no FlowFiles left on the input queue.
|
void |
assertQueueNotEmpty()
Assert that there is at least one FlowFile left on the input queue.
|
void |
assertTransferCount(Relationship relationship,
int count)
Assert that the number of FlowFiles transferred to the given relationship
is equal to the given count
|
void |
assertTransferCount(String relationship,
int count)
Assert that the number of FlowFiles transferred to the given relationship
is equal to the given count
|
void |
assertValid()
Assert that the currently configured set of properties/annotation data
are valid
|
void |
assertValid(ControllerService service)
Assert that the currently configured set of properties/annotation data
are valid for the given Controller Service.
|
void |
clearProvenanceEvents()
Clears the Provenance Events that have been emitted by the Processor
|
void |
clearTransferState()
Resets the Transfer Counts that indicate how many FlowFiles have been
transferred to each Relationship and removes from memory any FlowFiles
that have been transferred to this Relationships.
|
private static void |
detectDeprecatedAnnotations(Processor processor) |
void |
disableControllerService(ControllerService service)
Marks the Controller Service as disabled so that it cannot be used by
other components.
|
void |
enableControllerService(ControllerService service)
Marks the Controller Service as enabled so that it can be used by other
components.
|
void |
enqueue(byte[] data)
Copies the content from the given byte array into memory and creates a
FlowFile from this content with no attributes and adds this FlowFile to
the Processor's Input Queue
|
void |
enqueue(byte[] data,
Map<String,String> attributes)
Copies the content from the given byte array into memory and creates a
FlowFile from this content with the given attributes and adds this
FlowFile to the Processor's Input Queue
|
void |
enqueue(FlowFile... flowFiles)
Enqueues the given FlowFiles into the Processor's input queue
|
void |
enqueue(InputStream data)
Reads the content from the given
InputStream into memory and
creates a FlowFile from this content with no attributes and adds this
FlowFile to the Processor's Input Queue |
void |
enqueue(InputStream data,
Map<String,String> attributes)
Reads the content from the given
InputStream into memory and
creates a FlowFile from this content with the given attributes and adds
this FlowFile to the Processor's Input Queue |
void |
enqueue(Path path)
Reads the content from the given
Path into memory and creates a
FlowFile from this content with no attributes and adds this FlowFile to
the Processor's Input Queue |
void |
enqueue(Path path,
Map<String,String> attributes)
Reads the content from the given
Path into memory and creates a
FlowFile from this content with the given attributes and adds this
FlowFile to the Processor's Input Queue |
void |
enqueue(String data)
Creates a FlowFile with the content set to the given string (in UTF-8 format), with no attributes,
and adds this FlowFile to the Processor's Input Queue
|
void |
enqueue(String data,
Map<String,String> attributes)
Creates a FlowFile with the content set to the given string (in UTF-8 format), with the given attributes,
and adds this FlowFile to the Processor's Input Queue
|
private ControllerServiceConfiguration |
getConfigToUpdate(ControllerService service) |
byte[] |
getContentAsByteArray(MockFlowFile flowFile)
Copies the contents of the given
MockFlowFile into a byte array
and returns that byte array. |
ControllerService |
getControllerService(String identifier) |
<T extends ControllerService> |
getControllerService(String identifier,
Class<T> serviceType) |
MockProcessorLog |
getControllerServiceLogger(String identifier)
Returns the
MockProcessorLog that is used by the specified controller service. |
Long |
getCounterValue(String name) |
List<MockFlowFile> |
getFlowFilesForRelationship(Relationship relationship)
Returns a List of FlowFiles in the order in which they were transferred
to the given relationship
|
List<MockFlowFile> |
getFlowFilesForRelationship(String relationship)
Returns a List of FlowFiles in the order in which they were transferred
to the given relationship
|
MockProcessorLog |
getLogger()
Returns the
MockProcessorLog that is used by the Processor under test. |
List<MockFlowFile> |
getPenalizedFlowFiles()
Returns a List of FlowFiles in the order in which they were transferred that were penalized
|
MockProcessContext |
getProcessContext() |
Processor |
getProcessor() |
ProcessSessionFactory |
getProcessSessionFactory() |
List<ProvenanceEventRecord> |
getProvenanceEvents()
Returns a
List of all ProvenanceEventRecord s that were
emitted by the Processor |
ProvenanceReporter |
getProvenanceReporter()
Deprecated.
The ProvenanceReporter should not be accessed through the test runner, as it does not expose the events that were emitted.
|
QueueSize |
getQueueSize() |
int |
getRemovedCount() |
MockStateManager |
getStateManager() |
MockStateManager |
getStateManager(ControllerService controllerService)
Returns the State Manager for the given Controller Service.
|
int |
getThreadCount() |
boolean |
isControllerServiceEnabled(ControllerService service) |
boolean |
isQueueEmpty() |
private static void |
populateDeprecatedMethods() |
void |
removeConnection(Relationship relationship)
Removes the connection for the given Relationship from the configured processor.
|
void |
removeConnection(String relationshipName)
Removes the connection for the relationship with the given name from the configured processor.
|
void |
removeControllerService(ControllerService service)
Removes the Controller Service from the TestRunner.
|
boolean |
removeProperty(PropertyDescriptor descriptor)
Removes the
PropertyDescriptor from the ProcessContext ,
effectively setting its value to null, or the property's default value, if it has one. |
void |
run()
Performs exactly the same operation as calling
TestRunner.run(int) with a
value of 1. |
void |
run(int iterations)
Performs the same operation as calling
TestRunner.run(int, boolean) with a
value of true |
void |
run(int iterations,
boolean stopOnFinish)
performs the same operation as calling
TestRunner.run(int, boolean, boolean)
with a value of iterations , stopOnFinish , true |
void |
run(int iterations,
boolean stopOnFinish,
boolean initialize)
This method runs the
Processor iterations times,
using the sequence of steps below:
If initialize is true, run all methods on the Processor that are
annotated with the
@OnScheduled annotation. |
void |
run(int iterations,
boolean stopOnFinish,
boolean initialize,
long runWait)
This method runs the
Processor iterations times,
using the sequence of steps below:
If initialize is true, run all methods on the Processor that are
annotated with the
@OnScheduled annotation. |
void |
setAnnotationData(ControllerService service,
String annotationData)
Sets the annontation data of the given service to the provided annotation
data.
|
void |
setAnnotationData(String annotationData)
Sets the annotation data.
|
void |
setIncomingConnection(boolean hasIncomingConnection)
Indicates to the framework that the configured processor has one or more
incoming connections.
|
void |
setNonLoopConnection(boolean hasNonLoopConnection)
Indicates to the framework that the configured processor has one or more incoming
connections for which the processor is not also the source.
|
ValidationResult |
setProperty(ControllerService service,
PropertyDescriptor property,
AllowableValue value)
Sets the given property on the given ControllerService
|
ValidationResult |
setProperty(ControllerService service,
PropertyDescriptor property,
String value)
Sets the given property on the given ControllerService
|
ValidationResult |
setProperty(ControllerService service,
String propertyName,
String value)
Sets the property with the given name on the given ControllerService
|
ValidationResult |
setProperty(PropertyDescriptor descriptor,
AllowableValue value)
Updates the value of the property with the given PropertyDescriptor to
the specified value IF and ONLY IF the value is valid according to the
descriptor's validator.
|
ValidationResult |
setProperty(PropertyDescriptor descriptor,
String value)
Updates the value of the property with the given PropertyDescriptor to
the specified value IF and ONLY IF the value is valid according to the
descriptor's validator.
|
ValidationResult |
setProperty(String propertyName,
String propertyValue)
Updates the value of the property with the given PropertyDescriptor to
the specified value IF and ONLY IF the value is valid according to the
descriptor's validator.
|
void |
setRelationshipAvailable(Relationship relationship)
Indicates to the Framework that the given Relationship should be
considered "available", meaning that the queues of all Connections that
contain this Relationship are not full.
|
void |
setRelationshipAvailable(String relationshipName)
Indicates to the Framework that the given Relationship with the given
name should be considered "available", meaning that the queues of all
Connections that contain this Relationship are not full.
|
void |
setRelationshipUnavailable(Relationship relationship)
Indicates to the Framework that the given Relationship should NOT be
considered "available", meaning that the queue of at least one Connection
that contain this Relationship is full.
|
void |
setRelationshipUnavailable(String relationshipName)
Indicates to the Framework that the Relationship with the given name
should NOT be considered "available", meaning that the queue of at least
one Connection that contain this Relationship is full.
|
void |
setThreadCount(int threadCount)
Updates the number of threads that will be used to run the Processor when
calling the
TestRunner.run() or TestRunner.run(int) methods. |
void |
setValidateExpressionUsage(boolean validate)
Specifies whether or not the TestRunner will validate the use of
Expression Language.
|
void |
shutdown()
Invokes all methods on the Processor that are annotated with the
@OnShutdown annotation. |
private final Processor processor
private final MockProcessContext context
private final MockFlowFileQueue flowFileQueue
private final MockSessionFactory sessionFactory
private final SharedSessionState sharedState
private final AtomicLong idGenerator
private final boolean triggerSerially
private final MockStateManager processorStateManager
private final Map<String,MockStateManager> controllerServiceStateManagers
private int numThreads
private final AtomicInteger invocations
private static final Set<Class<? extends Annotation>> deprecatedTypeAnnotations
private static final Set<Class<? extends Annotation>> deprecatedMethodAnnotations
private final Map<String,MockProcessorLog> controllerServiceLoggers
private final MockProcessorLog logger
StandardProcessorTestRunner(Processor processor)
private static void populateDeprecatedMethods()
private static void detectDeprecatedAnnotations(Processor processor)
public void setValidateExpressionUsage(boolean validate)
TestRunner
true
, which
means that an Exception will be thrown if the Processor attempts to
obtain the configured value of a Property without calling
evaluateAttributeExpressions
on the Property Value or if
evaluateAttributeExpressions
is called but the PropertyDescriptor indicates that the Expression
Language is not supported.
See Also:
PropertyDescriptor.Builder#expressionLanguageSupported(boolean)
setValidateExpressionUsage
in interface TestRunner
validate
- whether there is any need to validate the EL was usedpublic Processor getProcessor()
getProcessor
in interface TestRunner
Processor
for which this TestRunner
is
configuredpublic MockProcessContext getProcessContext()
getProcessContext
in interface TestRunner
TestRunner
will
use to invoke the
onTrigger
methodpublic void run()
TestRunner
TestRunner.run(int)
with a
value of 1.run
in interface TestRunner
public void run(int iterations)
TestRunner
TestRunner.run(int, boolean)
with a
value of true
run
in interface TestRunner
iterations
- number of iterationspublic void run(int iterations, boolean stopOnFinish)
TestRunner
TestRunner.run(int, boolean, boolean)
with a value of iterations
, stopOnFinish
, true
run
in interface TestRunner
iterations
- number of iterationsstopOnFinish
- flag to stop when finishedpublic void run(int iterations, boolean stopOnFinish, boolean initialize)
TestRunner
Processor
iterations
times,
using the sequence of steps below:
initialize
is true, run all methods on the Processor that are
annotated with the
@OnScheduled
annotation. If
any of these methods throws an Exception, the Unit Test will fail.
onTrigger
method to be invoked iterations
times. The number of threads
used to run these iterations is determined by the ThreadCount of this
TestRunner
. By default, the value is set to 1, but it can be
modified by calling the TestRunner.setThreadCount(int)
method.
onTrigger
,
all methods on the Processor that are annotated with the
@OnUnscheduled
annotation
are invoked. If any of these methods throws an Exception, the Unit Test
will fail.
shutdown
is true: Call all
methods on the Processor that is annotated with the
@OnStopped
annotation.
run
in interface TestRunner
iterations
- number of iterationsstopOnFinish
- whether or not to run the Processor methods that are
annotated with @OnStopped
initialize
- true if must initializepublic void run(int iterations, boolean stopOnFinish, boolean initialize, long runWait)
TestRunner
Processor
iterations
times,
using the sequence of steps below:
initialize
is true, run all methods on the Processor that are
annotated with the
@OnScheduled
annotation. If
any of these methods throws an Exception, the Unit Test will fail.
onTrigger
method to be invoked iterations
times. The number of threads
used to run these iterations is determined by the ThreadCount of this
TestRunner
. By default, the value is set to 1, but it can be
modified by calling the TestRunner.setThreadCount(int)
method.
onTrigger
,
all methods on the Processor that are annotated with the
@OnUnscheduled
annotation
are invoked. If any of these methods throws an Exception, the Unit Test
will fail.
shutdown
is true: Call all
methods on the Processor that is annotated with the
@OnStopped
annotation.
run
in interface TestRunner
iterations
- number of iterationsstopOnFinish
- whether or not to run the Processor methods that are
annotated with @OnStopped
initialize
- true if must initializerunWait
- indicates the amount of time in milliseconds that the framework should wait for
processors to stop running before calling the @OnUnscheduled
annotationpublic void shutdown()
TestRunner
@OnShutdown
annotation. If
any of these methods throws an Exception, the Unit Test will failshutdown
in interface TestRunner
public ProcessSessionFactory getProcessSessionFactory()
getProcessSessionFactory
in interface TestRunner
ProcessSessionFactory
that this
TestRunner
will use to invoke the
Processor.onTrigger(ProcessContext, ProcessSessionFactory)
methodpublic void assertAllFlowFilesTransferred(String relationship)
TestRunner
assertAllFlowFilesTransferred
in interface TestRunner
relationship
- to verifypublic void assertAllFlowFilesTransferred(Relationship relationship)
TestRunner
assertAllFlowFilesTransferred
in interface TestRunner
relationship
- to verifypublic void assertAllFlowFilesTransferred(String relationship, int count)
TestRunner
count
assertAllFlowFilesTransferred
in interface TestRunner
relationship
- to verifycount
- number of expected transferspublic void assertAllFlowFilesTransferred(Relationship relationship, int count)
TestRunner
count
assertAllFlowFilesTransferred
in interface TestRunner
relationship
- to verifycount
- number of expected transferspublic void assertTransferCount(Relationship relationship, int count)
TestRunner
assertTransferCount
in interface TestRunner
relationship
- to verifycount
- number of expected transferspublic void assertTransferCount(String relationship, int count)
TestRunner
assertTransferCount
in interface TestRunner
relationship
- to verifycount
- number of expected transferspublic void assertPenalizeCount(int count)
TestRunner
assertPenalizeCount
in interface TestRunner
count
- number of expected penalizedpublic void assertValid()
TestRunner
assertValid
in interface TestRunner
public void assertNotValid()
TestRunner
assertNotValid
in interface TestRunner
public boolean isQueueEmpty()
isQueueEmpty
in interface TestRunner
true
if the Input Queue to the Processor is empty,
false
otherwisepublic void assertQueueEmpty()
TestRunner
assertQueueEmpty
in interface TestRunner
public void assertQueueNotEmpty()
TestRunner
assertQueueNotEmpty
in interface TestRunner
public void clearTransferState()
TestRunner
run
if the output is
to be examined after each run.clearTransferState
in interface TestRunner
public void enqueue(FlowFile... flowFiles)
TestRunner
enqueue
in interface TestRunner
flowFiles
- to enqueuepublic void enqueue(Path path) throws IOException
TestRunner
Path
into memory and creates a
FlowFile from this content with no attributes and adds this FlowFile to
the Processor's Input Queueenqueue
in interface TestRunner
path
- to read content fromIOException
- if unable to read contentpublic void enqueue(Path path, Map<String,String> attributes) throws IOException
TestRunner
Path
into memory and creates a
FlowFile from this content with the given attributes and adds this
FlowFile to the Processor's Input Queueenqueue
in interface TestRunner
path
- to read content fromattributes
- attributes to use for new flow fileIOException
- if unable to read contentpublic void enqueue(byte[] data)
TestRunner
enqueue
in interface TestRunner
data
- to enqueuepublic void enqueue(String data)
TestRunner
enqueue
in interface TestRunner
data
- to enqueuepublic void enqueue(byte[] data, Map<String,String> attributes)
TestRunner
enqueue
in interface TestRunner
data
- to enqueueattributes
- to use for enqueued itempublic void enqueue(String data, Map<String,String> attributes)
TestRunner
enqueue
in interface TestRunner
data
- to enqueueattributes
- to use for enqueued itempublic void enqueue(InputStream data)
TestRunner
InputStream
into memory and
creates a FlowFile from this content with no attributes and adds this
FlowFile to the Processor's Input Queueenqueue
in interface TestRunner
data
- to source data frompublic void enqueue(InputStream data, Map<String,String> attributes)
TestRunner
InputStream
into memory and
creates a FlowFile from this content with the given attributes and adds
this FlowFile to the Processor's Input Queueenqueue
in interface TestRunner
data
- source of dataattributes
- to use for flow filespublic byte[] getContentAsByteArray(MockFlowFile flowFile)
TestRunner
MockFlowFile
into a byte array
and returns that byte array.getContentAsByteArray
in interface TestRunner
flowFile
- to get content forpublic List<MockFlowFile> getFlowFilesForRelationship(String relationship)
TestRunner
getFlowFilesForRelationship
in interface TestRunner
relationship
- to get flowfiles forpublic List<MockFlowFile> getFlowFilesForRelationship(Relationship relationship)
TestRunner
getFlowFilesForRelationship
in interface TestRunner
relationship
- to get flowfiles forpublic List<MockFlowFile> getPenalizedFlowFiles()
TestRunner
getPenalizedFlowFiles
in interface TestRunner
@Deprecated public ProvenanceReporter getProvenanceReporter()
getProvenanceReporter
in interface TestRunner
ProvenanceReporter
that will be used by the
configured Processor
for reporting Provenance Eventspublic QueueSize getQueueSize()
getQueueSize
in interface TestRunner
public Long getCounterValue(String name)
getCounterValue
in interface TestRunner
name
- of counterpublic int getRemovedCount()
getRemovedCount
in interface TestRunner
public void setAnnotationData(String annotationData)
TestRunner
setAnnotationData
in interface TestRunner
annotationData
- datapublic ValidationResult setProperty(String propertyName, String propertyValue)
TestRunner
setProperty
in interface TestRunner
propertyName
- namepropertyValue
- valuepublic ValidationResult setProperty(PropertyDescriptor descriptor, String value)
TestRunner
setProperty
in interface TestRunner
descriptor
- descriptorvalue
- valuepublic ValidationResult setProperty(PropertyDescriptor descriptor, AllowableValue value)
TestRunner
setProperty
in interface TestRunner
descriptor
- descriptorvalue
- allowable valupublic void setThreadCount(int threadCount)
TestRunner
TestRunner.run()
or TestRunner.run(int)
methods.setThreadCount
in interface TestRunner
threadCount
- num threadspublic int getThreadCount()
getThreadCount
in interface TestRunner
TestRunner.run()
or TestRunner.run(int)
methodspublic void setRelationshipAvailable(Relationship relationship)
TestRunner
TriggerWhenAnyDestinationAvailable
annotation.setRelationshipAvailable
in interface TestRunner
relationship
- to mark as availablepublic void setRelationshipAvailable(String relationshipName)
TestRunner
TriggerWhenAnyDestinationAvailable
setRelationshipAvailable
in interface TestRunner
relationshipName
- relationship namepublic void setRelationshipUnavailable(Relationship relationship)
TestRunner
TriggerWhenAnyDestinationAvailable
annotation.setRelationshipUnavailable
in interface TestRunner
relationship
- to mark as unavailablepublic void setRelationshipUnavailable(String relationshipName)
TestRunner
TriggerWhenAnyDestinationAvailable
setRelationshipUnavailable
in interface TestRunner
relationshipName
- name of relationship.public void setIncomingConnection(boolean hasIncomingConnection)
TestRunner
setIncomingConnection
in interface TestRunner
hasIncomingConnection
- whether or not the configured processor should behave as though it has an incoming connectionpublic void setNonLoopConnection(boolean hasNonLoopConnection)
TestRunner
setNonLoopConnection
in interface TestRunner
hasNonLoopConnection
- whether or not the configured processor should behave as though it has a non-looping incoming connectionpublic void addConnection(Relationship relationship)
TestRunner
addConnection
in interface TestRunner
relationship
- that has a connectionpublic void addConnection(String relationshipName)
TestRunner
addConnection
in interface TestRunner
relationshipName
- name of relationship that has a connectionpublic void removeConnection(Relationship relationship)
TestRunner
removeConnection
in interface TestRunner
relationship
- to removepublic void removeConnection(String relationshipName)
TestRunner
removeConnection
in interface TestRunner
relationshipName
- name of the relationship to removepublic void addControllerService(String identifier, ControllerService service) throws InitializationException
TestRunner
ControllerService
to this TestRunner so that the
configured Processor can access it using the given
identifier
. The ControllerService is not expected to be
initialized, as the framework will create the appropriate
ControllerServiceInitializationContext
and initialize the ControllerService with no specified properties.
This will call any method on the given Controller Service that is
annotated with the
@OnAdded
annotation.addControllerService
in interface TestRunner
identifier
- of serviceservice
- the serviceInitializationException
- iepublic void addControllerService(String identifier, ControllerService service, Map<String,String> properties) throws InitializationException
TestRunner
ControllerService
to this TestRunner so that the
configured Processor can access it using the given
identifier
. The ControllerService is not expected to be
initialized, as the framework will create the appropriate
ControllerServiceInitializationContext
and initialize the ControllerService with the given properties.
This will call any method on the given Controller Service that is
annotated with the
@OnAdded
annotation.addControllerService
in interface TestRunner
identifier
- of serviceservice
- the serviceproperties
- service propertiesInitializationException
- iepublic void assertNotValid(ControllerService service)
TestRunner
assertNotValid
in interface TestRunner
service
- the service to validatepublic void assertValid(ControllerService service)
TestRunner
assertValid
in interface TestRunner
service
- the service to validatepublic void disableControllerService(ControllerService service)
TestRunner
Marks the Controller Service as disabled so that it cannot be used by other components.
This method will result in calling any method in the Controller Service
that is annotated with the
@OnDisabled
annotation.
disableControllerService
in interface TestRunner
service
- the service to disablepublic void enableControllerService(ControllerService service)
TestRunner
Marks the Controller Service as enabled so that it can be used by other components.
This method will result in calling any method in the Controller Service
that is annotated with the
@OnEnabled
annotation.
enableControllerService
in interface TestRunner
service
- the service to enablepublic boolean isControllerServiceEnabled(ControllerService service)
isControllerServiceEnabled
in interface TestRunner
service
- the servicetrue
if the given Controller Service is enabled,
false
if it is disabledpublic void removeControllerService(ControllerService service)
TestRunner
Removes the Controller Service from the TestRunner. This will call any
method on the ControllerService that is annotated with the
@OnRemoved
annotation.
removeControllerService
in interface TestRunner
service
- the servicepublic void setAnnotationData(ControllerService service, String annotationData)
TestRunner
setAnnotationData
in interface TestRunner
service
- to modifyannotationData
- the dataprivate ControllerServiceConfiguration getConfigToUpdate(ControllerService service)
public ValidationResult setProperty(ControllerService service, PropertyDescriptor property, AllowableValue value)
TestRunner
setProperty
in interface TestRunner
service
- to modifyproperty
- to modifyvalue
- value to usepublic ValidationResult setProperty(ControllerService service, PropertyDescriptor property, String value)
TestRunner
setProperty
in interface TestRunner
service
- to modifyproperty
- to modifyvalue
- value to usepublic ValidationResult setProperty(ControllerService service, String propertyName, String value)
TestRunner
setProperty
in interface TestRunner
service
- to modifypropertyName
- to modifyvalue
- value to usepublic ControllerService getControllerService(String identifier)
getControllerService
in interface TestRunner
identifier
- of controller serviceControllerService
that is registered with the given
identifier, or null
if no Controller Service exists with the
given identifierpublic <T extends ControllerService> T getControllerService(String identifier, Class<T> serviceType)
getControllerService
in interface TestRunner
T
- type of serviceidentifier
- identifier of serviceserviceType
- type of serviceControllerService
that is registered with the given
identifier, cast as the provided service type, or null
if no
Controller Service exists with the given identifierpublic boolean removeProperty(PropertyDescriptor descriptor)
TestRunner
PropertyDescriptor
from the ProcessContext
,
effectively setting its value to null, or the property's default value, if it has one.removeProperty
in interface TestRunner
descriptor
- of property to removetrue
if removed, false
if the property was not setpublic List<ProvenanceEventRecord> getProvenanceEvents()
TestRunner
List
of all ProvenanceEventRecord
s that were
emitted by the ProcessorgetProvenanceEvents
in interface TestRunner
public void clearProvenanceEvents()
TestRunner
clearProvenanceEvents
in interface TestRunner
public MockStateManager getStateManager()
getStateManager
in interface TestRunner
public MockStateManager getStateManager(ControllerService controllerService)
getStateManager
in interface TestRunner
controllerService
- the Controller Service whose State Manager should be returnedpublic MockProcessorLog getLogger()
TestRunner
MockProcessorLog
that is used by the Processor under test.getLogger
in interface TestRunner
public MockProcessorLog getControllerServiceLogger(String identifier)
TestRunner
MockProcessorLog
that is used by the specified controller service.getControllerServiceLogger
in interface TestRunner
identifier
- a controller service identifierCopyright © 2016 Apache NiFi Project. All rights reserved.