NIFIREG-42 Adding IT test for NiFi Registry client and upgrading to Spring Boot 
2.0.0.M7 so we can use Jersey 2.26

Signed-off-by: Bryan Bende <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi-registry/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-registry/commit/b2ff7b5a
Tree: http://git-wip-us.apache.org/repos/asf/nifi-registry/tree/b2ff7b5a
Diff: http://git-wip-us.apache.org/repos/asf/nifi-registry/diff/b2ff7b5a

Branch: refs/heads/master
Commit: b2ff7b5a7e436aef43103ec5e0e204776f12d8da
Parents: c8d32fb
Author: Bryan Bende <[email protected]>
Authored: Mon Dec 4 15:49:27 2017 -0500
Committer: Bryan Bende <[email protected]>
Committed: Thu Dec 7 14:37:35 2017 -0500

----------------------------------------------------------------------
 nifi-registry-client/pom.xml                    |  42 +--
 .../impl/TestJerseyNiFiRegistryClient.java      | 315 -----------------
 .../registry/client/impl/TestUserClient.java    |  58 ----
 nifi-registry-framework/pom.xml                 |  10 +
 .../nifi/registry/db/DatabaseKeyService.java    |   2 +-
 .../registry/db/DatabaseMetadataService.java    |  14 +-
 .../registry/db/DatabaseKeyServiceSpec.groovy   |   3 +-
 .../db/repository/TestBucketItemRepository.java |   8 +-
 .../db/repository/TestBucketRepository.java     |  18 +-
 .../db/repository/TestFlowRepository.java       |  12 +-
 .../repository/TestFlowSnapshotRepository.java  |  14 +-
 .../db/repository/TestKeyRepository.java        |  10 +-
 nifi-registry-web-api/pom.xml                   |  27 +-
 .../registry/NiFiRegistryApiApplication.java    |   2 +-
 .../nifi/registry/web/api/AccessResource.java   |   5 +-
 .../web/mapper/NiFiRegistryJsonProvider.java    |   2 +-
 .../kerberos/KerberosSpnegoFactory.java         |   4 +-
 .../KerberosSpnegoIdentityProvider.java         |   9 +-
 .../NiFiRegistryTestApiApplication.java         |   2 +-
 .../registry/SecureLdapTestApiApplication.java  |   2 +-
 .../registry/web/api/IntegrationTestBase.java   |  50 ++-
 .../web/api/SecureNiFiRegistryClientIT.java     | 163 +++++++++
 .../web/api/UnsecuredNiFiRegistryClientIT.java  | 347 +++++++++++++++++++
 pom.xml                                         |  71 ++--
 24 files changed, 664 insertions(+), 526 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-client/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-registry-client/pom.xml b/nifi-registry-client/pom.xml
index 6605995..70d2790 100644
--- a/nifi-registry-client/pom.xml
+++ b/nifi-registry-client/pom.xml
@@ -21,44 +21,6 @@
     <artifactId>nifi-registry-client</artifactId>
     <packaging>jar</packaging>
 
