Search in sources :

Example 1 with MutableVariableRegistry

use of org.apache.nifi.registry.variable.MutableVariableRegistry in project nifi by apache.

the class StandardProcessGroup method getUpdatedVariables.

private Set<String> getUpdatedVariables(final Map<String, String> newVariableValues) {
    final Set<String> updatedVariableNames = new HashSet<>();
    final MutableVariableRegistry registry = getVariableRegistry();
    for (final Map.Entry<String, String> entry : newVariableValues.entrySet()) {
        final String varName = entry.getKey();
        final String newValue = entry.getValue();
        final String curValue = registry.getVariableValue(varName);
        if (!Objects.equals(newValue, curValue)) {
            updatedVariableNames.add(varName);
        }
    }
    return updatedVariableNames;
}
Also used : MutableVariableRegistry(org.apache.nifi.registry.variable.MutableVariableRegistry) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet)

Example 2 with MutableVariableRegistry

use of org.apache.nifi.registry.variable.MutableVariableRegistry in project nifi by apache.

the class TestStandardControllerServiceProvider method createProcessor.

private ProcessorNode createProcessor(final StandardProcessScheduler scheduler, final ControllerServiceProvider serviceProvider) {
    final ReloadComponent reloadComponent = Mockito.mock(ReloadComponent.class);
    final LoggableComponent<Processor> dummyProcessor = new LoggableComponent<>(new DummyProcessor(), systemBundle.getBundleDetails().getCoordinate(), null);
    final ProcessorNode procNode = new StandardProcessorNode(dummyProcessor, UUID.randomUUID().toString(), new StandardValidationContextFactory(serviceProvider, null), scheduler, serviceProvider, niFiProperties, new StandardComponentVariableRegistry(VariableRegistry.EMPTY_REGISTRY), reloadComponent);
    final ProcessGroup group = new StandardProcessGroup(UUID.randomUUID().toString(), serviceProvider, scheduler, null, null, Mockito.mock(FlowController.class), new MutableVariableRegistry(variableRegistry));
    group.addProcessor(procNode);
    procNode.setProcessGroup(group);
    return procNode;
}
Also used : Processor(org.apache.nifi.processor.Processor) DummyProcessor(org.apache.nifi.controller.service.mock.DummyProcessor) StandardComponentVariableRegistry(org.apache.nifi.registry.variable.StandardComponentVariableRegistry) StandardProcessGroup(org.apache.nifi.groups.StandardProcessGroup) ReloadComponent(org.apache.nifi.controller.ReloadComponent) StandardValidationContextFactory(org.apache.nifi.processor.StandardValidationContextFactory) LoggableComponent(org.apache.nifi.controller.LoggableComponent) ProcessorNode(org.apache.nifi.controller.ProcessorNode) StandardProcessorNode(org.apache.nifi.controller.StandardProcessorNode) ProcessGroup(org.apache.nifi.groups.ProcessGroup) MockProcessGroup(org.apache.nifi.controller.service.mock.MockProcessGroup) StandardProcessGroup(org.apache.nifi.groups.StandardProcessGroup) MutableVariableRegistry(org.apache.nifi.registry.variable.MutableVariableRegistry) FlowController(org.apache.nifi.controller.FlowController) DummyProcessor(org.apache.nifi.controller.service.mock.DummyProcessor) StandardProcessorNode(org.apache.nifi.controller.StandardProcessorNode)

Aggregations

MutableVariableRegistry (org.apache.nifi.registry.variable.MutableVariableRegistry)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 FlowController (org.apache.nifi.controller.FlowController)1 LoggableComponent (org.apache.nifi.controller.LoggableComponent)1 ProcessorNode (org.apache.nifi.controller.ProcessorNode)1 ReloadComponent (org.apache.nifi.controller.ReloadComponent)1 StandardProcessorNode (org.apache.nifi.controller.StandardProcessorNode)1 DummyProcessor (org.apache.nifi.controller.service.mock.DummyProcessor)1 MockProcessGroup (org.apache.nifi.controller.service.mock.MockProcessGroup)1 ProcessGroup (org.apache.nifi.groups.ProcessGroup)1 StandardProcessGroup (org.apache.nifi.groups.StandardProcessGroup)1 Processor (org.apache.nifi.processor.Processor)1 StandardValidationContextFactory (org.apache.nifi.processor.StandardValidationContextFactory)1 StandardComponentVariableRegistry (org.apache.nifi.registry.variable.StandardComponentVariableRegistry)1