[nifi-registry] branch main updated: NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider
This is an automated email from the ASF dual-hosted git repository. kdoran pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-registry.git The following commit(s) were added to refs/heads/main by this push: new 85a3243 NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider 85a3243 is described below commit 85a3243ca0cfa3244d8852a636fd667715e7412d Author: Bryan Bende AuthorDate: Mon Aug 10 11:19:10 2020 -0400 NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider This closes #294. Signed-off-by: Kevin Doran --- .../nifi/registry/web/api/SecureDatabaseIT.java| 238 + .../application-ITSecureDatabase.properties| 36 .../resources/conf/secure-database/authorizers.xml | 80 +++ .../nifi-registry-client.properties| 25 +++ .../conf/secure-database/nifi-registry.properties | 33 +++ .../src/test/resources/db/clearDB.sql | 2 + 6 files changed, 414 insertions(+) diff --git a/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java b/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java new file mode 100644 index 000..3b7ce60 --- /dev/null +++ b/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java @@ -0,0 +1,238 @@ +/* + * 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. + */ +package org.apache.nifi.registry.web.api; + +import org.apache.nifi.registry.NiFiRegistryTestApiApplication; +import org.apache.nifi.registry.authorization.AccessPolicy; +import org.apache.nifi.registry.authorization.User; +import org.apache.nifi.registry.authorization.UserGroup; +import org.apache.nifi.registry.bucket.Bucket; +import org.apache.nifi.registry.client.BucketClient; +import org.apache.nifi.registry.client.NiFiRegistryClient; +import org.apache.nifi.registry.client.NiFiRegistryClientConfig; +import org.apache.nifi.registry.client.PoliciesClient; +import org.apache.nifi.registry.client.TenantsClient; +import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient; +import org.apache.nifi.registry.revision.entity.RevisionInfo; +import org.apache.nifi.registry.security.authorization.RequestAction; +import org.apache.nifi.registry.security.authorization.resource.ResourceFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest( +classes = NiFiRegistryTestApiApplication.class, +webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +properties = "spring.profiles.include=ITSecureDatabase") +@Import(SecureITClientConfiguration.class) +@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:db/clearDB.sql"}) +public class SecureDatabaseIT extends IntegrationTestBase { + +private static final Logger LOGGER = LoggerFactory.getLogger(SecureDatabaseIT.class); + +private static final String INITIAL_ADMIN_IDENTITY = "CN=user1, OU=nifi"; +private static final String OTHER_USER_IDENTITY = "CN=user2, OU=nifi"; + +private NiFiRegistryClient client; + +@Before +public void setup() { +final String baseUrl = createBaseURL(); +LOGGER.info("Using base url = " + baseUrl); + +final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl); +Assert.assertNotNull(clientConfig); + +final NiFiRegistryClient client = new JerseyNiFiRegistryClient.
[nifi-registry] branch main updated: NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider
This is an automated email from the ASF dual-hosted git repository. kdoran pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-registry.git The following commit(s) were added to refs/heads/main by this push: new 85a3243 NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider 85a3243 is described below commit 85a3243ca0cfa3244d8852a636fd667715e7412d Author: Bryan Bende AuthorDate: Mon Aug 10 11:19:10 2020 -0400 NIFIREG-410 Add integration tests that cover the new Database UserGroupProvider and AccessPolicyProvider This closes #294. Signed-off-by: Kevin Doran --- .../nifi/registry/web/api/SecureDatabaseIT.java| 238 + .../application-ITSecureDatabase.properties| 36 .../resources/conf/secure-database/authorizers.xml | 80 +++ .../nifi-registry-client.properties| 25 +++ .../conf/secure-database/nifi-registry.properties | 33 +++ .../src/test/resources/db/clearDB.sql | 2 + 6 files changed, 414 insertions(+) diff --git a/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java b/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java new file mode 100644 index 000..3b7ce60 --- /dev/null +++ b/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureDatabaseIT.java @@ -0,0 +1,238 @@ +/* + * 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. + */ +package org.apache.nifi.registry.web.api; + +import org.apache.nifi.registry.NiFiRegistryTestApiApplication; +import org.apache.nifi.registry.authorization.AccessPolicy; +import org.apache.nifi.registry.authorization.User; +import org.apache.nifi.registry.authorization.UserGroup; +import org.apache.nifi.registry.bucket.Bucket; +import org.apache.nifi.registry.client.BucketClient; +import org.apache.nifi.registry.client.NiFiRegistryClient; +import org.apache.nifi.registry.client.NiFiRegistryClientConfig; +import org.apache.nifi.registry.client.PoliciesClient; +import org.apache.nifi.registry.client.TenantsClient; +import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient; +import org.apache.nifi.registry.revision.entity.RevisionInfo; +import org.apache.nifi.registry.security.authorization.RequestAction; +import org.apache.nifi.registry.security.authorization.resource.ResourceFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest( +classes = NiFiRegistryTestApiApplication.class, +webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, +properties = "spring.profiles.include=ITSecureDatabase") +@Import(SecureITClientConfiguration.class) +@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:db/clearDB.sql"}) +public class SecureDatabaseIT extends IntegrationTestBase { + +private static final Logger LOGGER = LoggerFactory.getLogger(SecureDatabaseIT.class); + +private static final String INITIAL_ADMIN_IDENTITY = "CN=user1, OU=nifi"; +private static final String OTHER_USER_IDENTITY = "CN=user2, OU=nifi"; + +private NiFiRegistryClient client; + +@Before +public void setup() { +final String baseUrl = createBaseURL(); +LOGGER.info("Using base url = " + baseUrl); + +final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl); +Assert.assertNotNull(clientConfig); + +final NiFiRegistryClient client = new JerseyNiFiRegistryClient.