Package org.apache.nifi.util
Class MockProcessContext
java.lang.Object
org.apache.nifi.util.MockControllerServiceLookup
org.apache.nifi.util.MockProcessContext
- All Implemented Interfaces:
org.apache.nifi.context.ClusterContext,org.apache.nifi.context.PropertyContext,org.apache.nifi.controller.ControllerServiceLookup,org.apache.nifi.controller.NodeTypeProvider,org.apache.nifi.processor.ProcessContext
public class MockProcessContext
extends MockControllerServiceLookup
implements org.apache.nifi.processor.ProcessContext, org.apache.nifi.controller.ControllerServiceLookup, org.apache.nifi.controller.NodeTypeProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Stringprivate final org.apache.nifi.components.ConfigurableComponentprivate final Stringprivate Set<org.apache.nifi.processor.Relationship> private booleanprivate org.apache.nifi.annotation.behavior.InputRequirementprivate booleanprivate booleanprivate booleanprivate booleanprivate intprivate booleanprivate final ParameterLookupprivate final org.apache.nifi.components.state.StateManagerprivate Set<org.apache.nifi.processor.Relationship> private boolean -
Constructor Summary
ConstructorsConstructorDescriptionMockProcessContext(org.apache.nifi.components.ConfigurableComponent component) MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName) MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) Creates a new MockProcessContext for the given Processor with given nameMockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables, Map<String, String> contextParameters) Creates a new MockProcessContext for the given Processor with given nameMockProcessContext(org.apache.nifi.components.ConfigurableComponent component, org.apache.nifi.components.state.StateManager stateManager) Creates a new MockProcessContext for the given ProcessorMockProcessContext(org.apache.nifi.controller.ControllerService component, String componentName, MockProcessContext context, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) MockProcessContext(org.apache.nifi.controller.ControllerService component, MockProcessContext context, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnection(org.apache.nifi.processor.Relationship relationship) voidaddControllerService(org.apache.nifi.controller.ControllerService controllerService, Map<org.apache.nifi.components.PropertyDescriptor, String> properties, String annotationData) voidvoidvoiddetermineUnsatisfiedDependencies(org.apache.nifi.components.PropertyDescriptor descriptor) Set<org.apache.nifi.processor.Relationship> Set<org.apache.nifi.processor.Relationship> (package private) StringgetControllerServiceAnnotationData(org.apache.nifi.controller.ControllerService controllerService) org.apache.nifi.controller.ControllerServiceLookupgetControllerServiceProperties(org.apache.nifi.controller.ControllerService controllerService) org.apache.nifi.scheduling.ExecutionNodeorg.apache.nifi.annotation.behavior.InputRequirementintgetName()org.apache.nifi.components.PropertyValuegetProperty(String propertyName) org.apache.nifi.components.PropertyValuegetProperty(org.apache.nifi.components.PropertyDescriptor descriptor) org.apache.nifi.components.PropertyDescriptorgetPropertyDescriptor(String propertyName) org.apache.nifi.components.PropertyValuegetPropertyWithoutValidatingExpressions(org.apache.nifi.components.PropertyDescriptor propertyDescriptor) intorg.apache.nifi.components.state.StateManagerSet<org.apache.nifi.processor.Relationship> booleanhasConnection(org.apache.nifi.processor.Relationship relationship) booleanbooleanbooleanisAutoTerminated(org.apache.nifi.processor.Relationship relationship) booleanbooleanbooleanbooleanisExpressionLanguagePresent(org.apache.nifi.components.PropertyDescriptor property) booleanbooleanisRelationshipRetried(org.apache.nifi.processor.Relationship relationship) booleanisValid()booleanorg.apache.nifi.components.PropertyValuenewPropertyValue(String rawValue) voidremoveConnection(org.apache.nifi.processor.Relationship relationship) booleanremoveProperty(String property) booleanremoveProperty(org.apache.nifi.components.PropertyDescriptor descriptor) voidsetAnnotationData(String annotationData) voidsetClustered(boolean clustered) voidsetConnected(boolean connected) voidsetConnections(Set<org.apache.nifi.processor.Relationship> connections) voidsetIncomingConnection(boolean hasIncomingConnection) voidsetIsConfiguredForClustering(boolean isConfiguredForClustering) voidsetMaxConcurrentTasks(int maxConcurrentTasks) voidsetNonLoopConnection(boolean hasNonLoopConnection) voidsetPrimaryNode(boolean primaryNode) org.apache.nifi.components.ValidationResultsetProperty(String propertyName, String propertyValue) org.apache.nifi.components.ValidationResultsetProperty(org.apache.nifi.components.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.voidsetUnavailableRelationships(Set<org.apache.nifi.processor.Relationship> relationships) voidsetValidateExpressionUsage(boolean validate) Collection<org.apache.nifi.components.ValidationResult> validate()Validates the current properties, returning ValidationResults for any invalid properties.validatedDependencies(org.apache.nifi.components.PropertyDescriptor descriptor) protected final Collection<org.apache.nifi.components.ValidationResult> validateReferencedControllerServices(org.apache.nifi.components.ValidationContext validationContext) voidyield()Methods inherited from class org.apache.nifi.util.MockControllerServiceLookup
addControllerService, addControllerService, addControllerServices, getConfiguration, getControllerService, getControllerServiceIdentifiers, getControllerServiceName, getControllerServices, isControllerServiceEnabled, isControllerServiceEnabled, isControllerServiceEnabling, removeControllerServiceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.nifi.controller.ControllerServiceLookup
getControllerService, getControllerServiceIdentifiers, getControllerServiceName, isControllerServiceEnabled, isControllerServiceEnabled, isControllerServiceEnablingMethods inherited from interface org.apache.nifi.controller.NodeTypeProvider
getClusterMembers, getCurrentNode, isConnected
-
Field Details
-
component
private final org.apache.nifi.components.ConfigurableComponent component -
componentName
-
properties
-
stateManager
private final org.apache.nifi.components.state.StateManager stateManager -
annotationData
-
yieldCalled
private boolean yieldCalled -
allowExpressionValidation
private boolean allowExpressionValidation -
incomingConnection
private volatile boolean incomingConnection -
nonLoopConnection
private volatile boolean nonLoopConnection -
inputRequirement
private volatile org.apache.nifi.annotation.behavior.InputRequirement inputRequirement -
maxConcurrentTasks
private int maxConcurrentTasks -
connections
-
isClustered
private volatile boolean isClustered -
isConfiguredForClustering
private volatile boolean isConfiguredForClustering -
isPrimaryNode
private volatile boolean isPrimaryNode -
isConnected
private volatile boolean isConnected -
environmentVariables
-
parameterLookup
-
-
Constructor Details
-
MockProcessContext
public MockProcessContext(org.apache.nifi.components.ConfigurableComponent component) -
MockProcessContext
public MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName) -
MockProcessContext
public MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, org.apache.nifi.components.state.StateManager stateManager) Creates a new MockProcessContext for the given Processor- Parameters:
component- being mockedstateManager- state manager
-
MockProcessContext
public MockProcessContext(org.apache.nifi.controller.ControllerService component, MockProcessContext context, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) -
MockProcessContext
public MockProcessContext(org.apache.nifi.controller.ControllerService component, String componentName, MockProcessContext context, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) -
MockProcessContext
public MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables) Creates a new MockProcessContext for the given Processor with given name- Parameters:
component- being mockedcomponentName- the name to be given the component;stateManager- state manager
-
MockProcessContext
public MockProcessContext(org.apache.nifi.components.ConfigurableComponent component, String componentName, org.apache.nifi.components.state.StateManager stateManager, Map<String, String> environmentVariables, Map<String, String> contextParameters) Creates a new MockProcessContext for the given Processor with given name- Parameters:
component- being mockedcomponentName- the name to be given the component;stateManager- state managerenvironmentVariables- the environment variablescontextParameters- the context parameters
-
-
Method Details
-
getProperty
public org.apache.nifi.components.PropertyValue getProperty(org.apache.nifi.components.PropertyDescriptor descriptor) - Specified by:
getPropertyin interfaceorg.apache.nifi.context.PropertyContext
-
getPropertyWithoutValidatingExpressions
public org.apache.nifi.components.PropertyValue getPropertyWithoutValidatingExpressions(org.apache.nifi.components.PropertyDescriptor propertyDescriptor) -
getProperty
- Specified by:
getPropertyin interfaceorg.apache.nifi.processor.ProcessContext
-
determineUnsatisfiedDependencies
private List<MockProcessContext.ValidatedPropertyDependency> determineUnsatisfiedDependencies(org.apache.nifi.components.PropertyDescriptor descriptor) -
validatedDependencies
private List<MockProcessContext.ValidatedPropertyDependency> validatedDependencies(org.apache.nifi.components.PropertyDescriptor descriptor) -
newPropertyValue
- Specified by:
newPropertyValuein interfaceorg.apache.nifi.processor.ProcessContext
-
setProperty
-
getPropertyDescriptor
-
setProperty
public org.apache.nifi.components.ValidationResult setProperty(org.apache.nifi.components.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. Otherwise, the property value is not updated. In either case, the ValidationResult is returned, indicating whether or not the property is valid- Parameters:
descriptor- of property to modifyvalue- new value- Returns:
- result
-
removeProperty
public boolean removeProperty(org.apache.nifi.components.PropertyDescriptor descriptor) -
removeProperty
-
clearProperties
public void clearProperties() -
yield
public void yield()- Specified by:
yieldin interfaceorg.apache.nifi.processor.ProcessContext
-
isYieldCalled
public boolean isYieldCalled() -
addControllerService
-
getMaxConcurrentTasks
public int getMaxConcurrentTasks()- Specified by:
getMaxConcurrentTasksin interfaceorg.apache.nifi.processor.ProcessContext
-
getExecutionNode
public org.apache.nifi.scheduling.ExecutionNode getExecutionNode()- Specified by:
getExecutionNodein interfaceorg.apache.nifi.processor.ProcessContext
-
setAnnotationData
-
getAnnotationData
- Specified by:
getAnnotationDatain interfaceorg.apache.nifi.processor.ProcessContext
-
getProperties
- Specified by:
getPropertiesin interfaceorg.apache.nifi.processor.ProcessContext
-
getAllProperties
- Specified by:
getAllPropertiesin interfaceorg.apache.nifi.context.PropertyContext
-
validate
Validates the current properties, returning ValidationResults for any invalid properties. All processor defined properties will be validated. If they are not included in the in the purposed configuration, the default value will be used.- Returns:
- Collection of validation result objects for any invalid findings only. If the collection is empty then the processor is valid. Guaranteed non-null
-
validateReferencedControllerServices
protected final Collection<org.apache.nifi.components.ValidationResult> validateReferencedControllerServices(org.apache.nifi.components.ValidationContext validationContext) -
isValid
public boolean isValid() -
assertValid
public void assertValid() -
setValidateExpressionUsage
public void setValidateExpressionUsage(boolean validate) -
getControllerServiceProperties
-
getControllerServiceAnnotationData
String getControllerServiceAnnotationData(org.apache.nifi.controller.ControllerService controllerService) -
getControllerServiceLookup
public org.apache.nifi.controller.ControllerServiceLookup getControllerServiceLookup()- Specified by:
getControllerServiceLookupin interfaceorg.apache.nifi.processor.ProcessContext
-
getAllRelationships
-
getAvailableRelationships
- Specified by:
getAvailableRelationshipsin interfaceorg.apache.nifi.processor.ProcessContext
-
isAutoTerminated
public boolean isAutoTerminated(org.apache.nifi.processor.Relationship relationship) - Specified by:
isAutoTerminatedin interfaceorg.apache.nifi.processor.ProcessContext
-
hasIncomingConnection
public boolean hasIncomingConnection()- Specified by:
hasIncomingConnectionin interfaceorg.apache.nifi.processor.ProcessContext
-
setIncomingConnection
public void setIncomingConnection(boolean hasIncomingConnection) -
hasConnection
public boolean hasConnection(org.apache.nifi.processor.Relationship relationship) - Specified by:
hasConnectionin interfaceorg.apache.nifi.processor.ProcessContext
-
setNonLoopConnection
public void setNonLoopConnection(boolean hasNonLoopConnection) -
hasNonLoopConnection
public boolean hasNonLoopConnection()- Specified by:
hasNonLoopConnectionin interfaceorg.apache.nifi.processor.ProcessContext
-
addConnection
public void addConnection(org.apache.nifi.processor.Relationship relationship) -
removeConnection
public void removeConnection(org.apache.nifi.processor.Relationship relationship) -
clearConnections
public void clearConnections() -
setConnections
-
isExpressionLanguagePresent
public boolean isExpressionLanguagePresent(org.apache.nifi.components.PropertyDescriptor property) - Specified by:
isExpressionLanguagePresentin interfaceorg.apache.nifi.processor.ProcessContext
-
getStateManager
public org.apache.nifi.components.state.StateManager getStateManager()- Specified by:
getStateManagerin interfaceorg.apache.nifi.processor.ProcessContext
-
getName
- Specified by:
getNamein interfaceorg.apache.nifi.processor.ProcessContext
-
setMaxConcurrentTasks
public void setMaxConcurrentTasks(int maxConcurrentTasks) -
isClustered
public boolean isClustered()- Specified by:
isClusteredin interfaceorg.apache.nifi.controller.NodeTypeProvider
-
isConfiguredForClustering
public boolean isConfiguredForClustering()- Specified by:
isConfiguredForClusteringin interfaceorg.apache.nifi.controller.NodeTypeProvider
-
isPrimary
public boolean isPrimary()- Specified by:
isPrimaryin interfaceorg.apache.nifi.controller.NodeTypeProvider
-
setClustered
public void setClustered(boolean clustered) -
setIsConfiguredForClustering
public void setIsConfiguredForClustering(boolean isConfiguredForClustering) -
setPrimaryNode
public void setPrimaryNode(boolean primaryNode) -
getInputRequirement
public org.apache.nifi.annotation.behavior.InputRequirement getInputRequirement()- Overrides:
getInputRequirementin classMockControllerServiceLookup
-
setConnected
public void setConnected(boolean connected) -
isConnectedToCluster
public boolean isConnectedToCluster()- Specified by:
isConnectedToClusterin interfaceorg.apache.nifi.context.ClusterContext
-
getRetryCount
public int getRetryCount()- Specified by:
getRetryCountin interfaceorg.apache.nifi.processor.ProcessContext
-
isRelationshipRetried
public boolean isRelationshipRetried(org.apache.nifi.processor.Relationship relationship) - Specified by:
isRelationshipRetriedin interfaceorg.apache.nifi.processor.ProcessContext
-
getEnvironmentVariables
-