@@ -0,0 +1,2323 @@
+/*%0A * Copyright 2022 Jim Voris.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.qvcsos.server;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * A simple test to backup the database using the pg_dump tool.%0A *%0A * @author Jim Voris.%0A */%0Apublic class BackupDatabaseTest %7B%0A    private static final Logger LOGGER = LoggerFactory.getLogger(BackupDatabaseTest.class);%0A%0A    /**%0A     * Backup the database.%0A     */%0A    @Test%0A    public void testBackupDatabase() %7B%0A        SimpleDateFormat dateFormatter = new SimpleDateFormat(%22yyyy.MM.dd-HH.mm.ss%22);%0A        Date now = new Date();%0A        String dateString = dateFormatter.format(now);%0A        String host = %2210.0.1.3%22;%0A        String port = %225432%22;%0A        String userDir = System.getProperty(%22user.home%22);%0A        try %7B%0A            String execString = String.format(%22pg_dump --file %25s/tmp/qvcsos_db_backup-%25s --host %25s --port %25s --username postgres --no-password --verbose --role qvcsos410prod --format=p --encoding UTF8 qvcsos410prod%22,%0A                    userDir, dateString, host, port);%0A            Process p = Runtime.getRuntime().exec(execString);%0A%0A            try ( BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream()))) %7B%0A                String line;%0A                while ((line = in.readLine()) != null) %7B%0A                    System.out.println(line);%0A                %7D%0A            %7D%0A            p.waitFor();%0A            LOGGER.info(%22Backup database process exit value: %5B%7B%7D%5D%22, p.exitValue());%0A        %7D catch (IOException %7C InterruptedException ex) %7B%0A            LOGGER.warn(ex.getLocalizedMessage(), ex);%0A        %7D%0A    %7D%0A%0A%7D%0A

Add unit test to backup qvcsos postgres database.