exceptionfactory commented on a change in pull request #5710:
URL: https://github.com/apache/nifi/pull/5710#discussion_r795073185



##########
File path: 
nifi-nar-bundles/nifi-cdc/nifi-cdc-postgresql-bundle/nifi-cdc-postgresql-processors/src/test/java/org/apache/nifi/cdc/postgresql/processors/ITCaptureChangePostgreSQL.java
##########
@@ -0,0 +1,1113 @@
+/*
+ * 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.cdc.postgresql.processors;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.apache.nifi.components.state.Scope;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.provenance.ProvenanceEventType;
+import org.apache.nifi.reporting.InitializationException;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+import org.postgresql.replication.LogSequenceNumber;
+import org.postgresql.util.PSQLException;
+
+/**
+ * Integration Test for PostgreSQL CDC Processor.
+ *
+ * The PostgreSQL Cluster should be configured to enable logical replication:
+ *
+ * - Property listen_addresses should be set to the hostname to listen to;
+ *
+ * - Property max_wal_senders should be at least equal to the number of
+ * replication consumers;
+ *
+ * - Property wal_keep_size (or wal_keep_segments for PostgreSQL versions
+ * before 13) specifies the minimum size of past WAL segments kept in the WAL
+ * dir;
+ *
+ * - Property wal_level for logical replication should be equal to
+ * logical;
+ *
+ * - Property max_replication_slots should be greater than zero for logical
+ * replication.
+ *
+ * For example:
+ *
+ * <code>
+ * [postgresql.conf]
+ *
+ * listen_addresses = '*'
+ * max_wal_senders = 4
+ * wal_keep_size = 4
+ * wal_level = logical
+ * max_replication_slots = 4
+ * </code>
+ *
+ * For the Integration Tests it will be necessary to create specific users and
+ * database:
+ *
+ * <code>
+ * $ psql -h localhost -p 5432 -U postgres
+ *
+ * CREATE USER nifi SUPERUSER PASSWORD 'Change1t!';
+ * CREATE USER intern PASSWORD 'justForT3sts!';
+ *
+ * CREATE DATABASE db_test;
+ * </code>
+ *
+ * At last, authorize query and replication connections for user(s) and 
host(s).
+ * For example:
+ *
+ * <code>
+ * [pg_hba.conf]
+ *
+ * host db_test nifi 192.168.56.0/24 md5
+ * host db_test intern 192.168.56.0/24 md5
+ *
+ * host replication nifi 192.168.56.0/24 md5
+ * host replication intern 192.168.56.0/24 md5
+ * </code>
+ *
+ * These configurations requires the restart of PostgreSQL service.
+ */
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ITCaptureChangePostgreSQL {
+
+        // Change it!
+        private static final String DRIVER_LOCATION = 
"/Users/davy.machado/Documents/SOFTWARES/LIBS/postgresql-42.3.1.jar";
+        private static final String DRIVER_NAME = "org.postgresql.Driver";
+        private static final String HOST = "192.168.56.101";
+        private static final String PORT = "5432";
+        private static final String DATABASE = "db_test";
+        private static final String USERNAME = "nifi";
+        private static final String PASSWORD = "Change1t!";
+        private static final String CONNECTION_TIMEOUT = "30 seconds";
+        private static final String PUBLICATION = "pub_city";
+        private static final String REPLICATION_SLOT = "slot_city";
+
+        ITPostgreSQLClient client;
+        TestRunner runner;
+
+        @Before
+        public void setUp() throws Exception {
+                runner = TestRunners.newTestRunner(new 
CaptureChangePostgreSQL());
+                client = new ITPostgreSQLClient(HOST, PORT, DATABASE, 
USERNAME, PASSWORD);
+        }
+
+        @After
+        public void tearDown() throws Exception {
+                runner = null;
+
+                if (client != null) {
+                        client.closeConnection();
+                        client = null;
+                }
+        }

Review comment:
       The indentation formatting for this file also appears incorrect and 
needs to be changed to four spaces.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to