NIFIREG-337 Add automated testing for Postgres 10.x
diff --git a/README.md b/README.md
index 4999a69..3e97e83 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,8 @@
 | --------------- | ------------- |
 | All supported   | `mvn verify -Ptest-all-dbs` |
 | H2 (default)    | `mvn verify` |
-| PostgreSQL      | `mvn verify -Dspring.profiles.active=postgres` | 
+| PostgreSQL 9.x  | `mvn verify -Dspring.profiles.active=postgres` | 
+| PostgreSQL 10.x | `mvn verify -Dspring.profiles.active=postgres-10` | 
 | MySQL 5.6       | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-56` |
 | MySQL 5.7       | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-57` |
 | MySQL 8         | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-8`  |
diff --git a/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc b/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
index 0c6a5dd..90b80d5 100644
--- a/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
+++ b/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
@@ -1128,7 +1128,7 @@
 
 The metadata database maintains the knowledge of which buckets exist, which versioned items belong to which buckets, as well as the version history for each item.
 
-Currently, NiFi Registry supports using H2, Postgres 9.x, and MySQL (5.6, 5.7, 8.0) for the relational database engine.
+Currently, NiFi Registry supports using H2, Postgres (9.x, 10.x), and MySQL (5.6, 5.7, 8.0) for the relational database engine.
 
 NOTE: NiFi Registry 0.1.0 only supports H2.
 
diff --git a/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java b/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java
new file mode 100644
index 0000000..23d2f1d
--- /dev/null
+++ b/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/Postgres10DataSourceFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.db;
+
+import org.postgresql.ds.PGSimpleDataSource;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.delegate.DatabaseDelegate;
+import org.testcontainers.jdbc.JdbcDatabaseDelegate;
+
+import javax.annotation.PostConstruct;
+import javax.script.ScriptException;
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+@Configuration
+@Profile("postgres-10")
+public class Postgres10DataSourceFactory extends TestDataSourceFactory {
+
+    private static final PostgreSQLContainer POSTGRESQL_CONTAINER = new PostgreSQLContainer("postgres:10");
+
+    static {
+        POSTGRESQL_CONTAINER.start();
+    }
+
+    @Override
+    protected DataSource createDataSource() {
+        PGSimpleDataSource dataSource = new PGSimpleDataSource();
+        dataSource.setUrl(POSTGRESQL_CONTAINER.getJdbcUrl());
+        dataSource.setUser(POSTGRESQL_CONTAINER.getUsername());
+        dataSource.setPassword(POSTGRESQL_CONTAINER.getPassword());
+        return dataSource;
+    }
+
+    @PostConstruct
+    public void initDatabase() throws SQLException, ScriptException {
+        DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(POSTGRESQL_CONTAINER, "");
+        databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true);
+    }
+}
diff --git a/nifi-registry-core/pom.xml b/nifi-registry-core/pom.xml
index b85abef..cb4c9fc 100644
--- a/nifi-registry-core/pom.xml
+++ b/nifi-registry-core/pom.xml
@@ -207,6 +207,19 @@
                                     </systemPropertyVariables>
                                 </configuration>
                             </execution>
+                            <execution>
+                                <id>postgres10-test</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <spring.profiles.active>postgres-10</spring.profiles.active>
+                                    </systemPropertyVariables>
+                                </configuration>
+                            </execution>
                         </executions>
                     </plugin>
                 </plugins>