-    <!-- Use the newest version of Jersey for the client here, since the 
primary client is NiFi which also uses Jersey 2.26,
-         when spring-boot 2.0.0 comes out spring-boot-jersey will use 2.26 and 
nifi-registry-client and backend can both use 2.2.6
-     -->
-    <properties>
-        <jersey.version>2.26</jersey.version>
-        <jax.rs.api.version>2.1</jax.rs.api.version>
-    </properties>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>javax.ws.rs</groupId>
-                <artifactId>javax.ws.rs-api</artifactId>
-                <version>${jax.rs.api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.glassfish.jersey.core</groupId>
-                <artifactId>jersey-client</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.glassfish.jersey.media</groupId>
-                <artifactId>jersey-media-json-jackson</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.glassfish.jersey.inject</groupId>
-                <artifactId>jersey-hk2</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.glassfish.jersey.core</groupId>
-                <artifactId>jersey-common</artifactId>
-                <version>${jersey.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.nifi.registry</groupId>
@@ -73,18 +35,22 @@
         <dependency>
             <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-client</artifactId>
+            <version>${jersey.version}</version>
         </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.media</groupId>
             <artifactId>jersey-media-json-jackson</artifactId>
+            <version>${jersey.version}</version>
         </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.inject</groupId>
             <artifactId>jersey-hk2</artifactId>
+            <version>${jersey.version}</version>
         </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-common</artifactId>
+            <version>${jersey.version}</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestJerseyNiFiRegistryClient.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestJerseyNiFiRegistryClient.java
 
b/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestJerseyNiFiRegistryClient.java
deleted file mode 100644
index bfdfb33..0000000
--- 
a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestJerseyNiFiRegistryClient.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * 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.client.impl;
-
-import org.apache.nifi.registry.bucket.Bucket;
-import org.apache.nifi.registry.bucket.BucketItem;
-import org.apache.nifi.registry.client.BucketClient;
-import org.apache.nifi.registry.client.FlowClient;
-import org.apache.nifi.registry.client.FlowSnapshotClient;
-import org.apache.nifi.registry.client.ItemsClient;
-import org.apache.nifi.registry.client.NiFiRegistryClient;
-import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
-import org.apache.nifi.registry.client.NiFiRegistryException;
-import org.apache.nifi.registry.field.Fields;
-import org.apache.nifi.registry.flow.VersionedFlow;
-import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
-import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
-import org.apache.nifi.registry.flow.VersionedProcessGroup;
-import org.apache.nifi.registry.flow.VersionedProcessor;
-import org.apache.nifi.registry.params.SortOrder;
-import org.apache.nifi.registry.params.SortParameter;
-import org.junit.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class TestJerseyNiFiRegistryClient {
-
-    public static final Logger LOGGER = 
LoggerFactory.getLogger(TestJerseyNiFiRegistryClient.class);
-
-    public static void main(String[] args) {
-        final NiFiRegistryClientConfig config = new 
NiFiRegistryClientConfig.Builder()
-                .baseUrl("http://localhost:8080";)
-                .build();
-
-        final NiFiRegistryClient client = new 
JerseyNiFiRegistryClient.Builder()
-                .config(config)
-                .build();
-
-        final BucketClient bucketClient = client.getBucketClient();
-
-        try {
-            // ---------------------- TEST BUCKETS --------------------------//
-
-            // create buckets
-            final int numBuckets = 10;
-            final List<Bucket> createdBuckets = new ArrayList<>();
-
-            for (int i=0; i < numBuckets; i++) {
-                final Bucket createdBucket = createBucket(bucketClient, i);
-                System.out.println("Created bucket # " + i + " with id " + 
createdBucket.getIdentifier());
-                createdBuckets.add(createdBucket);
-            }
-
-            // get each bucket
-            for (final Bucket bucket : createdBuckets) {
-                final Bucket retrievedBucket = 
bucketClient.get(bucket.getIdentifier());
-                Assert.assertNotNull(retrievedBucket);
-                System.out.println("Retrieved bucket " + 
retrievedBucket.getIdentifier());
-            }
-
-            //final Bucket nonExistentBucket = 
bucketClient.get("does-not-exist");
-            //Assert.assertNull(nonExistentBucket);
-
-            // get bucket fields
-            final Fields bucketFields = bucketClient.getFields();
-            Assert.assertNotNull(bucketFields);
-            System.out.println("Retrieved bucket fields, size = " + 
bucketFields.getFields().size());
-            Assert.assertTrue(bucketFields.getFields().size() > 0);
-
-            // get all buckets
-            final List<Bucket> allBuckets = bucketClient.getAll();
-            System.out.println("Retrieved buckets, size = " + 
allBuckets.size());
-            Assert.assertEquals(numBuckets, allBuckets.size());
-            allBuckets.stream().forEach(b -> System.out.println("Retrieve 
bucket " + b.getIdentifier()));
-
-            // get all buckets with sorting
-            final SortParameter sortParam = new SortParameter("created", 
SortOrder.ASC);
-            final List<Bucket> allBucketsSorted = 
bucketClient.getAll(Arrays.asList(sortParam));
-            System.out.println("Retrieved sorted buckets, size = " + 
allBucketsSorted.size());
-            Assert.assertEquals(numBuckets, allBucketsSorted.size());
-            allBucketsSorted.stream().forEach(b -> 
System.out.println("Retrieve bucket " + b.getIdentifier()));
-
-            // update each bucket
-            for (final Bucket bucket : createdBuckets) {
-                final Bucket bucketUpdate = new Bucket();
-                bucketUpdate.setIdentifier(bucket.getIdentifier());
-                bucketUpdate.setDescription(bucket.getDescription() + " 
UPDATE");
-
-                final Bucket updatedBucket = bucketClient.update(bucketUpdate);
-                Assert.assertNotNull(updatedBucket);
-                System.out.println("Updated bucket " + 
updatedBucket.getIdentifier());
-            }
-
-            // ---------------------- TEST FLOWS --------------------------//
-
-            final FlowClient flowClient = client.getFlowClient();
-
-            // create flows
-            final Bucket flowsBucket = createdBuckets.get(0);
-
-            final VersionedFlow flow1 = createFlow(flowClient, flowsBucket, 1);
-            System.out.println("Created flow # 1 with id " + 
flow1.getIdentifier());
-
-            final VersionedFlow flow2 = createFlow(flowClient, flowsBucket, 2);
-            System.out.println("Created flow # 2 with id " + 
flow2.getIdentifier());
-
-            // get flow
-            final VersionedFlow retrievedFlow1 = 
flowClient.get(flowsBucket.getIdentifier(), flow1.getIdentifier());
-            Assert.assertNotNull(retrievedFlow1);
-            System.out.println("Retrieved flow # 1 with id " + 
retrievedFlow1.getIdentifier());
-
-            final VersionedFlow retrievedFlow2 = 
flowClient.get(flowsBucket.getIdentifier(), flow2.getIdentifier());
-            Assert.assertNotNull(retrievedFlow2);
-            System.out.println("Retrieved flow # 2 with id " + 
retrievedFlow2.getIdentifier());
-
-            // update flows
-            final VersionedFlow flow1Update = new VersionedFlow();
-            flow1Update.setIdentifier(flow1.getIdentifier());
-            flow1Update.setName(flow1.getName() + " UPDATED");
-
-            final VersionedFlow updatedFlow1 = 
flowClient.update(flowsBucket.getIdentifier(), flow1Update);
-            Assert.assertNotNull(updatedFlow1);
-            System.out.println("Updated flow # 1 with id " + 
updatedFlow1.getIdentifier());
-
-            // get flow fields
-            final Fields flowFields = flowClient.getFields();
-            Assert.assertNotNull(flowFields);
-            System.out.println("Retrieved flow fields, size = " + 
flowFields.getFields().size());
-            Assert.assertTrue(flowFields.getFields().size() > 0);
-
-            // get flows in bucket
-            final List<VersionedFlow> flowsInBucket = 
flowClient.getByBucket(flowsBucket.getIdentifier());
-            Assert.assertNotNull(flowsInBucket);
-            Assert.assertEquals(2, flowsInBucket.size());
-            flowsInBucket.stream().forEach(f -> System.out.println("Flow in 
bucket, flow id " + f.getIdentifier()));
-
-            // get flows in bucket with sorting
-            final SortParameter flowsSortParam = new SortParameter("created", 
SortOrder.ASC);
-            final List<VersionedFlow> flowsInBucketSorted = 
flowClient.getByBucket(flowsBucket.getIdentifier(), 
Arrays.asList(flowsSortParam));
-            Assert.assertNotNull(flowsInBucketSorted);
-            Assert.assertEquals(2, flowsInBucketSorted.size());
-
-            // ---------------------- TEST SNAPSHOTS 
--------------------------//
-
-            final FlowSnapshotClient snapshotClient = 
client.getFlowSnapshotClient();
-
-            // create snapshots
-            final VersionedFlow snapshotFlow = flow1;
-
-            final VersionedFlowSnapshot snapshot1 = 
createSnapshot(snapshotClient, snapshotFlow, 1);
-            System.out.println("Created snapshot # 1 with version " + 
snapshot1.getSnapshotMetadata().getVersion());
-
-            final VersionedFlowSnapshot snapshot2 = 
createSnapshot(snapshotClient, snapshotFlow, 2);
-            System.out.println("Created snapshot # 2 with version " + 
snapshot2.getSnapshotMetadata().getVersion());
-
-            // get snapshot
-            final VersionedFlowSnapshot retrievedSnapshot1 = 
snapshotClient.get(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier(), 1);
-            Assert.assertNotNull(retrievedSnapshot1);
-            Assert.assertFalse(retrievedSnapshot1.isLatest());
-            System.out.println("Retrieved snapshot # 1 with version " + 
retrievedSnapshot1.getSnapshotMetadata().getVersion());
-
-            final VersionedFlowSnapshot retrievedSnapshot2 = 
snapshotClient.get(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier(), 2);
-            Assert.assertNotNull(retrievedSnapshot2);
-            Assert.assertTrue(retrievedSnapshot2.isLatest());
-            System.out.println("Retrieved snapshot # 2 with version " + 
retrievedSnapshot2.getSnapshotMetadata().getVersion());
-
-            // get latest
-            final VersionedFlowSnapshot retrievedSnapshotLatest = 
snapshotClient.getLatest(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier());
-            Assert.assertNotNull(retrievedSnapshotLatest);
-            Assert.assertEquals(snapshot2.getSnapshotMetadata().getVersion(), 
retrievedSnapshotLatest.getSnapshotMetadata().getVersion());
-            Assert.assertTrue(retrievedSnapshotLatest.isLatest());
-            System.out.println("Retrieved latest snapshot with version " + 
retrievedSnapshotLatest.getSnapshotMetadata().getVersion());
-
-            // get metadata
-            final List<VersionedFlowSnapshotMetadata> retrievedMetadata = 
snapshotClient.getSnapshotMetadata(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier());
-            Assert.assertNotNull(retrievedMetadata);
-            Assert.assertEquals(2, retrievedMetadata.size());
-            retrievedMetadata.stream().forEach(s -> 
System.out.println("Retrieved snapshot metadata " + s.getVersion()));
-
-            // ---------------------- TEST ITEMS --------------------------//
-
-            final ItemsClient itemsClient = client.getItemsClient();
-
-            // get fields
-            final Fields itemFields = itemsClient.getFields();
-            Assert.assertNotNull(itemFields.getFields());
-            Assert.assertTrue(itemFields.getFields().size() > 0);
-
-            // get all items
-            final List<BucketItem> allItems = itemsClient.getAll();
-            Assert.assertEquals(2, allItems.size());
-            allItems.stream().forEach(i -> System.out.println("All items, item 
" + i.getIdentifier()));
-
-            // get all items with sorting
-            final SortParameter itemsSortParam = new SortParameter("created", 
SortOrder.ASC);
-            final List<BucketItem> allItemsSorted = 
itemsClient.getAll(Arrays.asList(itemsSortParam));
-            Assert.assertEquals(2, allItemsSorted.size());
-
-            // get items for bucket
-            final List<BucketItem> bucketItems = 
itemsClient.getByBucket(flowsBucket.getIdentifier());
-            Assert.assertEquals(2, bucketItems.size());
-            bucketItems.stream().forEach(i -> System.out.println("Items in 
bucket, item " + i.getIdentifier()));
-
-            // get items for bucket with sorting
-            final List<BucketItem> bucketItemsSorted = 
itemsClient.getByBucket(flowsBucket.getIdentifier(), 
Arrays.asList(itemsSortParam));
-            Assert.assertEquals(2, bucketItemsSorted.size());
-
-            // ---------------------- DELETE DATA --------------------------//
-
-            final VersionedFlow deletedFlow1 = 
flowClient.delete(flowsBucket.getIdentifier(), flow1.getIdentifier());
-            Assert.assertNotNull(deletedFlow1);
-            System.out.println("Deleted flow " + deletedFlow1.getIdentifier());
-
-            final VersionedFlow deletedFlow2 = 
flowClient.delete(flowsBucket.getIdentifier(), flow2.getIdentifier());
-            Assert.assertNotNull(deletedFlow2);
-            System.out.println("Deleted flow " + deletedFlow2.getIdentifier());
-
-            // delete each bucket
-            for (final Bucket bucket : createdBuckets) {
-                final Bucket deletedBucket = 
bucketClient.delete(bucket.getIdentifier());
-                Assert.assertNotNull(deletedBucket);
-                System.out.println("Deleted bucket " + 
deletedBucket.getIdentifier());
-            }
-            Assert.assertEquals(0, bucketClient.getAll().size());
-
-            System.out.println("!!! SUCCESS !!!");
-
-        } catch (Exception e) {
-            LOGGER.error(e.getMessage(), e);
-        } finally {
-            try {
-                client.close();
-            } catch (Exception e) {
-
-            }
-        }
-    }
-
-    private static Bucket createBucket(BucketClient bucketClient, int num) 
throws IOException, NiFiRegistryException {
-        final Bucket bucket = new Bucket();
-        bucket.setName("Bucket #" + num);
-        bucket.setDescription("This is bucket #" + num);
-        return bucketClient.create(bucket);
-    }
-
-    private static VersionedFlow createFlow(FlowClient client, Bucket bucket, 
int num) throws IOException, NiFiRegistryException {
-        final VersionedFlow versionedFlow = new VersionedFlow();
-        versionedFlow.setName(bucket.getName() + " Flow #" + num);
-        versionedFlow.setDescription("This is " + bucket.getName() + " flow #" 
+ num);
-        versionedFlow.setBucketIdentifier(bucket.getIdentifier());
-        return client.create(versionedFlow);
-    }
-
-    private static VersionedFlowSnapshot createSnapshot(FlowSnapshotClient 
client, VersionedFlow flow, int num) throws IOException, NiFiRegistryException {
-        final VersionedFlowSnapshotMetadata snapshotMetadata = new 
VersionedFlowSnapshotMetadata();
-        snapshotMetadata.setBucketIdentifier(flow.getBucketIdentifier());
-        snapshotMetadata.setFlowIdentifier(flow.getIdentifier());
-        snapshotMetadata.setVersion(num);
-        snapshotMetadata.setComments("This is snapshot #" + num);
-
-        final VersionedProcessGroup rootProcessGroup = new 
VersionedProcessGroup();
-        rootProcessGroup.setIdentifier("root-pg");
-        rootProcessGroup.setName("Root Process Group");
-
-        final VersionedProcessGroup subProcessGroup = new 
VersionedProcessGroup();
-        subProcessGroup.setIdentifier("sub-pg");
-        subProcessGroup.setName("Sub Process Group");
-        rootProcessGroup.getProcessGroups().add(subProcessGroup);
-
-        final Map<String,String> processorProperties = new HashMap<>();
-        processorProperties.put("Prop 1", "Val 1");
-        processorProperties.put("Prop 2", "Val 2");
-
-        final VersionedProcessor processor1 = new VersionedProcessor();
-        processor1.setIdentifier("p1");
-        processor1.setName("Processor 1");
-        processor1.setProperties(processorProperties);
-
-        final VersionedProcessor processor2 = new VersionedProcessor();
-        processor2.setIdentifier("p2");
-        processor2.setName("Processor 2");
-        processor2.setProperties(processorProperties);
-
-        subProcessGroup.getProcessors().add(processor1);
-        subProcessGroup.getProcessors().add(processor2);
-
-        final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot();
-        snapshot.setSnapshotMetadata(snapshotMetadata);
-        snapshot.setFlowContents(rootProcessGroup);
-
-        return client.create(snapshot);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestUserClient.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestUserClient.java
 
b/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestUserClient.java
deleted file mode 100644
index 1184e56..0000000
--- 
a/nifi-registry-client/src/test/java/org/apache/nifi/registry/client/impl/TestUserClient.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.client.impl;
-
-import org.apache.nifi.registry.client.NiFiRegistryClient;
-import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
-import org.apache.nifi.registry.client.UserClient;
-import org.apache.nifi.registry.model.authorization.AccessStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestUserClient {
-
-    public static final Logger LOGGER = 
LoggerFactory.getLogger(TestUserClient.class);
-
-    public static void main(String[] args) {
-        final NiFiRegistryClientConfig config = new 
NiFiRegistryClientConfig.Builder()
-                .baseUrl("http://localhost:8080";)
-                .build();
-
-        final NiFiRegistryClient client = new 
JerseyNiFiRegistryClient.Builder()
-                .config(config)
-                .build();
-
-        final UserClient userClient = client.getUserClient();
-
-        try {
-            final AccessStatus status = userClient.getAccessStatus();
-            System.out.println("Identity: " + status.getIdentity());
-            System.out.println("Status: " + status.getStatus());
-            System.out.println("Message: " + status.getMessage());
-
-        } catch (Exception e) {
-            LOGGER.error(e.getMessage(), e);
-        } finally {
-            try {
-                client.close();
-            } catch (Exception e) {
-
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-registry-framework/pom.xml b/nifi-registry-framework/pom.xml
index e4bc462..28870b5 100644
--- a/nifi-registry-framework/pom.xml
+++ b/nifi-registry-framework/pom.xml
@@ -263,6 +263,16 @@
             <artifactId>flyway-spring-test</artifactId>
             <version>${flyway.version}</version>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-context</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-jdbc</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java
 
b/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java
index eb55251..d0697b3 100644
--- 
a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java
+++ 
b/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java
@@ -55,7 +55,7 @@ public class DatabaseKeyService implements KeyService {
         Key key = null;
         readLock.lock();
         try {
-            KeyEntity keyEntity = keyRepository.findOne(id);
+            KeyEntity keyEntity = keyRepository.findById(id).orElse(null);
             if (keyEntity != null) {
                 key = DataModelMapper.map(keyEntity);
             } else {

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseMetadataService.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseMetadataService.java
 
b/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseMetadataService.java
index 02be445..3f0373a 100644
--- 
a/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseMetadataService.java
+++ 
b/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseMetadataService.java
@@ -106,7 +106,7 @@ public class DatabaseMetadataService implements 
MetadataService {
 
     @Override
     public BucketEntity getBucketById(final String bucketIdentifier) {
-        return bucketRepository.findOne(bucketIdentifier);
+        return bucketRepository.findById(bucketIdentifier).orElse(null);
     }
 
     @Override
@@ -282,7 +282,7 @@ public class DatabaseMetadataService implements 
MetadataService {
 
     @Override
     public FlowEntity getFlowById(final String bucketIdentifier, final String 
flowIdentifier) {
-        FlowEntity flow = flowRepository.findOne(flowIdentifier);
+        FlowEntity flow = flowRepository.findById(flowIdentifier).orElse(null);
 
         if (flow == null || flow.getBucket() == null || 
!bucketIdentifier.equals(flow.getBucket().getId())) {
             return null;
@@ -293,7 +293,7 @@ public class DatabaseMetadataService implements 
MetadataService {
 
     @Override
     public FlowEntity getFlowByIdWithSnapshotCounts(final String 
bucketIdentifier, final String flowIdentifier) {
-        FlowEntity flow = flowRepository.findOne(flowIdentifier);
+        FlowEntity flow = flowRepository.findById(flowIdentifier).orElse(null);
 
         if (flow == null || flow.getBucket() == null || 
!bucketIdentifier.equals(flow.getBucket().getId())) {
             return null;
@@ -362,7 +362,7 @@ public class DatabaseMetadataService implements 
MetadataService {
     @Override
     public FlowSnapshotEntity getFlowSnapshot(final String bucketIdentifier, 
final String flowIdentifier, final Integer version) {
         final FlowSnapshotEntityKey key = new 
FlowSnapshotEntityKey(flowIdentifier, version);
-        FlowSnapshotEntity flowSnapshot = flowSnapshotRepository.findOne(key);
+        FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
 
         if (flowSnapshot == null
                 || flowSnapshot.getFlow() == null
@@ -403,9 +403,9 @@ public class DatabaseMetadataService implements 
MetadataService {
     private Pageable getPageRequest(final QueryParameters parameters) {
         final Sort sort = getSort(parameters);
         if (sort == null) {
-            return new PageRequest(parameters.getPageNum(), 
parameters.getNumRows());
+            return PageRequest.of(parameters.getPageNum(), 
parameters.getNumRows());
         } else {
-            return new PageRequest(parameters.getPageNum(), 
parameters.getNumRows(), sort);
+            return PageRequest.of(parameters.getPageNum(), 
parameters.getNumRows(), sort);
         }
     }
 
@@ -427,7 +427,7 @@ public class DatabaseMetadataService implements 
MetadataService {
         if (orders.isEmpty()) {
             return null;
         } else {
-            return new Sort(orders);
+            return Sort.by(orders);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/groovy/org/apache/nifi/registry/db/DatabaseKeyServiceSpec.groovy
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/groovy/org/apache/nifi/registry/db/DatabaseKeyServiceSpec.groovy
 
b/nifi-registry-framework/src/test/groovy/org/apache/nifi/registry/db/DatabaseKeyServiceSpec.groovy
index c3cea6a..3695ead 100644
--- 
a/nifi-registry-framework/src/test/groovy/org/apache/nifi/registry/db/DatabaseKeyServiceSpec.groovy
+++ 
b/nifi-registry-framework/src/test/groovy/org/apache/nifi/registry/db/DatabaseKeyServiceSpec.groovy
@@ -34,7 +34,8 @@ class DatabaseKeyServiceSpec extends Specification {
     def "get key"() {
 
         given: "a record exists for id=key1"
-        keyRepository.findOne("key1") >> new KeyEntity([id: "key1", 
tenantIdentity: "user1", keyValue: "keyValue1"])
+        keyRepository.findById("key1") >> Optional.of(new KeyEntity([id: 
"key1", tenantIdentity: "user1", keyValue: "keyValue1"]))
+        keyRepository.findById("key2") >> Optional.empty()
 
         when: "getKey is called with an existing id"
         Key existingKey = keyService.getKey("key1")

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketItemRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketItemRepository.java
 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketItemRepository.java
index c7fd7af..c024d76 100644
--- 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketItemRepository.java
+++ 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketItemRepository.java
@@ -39,7 +39,7 @@ public class TestBucketItemRepository extends 
DatabaseBaseTest {
 
     @Test
     public void testFindByBucket() {
-        final BucketEntity bucket = bucketRepository.findOne("1");
+        final BucketEntity bucket = 
bucketRepository.findById("1").orElse(null);
         assertNotNull(bucket);
 
         final List<BucketItemEntity> entities = 
bucketItemRepository.findByBucket(bucket);
@@ -49,10 +49,10 @@ public class TestBucketItemRepository extends 
DatabaseBaseTest {
 
     @Test
     public void testFindByBucketPageable() {
-        final BucketEntity bucket = bucketRepository.findOne("1");
+        final BucketEntity bucket = 
bucketRepository.findById("1").orElse(null);
         assertNotNull(bucket);
 
-        final List<BucketItemEntity> entities = 
bucketItemRepository.findByBucket(bucket, new PageRequest(0, 2, new 
Sort(Sort.Direction.ASC, "id")));
+        final List<BucketItemEntity> entities = 
bucketItemRepository.findByBucket(bucket, PageRequest.of(0, 2, new 
Sort(Sort.Direction.ASC, "id")));
         assertNotNull(entities);
         assertEquals(2, entities.size());
         assertEquals("1", entities.get(0).getId());
@@ -61,7 +61,7 @@ public class TestBucketItemRepository extends 
DatabaseBaseTest {
 
     @Test
     public void testFindByBucketSort() {
-        final BucketEntity bucket = bucketRepository.findOne("1");
+        final BucketEntity bucket = 
bucketRepository.findById("1").orElse(null);
         assertNotNull(bucket);
 
         final List<BucketItemEntity> entities = 
bucketItemRepository.findByBucket(bucket, new Sort(Sort.Direction.DESC, "id"));

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketRepository.java
 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketRepository.java
index f431180..7c1d74f 100644
--- 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketRepository.java
+++ 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestBucketRepository.java
@@ -61,7 +61,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
     public void testUpdate() {
         final String id = "1";
 
-        final BucketEntity existingBucket = bucketRepository.findOne(id);
+        final BucketEntity existingBucket = 
bucketRepository.findById(id).orElse(null);
         assertNotNull(existingBucket);
 
         final String updatedDescription = existingBucket.getDescription() + " 
UPDATED";
@@ -69,7 +69,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
 
         bucketRepository.save(existingBucket);
 
-        final BucketEntity updatedBucket = bucketRepository.findOne(id);
+        final BucketEntity updatedBucket = 
bucketRepository.findById(id).orElse(null);
         assertNotNull(updatedBucket);
         assertEquals(updatedDescription, updatedBucket.getDescription());
 
@@ -81,12 +81,12 @@ public class TestBucketRepository extends DatabaseBaseTest {
     public void testDelete() {
         final String id = "6";
 
-        final BucketEntity existingBucket = bucketRepository.findOne(id);
+        final BucketEntity existingBucket = 
bucketRepository.findById(id).orElse(null);
         assertNotNull(existingBucket);
 
         bucketRepository.delete(existingBucket);
 
-        final BucketEntity updatedBucket = bucketRepository.findOne(id);
+        final BucketEntity updatedBucket = 
bucketRepository.findById(id).orElse(null);
         assertNull(updatedBucket);
     }
 
@@ -94,7 +94,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
     public void testOneToManyWithBucketItems() {
         final String id = "1";
 
-        final BucketEntity existingBucket = bucketRepository.findOne(id);
+        final BucketEntity existingBucket = 
bucketRepository.findById(id).orElse(null);
         assertNotNull(existingBucket);
 
         final Set<BucketItemEntity> items = existingBucket.getItems();
@@ -122,7 +122,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
         int pageSize = 2;
 
         // query for first page
-        Pageable pageable = new PageRequest(pageIndex, pageSize, sort);
+        Pageable pageable = PageRequest.of(pageIndex, pageSize, sort);
 
         Page<BucketEntity> page = bucketRepository.findAll(pageable);
         assertNotNull(page);
@@ -139,7 +139,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
 
         // query for second page
         pageIndex++;
-        pageable = new PageRequest(pageIndex, pageSize, sort);
+        pageable = PageRequest.of(pageIndex, pageSize, sort);
         buckets = bucketRepository.findAll(pageable);
         assertNotNull(buckets);
 
@@ -150,7 +150,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
 
         // query for third page
         pageIndex++;
-        pageable = new PageRequest(pageIndex, pageSize, sort);
+        pageable = PageRequest.of(pageIndex, pageSize, sort);
         buckets = bucketRepository.findAll(pageable);
         assertNotNull(buckets);
 
@@ -161,7 +161,7 @@ public class TestBucketRepository extends DatabaseBaseTest {
 
         // query for fourth page
         pageIndex++;
-        pageable = new PageRequest(pageIndex, pageSize, sort);
+        pageable = PageRequest.of(pageIndex, pageSize, sort);
         buckets = bucketRepository.findAll(pageable);
         assertNotNull(buckets);
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowRepository.java
 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowRepository.java
index dbffb7a..5646966 100644
--- 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowRepository.java
+++ 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowRepository.java
@@ -44,7 +44,7 @@ public class TestFlowRepository extends DatabaseBaseTest {
     public void testCreateFlow() {
         final String bucketId = "1";
 
-        final BucketEntity existingBucket = bucketRepository.findOne(bucketId);
+        final BucketEntity existingBucket = 
bucketRepository.findById(bucketId).orElse(null);
         assertNotNull(existingBucket);
         assertNotNull(existingBucket.getItems());
         assertEquals(2, existingBucket.getItems().size());
@@ -71,7 +71,7 @@ public class TestFlowRepository extends DatabaseBaseTest {
     public void testUpdateFlow() {
         final String flowId = "1";
 
-        final FlowEntity flow = flowRepository.findOne(flowId);
+        final FlowEntity flow = flowRepository.findById(flowId).orElse(null);
         assertNotNull(flow);
         assertEquals(flowId, flow.getId());
 
@@ -80,7 +80,7 @@ public class TestFlowRepository extends DatabaseBaseTest {
 
         flowRepository.save(flow);
 
-        final FlowEntity updatedFlow = flowRepository.findOne(flowId);
+        final FlowEntity updatedFlow = 
flowRepository.findById(flowId).orElse(null);
         assertEquals(flow.getName(), updatedFlow.getName());
         assertEquals(flow.getDescription(), updatedFlow.getDescription());
         assertEquals(flow.getCreated(), updatedFlow.getCreated());
@@ -92,12 +92,12 @@ public class TestFlowRepository extends DatabaseBaseTest {
     public void testDeleteFlow() {
         final String flowId = "1";
 
-        final FlowEntity flow = flowRepository.findOne(flowId);
+        final FlowEntity flow = flowRepository.findById(flowId).orElse(null);
         assertNotNull(flow);
 
         flowRepository.delete(flow);
 
-        final FlowEntity deletedFlow = flowRepository.findOne(flowId);
+        final FlowEntity deletedFlow = 
flowRepository.findById(flowId).orElse(null);
         assertNull(deletedFlow);
     }
 
@@ -105,7 +105,7 @@ public class TestFlowRepository extends DatabaseBaseTest {
     public void testOneToManyWithFlowSnapshots() {
         final String flowId = "1";
 
-        final FlowEntity flow = flowRepository.findOne(flowId);
+        final FlowEntity flow = flowRepository.findById(flowId).orElse(null);
         assertNotNull(flow);
         assertNotNull(flow.getSnapshots());
         assertEquals(3, flow.getSnapshots().size());

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowSnapshotRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowSnapshotRepository.java
 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowSnapshotRepository.java
index d2d5985..2dc74b9 100644
--- 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowSnapshotRepository.java
+++ 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestFlowSnapshotRepository.java
@@ -57,7 +57,7 @@ public class TestFlowSnapshotRepository extends 
DatabaseBaseTest {
 
         flowSnapshotRepository.save(flowSnapshot);
 
-        final FlowSnapshotEntity createdFlowSnapshot = 
flowSnapshotRepository.findOne(key);
+        final FlowSnapshotEntity createdFlowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
         assertNotNull(createdFlowSnapshot);
     }
 
@@ -67,7 +67,7 @@ public class TestFlowSnapshotRepository extends 
DatabaseBaseTest {
         key.setFlowId("1");
         key.setVersion(1);
 
-        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findOne(key);
+        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
         assertNotNull(flowSnapshot);
         assertEquals(key, flowSnapshot.getId());
         assertNotNull(flowSnapshot.getFlow());
@@ -80,12 +80,12 @@ public class TestFlowSnapshotRepository extends 
DatabaseBaseTest {
         key.setFlowId("1");
         key.setVersion(1);
 
-        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findOne(key);
+        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
         assertNotNull(flowSnapshot);
 
         flowSnapshotRepository.delete(flowSnapshot);
 
-        final FlowSnapshotEntity deletedFlowSnapshot = 
flowSnapshotRepository.findOne(key);
+        final FlowSnapshotEntity deletedFlowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
         assertNull(deletedFlowSnapshot);
     }
 
@@ -95,7 +95,7 @@ public class TestFlowSnapshotRepository extends 
DatabaseBaseTest {
         key.setFlowId("1");
         key.setVersion(1);
 
-        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findOne(key);
+        final FlowSnapshotEntity flowSnapshot = 
flowSnapshotRepository.findById(key).orElse(null);
         assertNotNull(flowSnapshot);
 
         final FlowEntity flow = flowSnapshot.getFlow();
@@ -106,8 +106,8 @@ public class TestFlowSnapshotRepository extends 
DatabaseBaseTest {
 
         bucketRepository.delete(bucket);
 
-        assertNull(flowRepository.findOne(flow.getId()));
-        assertNull(flowSnapshotRepository.findOne(key));
+        assertNull(flowRepository.findById(flow.getId()).orElse(null));
+        assertNull(flowSnapshotRepository.findById(key).orElse(null));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestKeyRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestKeyRepository.java
 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestKeyRepository.java
index 567b0be..6bc4fef 100644
--- 
a/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestKeyRepository.java
+++ 
b/nifi-registry-framework/src/test/java/org/apache/nifi/registry/db/repository/TestKeyRepository.java
@@ -51,7 +51,7 @@ public class TestKeyRepository extends DatabaseBaseTest {
     public void testUpdate() {
         final String prepopulatedKeyId = "1";  // see test-setup.sql
 
-        final KeyEntity existingKey = keyRepository.findOne(prepopulatedKeyId);
+        final KeyEntity existingKey = 
keyRepository.findById(prepopulatedKeyId).orElse(null);
         assertNotNull(existingKey);
 
         final String updatedKeyValue = existingKey.getKeyValue() + " UPDATED";
@@ -59,7 +59,7 @@ public class TestKeyRepository extends DatabaseBaseTest {
 
         keyRepository.save(existingKey);
 
-        final KeyEntity updatedKey = keyRepository.findOne(prepopulatedKeyId);
+        final KeyEntity updatedKey = 
keyRepository.findById(prepopulatedKeyId).orElse(null);
         assertNotNull(updatedKey);
         assertEquals(updatedKeyValue, updatedKey.getKeyValue());
     }
@@ -69,12 +69,12 @@ public class TestKeyRepository extends DatabaseBaseTest {
     public void testDelete() {
         final String id = "1";
 
-        final KeyEntity existingKey = keyRepository.findOne("1");
+        final KeyEntity existingKey = keyRepository.findById("1").orElse(null);
         assertNotNull(existingKey);
 
         keyRepository.delete(existingKey);
 
-        final KeyEntity deletedKey = keyRepository.findOne("1");
+        final KeyEntity deletedKey = keyRepository.findById("1").orElse(null);
         assertNull(deletedKey);
     }
 
@@ -99,7 +99,7 @@ public class TestKeyRepository extends DatabaseBaseTest {
 
         KeyEntity deletedKey = 
keyRepository.findOneByTenantIdentity(prepopulatedKeyTenantIdentity);
         assertNull(deletedKey);
-        deletedKey = keyRepository.findOne("1");
+        deletedKey = keyRepository.findById("1").orElse(null);
         assertNull(deletedKey);
     }
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-registry-web-api/pom.xml b/nifi-registry-web-api/pom.xml
index 8b53496..48c5615 100644
--- a/nifi-registry-web-api/pom.xml
+++ b/nifi-registry-web-api/pom.xml
@@ -108,10 +108,17 @@
             <artifactId>spring-boot-starter-jersey</artifactId>
             <version>${spring.boot.version}</version>
         </dependency>
+        <!-- Exclude micrometer-core because it creates a class cast issue 
with logback, revisit later -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
             <version>${spring.boot.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.micrometer</groupId>
+                    <artifactId>micrometer-core</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.springframework.security.kerberos</groupId>
@@ -173,26 +180,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.glassfish.jersey.core</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.containers</groupId>
-            <artifactId>jersey-container-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.core</groupId>
-            <artifactId>jersey-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.media</groupId>
-            <artifactId>jersey-media-json-jackson</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.ext</groupId>
-            <artifactId>jersey-bean-validation</artifactId>
-        </dependency>
-        <dependency>
             <groupId>io.swagger</groupId>
             <artifactId>swagger-annotations</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java
 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java
index 19adaed..ad6c1db 100644
--- 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java
+++ 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java
@@ -19,7 +19,7 @@ package org.apache.nifi.registry;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import 
org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 
 import java.util.Properties;
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java
 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java
index 5cd1ccd..02bc3db 100644
--- 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java
+++ 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java
@@ -41,6 +41,7 @@ import 
org.apache.nifi.registry.web.security.authentication.x509.X509IdentityPro
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.lang.Nullable;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
@@ -80,8 +81,8 @@ public class AccessResource extends ApplicationResource {
             NiFiRegistryProperties properties,
             JwtService jwtService,
             X509IdentityProvider x509IdentityProvider,
-            KerberosSpnegoIdentityProvider kerberosSpnegoIdentityProvider,
-            IdentityProvider identityProvider) {
+            @Nullable KerberosSpnegoIdentityProvider 
kerberosSpnegoIdentityProvider,
+            @Nullable IdentityProvider identityProvider) {
         this.properties = properties;
         this.jwtService = jwtService;
         this.x509IdentityProvider = x509IdentityProvider;

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/mapper/NiFiRegistryJsonProvider.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/mapper/NiFiRegistryJsonProvider.java
 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/mapper/NiFiRegistryJsonProvider.java
index 3d2e4a1..a2174ba 100644
--- 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/mapper/NiFiRegistryJsonProvider.java
+++ 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/mapper/NiFiRegistryJsonProvider.java
@@ -19,8 +19,8 @@ package org.apache.nifi.registry.web.mapper;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+import 
org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import org.springframework.stereotype.Component;
 
 import javax.ws.rs.Produces;

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoFactory.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoFactory.java
 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoFactory.java
index 66d369d..16211ed 100644
--- 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoFactory.java
+++ 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoFactory.java
@@ -47,8 +47,8 @@ public class KerberosSpnegoFactory {
         return kerberosSpnegoIdentityProvider;
     }
 
-    @Bean
-    public KerberosServiceAuthenticationProvider 
kerberosServiceAuthenticationProvider() throws Exception {
+
+    private KerberosServiceAuthenticationProvider 
kerberosServiceAuthenticationProvider() throws Exception {
 
         if (kerberosServiceAuthenticationProvider == null && 
properties.isKerberosSpnegoSupportEnabled()) {
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java
 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java
index 7002792..e611b53 100644
--- 
a/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java
+++ 
b/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosSpnegoIdentityProvider.java
@@ -31,6 +31,7 @@ import org.apache.nifi.registry.util.FormatUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.lang.Nullable;
 import org.springframework.security.authentication.AuthenticationDetailsSource;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -73,7 +74,9 @@ public class KerberosSpnegoIdentityProvider implements 
IdentityProvider {
     private AuthenticationDetailsSource<HttpServletRequest, ?> 
authenticationDetailsSource;
 
     @Autowired
-    public 
KerberosSpnegoIdentityProvider(KerberosServiceAuthenticationProvider 
kerberosServiceAuthenticationProvider, NiFiRegistryProperties properties) {
+    public KerberosSpnegoIdentityProvider(
+            @Nullable  KerberosServiceAuthenticationProvider 
kerberosServiceAuthenticationProvider,
+            NiFiRegistryProperties properties) {
         this.kerberosServiceAuthenticationProvider = 
kerberosServiceAuthenticationProvider;
         authenticationDetailsSource = new WebAuthenticationDetailsSource();
 
@@ -129,6 +132,10 @@ public class KerberosSpnegoIdentityProvider implements 
IdentityProvider {
             return null;
         }
 
+        if (kerberosServiceAuthenticationProvider == null) {
+            throw new IdentityAccessException("The Kerberos authentication 
provider is not initialized.");
+        }
+
         try {
             KerberosServiceRequestToken kerberosServiceRequestToken = new 
KerberosServiceRequestToken(kerberosTicket);
             
kerberosServiceRequestToken.setDetails(authenticationRequest.getDetails());

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/NiFiRegistryTestApiApplication.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/NiFiRegistryTestApiApplication.java
 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/NiFiRegistryTestApiApplication.java
index e55fb21..04514dd 100644
--- 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/NiFiRegistryTestApiApplication.java
+++ 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/NiFiRegistryTestApiApplication.java
@@ -18,7 +18,7 @@ package org.apache.nifi.registry;
 
 import org.apache.nifi.registry.db.DataSourceFactory;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import 
org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.FilterType;
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/SecureLdapTestApiApplication.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/SecureLdapTestApiApplication.java
 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/SecureLdapTestApiApplication.java
index fea8349..74d0730 100644
--- 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/SecureLdapTestApiApplication.java
+++ 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/SecureLdapTestApiApplication.java
@@ -19,7 +19,7 @@ package org.apache.nifi.registry;
 import org.apache.nifi.registry.db.DataSourceFactory;
 import org.apache.nifi.registry.security.authorization.AuthorizerFactory;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import 
org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.FilterType;
 

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/IntegrationTestBase.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/IntegrationTestBase.java
 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/IntegrationTestBase.java
index e1d396e..9f3d439 100644
--- 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/IntegrationTestBase.java
+++ 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/IntegrationTestBase.java
@@ -19,16 +19,16 @@ package org.apache.nifi.registry.web.api;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
 import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
 import org.apache.nifi.registry.properties.NiFiRegistryProperties;
 import org.glassfish.jersey.client.ClientConfig;
+import 
org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.embedded.LocalServerPort;
-import 
org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
 import org.springframework.boot.test.context.TestConfiguration;
+import 
org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
+import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.context.annotation.Bean;
 
 import javax.annotation.PostConstruct;
@@ -46,7 +46,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
  */
 public abstract class IntegrationTestBase {
 
-    private static final String CONTEXT_PATH = "/nifi-registry-api-test";
+    private static final String CONTEXT_PATH = "/nifi-registry-api";
 
     @TestConfiguration
     public static class TestConfigurationClass {
@@ -62,8 +62,8 @@ public abstract class IntegrationTestBase {
         private NiFiRegistryProperties testProperties;
 
         @Bean
-        public JettyEmbeddedServletContainerFactory 
jettyEmbeddedServletContainerFactory() {
-            JettyEmbeddedServletContainerFactory jettyContainerFactory = new 
JettyEmbeddedServletContainerFactory();
+        public JettyServletWebServerFactory 
jettyEmbeddedServletContainerFactory() {
+            JettyServletWebServerFactory jettyContainerFactory = new 
JettyServletWebServerFactory();
             jettyContainerFactory.setContextPath(CONTEXT_PATH);
             return jettyContainerFactory;
         }
@@ -125,11 +125,7 @@ public abstract class IntegrationTestBase {
             throw new IllegalArgumentException("Resource path cannot be null");
         }
 
-        final boolean isSecure = this.properties.getSslPort() != null;
-        final String protocolSchema = isSecure ? "https" : "http";
-
-        final StringBuilder baseUriBuilder = new StringBuilder()
-                
.append(protocolSchema).append("://localhost:").append(port).append(CONTEXT_PATH);
+        final StringBuilder baseUriBuilder = new 
StringBuilder(createBaseURL()).append(CONTEXT_PATH);
 
         if (!relativeResourcePath.startsWith("/")) {
             baseUriBuilder.append('/');
@@ -140,6 +136,38 @@ public abstract class IntegrationTestBase {
     }
 
     /**
+     * Sub-classes can utilize this method to obtain the base-url for a client.
+     *
+     * @return a string containing the base url which includes the scheme, 
host, and port
+     */
+    String createBaseURL() {
+        final boolean isSecure = this.properties.getSslPort() != null;
+        final String protocolSchema = isSecure ? "https" : "http";
+
+        final StringBuilder baseUriBuilder = new StringBuilder()
+                .append(protocolSchema).append("://localhost:").append(port);
+
+        return baseUriBuilder.toString();
+    }
+
+    NiFiRegistryClientConfig createClientConfig(String baseUrl) {
+        final NiFiRegistryClientConfig.Builder builder = new 
NiFiRegistryClientConfig.Builder();
+        builder.baseUrl(baseUrl);
+
+        if (this.clientConfig != null) {
+            if (this.clientConfig.getSslContext() != null) {
+                builder.sslContext(this.clientConfig.getSslContext());
+            }
+
+            if (this.clientConfig.getHostnameVerifier() != null) {
+                
builder.hostnameVerifier(this.clientConfig.getHostnameVerifier());
+            }
+        }
+
+        return builder.build();
+    }
+
+    /**
      * A helper method for loading NiFiRegistryProperties by reading 
*.properties files from disk.
      *
      * @param propertiesFilePath The location of the properties file

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
new file mode 100644
index 0000000..45c32c0
--- /dev/null
+++ 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
@@ -0,0 +1,163 @@
+/*
+ * 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.bucket.Bucket;
+import org.apache.nifi.registry.client.BucketClient;
+import org.apache.nifi.registry.client.FlowClient;
+import org.apache.nifi.registry.client.FlowSnapshotClient;
+import org.apache.nifi.registry.client.NiFiRegistryClient;
+import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
+import org.apache.nifi.registry.client.NiFiRegistryException;
+import org.apache.nifi.registry.client.UserClient;
+import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient;
+import org.apache.nifi.registry.flow.VersionedFlow;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
+import org.apache.nifi.registry.flow.VersionedProcessGroup;
+import org.apache.nifi.registry.model.authorization.AccessStatus;
+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.io.IOException;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(
+        classes = NiFiRegistryTestApiApplication.class,
+        webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
+        properties = "spring.profiles.include=ITSecureFile")
+@Import(SecureITClientConfiguration.class)
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = 
"classpath:db/clearDB.sql")
+public class SecureNiFiRegistryClientIT extends IntegrationTestBase {
+
+    static final Logger LOGGER = 
LoggerFactory.getLogger(SecureNiFiRegistryClientIT.class);
+
+    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.Builder()
+                .config(clientConfig)
+                .build();
+        Assert.assertNotNull(client);
+        this.client = client;
+    }
+
+    @After
+    public void teardown() {
+        try {
+            client.close();
+        } catch (Exception e) {
+
+        }
+    }
+
+    @Test
+    public void testGetAccessStatus() throws IOException, 
NiFiRegistryException {
+        final UserClient userClient = client.getUserClient();
+        final AccessStatus status = userClient.getAccessStatus();
+        Assert.assertEquals("CN=user1, OU=nifi", status.getIdentity());
+        Assert.assertEquals("ACTIVE", status.getStatus());
+    }
+
+    @Test
+    public void testCrudOperations() throws IOException, NiFiRegistryException 
{
+        final Bucket bucket = new Bucket();
+        bucket.setName("Bucket 1");
+        bucket.setDescription("This is bucket 1");
+
+        final BucketClient bucketClient = client.getBucketClient();
+        final Bucket createdBucket = bucketClient.create(bucket);
+        Assert.assertNotNull(createdBucket);
+        Assert.assertNotNull(createdBucket.getIdentifier());
+
+        final List<Bucket> buckets = bucketClient.getAll();
+        Assert.assertEquals(1, buckets.size());
+
+        final VersionedFlow flow = new VersionedFlow();
+        flow.setBucketIdentifier(createdBucket.getIdentifier());
+        flow.setName("Flow 1");
+
+        final FlowClient flowClient = client.getFlowClient();
+        final VersionedFlow createdFlow = flowClient.create(flow);
+        Assert.assertNotNull(createdFlow);
+        Assert.assertNotNull(createdFlow.getIdentifier());
+
+        final VersionedFlowSnapshotMetadata snapshotMetadata = new 
VersionedFlowSnapshotMetadata();
+        
snapshotMetadata.setBucketIdentifier(createdFlow.getBucketIdentifier());
+        snapshotMetadata.setFlowIdentifier(createdFlow.getIdentifier());
+        snapshotMetadata.setVersion(1);
+        snapshotMetadata.setComments("This is snapshot #1");
+
+        final VersionedProcessGroup rootProcessGroup = new 
VersionedProcessGroup();
+        rootProcessGroup.setIdentifier("root-pg");
+        rootProcessGroup.setName("Root Process Group");
+
+        final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot();
+        snapshot.setSnapshotMetadata(snapshotMetadata);
+        snapshot.setFlowContents(rootProcessGroup);
+
+        final FlowSnapshotClient snapshotClient = 
client.getFlowSnapshotClient();
+        final VersionedFlowSnapshot createdSnapshot = 
snapshotClient.create(snapshot);
+        Assert.assertNotNull(createdSnapshot);
+        Assert.assertEquals("CN=user1, OU=nifi", 
createdSnapshot.getSnapshotMetadata().getAuthor());
+    }
+
+    @Test
+    public void testGetAccessStatusWithProxiedEntity() throws IOException, 
NiFiRegistryException {
+        final String proxiedEntity = "user2";
+        final UserClient userClient = client.getUserClient(proxiedEntity);
+        final AccessStatus status = userClient.getAccessStatus();
+        Assert.assertEquals("user2", status.getIdentity());
+        Assert.assertEquals("ACTIVE", status.getStatus());
+    }
+
+    @Test
+    public void testCreatedBucketWithProxiedEntity() throws IOException, 
NiFiRegistryException {
+        final String proxiedEntity = "user2";
+        final BucketClient bucketClient = 
client.getBucketClient(proxiedEntity);
+
+        final Bucket bucket = new Bucket();
+        bucket.setName("Bucket 1");
+        bucket.setDescription("This is bucket 1");
+
+        try {
+            bucketClient.create(bucket);
+            Assert.fail("Shouldn't have been able to create a bucket");
+        } catch (Exception e) {
+
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/b2ff7b5a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java
----------------------------------------------------------------------
diff --git 
a/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java
 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java
new file mode 100644
index 0000000..bcc2c0a
--- /dev/null
+++ 
b/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java
@@ -0,0 +1,347 @@
+/*
+ * 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.bucket.Bucket;
+import org.apache.nifi.registry.bucket.BucketItem;
+import org.apache.nifi.registry.client.BucketClient;
+import org.apache.nifi.registry.client.FlowClient;
+import org.apache.nifi.registry.client.FlowSnapshotClient;
+import org.apache.nifi.registry.client.ItemsClient;
+import org.apache.nifi.registry.client.NiFiRegistryClient;
+import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
+import org.apache.nifi.registry.client.NiFiRegistryException;
+import org.apache.nifi.registry.client.UserClient;
+import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient;
+import org.apache.nifi.registry.field.Fields;
+import org.apache.nifi.registry.flow.VersionedFlow;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
+import org.apache.nifi.registry.flow.VersionedProcessGroup;
+import org.apache.nifi.registry.flow.VersionedProcessor;
+import org.apache.nifi.registry.model.authorization.AccessStatus;
+import org.apache.nifi.registry.params.SortOrder;
+import org.apache.nifi.registry.params.SortParameter;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test all basic functionality of JerseyNiFiRegistryClient.
+ */
+public class UnsecuredNiFiRegistryClientIT extends UnsecuredITBase {
+
+    static final Logger LOGGER = 
LoggerFactory.getLogger(UnsecuredNiFiRegistryClientIT.class);
+
+    private NiFiRegistryClient client;
+
+    @Before
+    public void setup() {
+        final String baseUrl = createBaseURL();
+        LOGGER.info("Using base url = " + baseUrl);
+
+        final NiFiRegistryClientConfig clientConfig = new 
NiFiRegistryClientConfig.Builder()
+                .baseUrl(baseUrl)
+                .build();
+
+        Assert.assertNotNull(clientConfig);
+
+        final NiFiRegistryClient client = new 
JerseyNiFiRegistryClient.Builder()
+                .config(clientConfig)
+                .build();
+
+        Assert.assertNotNull(client);
+        this.client = client;
+    }
+
+    @After
+    public void teardown() {
+        try {
+            client.close();
+        } catch (Exception e) {
+
+        }
+    }
+
+    @Test
+    public void testUserClient() {
+        final UserClient userClient = client.getUserClient();
+        try {
+            final AccessStatus status = userClient.getAccessStatus();
+            Assert.fail("Should have thrown a 409");
+        } catch (Exception e) {
+        }
+    }
+
+    @Test
+    public void testNiFiRegistryClient() throws IOException, 
NiFiRegistryException {
+        // ---------------------- TEST BUCKETS --------------------------//
+
+        final BucketClient bucketClient = client.getBucketClient();
+
+        // create buckets
+        final int numBuckets = 10;
+        final List<Bucket> createdBuckets = new ArrayList<>();
+
+        for (int i=0; i < numBuckets; i++) {
+            final Bucket createdBucket = createBucket(bucketClient, i);
+            LOGGER.info("Created bucket # " + i + " with id " + 
createdBucket.getIdentifier());
+            createdBuckets.add(createdBucket);
+        }
+
+        // get each bucket
+        for (final Bucket bucket : createdBuckets) {
+            final Bucket retrievedBucket = 
bucketClient.get(bucket.getIdentifier());
+            Assert.assertNotNull(retrievedBucket);
+            LOGGER.info("Retrieved bucket " + retrievedBucket.getIdentifier());
+        }
+
+        //final Bucket nonExistentBucket = bucketClient.get("does-not-exist");
+        //Assert.assertNull(nonExistentBucket);
+
+        // get bucket fields
+        final Fields bucketFields = bucketClient.getFields();
+        Assert.assertNotNull(bucketFields);
+        LOGGER.info("Retrieved bucket fields, size = " + 
bucketFields.getFields().size());
+        Assert.assertTrue(bucketFields.getFields().size() > 0);
+
+        // get all buckets
+        final List<Bucket> allBuckets = bucketClient.getAll();
+        LOGGER.info("Retrieved buckets, size = " + allBuckets.size());
+        Assert.assertEquals(numBuckets, allBuckets.size());
+        allBuckets.stream().forEach(b -> System.out.println("Retrieve bucket " 
+ b.getIdentifier()));
+
+        // get all buckets with sorting
+        final SortParameter sortParam = new SortParameter("created", 
SortOrder.ASC);
+        final List<Bucket> allBucketsSorted = 
bucketClient.getAll(Arrays.asList(sortParam));
+        LOGGER.info("Retrieved sorted buckets, size = " + 
allBucketsSorted.size());
+        Assert.assertEquals(numBuckets, allBucketsSorted.size());
+        allBucketsSorted.stream().forEach(b -> System.out.println("Retrieve 
bucket " + b.getIdentifier()));
+
+        // update each bucket
+        for (final Bucket bucket : createdBuckets) {
+            final Bucket bucketUpdate = new Bucket();
+            bucketUpdate.setIdentifier(bucket.getIdentifier());
+            bucketUpdate.setDescription(bucket.getDescription() + " UPDATE");
+
+            final Bucket updatedBucket = bucketClient.update(bucketUpdate);
+            Assert.assertNotNull(updatedBucket);
+            LOGGER.info("Updated bucket " + updatedBucket.getIdentifier());
+        }
+
+        // ---------------------- TEST FLOWS --------------------------//
+
+        final FlowClient flowClient = client.getFlowClient();
+
+        // create flows
+        final Bucket flowsBucket = createdBuckets.get(0);
+
+        final VersionedFlow flow1 = createFlow(flowClient, flowsBucket, 1);
+        LOGGER.info("Created flow # 1 with id " + flow1.getIdentifier());
+
+        final VersionedFlow flow2 = createFlow(flowClient, flowsBucket, 2);
+        LOGGER.info("Created flow # 2 with id " + flow2.getIdentifier());
+
+        // get flow
+        final VersionedFlow retrievedFlow1 = 
flowClient.get(flowsBucket.getIdentifier(), flow1.getIdentifier());
+        Assert.assertNotNull(retrievedFlow1);
+        LOGGER.info("Retrieved flow # 1 with id " + 
retrievedFlow1.getIdentifier());
+
+        final VersionedFlow retrievedFlow2 = 
flowClient.get(flowsBucket.getIdentifier(), flow2.getIdentifier());
+        Assert.assertNotNull(retrievedFlow2);
+        LOGGER.info("Retrieved flow # 2 with id " + 
retrievedFlow2.getIdentifier());
+
+        // update flows
+        final VersionedFlow flow1Update = new VersionedFlow();
+        flow1Update.setIdentifier(flow1.getIdentifier());
+        flow1Update.setName(flow1.getName() + " UPDATED");
+
+        final VersionedFlow updatedFlow1 = 
flowClient.update(flowsBucket.getIdentifier(), flow1Update);
+        Assert.assertNotNull(updatedFlow1);
+        LOGGER.info("Updated flow # 1 with id " + 
updatedFlow1.getIdentifier());
+
+        // get flow fields
+        final Fields flowFields = flowClient.getFields();
+        Assert.assertNotNull(flowFields);
+        LOGGER.info("Retrieved flow fields, size = " + 
flowFields.getFields().size());
+        Assert.assertTrue(flowFields.getFields().size() > 0);
+
+        // get flows in bucket
+        final List<VersionedFlow> flowsInBucket = 
flowClient.getByBucket(flowsBucket.getIdentifier());
+        Assert.assertNotNull(flowsInBucket);
+        Assert.assertEquals(2, flowsInBucket.size());
+        flowsInBucket.stream().forEach(f -> LOGGER.info("Flow in bucket, flow 
id " + f.getIdentifier()));
+
+        // get flows in bucket with sorting
+        final SortParameter flowsSortParam = new SortParameter("created", 
SortOrder.ASC);
+        final List<VersionedFlow> flowsInBucketSorted = 
flowClient.getByBucket(flowsBucket.getIdentifier(), 
Arrays.asList(flowsSortParam));
+        Assert.assertNotNull(flowsInBucketSorted);
+        Assert.assertEquals(2, flowsInBucketSorted.size());
+
+        // ---------------------- TEST SNAPSHOTS --------------------------//
+
+        final FlowSnapshotClient snapshotClient = 
client.getFlowSnapshotClient();
+
+        // create snapshots
+        final VersionedFlow snapshotFlow = flow1;
+
+        final VersionedFlowSnapshot snapshot1 = createSnapshot(snapshotClient, 
snapshotFlow, 1);
+        LOGGER.info("Created snapshot # 1 with version " + 
snapshot1.getSnapshotMetadata().getVersion());
+
+        final VersionedFlowSnapshot snapshot2 = createSnapshot(snapshotClient, 
snapshotFlow, 2);
+        LOGGER.info("Created snapshot # 2 with version " + 
snapshot2.getSnapshotMetadata().getVersion());
+
+        // get snapshot
+        final VersionedFlowSnapshot retrievedSnapshot1 = 
snapshotClient.get(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier(), 1);
+        Assert.assertNotNull(retrievedSnapshot1);
+        Assert.assertFalse(retrievedSnapshot1.isLatest());
+        LOGGER.info("Retrieved snapshot # 1 with version " + 
retrievedSnapshot1.getSnapshotMetadata().getVersion());
+
+        final VersionedFlowSnapshot retrievedSnapshot2 = 
snapshotClient.get(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier(), 2);
+        Assert.assertNotNull(retrievedSnapshot2);
+        Assert.assertTrue(retrievedSnapshot2.isLatest());
+        LOGGER.info("Retrieved snapshot # 2 with version " + 
retrievedSnapshot2.getSnapshotMetadata().getVersion());
+
+        // get latest
+        final VersionedFlowSnapshot retrievedSnapshotLatest = 
snapshotClient.getLatest(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier());
+        Assert.assertNotNull(retrievedSnapshotLatest);
+        Assert.assertEquals(snapshot2.getSnapshotMetadata().getVersion(), 
retrievedSnapshotLatest.getSnapshotMetadata().getVersion());
+        Assert.assertTrue(retrievedSnapshotLatest.isLatest());
+        LOGGER.info("Retrieved latest snapshot with version " + 
retrievedSnapshotLatest.getSnapshotMetadata().getVersion());
+
+        // get metadata
+        final List<VersionedFlowSnapshotMetadata> retrievedMetadata = 
snapshotClient.getSnapshotMetadata(snapshotFlow.getBucketIdentifier(), 
snapshotFlow.getIdentifier());
+        Assert.assertNotNull(retrievedMetadata);
+        Assert.assertEquals(2, retrievedMetadata.size());
+        retrievedMetadata.stream().forEach(s -> LOGGER.info("Retrieved 
snapshot metadata " + s.getVersion()));
+
+        // ---------------------- TEST ITEMS --------------------------//
+
+        final ItemsClient itemsClient = client.getItemsClient();
+
+        // get fields
+        final Fields itemFields = itemsClient.getFields();
+        Assert.assertNotNull(itemFields.getFields());
+        Assert.assertTrue(itemFields.getFields().size() > 0);
+
+        // get all items
+        final List<BucketItem> allItems = itemsClient.getAll();
+        Assert.assertEquals(2, allItems.size());
+        allItems.stream().forEach(i -> LOGGER.info("All items, item " + 
i.getIdentifier()));
+
+        // get all items with sorting
+        final SortParameter itemsSortParam = new SortParameter("created", 
SortOrder.ASC);
+        final List<BucketItem> allItemsSorted = 
itemsClient.getAll(Arrays.asList(itemsSortParam));
+        Assert.assertEquals(2, allItemsSorted.size());
+
+        // get items for bucket
+        final List<BucketItem> bucketItems = 
itemsClient.getByBucket(flowsBucket.getIdentifier());
+        Assert.assertEquals(2, bucketItems.size());
+        bucketItems.stream().forEach(i -> LOGGER.info("Items in bucket, item " 
+ i.getIdentifier()));
+
+        // get items for bucket with sorting
+        final List<BucketItem> bucketItemsSorted = 
itemsClient.getByBucket(flowsBucket.getIdentifier(), 
Arrays.asList(itemsSortParam));
+        Assert.assertEquals(2, bucketItemsSorted.size());
+
+        // ---------------------- DELETE DATA --------------------------//
+
+        final VersionedFlow deletedFlow1 = 
flowClient.delete(flowsBucket.getIdentifier(), flow1.getIdentifier());
+        Assert.assertNotNull(deletedFlow1);
+        LOGGER.info("Deleted flow " + deletedFlow1.getIdentifier());
+
+        final VersionedFlow deletedFlow2 = 
flowClient.delete(flowsBucket.getIdentifier(), flow2.getIdentifier());
+        Assert.assertNotNull(deletedFlow2);
+        LOGGER.info("Deleted flow " + deletedFlow2.getIdentifier());
+
+        // delete each bucket
+        for (final Bucket bucket : createdBuckets) {
+            final Bucket deletedBucket = 
bucketClient.delete(bucket.getIdentifier());
+            Assert.assertNotNull(deletedBucket);
+            LOGGER.info("Deleted bucket " + deletedBucket.getIdentifier());
+        }
+        Assert.assertEquals(0, bucketClient.getAll().size());
+
+        LOGGER.info("!!! SUCCESS !!!");
+
+    }
+
+    private static Bucket createBucket(BucketClient bucketClient, int num) 
throws IOException, NiFiRegistryException {
+        final Bucket bucket = new Bucket();
+        bucket.setName("Bucket #" + num);
+        bucket.setDescription("This is bucket #" + num);
+        return bucketClient.create(bucket);
+    }
+
+    private static VersionedFlow createFlow(FlowClient client, Bucket bucket, 
int num) throws IOException, NiFiRegistryException {
+        final VersionedFlow versionedFlow = new VersionedFlow();
+        versionedFlow.setName(bucket.getName() + " Flow #" + num);
+        versionedFlow.setDescription("This is " + bucket.getName() + " flow #" 
+ num);
+        versionedFlow.setBucketIdentifier(bucket.getIdentifier());
+        return client.create(versionedFlow);
+    }
+
+    private static VersionedFlowSnapshot createSnapshot(FlowSnapshotClient 
client, VersionedFlow flow, int num) throws IOException, NiFiRegistryException {
+        final VersionedFlowSnapshotMetadata snapshotMetadata = new 
VersionedFlowSnapshotMetadata();
+        snapshotMetadata.setBucketIdentifier(flow.getBucketIdentifier());
+        snapshotMetadata.setFlowIdentifier(flow.getIdentifier());
+        snapshotMetadata.setVersion(num);
+        snapshotMetadata.setComments("This is snapshot #" + num);
+
+        final VersionedProcessGroup rootProcessGroup = new 
VersionedProcessGroup();
+        rootProcessGroup.setIdentifier("root-pg");
+        rootProcessGroup.setName("Root Process Group");
+
+        final VersionedProcessGroup subProcessGroup = new 
VersionedProcessGroup();
+        subProcessGroup.setIdentifier("sub-pg");
+        subProcessGroup.setName("Sub Process Group");
+        rootProcessGroup.getProcessGroups().add(subProcessGroup);
+
+        final Map<String,String> processorProperties = new HashMap<>();
+        processorProperties.put("Prop 1", "Val 1");
+        processorProperties.put("Prop 2", "Val 2");
+
+        final VersionedProcessor processor1 = new VersionedProcessor();
+        processor1.setIdentifier("p1");
+        processor1.setName("Processor 1");
+        processor1.setProperties(processorProperties);
+
+        final VersionedProcessor processor2 = new VersionedProcessor();
+        processor2.setIdentifier("p2");
+        processor2.setName("Processor 2");
+        processor2.setProperties(processorProperties);
+
+        subProcessGroup.getProcessors().add(processor1);
+        subProcessGroup.getProcessors().add(processor2);
+
+        final VersionedFlowSnapshot snapshot = new VersionedFlowSnapshot();
+        snapshot.setSnapshotMetadata(snapshotMetadata);
+        snapshot.setFlowContents(rootProcessGroup);
+
+        return client.create(snapshot);
+    }
+
+}

Reply via email to