[nifi] branch main updated: NIFI-9038: Fix fingerprinting group access control policies for Remote Port
This is an automated email from the ASF dual-hosted git repository. exceptionfactory pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 5e2ec9b NIFI-9038: Fix fingerprinting group access control policies for Remote Port 5e2ec9b is described below commit 5e2ec9b4543fe06accbeefa22cf09572a01e28cf Author: Mohammed Nadeem AuthorDate: Tue Aug 10 00:57:38 2021 +0530 NIFI-9038: Fix fingerprinting group access control policies for Remote Port This closes #5300 Signed-off-by: David Handermann --- .../nifi/fingerprint/FingerprintFactory.java | 28 +++--- .../nifi/fingerprint/FingerprintFactoryTest.java | 45 ++ .../src/test/resources/nifi/fingerprint/flow1a.xml | 44 + .../src/test/resources/nifi/fingerprint/flow1b.xml | 44 + .../src/test/resources/nifi/fingerprint/flow2.xml | 4 ++ .../nifi/fingerprint/flow3-with-bundle-1.xml | 2 + .../nifi/fingerprint/flow3-with-bundle-2.xml | 2 + .../nifi/fingerprint/flow3-with-missing-bundle.xml | 2 + .../nifi/fingerprint/flow3-with-no-bundle.xml | 2 + .../fingerprint/flow4-with-different-bundle.xml| 2 + .../src/test/resources/nifi/fingerprint/flow4.xml | 2 + .../test/resources/nifi/fingerprint/initial.xml| 2 + .../test/resources/nifi/fingerprint/modified.xml | 2 + .../fingerprint/public-port-with-no-policies.xml | 42 .../resources/nifi/fingerprint/validating-flow.xml | 2 + 15 files changed, 203 insertions(+), 22 deletions(-) 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 6cd55cd..ffaf032 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 @@ -359,7 +359,6 @@ public class FingerprintFactory { appendFirstValue(builder, DomUtils.getChildNodesByTagName(processGroupElem, "defaultBackPressureObjectThreshold")); appendFirstValue(builder, DomUtils.getChildNodesByTagName(processGroupElem, "defaultBackPressureDataSizeThreshold")); - final Element versionControlInfo = DomUtils.getChild(processGroupElem, "versionControlInformation"); if (versionControlInfo == null) { builder.append("NO_VERSION_CONTROL_INFORMATION"); @@ -567,6 +566,7 @@ public class FingerprintFactory { appendFirstValue(builder, DomUtils.getChildNodesByTagName(portElem, "name")); appendFirstValue(builder, DomUtils.getChildNodesByTagName(portElem, "allowRemoteAccess")); +// user access control final NodeList userAccessControlNodeList = DomUtils.getChildNodesByTagName(portElem, "userAccessControl"); if (userAccessControlNodeList == null || userAccessControlNodeList.getLength() == 0) { builder.append("NO_USER_ACCESS_CONTROL"); @@ -581,7 +581,8 @@ public class FingerprintFactory { } } -final NodeList groupAccessControlNodeList = DomUtils.getChildNodesByTagName(portElem, "userAccessControl"); +// group access control +final NodeList groupAccessControlNodeList = DomUtils.getChildNodesByTagName(portElem, "groupAccessControl"); if (groupAccessControlNodeList == null || groupAccessControlNodeList.getLength() == 0) { builder.append("NO_GROUP_ACCESS_CONTROL"); } else { @@ -682,7 +683,6 @@ public class FingerprintFactory { return builder; } - private StringBuilder addConnectionFingerprint(final StringBuilder builder, final Element connectionElem) throws FingerprintException { // id appendFirstValue(builder, DomUtils.getChildNodesByTagName(connectionElem, "id")); @@ -895,21 +895,11 @@ public class FingerprintFactory { } private String getValue(final Node node, final String defaultValue) { -final String value; -if (node.getTextContent() == null || StringUtils.isBlank(node.getTextContent())) { -value = defaultValue; -} else { -value = node.getTextContent().trim(); -} -return value; +return StringUtils.isBlank(node.getTextContent()) ? defaultValue : node.getTextContent().trim(); } private String getValue(final String value, final String defaultValue) { -if (StringUtils.isBlank(value)) { -return defaultValue; -} else { -return value; -} +return
[nifi] branch main updated: NIFI-9081 Updated nifi-framework-api tests to JUnit 5
This is an automated email from the ASF dual-hosted git repository. exceptionfactory pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 6a55c6c NIFI-9081 Updated nifi-framework-api tests to JUnit 5 6a55c6c is described below commit 6a55c6ca447ea902e454daf29eb9d17720310219 Author: Mike Thomsen AuthorDate: Tue Aug 24 10:41:26 2021 -0400 NIFI-9081 Updated nifi-framework-api tests to JUnit 5 - Updated nifi-external tests to JUnit 5 - Updated nifi-stateless to use JUnit 5 - Updated nifi-api to use JUnit 5 Signed-off-by: David Handermann --- .../nifi/components/TestPropertyDescriptor.java| 24 - .../resource/TestStandardResourceReferences.java | 6 +-- .../org/apache/nifi/processor/TestDataUnit.java| 4 +- .../apache/nifi/registry/TestVariableRegistry.java | 6 +-- .../nifi/processors/WriteResourceToStreamTest.java | 12 ++--- .../kafka/connect/StatelessNiFiSinkTaskIT.java | 50 -- .../kafka/connect/StatelessNiFiSourceTaskIT.java | 59 +- .../TestAbstractPolicyBasedAuthorizer.java | 11 ++-- .../nifi/authorization/TestAccessPolicy.java | 31 ++-- .../org/apache/nifi/authorization/TestGroup.java | 25 - .../org/apache/nifi/authorization/TestUser.java| 21 .../apache/nifi/bundle/BundleCoordinateTest.java | 9 ++-- .../org/apache/nifi/bundle/BundleDetailsTest.java | 19 +++ .../java/org/apache/nifi/web/TestRevision.java | 21 .../bootstrap/TestBootstrapConfiguration.java | 12 ++--- .../TestPropertiesFileFlowDefinitionParser.java| 6 +-- .../queue/TestStatelessFlowFileQueue.java | 14 ++--- .../TestStatelessFileSystemContentRepository.java | 16 +++--- .../session/TestAsynchronousCommitTracker.java | 8 +-- 19 files changed, 167 insertions(+), 187 deletions(-) diff --git a/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java b/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java index edeab30..bab58f7 100644 --- a/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java +++ b/nifi-api/src/test/java/org/apache/nifi/components/TestPropertyDescriptor.java @@ -20,19 +20,18 @@ import org.apache.nifi.components.PropertyDescriptor.Builder; import org.apache.nifi.components.resource.ResourceCardinality; import org.apache.nifi.components.resource.ResourceType; import org.apache.nifi.expression.ExpressionLanguageScope; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.concurrent.atomic.AtomicReference; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.anyString; /** @@ -46,10 +45,7 @@ public class TestPropertyDescriptor { private static Builder validDescriptorBuilder; private static String DEFAULT_VALUE = "Default Value"; -@Rule -public ExpectedException thrown = ExpectedException.none(); - -@BeforeClass +@BeforeAll public static void setUp() { validDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue("Allowable Value"); invalidDescriptorBuilder = new PropertyDescriptor.Builder().name("").allowableValues("Allowable Value", "Another Allowable Value").defaultValue(DEFAULT_VALUE); @@ -57,10 +53,8 @@ public class TestPropertyDescriptor { @Test public void testExceptionThrownByDescriptorWithInvalidDefaultValue() { -thrown.expect(IllegalStateException.class); -thrown.expectMessage("[" + DEFAULT_VALUE + "]"); - -invalidDescriptorBuilder.build(); +IllegalStateException exception = assertThrows(IllegalStateException.class, () -> invalidDescriptorBuilder.build()); +assertTrue(exception.getMessage().contains("[" + DEFAULT_VALUE + "]") ); } @Test diff --git a/nifi-api/src/test/java/org/apache/nifi/components/resource/TestStandardResourceReferences.java b/nifi-api/src/test/java/org/apache/nifi/components/resource/TestStandardResourceReferences.java index 1ce4f0044..cd05565 100644 --- a/nifi-api/src/test/java/org/apache/nifi/components/resource/TestStandardResourceReferences.java +++
[nifi] branch main updated: NIFI-9210 Upgraded jsoup from 1.8.3 to 1.14.2
This is an automated email from the ASF dual-hosted git repository. mthomsen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 977800b NIFI-9210 Upgraded jsoup from 1.8.3 to 1.14.2 977800b is described below commit 977800b8350d396ba2319a3c54d2ce10812f5584 Author: exceptionfactory AuthorDate: Thu Sep 9 16:05:12 2021 -0500 NIFI-9210 Upgraded jsoup from 1.8.3 to 1.14.2 This closes #5379 Signed-off-by: Mike Thomsen --- minifi/pom.xml | 2 +- nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/pom.xml | 2 +- .../src/test/java/org/apache/nifi/TestPutHTMLElement.java | 10 ++ nifi-nar-bundles/nifi-media-bundle/pom.xml | 6 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/minifi/pom.xml b/minifi/pom.xml index e28972e..f57d783 100644 --- a/minifi/pom.xml +++ b/minifi/pom.xml @@ -1028,7 +1028,7 @@ limitations under the License. org.jsoup jsoup -1.8.3 +1.14.2 org.codehaus.groovy diff --git a/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/pom.xml b/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/pom.xml index e8662b7..8b5563b 100644 --- a/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/pom.xml +++ b/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/pom.xml @@ -29,7 +29,7 @@ org.jsoup jsoup -1.8.3 +1.14.2 org.apache.commons diff --git a/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/src/test/java/org/apache/nifi/TestPutHTMLElement.java b/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/src/test/java/org/apache/nifi/TestPutHTMLElement.java index b842ccb..5d4c5e5 100644 --- a/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/src/test/java/org/apache/nifi/TestPutHTMLElement.java +++ b/nifi-nar-bundles/nifi-html-bundle/nifi-html-processors/src/test/java/org/apache/nifi/TestPutHTMLElement.java @@ -29,6 +29,8 @@ import org.junit.Test; import java.io.File; import java.util.List; + +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -58,7 +60,7 @@ public class TestPutHTMLElement extends AbstractHTMLTest { testRunner.assertTransferCount(PutHTMLElement.REL_NOT_FOUND, 0); List ffs = testRunner.getFlowFilesForRelationship(PutHTMLElement.REL_SUCCESS); -assertTrue(ffs.size() == 1); +assertEquals(1, ffs.size()); String data = new String(testRunner.getContentAsByteArray(ffs.get(0))); //Contents will be the entire HTML doc. So lets use Jsoup again just the grab the element we want. @@ -85,7 +87,7 @@ public class TestPutHTMLElement extends AbstractHTMLTest { testRunner.assertTransferCount(PutHTMLElement.REL_NOT_FOUND, 0); List ffs = testRunner.getFlowFilesForRelationship(PutHTMLElement.REL_SUCCESS); -assertTrue(ffs.size() == 1); +assertEquals(1, ffs.size()); String data = new String(testRunner.getContentAsByteArray(ffs.get(0))); //Contents will be the entire HTML doc. So lets use Jsoup again just the grab the element we want. @@ -93,7 +95,7 @@ public class TestPutHTMLElement extends AbstractHTMLTest { Elements eles = doc.select("#put"); Element ele = eles.get(0); -assertTrue(StringUtils.equals("modified value \n", ele.html())); +assertEquals("modified value", ele.html()); } @Test @@ -112,7 +114,7 @@ public class TestPutHTMLElement extends AbstractHTMLTest { testRunner.assertTransferCount(PutHTMLElement.REL_NOT_FOUND, 0); List ffs = testRunner.getFlowFilesForRelationship(PutHTMLElement.REL_SUCCESS); -assertTrue(ffs.size() == 1); +assertEquals(1, ffs.size()); String data = new String(testRunner.getContentAsByteArray(ffs.get(0))); //Contents will be the entire HTML doc. So lets use Jsoup again just the grab the element we want. diff --git a/nifi-nar-bundles/nifi-media-bundle/pom.xml b/nifi-nar-bundles/nifi-media-bundle/pom.xml index 1aa2bde..efe1de1 100644 --- a/nifi-nar-bundles/nifi-media-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-media-bundle/pom.xml @@ -40,6 +40,12 @@ commons-compress 1.21 + + +org.jsoup +jsoup +1.14.2 +