Repository: nifi Updated Branches: refs/heads/master 1fcec3747 -> 087622ead
NIFI-2606: - Addressing issue when fingerprinting ReportingTasks and ControllerServices properties with default values. - Ensuring the flow is saved when templates are created and imported. - Ensuring default values are included in templates. - Fixing unit tests. This closes #908. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/087622ea Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/087622ea Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/087622ea Branch: refs/heads/master Commit: 087622eadc5863cfce615dd22dc5584639146e4a Parents: 1fcec37 Author: Matt Gilman <[email protected]> Authored: Mon Aug 22 11:48:22 2016 -0400 Committer: Mark Payne <[email protected]> Committed: Mon Aug 22 13:35:15 2016 -0400 ---------------------------------------------------------------------- .../nifi/annotation/lifecycle/OnAdded.java | 6 - .../apache/nifi/controller/FlowController.java | 162 +++++++------ .../nifi/fingerprint/FingerprintFactory.java | 240 +++++++------------ .../org/apache/nifi/web/NiFiServiceFacade.java | 10 +- .../nifi/web/StandardNiFiServiceFacade.java | 75 ++++++ .../nifi/web/api/ProcessGroupResource.java | 1 + .../org/apache/nifi/web/api/dto/DtoFactory.java | 2 + .../nifi/web/controller/ControllerFacade.java | 2 +- .../org/apache/nifi/web/dao/TemplateDAO.java | 7 + .../nifi/web/dao/impl/StandardTemplateDAO.java | 5 + .../accesscontrol/AccessControlHelper.java | 32 +-- .../accesscontrol/ITAccessTokenEndpoint.java | 12 +- .../ITConnectionAccessControl.java | 4 +- .../accesscontrol/ITCountersAccessControl.java | 4 +- .../accesscontrol/ITFlowAccessControl.java | 6 +- .../accesscontrol/ITFunnelAccessControl.java | 4 +- .../accesscontrol/ITInputPortAccessControl.java | 4 +- .../accesscontrol/ITLabelAccessControl.java | 4 +- .../ITOutputPortAccessControl.java | 4 +- .../ITProcessGroupAccessControl.java | 4 +- .../accesscontrol/ITProcessorAccessControl.java | 4 +- .../nifi/integration/util/NiFiTestServer.java | 25 +- .../access-control/nifi-flow.properties | 140 +++++++++++ .../resources/access-control/nifi.properties | 2 +- 24 files changed, 445 insertions(+), 314 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java ---------------------------------------------------------------------- diff --git a/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java b/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java index 95edc0a..75555a7 100644 --- a/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java +++ b/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnAdded.java @@ -37,12 +37,6 @@ import java.lang.annotation.Target; * Methods with this annotation are called without any arguments, as all * settings and properties can be assumed to be the defaults. * </p> - * - * <p> - * If any method annotated with this annotation throws a Throwable, the - * component will not be added to the flow. - * </p> - * */ @Documented @Target({ElementType.METHOD}) http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java index b39162a..ad5c87b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java @@ -16,38 +16,7 @@ */ package org.apache.nifi.controller; -import static java.util.Objects.requireNonNull; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import javax.net.ssl.SSLContext; - +import com.sun.jersey.api.client.ClientHandlerException; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.action.Action; @@ -237,7 +206,36 @@ import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.sun.jersey.api.client.ClientHandlerException; +import javax.net.ssl.SSLContext; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import static java.util.Objects.requireNonNull; public class FlowController implements EventAccess, ControllerServiceProvider, ReportingTaskProvider, QueueProvider, Authorizable, ProvenanceAuthorizableFactory, NodeTypeProvider { @@ -1912,45 +1910,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R } } - /** - * <p> - * Verifies that the given DTO is valid, according to the following: - * - * <ul> - * <li>None of the ID's in any component of the DTO can be used in this - * flow.</li> - * <li>The ProcessGroup to which the template's contents will be added must - * not contain any InputPort or OutputPort with the same name as one of the - * corresponding components in the root level of the template.</li> - * <li>All Processors' classes must exist in this instance.</li> - * <li>All Flow File Prioritizers' classes must exist in this instance.</li> - * </ul> - * </p> - * - * <p> - * If any of the above statements does not hold true, an - * {@link IllegalStateException} or a - * {@link ProcessorInstantiationException} will be thrown. - * </p> - * - * @param group group - * @param templateContents contents - */ - private void validateSnippetContents(final ProcessGroup group, final FlowSnippetDTO templateContents) { - // validate the names of Input Ports - for (final PortDTO port : templateContents.getInputPorts()) { - if (group.getInputPortByName(port.getName()) != null) { - throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); - } - } - - // validate the names of Output Ports - for (final PortDTO port : templateContents.getOutputPorts()) { - if (group.getOutputPortByName(port.getName()) != null) { - throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); - } - } - + public void verifyComponentTypesInSnippet(final FlowSnippetDTO templateContents) { // validate that all Processor Types and Prioritizer Types are valid final Set<String> processorClasses = new HashSet<>(); for (final Class<?> c : ExtensionManager.getExtensions(Processor.class)) { @@ -2002,6 +1962,48 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R } /** + * <p> + * Verifies that the given DTO is valid, according to the following: + * + * <ul> + * <li>None of the ID's in any component of the DTO can be used in this + * flow.</li> + * <li>The ProcessGroup to which the template's contents will be added must + * not contain any InputPort or OutputPort with the same name as one of the + * corresponding components in the root level of the template.</li> + * <li>All Processors' classes must exist in this instance.</li> + * <li>All Flow File Prioritizers' classes must exist in this instance.</li> + * </ul> + * </p> + * + * <p> + * If any of the above statements does not hold true, an + * {@link IllegalStateException} or a + * {@link ProcessorInstantiationException} will be thrown. + * </p> + * + * @param group group + * @param templateContents contents + */ + private void validateSnippetContents(final ProcessGroup group, final FlowSnippetDTO templateContents) { + // validate the names of Input Ports + for (final PortDTO port : templateContents.getInputPorts()) { + if (group.getInputPortByName(port.getName()) != null) { + throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); + } + } + + // validate the names of Output Ports + for (final PortDTO port : templateContents.getOutputPorts()) { + if (group.getOutputPortByName(port.getName()) != null) { + throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); + } + } + + verifyComponentTypesInSnippet(templateContents); + } + + /** * Recursively finds all ProcessorDTO's * * @param group group @@ -2799,6 +2801,10 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R @Override public ReportingTaskNode createReportingTask(final String type, final String id, final boolean firstTimeAdded) throws ReportingTaskInstantiationException { + return createReportingTask(type, id, firstTimeAdded, true); + } + + public ReportingTaskNode createReportingTask(final String type, final String id, final boolean firstTimeAdded, final boolean register) throws ReportingTaskInstantiationException { if (type == null || id == null) { throw new NullPointerException(); } @@ -2864,12 +2870,14 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R } } - reportingTasks.put(id, taskNode); + if (register) { + reportingTasks.put(id, taskNode); - // Register log observer to provide bulletins when reporting task logs anything at WARN level or above - final LogRepository logRepository = LogRepositoryFactory.getRepository(id); - logRepository.addObserver(StandardProcessorNode.BULLETIN_OBSERVER_ID, LogLevel.WARN, - new ReportingTaskLogObserver(getBulletinRepository(), taskNode)); + // Register log observer to provide bulletins when reporting task logs anything at WARN level or above + final LogRepository logRepository = LogRepositoryFactory.getRepository(id); + logRepository.addObserver(StandardProcessorNode.BULLETIN_OBSERVER_ID, LogLevel.WARN, + new ReportingTaskLogObserver(getBulletinRepository(), taskNode)); + } return taskNode; } http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java index d50d31b..43cdb80 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java @@ -16,37 +16,16 @@ */ package org.apache.nifi.fingerprint; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.UUID; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; - import org.apache.commons.lang3.StringUtils; +import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.ControllerService; import org.apache.nifi.controller.FlowController; -import org.apache.nifi.controller.Template; import org.apache.nifi.controller.exception.ProcessorInstantiationException; import org.apache.nifi.controller.serialization.FlowFromDOMFactory; import org.apache.nifi.encrypt.StringEncryptor; import org.apache.nifi.processor.Processor; +import org.apache.nifi.reporting.ReportingTask; import org.apache.nifi.util.DomUtils; import org.apache.nifi.web.api.dto.ComponentDTO; import org.apache.nifi.web.api.dto.ConnectionDTO; @@ -62,7 +41,6 @@ import org.apache.nifi.web.api.dto.RemoteProcessGroupContentsDTO; import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO; import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO; import org.apache.nifi.web.api.dto.ReportingTaskDTO; -import org.apache.nifi.web.api.dto.TemplateDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -71,6 +49,25 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.UUID; + /** * Creates a fingerprint of a flow.xml. The order of elements or attributes in the flow.xml does not influence the fingerprint generation. * @@ -137,16 +134,6 @@ public final class FingerprintFactory { } } - public String md5Hash(final String string) throws NoSuchAlgorithmException { - final MessageDigest digest = MessageDigest.getInstance("MD5"); - final byte[] hash = digest.digest(string.getBytes(Charset.forName("UTF-8"))); - final StringBuilder strb = new StringBuilder(); - for (int i = 0; i < hash.length; i++) { - strb.append(Integer.toHexString((hash[i] & 0xFF) | 0x100).substring(1, 3)); - } - return strb.toString(); - } - /** * Creates a fingerprint from an XML document representing the flow.xml. * @@ -177,50 +164,6 @@ public final class FingerprintFactory { } /** - * Creates a fingerprint of a Collection of Templates The order of the templates does not influence the fingerprint generation. - * - * - * @param templates collection of templates - * @return a generated fingerprint - * - * @throws FingerprintException if the fingerprint failed to be generated - */ - public String createFingerprint(final Collection<Template> templates) throws FingerprintException { - if (templates == null || templates.isEmpty()) { - return ""; - } - - final List<Template> sortedTemplates = new ArrayList<>(templates); - Collections.sort(sortedTemplates, new Comparator<Template>() { - @Override - public int compare(final Template o1, final Template o2) { - if (o1 == null && o2 == null) { - return 0; - } - if (o1 == null) { - return 1; - } - if (o2 == null) { - return -1; - } - - final TemplateDTO dto1 = o1.getDetails(); - final TemplateDTO dto2 = o2.getDetails(); - return dto1.getId().compareTo(dto2.getId()); - } - }); - - // builder to hold fingerprint state - final StringBuilder fingerprintBuilder = new StringBuilder(); - - for (final Template template : sortedTemplates) { - addTemplateFingerprint(fingerprintBuilder, template.getDetails()); - } - - return fingerprintBuilder.toString(); - } - - /** * Parse the given flow.xml bytes into a Document instance. * * @param flow a flow @@ -272,7 +215,7 @@ public final class FingerprintFactory { }); for (final ControllerServiceDTO dto : serviceDtos) { - addControllerServiceFingerprint(builder, dto); + addControllerServiceFingerprint(builder, dto, controller); } } @@ -302,26 +245,14 @@ public final class FingerprintFactory { }); for (final ReportingTaskDTO dto : reportingTaskDtos) { - addReportingTaskFingerprint(builder, dto); + addReportingTaskFingerprint(builder, dto, controller); } } return builder; } - private StringBuilder addTemplateFingerprint(final StringBuilder builder, final TemplateDTO dto) { - builder.append(dto.getId()); - builder.append(dto.getGroupId()); - builder.append(dto.getName()); - builder.append(dto.getDescription()); - final FlowSnippetDTO snippet = dto.getSnippet(); - if (snippet != null) { - addSnippetFingerprint(builder, snippet); - } - return builder; - } - - private StringBuilder addSnippetFingerprint(final StringBuilder builder, final FlowSnippetDTO snippet) { + private StringBuilder addSnippetFingerprint(final StringBuilder builder, final FlowSnippetDTO snippet, final FlowController controller) { final Comparator<ComponentDTO> componentComparator = new Comparator<ComponentDTO>() { @Override public int compare(final ComponentDTO o1, final ComponentDTO o2) { @@ -407,7 +338,7 @@ public final class FingerprintFactory { Collections.sort(sortedProcGroups, componentComparator); for (final ProcessGroupDTO procGroup : sortedProcGroups) { - addProcessGroupFingerprint(builder, procGroup); + addProcessGroupFingerprint(builder, procGroup, controller); } } @@ -419,7 +350,7 @@ public final class FingerprintFactory { Collections.sort(sortedProcessors, componentComparator); for (final ProcessorDTO proc : sortedProcessors) { - addProcessorFingerprint(builder, proc); + addProcessorFingerprint(builder, proc, controller); } } @@ -443,7 +374,7 @@ public final class FingerprintFactory { Collections.sort(sortedServices, componentComparator); for (final ControllerServiceDTO service : sortedServices) { - addControllerServiceFingerprint(builder, service); + addControllerServiceFingerprint(builder, service, controller); } } @@ -513,13 +444,13 @@ public final class FingerprintFactory { return builder; } - private StringBuilder addProcessGroupFingerprint(final StringBuilder builder, final ProcessGroupDTO group) { + private StringBuilder addProcessGroupFingerprint(final StringBuilder builder, final ProcessGroupDTO group, final FlowController controller) { builder.append(group.getId()); builder.append(group.getName()); builder.append(group.getParentGroupId()); final FlowSnippetDTO contents = group.getContents(); - addSnippetFingerprint(builder, contents); + addSnippetFingerprint(builder, contents, controller); return builder; } @@ -550,7 +481,9 @@ public final class FingerprintFactory { final NodeList propertyElems = DomUtils.getChildNodesByTagName(processorElem, "property"); final List<Element> sortedPropertyElems = sortElements(propertyElems, getProcessorPropertiesComparator()); for (final Element propertyElem : sortedPropertyElems) { - addFlowFileProcessorPropertyFingerprint(builder, propertyElem, processor); + final String propName = DomUtils.getChildElementsByTagName(propertyElem, "name").get(0).getTextContent(); + String propValue = getFirstValue(DomUtils.getChildNodesByTagName(propertyElem, "value"), null); + addPropertyFingerprint(builder, processor, propName, propValue); } final NodeList autoTerminateElems = DomUtils.getChildNodesByTagName(processorElem, "autoTerminatedRelationship"); @@ -562,7 +495,7 @@ public final class FingerprintFactory { return builder; } - private StringBuilder addProcessorFingerprint(final StringBuilder builder, final ProcessorDTO processor) { + private StringBuilder addProcessorFingerprint(final StringBuilder builder, final ProcessorDTO processor, final FlowController controller) { final ProcessorConfigDTO config = processor.getConfig(); builder.append(processor.getId()); @@ -577,21 +510,21 @@ public final class FingerprintFactory { builder.append(config.getPenaltyDuration()); builder.append(config.getAnnotationData()); - if (config.getProperties() == null) { - builder.append("NO_PROPERTIES"); - } else { - final SortedMap<String, String> sortedProps = new TreeMap<>(config.getProperties()); - for (final Map.Entry<String, String> entry : sortedProps.entrySet()) { - final String propName = entry.getKey(); - final String propValue = entry.getValue(); - if (propValue == null) { - continue; - } - - builder.append(propName).append("=").append(propValue); + // create an instance of the Processor so that we know the default property values + Processor processorInstance = null; + try { + if (controller != null) { + processorInstance = controller.createProcessor(processor.getType(), UUID.randomUUID().toString(), false).getProcessor(); + } + } catch (ProcessorInstantiationException e) { + logger.warn("Unable to create Processor of type {} due to {}; its default properties will be fingerprinted instead of being ignored.", processor.getType(), e.toString()); + if (logger.isDebugEnabled()) { + logger.warn("", e); } } + addPropertiesFingerprint(builder, processorInstance, config.getProperties()); + final Set<String> autoTerm = config.getAutoTerminatedRelationships(); if (autoTerm == null || autoTerm.isEmpty()) { builder.append("NO_AUTO_TERMINATED_RELATIONSHIPS"); @@ -606,41 +539,35 @@ public final class FingerprintFactory { return builder; } - StringBuilder addFlowFileProcessorPropertyFingerprint(final StringBuilder builder, final Element propElem, final Processor processor) throws FingerprintException { - // If we have a Processor to use, first determine if the value given is the default value for the specified property. + private StringBuilder addPropertyFingerprint(final StringBuilder builder, final ConfigurableComponent component, final String propName, final String propValue) throws FingerprintException { + // If we have a component to use, first determine if the value given is the default value for the specified property. // If so, we do not add the property to the fingerprint. - // We do this because if a Processor is updated to add a new property, whenever we connect to the cluster, we have issues because + // We do this because if a component is updated to add a new property, whenever we connect to the cluster, we have issues because // the Cluster Coordinator's flow comes from disk, where the flow.xml doesn't have the new property but our FlowController does have the new property. // This causes the fingerprints not to match. As a result, we just ignore default values, and this resolves the issue. - if (processor != null) { - final String propName = DomUtils.getChildElementsByTagName(propElem, "name").get(0).getTextContent(); - - String propValue = null; - final List<Element> valueElements = DomUtils.getChildElementsByTagName(propElem, "value"); - if (valueElements != null && valueElements.size() >= 1) { - propValue = valueElements.get(0).getTextContent(); - } - final PropertyDescriptor descriptor = processor.getPropertyDescriptor(propName); + if (component != null) { + final PropertyDescriptor descriptor = component.getPropertyDescriptor(propName); if (descriptor != null && propValue != null && propValue.equals(descriptor.getDefaultValue())) { return builder; } } // check if there is a value - String propValue = getFirstValue(DomUtils.getChildNodesByTagName(propElem, "value"), null); if (propValue == null) { return builder; } // append name - appendFirstValue(builder, DomUtils.getChildNodesByTagName(propElem, "name")); + builder.append(propName).append("="); // append value if (isEncrypted(propValue)) { - propValue = decrypt(propValue); + // propValue is non null, no need to use getValue + builder.append(decrypt(propValue)); + } else { + builder.append(getValue(propValue, NO_VALUE)); } - builder.append(getValue(propValue, NO_VALUE)); return builder; } @@ -902,7 +829,7 @@ public final class FingerprintFactory { return builder; } - private void addControllerServiceFingerprint(final StringBuilder builder, final ControllerServiceDTO dto) { + private void addControllerServiceFingerprint(final StringBuilder builder, final ControllerServiceDTO dto, final FlowController controller) { builder.append(dto.getId()); builder.append(dto.getType()); builder.append(dto.getName()); @@ -910,24 +837,34 @@ public final class FingerprintFactory { builder.append(dto.getAnnotationData()); builder.append(dto.getState()); - final Map<String, String> properties = dto.getProperties(); + // create an instance of the ControllerService so that we know the default property values + ControllerService controllerService = null; + try { + if (controller != null) { + controllerService = controller.createControllerService(dto.getType(), UUID.randomUUID().toString(), false).getControllerServiceImplementation(); + } + } catch (Exception e) { + logger.warn("Unable to create ControllerService of type {} due to {}; its default properties will be fingerprinted instead of being ignored.", dto.getType(), e.toString()); + if (logger.isDebugEnabled()) { + logger.warn("", e); + } + } + + addPropertiesFingerprint(builder, controllerService, dto.getProperties()); + } + + private void addPropertiesFingerprint(final StringBuilder builder, final ConfigurableComponent component, final Map<String, String> properties) { if (properties == null) { builder.append("NO_PROPERTIES"); } else { final SortedMap<String, String> sortedProps = new TreeMap<>(properties); for (final Map.Entry<String, String> entry : sortedProps.entrySet()) { - final String propName = entry.getKey(); - final String propValue = entry.getValue(); - if (propValue == null) { - continue; - } - - builder.append(propName).append("=").append(propValue); + addPropertyFingerprint(builder, component, entry.getKey(), entry.getValue()); } } } - private void addReportingTaskFingerprint(final StringBuilder builder, final ReportingTaskDTO dto) { + private void addReportingTaskFingerprint(final StringBuilder builder, final ReportingTaskDTO dto, final FlowController controller) { builder.append(dto.getId()); builder.append(dto.getType()); builder.append(dto.getName()); @@ -936,21 +873,20 @@ public final class FingerprintFactory { builder.append(dto.getSchedulingStrategy()); builder.append(dto.getAnnotationData()); - final Map<String, String> properties = dto.getProperties(); - if (properties == null) { - builder.append("NO_PROPERTIES"); - } else { - final SortedMap<String, String> sortedProps = new TreeMap<>(properties); - for (final Map.Entry<String, String> entry : sortedProps.entrySet()) { - final String propName = entry.getKey(); - final String propValue = entry.getValue(); - if (propValue == null) { - continue; - } - - builder.append(propName).append("=").append(propValue); + // create an instance of the ReportingTask so that we know the default property values + ReportingTask reportingTask = null; + try { + if (controller != null) { + reportingTask = controller.createReportingTask(dto.getType(), UUID.randomUUID().toString(), false, false).getReportingTask(); + } + } catch (Exception e) { + logger.warn("Unable to create ReportingTask of type {} due to {}; its default properties will be fingerprinted instead of being ignored.", dto.getType(), e.toString()); + if (logger.isDebugEnabled()) { + logger.warn("", e); } } + + addPropertiesFingerprint(builder, reportingTask, dto.getProperties()); } private Comparator<Element> getIdsComparator() { http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java index ce9b248..50c36c5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java @@ -38,6 +38,7 @@ import org.apache.nifi.web.api.dto.CountersDTO; import org.apache.nifi.web.api.dto.DocumentedTypeDTO; import org.apache.nifi.web.api.dto.DropRequestDTO; import org.apache.nifi.web.api.dto.FlowFileDTO; +import org.apache.nifi.web.api.dto.FlowSnippetDTO; import org.apache.nifi.web.api.dto.FunnelDTO; import org.apache.nifi.web.api.dto.LabelDTO; import org.apache.nifi.web.api.dto.ListingRequestDTO; @@ -359,11 +360,18 @@ public interface NiFiServiceFacade { * Verifies a template with the specified name can be created. * * @param groupId the id of the group for the template - * @param name name of purposed template + * @param name name of proposed template */ void verifyCanAddTemplate(String groupId, String name); /** + * Verifies the types of components in a template. + * + * @param snippet proposed template + */ + void verifyComponentTypes(FlowSnippetDTO snippet); + + /** * Creates a new Template based off the specified snippet. * * @param name name http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index 5952579..55d98b5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -58,6 +58,7 @@ import org.apache.nifi.connectable.Connection; import org.apache.nifi.connectable.Funnel; import org.apache.nifi.connectable.Port; import org.apache.nifi.controller.ConfiguredComponent; +import org.apache.nifi.controller.ControllerService; import org.apache.nifi.controller.Counter; import org.apache.nifi.controller.FlowController; import org.apache.nifi.controller.ProcessorNode; @@ -117,6 +118,7 @@ import org.apache.nifi.web.api.dto.PermissionsDTO; import org.apache.nifi.web.api.dto.PortDTO; import org.apache.nifi.web.api.dto.PreviousValueDTO; import org.apache.nifi.web.api.dto.ProcessGroupDTO; +import org.apache.nifi.web.api.dto.ProcessorConfigDTO; import org.apache.nifi.web.api.dto.ProcessorDTO; import org.apache.nifi.web.api.dto.PropertyDescriptorDTO; import org.apache.nifi.web.api.dto.PropertyHistoryDTO; @@ -1554,6 +1556,11 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } @Override + public void verifyComponentTypes(FlowSnippetDTO snippet) { + templateDAO.verifyComponentTypes(snippet); + } + + @Override public TemplateDTO createTemplate(final String name, final String description, final String snippetId, final String groupId, final Optional<String> idGenerationSeed) { // get the specified snippet final Snippet snippet = snippetDAO.getSnippet(snippetId); @@ -1576,9 +1583,71 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // drop the snippet snippetDAO.dropSnippet(snippetId); + // save the flow + controllerFacade.save(); + return dtoFactory.createTemplateDTO(template); } + /** + * Ensures default values are populated for all components in this snippet. This is necessary to handle old templates without default values + * and when existing properties have default values introduced. + * + * @param snippet snippet + */ + private void ensureDefaultPropertyValuesArePopulated(final FlowSnippetDTO snippet) { + if (snippet != null) { + if (snippet.getControllerServices() != null) { + snippet.getControllerServices().forEach(dto -> { + if (dto.getProperties() == null) { + dto.setProperties(new LinkedHashMap<>()); + } + + try { + final ControllerService controllerService = controllerFacade.createTemporaryControllerService(dto.getType()).getControllerServiceImplementation(); + controllerService.getPropertyDescriptors().forEach(descriptor -> { + if (dto.getProperties().get(descriptor.getName()) == null) { + dto.getProperties().put(descriptor.getName(), descriptor.getDefaultValue()); + } + }); + } catch (final Exception e) { + logger.warn(String.format("Unable to create ControllerService of type %s to populate default values.", dto.getType())); + } + }); + } + + if (snippet.getProcessors() != null) { + snippet.getProcessors().forEach(dto -> { + if (dto.getConfig() == null) { + dto.setConfig(new ProcessorConfigDTO()); + } + + final ProcessorConfigDTO config = dto.getConfig(); + if (config.getProperties() == null) { + config.setProperties(new LinkedHashMap<>()); + } + + try { + final ProcessorNode processorNode = controllerFacade.createTemporaryProcessor(dto.getType()); + processorNode.getPropertyDescriptors().forEach(descriptor -> { + if (config.getProperties().get(descriptor.getName()) == null) { + config.getProperties().put(descriptor.getName(), descriptor.getDefaultValue()); + } + }); + } catch (final Exception e) { + logger.warn(String.format("Unable to create Processor of type %s to populate default values.", dto.getType())); + } + }); + } + + if (snippet.getProcessGroups() != null) { + snippet.getProcessGroups().forEach(processGroup -> { + ensureDefaultPropertyValuesArePopulated(processGroup.getContents()); + }); + } + } + } + @Override public TemplateDTO importTemplate(final TemplateDTO templateDTO, final String groupId, final Optional<String> idGenerationSeed) { // ensure id is set @@ -1588,9 +1657,15 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // mark the timestamp templateDTO.setTimestamp(new Date()); + // ensure default values are populated + ensureDefaultPropertyValuesArePopulated(templateDTO.getSnippet()); + // import the template final Template template = templateDAO.importTemplate(templateDTO, groupId); + // save the flow + controllerFacade.save(); + // return the template dto return dtoFactory.createTemplateDTO(template); } http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 00fe7d2..3ae7201 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -2042,6 +2042,7 @@ public class ProcessGroupResource extends ApplicationResource { } if (validationPhase) { serviceFacade.verifyCanAddTemplate(groupId, templateEntity.getTemplate().getName()); + serviceFacade.verifyComponentTypes(templateEntity.getTemplate().getSnippet()); return generateContinueResponse().build(); } http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 075876a..463c6f1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -2446,6 +2446,8 @@ public final class DtoFactory { String propertyValue = entry.getValue(); if (propertyValue != null && descriptor.isSensitive()) { propertyValue = SENSITIVE_VALUE_MASK; + } else if (propertyValue == null && descriptor.getDefaultValue() != null) { + propertyValue = descriptor.getDefaultValue(); } // set the property value http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java index cbdc2da..fe0bff1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java @@ -211,7 +211,7 @@ public class ControllerFacade implements Authorizable { * @throws ReportingTaskInstantiationException when unable to instantiate the reporting task */ public ReportingTaskNode createTemporaryReportingTask(String type) throws ReportingTaskInstantiationException { - return flowController.createReportingTask(type, UUID.randomUUID().toString(), false); + return flowController.createReportingTask(type, UUID.randomUUID().toString(), false, false); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/TemplateDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/TemplateDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/TemplateDAO.java index 9cebebe..7d883e0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/TemplateDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/TemplateDAO.java @@ -33,6 +33,13 @@ public interface TemplateDAO { void verifyCanAddTemplate(String name, String groupId); /** + * Verifies the types of components in a template. + * + * @param snippet proposed template + */ + void verifyComponentTypes(FlowSnippetDTO snippet); + + /** * Creates a template. * * @param templateDTO The template DTO http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java index 682b93a..868e2d0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardTemplateDAO.java @@ -70,6 +70,11 @@ public class StandardTemplateDAO extends ComponentDAO implements TemplateDAO { } @Override + public void verifyComponentTypes(FlowSnippetDTO snippet) { + flowController.verifyComponentTypesInSnippet(snippet); + } + + @Override public Template createTemplate(TemplateDTO templateDTO, String groupId) { final ProcessGroup processGroup = flowController.getGroup(groupId); if (processGroup == null) { http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/AccessControlHelper.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/AccessControlHelper.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/AccessControlHelper.java index b6f419f..6bd0b36 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/AccessControlHelper.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/AccessControlHelper.java @@ -26,8 +26,6 @@ import org.apache.nifi.nar.NarClassLoaders; import org.apache.nifi.util.NiFiProperties; import java.io.File; -import java.util.HashMap; -import java.util.Map; import static org.junit.Assert.assertEquals; @@ -48,41 +46,27 @@ public class AccessControlHelper { private static final String CONTEXT_PATH = "/nifi-api"; - private String flowXmlPath; private NiFiTestServer server; private String baseUrl; + private String flowXmlPath; - public AccessControlHelper(final String flowXmlPath) throws Exception { - this(flowXmlPath, null); + public AccessControlHelper() throws Exception { + this("src/test/resources/access-control/nifi.properties"); } - public AccessControlHelper(final String flowXmlPath, final String overrideAuthorizer) throws Exception { - this.flowXmlPath = flowXmlPath; - - // look for the flow.xml and toss it - File flow = new File(flowXmlPath); - if (flow.exists()) { - flow.delete(); - } - + public AccessControlHelper(final String nifiPropertiesPath) throws Exception { // configure the location of the nifi properties - File nifiPropertiesFile = new File("src/test/resources/access-control/nifi.properties"); + File nifiPropertiesFile = new File(nifiPropertiesPath); System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, nifiPropertiesFile.getAbsolutePath()); - - // update the flow.xml property - final Map<String, String> addProps = new HashMap<>(); - addProps.put(NiFiProperties.FLOW_CONFIGURATION_FILE, flowXmlPath); - if (overrideAuthorizer != null) { - addProps.put(NiFiProperties.SECURITY_USER_AUTHORIZER, overrideAuthorizer); - } - NiFiProperties props = NiFiProperties.createBasicNiFiProperties(null, addProps); + NiFiProperties props = NiFiProperties.createBasicNiFiProperties(null, null); + flowXmlPath = props.getProperty(NiFiProperties.FLOW_CONFIGURATION_FILE); // load extensions NarClassLoaders.getInstance().init(props.getFrameworkWorkingDirectory(), props.getExtensionsWorkingDirectory()); ExtensionManager.discoverExtensions(NarClassLoaders.getInstance().getExtensionClassLoaders()); // start the server - server = new NiFiTestServer("src/main/webapp", CONTEXT_PATH); + server = new NiFiTestServer("src/main/webapp", CONTEXT_PATH, props); server.startServer(); server.loadFlow(); http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITAccessTokenEndpoint.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITAccessTokenEndpoint.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITAccessTokenEndpoint.java index dc07fdf..fb6fcd4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITAccessTokenEndpoint.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITAccessTokenEndpoint.java @@ -51,8 +51,8 @@ public class ITAccessTokenEndpoint { private static final String CLIENT_ID = "token-endpoint-id"; private static final String CONTEXT_PATH = "/nifi-api"; - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-admin.xml"; + private static String flowXmlPath; private static NiFiTestServer SERVER; private static NiFiTestUser TOKEN_USER; private static String BASE_URL; @@ -63,10 +63,8 @@ public class ITAccessTokenEndpoint { File nifiPropertiesFile = new File("src/test/resources/access-control/nifi.properties"); System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, nifiPropertiesFile.getAbsolutePath()); - // update the flow.xml property - final Map<String, String> addProps = new HashMap<>(); - addProps.put("nifi.flow.configuration.file", FLOW_XML_PATH); - NiFiProperties props = NiFiProperties.createBasicNiFiProperties(null, addProps); + NiFiProperties props = NiFiProperties.createBasicNiFiProperties(null, null); + flowXmlPath = props.getProperty(NiFiProperties.FLOW_CONFIGURATION_FILE); // delete the database directory to avoid issues with re-registration in testRequestAccessUsingToken FileUtils.deleteDirectory(props.getDatabaseRepositoryPath().toFile()); @@ -76,7 +74,7 @@ public class ITAccessTokenEndpoint { ExtensionManager.discoverExtensions(NarClassLoaders.getInstance().getExtensionClassLoaders()); // start the server - SERVER = new NiFiTestServer("src/main/webapp", CONTEXT_PATH); + SERVER = new NiFiTestServer("src/main/webapp", CONTEXT_PATH, props); SERVER.startServer(); SERVER.loadFlow(); @@ -267,7 +265,7 @@ public class ITAccessTokenEndpoint { SERVER = null; // look for the flow.xml - File flow = new File(FLOW_XML_PATH); + File flow = new File(flowXmlPath); if (flow.exists()) { flow.delete(); } http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITConnectionAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITConnectionAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITConnectionAccessControl.java index 4be0bb9..dcc00d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITConnectionAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITConnectionAccessControl.java @@ -52,13 +52,11 @@ import static org.junit.Assert.assertTrue; */ public class ITConnectionAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-connections.xml"; - private static AccessControlHelper helper; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITCountersAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITCountersAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITCountersAccessControl.java index 2f017f8..7d4ee10 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITCountersAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITCountersAccessControl.java @@ -30,14 +30,12 @@ import static org.junit.Assert.assertEquals; */ public class ITCountersAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-counters.xml"; - private static AccessControlHelper helper; private static String uri; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); uri = helper.getBaseUrl() + "/counters"; } http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java index 9ebbc75..9c7b5c6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java @@ -28,13 +28,11 @@ import static org.junit.Assert.assertEquals; */ public class ITFlowAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-flow.xml"; - private static AccessControlHelper helper; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH, "flow-test-provider"); + helper = new AccessControlHelper("src/test/resources/access-control/nifi-flow.properties"); } /** @@ -215,7 +213,7 @@ public class ITFlowAccessControl { */ @Test public void testGetComponentHistory() throws Exception { - helper.testGenericGetUri(helper.getBaseUrl() + "/flow/history/components/my-component"); + testComponentSpecificGetUri(helper.getBaseUrl() + "/flow/history/components/my-component"); } public void testComponentSpecificGetUri(final String uri) throws Exception { http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFunnelAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFunnelAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFunnelAccessControl.java index a87b63e..663ee48 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFunnelAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFunnelAccessControl.java @@ -48,13 +48,11 @@ import static org.junit.Assert.assertTrue; */ public class ITFunnelAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-funnels.xml"; - private static AccessControlHelper helper; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITInputPortAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITInputPortAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITInputPortAccessControl.java index cd4f3ce..2cb2264 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITInputPortAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITInputPortAccessControl.java @@ -48,14 +48,12 @@ import static org.junit.Assert.assertTrue; */ public class ITInputPortAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-input-ports.xml"; - private static AccessControlHelper helper; private static int count = 0; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java index 2404c77..4b233cf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITLabelAccessControl.java @@ -48,13 +48,11 @@ import static org.junit.Assert.assertTrue; */ public class ITLabelAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-labels.xml"; - private static AccessControlHelper helper; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java index 6ec0846..3bf6a1b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITOutputPortAccessControl.java @@ -48,14 +48,12 @@ import static org.junit.Assert.assertTrue; */ public class ITOutputPortAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-output-ports.xml"; - private static AccessControlHelper helper; private static int count = 0; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java index 5f1c72b..36be2d3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessGroupAccessControl.java @@ -48,14 +48,12 @@ import static org.junit.Assert.assertTrue; */ public class ITProcessGroupAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-processors.xml"; - private static AccessControlHelper helper; private static int count = 0; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java index 0dec268..37567c4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java @@ -49,13 +49,11 @@ import static org.junit.Assert.assertTrue; */ public class ITProcessorAccessControl { - private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-processors.xml"; - private static AccessControlHelper helper; @BeforeClass public static void setup() throws Exception { - helper = new AccessControlHelper(FLOW_XML_PATH); + helper = new AccessControlHelper(); } /** http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java index 55c3168..677e6ab 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java @@ -17,17 +17,12 @@ package org.apache.nifi.integration.util; import com.sun.jersey.api.client.Client; -import java.io.File; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collections; -import javax.servlet.ServletContext; -import org.apache.nifi.util.NiFiProperties; -import org.apache.nifi.web.util.WebUtils; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.framework.security.util.SslContextFactory; import org.apache.nifi.services.FlowService; import org.apache.nifi.ui.extension.UiExtensionMapping; +import org.apache.nifi.util.NiFiProperties; +import org.apache.nifi.web.util.WebUtils; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.SecureRequestCustomizer; @@ -40,6 +35,10 @@ import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; +import javax.servlet.ServletContext; +import java.io.File; +import java.util.Collections; + /** * Creates an embedded server for testing the NiFi REST API. */ @@ -51,16 +50,8 @@ public class NiFiTestServer { private final NiFiProperties properties; private WebAppContext webappContext; - public NiFiTestServer(String webappRoot, String contextPath) { - final URL resource = NiFiTestServer.class.getResource("/site-to-site/nifi.properties"); - try { - final String propertiesFile = resource.toURI().getPath(); - System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, propertiesFile); - // load the configuration - properties = NiFiProperties.createBasicNiFiProperties(null, null); - } catch (final URISyntaxException ue) { - throw new RuntimeException(); - } + public NiFiTestServer(String webappRoot, String contextPath, NiFiProperties properties) { + this.properties = properties; createWebAppContext(webappRoot, contextPath); createServer(); http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi-flow.properties ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi-flow.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi-flow.properties new file mode 100644 index 0000000..a321cad --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi-flow.properties @@ -0,0 +1,140 @@ +# 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. + +# Core Properties # +nifi.version=nifi version +nifi.flow.configuration.file=target/test-classes/access-control/flow.xml.gz +nifi.flow.configuration.archive.dir=target/archive +nifi.flowcontroller.autoResumeState=true +nifi.flowcontroller.graceful.shutdown.period=10 sec +nifi.flowservice.writedelay.interval=2 sec + +nifi.authorizer.configuration.file=target/test-classes/access-control/authorizers.xml +nifi.login.identity.provider.configuration.file=target/test-classes/access-control/login-identity-providers.xml +nifi.templates.directory=target/test-classes/access-control/templates +nifi.ui.banner.text=TEST BANNER +nifi.ui.autorefresh.interval=30 sec +nifi.nar.library.directory=target/test-classes/access-control/lib +nifi.nar.working.directory=target/test-classes/access-control/nar + +nifi.state.management.configuration.file=target/test-classes/access-control/state-management.xml +nifi.state.management.embedded.zookeeper.start=false +nifi.state.management.embedded.zookeeper.properties= +nifi.state.management.embedded.zookeeper.max.instances=3 +nifi.state.management.provider.local=local-provider +nifi.state.management.provider.cluster= + +# H2 Settings +nifi.database.directory=target/test-classes/database_repository +nifi.h2.url.append=;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE + +# FlowFile Repository +nifi.provenance.repository.implementation=org.apache.nifi.provenance.VolatileProvenanceRepository +nifi.flowfile.repository.directory=target/test-classes/flowfile_repository +nifi.flowfile.repository.partitions=256 +nifi.flowfile.repository.checkpoint.interval=2 mins +nifi.queue.swap.threshold=20000 +nifi.swap.storage.directory=target/test-classes/flowfile_repository/swap +nifi.swap.in.period=5 sec +nifi.swap.in.threads=1 +nifi.swap.out.period=5 sec +nifi.swap.out.threads=4 + +# Content Repository +nifi.content.claim.max.appendable.size=10 MB +nifi.content.claim.max.flow.files=100 +nifi.content.repository.directory.default=target/test-classes/content_repository +nifi.content.repository.archive.enabled=false + +# Provenance Repository Properties +nifi.provenance.repository.directory.default=./target/provenance_repository +nifi.provenance.repository.query.threads=2 +nifi.provenance.repository.max.storage.time=24 hours +nifi.provenance.repository.max.storage.size=1 GB +nifi.provenance.repository.rollover.time=30 secs +nifi.provenance.repository.rollover.size=100 MB + +# Component Status Repository +nifi.components.status.repository.implementation=org.apache.nifi.controller.status.history.VolatileComponentStatusRepository +nifi.components.status.repository.buffer.size=288 +nifi.components.status.snapshot.frequency=10 secs + +# Site to Site properties +#For testing purposes. Default value should actually be empty! +nifi.remote.input.host= +nifi.remote.input.socket.port= +nifi.remote.input.secure=false + +# web properties # +nifi.web.war.directory=target/test-classes/lib +nifi.web.http.host= +nifi.web.http.port= +nifi.web.https.host= +nifi.web.https.port=8443 +nifi.web.jetty.working.directory=target/test-classes/access-control/jetty + +# security properties # +nifi.sensitive.props.key=REPLACE_ME +nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL +nifi.sensitive.props.provider=BC + +nifi.security.keystore=target/test-classes/access-control/localhost-ks.jks +nifi.security.keystoreType=JKS +nifi.security.keystorePasswd=localtest +nifi.security.keyPasswd= +nifi.security.truststore=target/test-classes/access-control/localhost-ts.jks +nifi.security.truststoreType=JKS +nifi.security.truststorePasswd=localtest +nifi.security.needClientAuth=true +nifi.security.user.login.identity.provider=test-provider +nifi.security.user.authorizer=flow-test-provider + +# cluster common properties (cluster manager and nodes must have same values) # +nifi.cluster.protocol.heartbeat.interval=5 sec +nifi.cluster.protocol.is.secure=false +nifi.cluster.protocol.socket.timeout=30 sec +nifi.cluster.protocol.connection.handshake.timeout=45 sec +# if multicast is used, then nifi.cluster.protocol.multicast.xxx properties must be configured # +nifi.cluster.protocol.use.multicast=false +nifi.cluster.protocol.multicast.address= +nifi.cluster.protocol.multicast.port= +nifi.cluster.protocol.multicast.service.broadcast.delay=500 ms +nifi.cluster.protocol.multicast.service.locator.attempts=3 +nifi.cluster.protocol.multicast.service.locator.attempts.delay=1 sec + +# cluster node properties (only configure for cluster nodes) # +nifi.cluster.is.node=false +nifi.cluster.node.address= +nifi.cluster.node.protocol.port= +nifi.cluster.node.protocol.threads=2 +# if multicast is not used, nifi.cluster.node.unicast.xxx must have same values as nifi.cluster.manager.xxx # +nifi.cluster.node.unicast.manager.address= +nifi.cluster.node.unicast.manager.protocol.port= +nifi.cluster.node.unicast.manager.authority.provider.port= + +# cluster manager properties (only configure for cluster manager) # +nifi.cluster.is.manager=false +nifi.cluster.manager.address= +nifi.cluster.manager.protocol.port= +nifi.cluster.manager.authority.provider.port= +nifi.cluster.manager.authority.provider.threads=10 +nifi.cluster.manager.node.firewall.file= +nifi.cluster.manager.node.event.history.size=10 +nifi.cluster.manager.node.api.connection.timeout=30 sec +nifi.cluster.manager.node.api.read.timeout=30 sec +nifi.cluster.manager.node.api.request.threads=10 +nifi.cluster.manager.flow.retrieval.delay=5 sec +nifi.cluster.manager.protocol.threads=10 +nifi.cluster.manager.safemode.duration=0 sec http://git-wip-us.apache.org/repos/asf/nifi/blob/087622ea/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi.properties ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi.properties index 4df1e3d..145352f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi.properties +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/resources/access-control/nifi.properties @@ -15,7 +15,7 @@ # Core Properties # nifi.version=nifi version -nifi.flow.configuration.file= +nifi.flow.configuration.file=target/test-classes/access-control/flow.xml.gz nifi.flow.configuration.archive.dir=target/archive nifi.flowcontroller.autoResumeState=true nifi.flowcontroller.graceful.shutdown.period=10 sec
