[DMAAP-DR-PROV] Remove aaf & cadi 08/132808/1
authorefiacor <fiachra.corcoran@est.tech>
Mon, 19 Dec 2022 23:27:29 +0000 (23:27 +0000)
committerefiacor <fiachra.corcoran@est.tech>
Mon, 19 Dec 2022 23:28:57 +0000 (23:28 +0000)
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I610251e4b148620a6d44004efbe933e7acede26d
Issue-ID: DMAAP-1573

70 files changed:
csit/scripts/dmaap-datarouter/docker-compose/provserver.properties
datarouter-prov/pom.xml
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/AuthRespSupplementImpl.java [deleted file]
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/ProvAuthorizer.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/FeedServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/InternalServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProvRunner.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProvServer.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/ProxyServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscribeServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtils.java [deleted file]
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManager.java [new file with mode: 0644]
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/SynchronizerTask.java
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.cred.props [deleted file]
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.keyfile [deleted file]
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.location.props [deleted file]
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.p12 [deleted file]
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.props [deleted file]
datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.trust.jks [deleted file]
datarouter-prov/src/main/resources/misc/sql_init_01.sql
datarouter-prov/src/main/resources/provserver.properties
datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationSuite.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestCleanup.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalGet.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRleBitSet.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRouteApi.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java [deleted file]
datarouter-prov/src/test/java/datarouter/provisioning/package.html [deleted file]
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/BaseServletTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/DRFeedsServletTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/FeedServletTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscribeServletTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServletTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/FeedTest.java
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtilsTest.java [deleted file]
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManagerTest.java [new file with mode: 0644]
datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/UrlUtilsTest.java [new file with mode: 0644]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.cred.props [deleted file]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.keyfile [deleted file]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.location.props [deleted file]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12 [deleted file]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.props [deleted file]
datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks [deleted file]
datarouter-prov/src/test/resources/certs/org.onap.dmaap-dr-prov.p12 [new file with mode: 0755]
datarouter-prov/src/test/resources/certs/truststore.jks [new file with mode: 0644]
datarouter-prov/src/test/resources/create.sql
datarouter-prov/src/test/resources/h2Database.properties
datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties [deleted file]
datarouter-prov/src/test/resources/integration_test.properties [deleted file]
datarouter-prov/src/test/resources/prov_data.json
datarouter-prov/src/test/resources/sql_init_01.sql

index caf8240..4260287 100755 (executable)
@@ -27,7 +27,6 @@ org.onap.dmaap.datarouter.provserver.dbscripts           = /opt/app/datartr/etc/
 org.onap.dmaap.datarouter.provserver.logretention        = 30
 
 org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false
-org.onap.dmaap.datarouter.provserver.cadi.enabled         = false
 org.onap.dmaap.datarouter.provserver.tlsenabled           = false
 org.onap.dmaap.datarouter.nodeserver.https.port           = 8443
 org.onap.dmaap.datarouter.nodeserver.http.port            = 8080
index 0417073..d43ae68 100755 (executable)
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <groupId>org.onap.aaf.authz</groupId>
-            <artifactId>aaf-cadi-core</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
                                         <include>**/**</include>
                                     </includes>
                                     <excludes>
-                                        <exclude>aaf/**</exclude>
                                         <exclude>docker/**</exclude>
                                     </excludes>
                                 </resource>
                             </resources>
                         </configuration>
                     </execution>
-                    <execution>
-                        <id>copy-aaf-props</id>
-                        <phase>validate</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/docker-stage/opt/app/osaaf/local</outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>${basedir}/src/main/resources/aaf</directory>
-                                    <includes>
-                                        <include>**/**</include>
-                                    </includes>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
                 </executions>
             </plugin>
             <plugin>
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/AuthRespSupplementImpl.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/authz/impl/AuthRespSupplementImpl.java
deleted file mode 100644 (file)
index b61c00e..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START==================================================\r
- * * org.onap.dmaap\r
- * * ===========================================================================\r
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * *\r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * *\r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-\r
-\r
-package org.onap.dmaap.datarouter.authz.impl;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.onap.dmaap.datarouter.authz.AuthorizationResponseSupplement;\r
-\r
-/** Carries supplementary information--an advice or an obligation--from the authorization response returned\r
- *  by a XACML Policy Decision Point.   Not used in Data Router R1.\r
- * @author J. F. Lucas\r
- *\r
- */\r
-public class AuthRespSupplementImpl implements AuthorizationResponseSupplement {\r
-\r
-    private String id;\r
-    private Map<String, String> attributes;\r
-\r
-    /** Constructor, available within the package.\r
-     *\r
-     * @param id  The identifier for the advice or obligation element\r
-     * @param attributes The attributes (name-value pairs) for the advice or obligation element.\r
-     */\r
-    AuthRespSupplementImpl(String id, Map<String, String> attributes) {\r
-        this.id = id;\r
-        this.attributes = new HashMap<>(attributes);\r
-    }\r
-\r
-    /** Return the identifier for the supplementary information element.\r
-     *\r
-     * @return a <code>String</code> containing the identifier.\r
-     */\r
-    @Override\r
-    public String getId() {\r
-        return id;\r
-    }\r
-\r
-    /** Return the attributes for the supplementary information element, as a <code>Map</code> in which\r
-     * keys represent attribute identifiers and values represent attribute values.\r
-     *\r
-     * @return attributes for the supplementary information element.\r
-     */\r
-    @Override\r
-    public Map<String, String> getAttributes() {\r
-        return attributes;\r
-    }\r
-\r
-}\r
index 48e31bf..97cdc12 100644 (file)
@@ -106,7 +106,6 @@ public class ProvAuthorizer implements Authorizer {
                     decision = allowSubAccess(resource, method, subject, subjectgroup);
                     break;
                 default:
-                    decision = false;
                     break;
             }
         }
index 1942b14..c37c0a7 100755 (executable)
@@ -85,23 +85,6 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
 
     public static final String BEHALF_HEADER = "X-DMAAP-DR-ON-BEHALF-OF";
 
-    public static final String EXCLUDE_AAF_HEADER = "X-EXCLUDE-AAF";
-
-    private static final String AAF_CADI_FEED_TYPE = "org.onap.dmaap.datarouter.provserver.aaf.feed.type";
-    private static final String AAF_CADI_SUB_TYPE = "org.onap.dmaap.datarouter.provserver.aaf.sub.type";
-    private static final String AAF_INSTANCE = "org.onap.dmaap.datarouter.provserver.aaf.instance";
-    private static final String AAF_CADI_FEED = "org.onap.dmaap-dr.feed";
-    private static final String AAF_CADI_SUB = "org.onap.dmaap-dr.sub";
-
-    static final String CREATE_PERMISSION = "create";
-    static final String EDIT_PERMISSION = "edit";
-    static final String DELETE_PERMISSION = "delete";
-    private static final String PUBLISH_PERMISSION = "publish";
-    private static final String SUSPEND_PERMISSION = "suspend";
-    private static final String RESTORE_PERMISSION = "restore";
-    private static final String SUBSCRIBE_PERMISSION = "subscribe";
-    static final String APPROVE_SUB_PERMISSION = "approveSub";
-
     static final String FEED_BASECONTENT_TYPE = "application/vnd.dmaap-dr.feed";
     public static final String FEED_CONTENT_TYPE = "application/vnd.dmaap-dr.feed; version=2.0";
     public static final String FEEDFULL_CONTENT_TYPE = "application/vnd.dmaap-dr.feed-full; version=2.0";
@@ -261,9 +244,6 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
     private static String isAddressAuthEnabled = ProvRunner.getProvProperties()
         .getProperty("org.onap.dmaap.datarouter.provserver.isaddressauthenabled", "false");
 
-    static String isCadiEnabled = ProvRunner.getProvProperties()
-        .getProperty("org.onap.dmaap.datarouter.provserver.cadi.enabled", "false");
-
     /**
      * Initialize data common to all the provisioning server servlets.
      */
@@ -959,96 +939,4 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider {
         }
 
     }
-
-    /*
-     * AAF changes: TDP EPIC US# 307413
-     * @Method - getFeedPermission - Forming permission string for feed part to check AAF access in CADI Framework
-     * @Params - aafInstance Passing aafInstance as it's used in permission string
-     * @Params - userAction Passing CONST values to set different actions in permission string
-     */
-    String getFeedPermission(String aafInstance, String userAction) {
-        try {
-            Properties props = ProvRunner.getProvProperties();
-            String type = props.getProperty(AAF_CADI_FEED_TYPE, AAF_CADI_FEED);
-            String action;
-            switch (userAction) {
-                case CREATE_PERMISSION:
-                    action = CREATE_PERMISSION;
-                    break;
-                case EDIT_PERMISSION:
-                    action = EDIT_PERMISSION;
-                    break;
-                case DELETE_PERMISSION:
-                    action = DELETE_PERMISSION;
-                    break;
-                case PUBLISH_PERMISSION:
-                    action = PUBLISH_PERMISSION;
-                    break;
-                case SUSPEND_PERMISSION:
-                    action = SUSPEND_PERMISSION;
-                    break;
-                case RESTORE_PERMISSION:
-                    action = RESTORE_PERMISSION;
-                    break;
-                default:
-                    action = "*";
-            }
-            if (aafInstance == null || "".equals(aafInstance)) {
-                aafInstance = props.getProperty(AAF_INSTANCE, "org.onap.dmaap-dr.NoInstanceDefined");
-            }
-            return type + "|" + aafInstance + "|" + action;
-        } catch (Exception e) {
-            intlogger.error("PROV7005 BaseServlet.getFeedPermission: " + e.getMessage(), e);
-        }
-        return null;
-    }
-
-    /*
-     * AAF changes: TDP EPIC US# 307413
-     * @Method - getSubscriberPermission - Forming permission string for subscription part to check
-     * AAF access in CADI Framework
-     * @Params - aafInstance Passing aafInstance as it's used in permission string
-     * @Params - userAction Passing CONST values to set different actions in permission string
-     */
-    String getSubscriberPermission(String aafInstance, String userAction) {
-        try {
-            Properties props = ProvRunner.getProvProperties();
-            String type = props.getProperty(AAF_CADI_SUB_TYPE, AAF_CADI_SUB);
-            String action;
-            switch (userAction) {
-                case SUBSCRIBE_PERMISSION:
-                    action = SUBSCRIBE_PERMISSION;
-                    type = props.getProperty(AAF_CADI_FEED_TYPE, AAF_CADI_FEED);
-                    break;
-                case EDIT_PERMISSION:
-                    action = EDIT_PERMISSION;
-                    break;
-                case DELETE_PERMISSION:
-                    action = DELETE_PERMISSION;
-                    break;
-                case RESTORE_PERMISSION:
-                    action = RESTORE_PERMISSION;
-                    break;
-                case SUSPEND_PERMISSION:
-                    action = SUSPEND_PERMISSION;
-                    break;
-                case PUBLISH_PERMISSION:
-                    action = PUBLISH_PERMISSION;
-                    break;
-                case APPROVE_SUB_PERMISSION:
-                    action = APPROVE_SUB_PERMISSION;
-                    type = props.getProperty(AAF_CADI_FEED_TYPE, AAF_CADI_FEED);
-                    break;
-                default:
-                    action = "*";
-            }
-            if (aafInstance == null || "".equals(aafInstance)) {
-                aafInstance = props.getProperty(AAF_INSTANCE, "org.onap.dmaap-dr.NoInstanceDefined");
-            }
-            return type + "|" + aafInstance + "|" + action;
-        } catch (Exception e) {
-            intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: " + e.getMessage(), e);
-        }
-        return null;
-    }
 }
index a0df71c..7266ee6 100644 (file)
@@ -28,11 +28,11 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.util.List;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
 import org.json.JSONObject;
 import org.onap.dmaap.datarouter.authz.AuthorizationResponse;
 import org.onap.dmaap.datarouter.provisioning.beans.EventLogRecord;
@@ -289,61 +289,6 @@ public class DRFeedsServlet extends ProxyServlet {
                 return;
             }
 
-            /*
-             * START - AAF changes
-             * TDP EPIC US# 307413
-             * CADI code - No legacy user check as all new users will be AAF users
-             */
-            String aafInstance = feed.getAafInstance();
-            if (Boolean.parseBoolean(isCadiEnabled)) {
-                if ((aafInstance == null || "".equals(aafInstance) || ("legacy".equalsIgnoreCase(aafInstance))
-                     && "true".equalsIgnoreCase(req.getHeader(EXCLUDE_AAF_HEADER)))) {
-                    // Check with the Authorizer
-                    AuthorizationResponse aresp = authz.decide(req);
-                    if (!aresp.isAuthorized()) {
-                        message = POLICY_ENGINE;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                } else {
-                    if ("true".equalsIgnoreCase(req.getHeader(EXCLUDE_AAF_HEADER))) {
-                        message = "DRFeedsServlet.doPost() -Invalid request exclude_AAF should not be true if passing "
-                                          + "AAF_Instance value= " + aafInstance;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                    String permission = getFeedPermission(aafInstance, BaseServlet.CREATE_PERMISSION);
-                    eventlogger.info("DRFeedsServlet.doPost().. Permission String - " + permission);
-                    if (!req.isUserInRole(permission)) {
-                        message = "AAF disallows access to permission - " + permission;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                }
-            } else {
-                AuthorizationResponse aresp = authz.decide(req);
-                if (!aresp.isAuthorized()) {
-                    message = POLICY_ENGINE;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            }
-            /*
-             * END - AAF changes
-             */
-
             feed.setPublisher(bhdr);    // set from X-DMAAP-DR-ON-BEHALF-OF header
 
             // Check if this feed already exists
index 5182cc2..475054d 100644 (file)
@@ -28,7 +28,6 @@ import static org.onap.dmaap.datarouter.provisioning.utils.HttpServletUtils.send
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -108,37 +107,6 @@ public class FeedServlet extends ProxyServlet {
                 sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);
                 return;
             }
-            /*
-             * START - AAF changes
-             * TDP EPIC US# 307413
-             * CADI code - check on permissions based on Legacy/AAF users to allow to delete/remove feed
-             */
-            String aafInstance = feed.getAafInstance();
-            if (aafInstance == null || "".equals(aafInstance) || "legacy".equalsIgnoreCase(aafInstance)) {
-                AuthorizationResponse aresp = authz.decide(req);
-                if (! aresp.isAuthorized()) {
-                    message = POLICY_ENGINE;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            } else {
-                String permission = getFeedPermission(aafInstance, BaseServlet.DELETE_PERMISSION);
-                eventlogger.info("FeedServlet.doDelete().. Permission String - " + permission);
-                if (!req.isUserInRole(permission)) {
-                    message = "AAF disallows access to permission - " + permission;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            }
-            /*
-             * END - AAF changes
-             */
             // Delete FEED table entry (set DELETED flag)
             feed.setDeleted(true);
             if (doUpdate(feed)) {
@@ -352,39 +320,6 @@ public class FeedServlet extends ProxyServlet {
                 return;
             }
 
-            /*
-             * START - AAF changes
-             * TDP EPIC US# 307413
-             * CADI code - check on permissions based on Legacy/AAF users to allow feed edit/update/modify
-             */
-            String aafInstance = feed.getAafInstance();
-            if (aafInstance == null || "".equals(aafInstance) || "legacy".equalsIgnoreCase(aafInstance)) {
-                // Check with the Authorizer
-                AuthorizationResponse aresp = authz.decide(req);
-                if (!aresp.isAuthorized()) {
-                    message = POLICY_ENGINE;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            } else {
-                String permission = getFeedPermission(aafInstance, BaseServlet.EDIT_PERMISSION);
-                eventlogger.info("FeedServlet.doPut().. Permission String - " + permission);
-                if (!req.isUserInRole(permission)) {
-                    message = "AAF disallows access to permission - " + permission;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            }
-            /*
-             * END - AAF changes
-             */
-
             // Update FEEDS table entries
             if (doUpdate(feed)) {
                 // send response
index 06959ee..0fb879e 100644 (file)
@@ -162,7 +162,7 @@ public class InternalServlet extends ProxyServlet {
     private static final Object lock = new Object();
     private static Integer logseq = 0; // another piece of info to make log spool file names unique
     //Adding EELF Logger Rally:US664892
-    private static EELFLogger eelfLogger = EELFManager.getInstance()
+    private static final EELFLogger eelfLogger = EELFManager.getInstance()
         .getLogger(InternalServlet.class);
 
     /**
index 747530a..4777be8 100644 (file)
@@ -29,16 +29,15 @@ import static java.lang.System.getProperty;
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Properties;
 import java.util.Timer;
 import org.eclipse.jetty.server.Server;
-import org.onap.dmaap.datarouter.provisioning.utils.AafPropsUtils;
 import org.onap.dmaap.datarouter.provisioning.utils.LogfileLoader;
 import org.onap.dmaap.datarouter.provisioning.utils.Poker;
 import org.onap.dmaap.datarouter.provisioning.utils.ProvDbUtils;
+import org.onap.dmaap.datarouter.provisioning.utils.ProvTlsManager;
 import org.onap.dmaap.datarouter.provisioning.utils.PurgeLogDirTask;
 import org.onap.dmaap.datarouter.provisioning.utils.SynchronizerTask;
 
@@ -76,7 +75,7 @@ public class ProvRunner {
     public static final EELFLogger intlogger = EELFManager.getInstance().getLogger("org.onap.dmaap.datarouter.provisioning.internal");
 
     private static Server provServer;
-    private static AafPropsUtils aafPropsUtils;
+    private static ProvTlsManager provTlsManager;
     private static Properties provProperties;
     private static Boolean tlsEnabled;
 
@@ -92,13 +91,11 @@ public class ProvRunner {
             exit(1);
         }
         if (Boolean.TRUE.equals(getTlsEnabled())) {
-            // Set up AAF properties
+            // Set up TLS Manager
             try {
-                aafPropsUtils = new AafPropsUtils(new File(getProvProperties().getProperty(
-                    "org.onap.dmaap.datarouter.provserver.aafprops.path",
-                    "/opt/app/osaaf/local/org.onap.dmaap-dr.props")));
-            } catch (IOException e) {
-                intlogger.error("NODE0314 Failed to load AAF props. Exiting", e);
+                provTlsManager = new ProvTlsManager(ProvRunner.getProvProperties(), true);
+            } catch (Exception e) {
+                intlogger.error("NODE0314 Failed to load TLS config. Exiting", e);
                 exit(1);
             }
         }
@@ -153,10 +150,6 @@ public class ProvRunner {
         return provProperties;
     }
 
-    public static AafPropsUtils getAafPropsUtils() {
-        return aafPropsUtils;
-    }
-
     public static Boolean getTlsEnabled() {
         if (tlsEnabled == null) {
             tlsEnabled = Boolean.parseBoolean(getProvProperties()
@@ -164,4 +157,8 @@ public class ProvRunner {
         }
         return tlsEnabled;
     }
+
+    public static ProvTlsManager getProvTlsManager() {
+        return provTlsManager;
+    }
 }
index 9eb9117..102d4a2 100644 (file)
@@ -42,7 +42,6 @@ import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.jetbrains.annotations.NotNull;
-import org.onap.dmaap.datarouter.provisioning.utils.AafPropsUtils;
 
 
 public class ProvServer {
@@ -106,14 +105,16 @@ public class ProvServer {
                 httpsConfiguration.setRequestHeaderSize(8192);
                 // HTTPS connector
                 try (ServerConnector httpsServerConnector = new ServerConnector(server,
-                    new SslConnectionFactory(getSslContextFactory(provProps), HttpVersion.HTTP_1_1.asString()),
+                    new SslConnectionFactory(getSslContextFactory(), HttpVersion.HTTP_1_1.asString()),
                     new HttpConnectionFactory(httpsConfiguration))) {
                     httpsServerConnector.setPort(httpsPort);
                     httpsServerConnector.setIdleTimeout(30000);
                     httpsServerConnector.setAcceptQueueSize(2);
+                    intlogger.info("ProvServer: TLS enabled. Setting up both HTTP/S connectors.");
                     server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
                 }
             } else {
+                intlogger.info("ProvServer: TLS disabled. Setting up HTTP connector only.");
                 server.setConnectors(new Connector[]{httpServerConnector});
             }
             server.setHandler(handlerCollection);
@@ -132,18 +133,9 @@ public class ProvServer {
     }
 
     @NotNull
-    private static SslContextFactory.Server getSslContextFactory(Properties provProps) {
-        SslContextFactory sslContextFactory = new SslContextFactory.Server();
-        sslContextFactory.setKeyStoreType(AafPropsUtils.KEYSTORE_TYPE_PROPERTY);
-        sslContextFactory.setKeyStorePath(ProvRunner.getAafPropsUtils().getKeystorePathProperty());
-        sslContextFactory.setKeyStorePassword(ProvRunner.getAafPropsUtils().getKeystorePassProperty());
-        sslContextFactory.setKeyManagerPassword(ProvRunner.getAafPropsUtils().getKeystorePassProperty());
-
-        sslContextFactory.setTrustStoreType(AafPropsUtils.TRUESTSTORE_TYPE_PROPERTY);
-        sslContextFactory.setTrustStorePath(ProvRunner.getAafPropsUtils().getTruststorePathProperty());
-        sslContextFactory.setTrustStorePassword(ProvRunner.getAafPropsUtils().getTruststorePassProperty());
-
-        sslContextFactory.setExcludeCipherSuites(
+    private static SslContextFactory.Server getSslContextFactory() {
+        SslContextFactory.Server sslContextFactoryServer = ProvRunner.getProvTlsManager().getSslContextFactoryServer();
+        sslContextFactoryServer.setExcludeCipherSuites(
             "SSL_RSA_WITH_DES_CBC_SHA",
             "SSL_DHE_RSA_WITH_DES_CBC_SHA",
             "SSL_DHE_DSS_WITH_DES_CBC_SHA",
@@ -152,17 +144,12 @@ public class ProvServer {
             "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
             "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
         );
-        sslContextFactory.addExcludeProtocols("SSLv3");
-        sslContextFactory.setIncludeProtocols(provProps.getProperty(
-            "org.onap.dmaap.datarouter.provserver.https.include.protocols",
-            "TLSv1.1|TLSv1.2").trim().split("\\|"));
-
-        intlogger.info("Unsupported protocols: " + String.join(",", sslContextFactory.getExcludeProtocols()));
-        intlogger.info("Supported protocols: " + String.join(",", sslContextFactory.getIncludeProtocols()));
-        intlogger.info("Unsupported ciphers: " + String.join(",", sslContextFactory.getExcludeCipherSuites()));
-        intlogger.info("Supported ciphers: " + String.join(",", sslContextFactory.getIncludeCipherSuites()));
-
-        return (SslContextFactory.Server) sslContextFactory;
+        sslContextFactoryServer.addExcludeProtocols("SSLv3");
+        intlogger.info("Unsupported protocols: " + String.join(",", sslContextFactoryServer.getExcludeProtocols()));
+        intlogger.info("Supported protocols: " + String.join(",", sslContextFactoryServer.getIncludeProtocols()));
+        intlogger.info("Unsupported ciphers: " + String.join(",", sslContextFactoryServer.getExcludeCipherSuites()));
+        intlogger.info("Supported ciphers: " + String.join(",", sslContextFactoryServer.getIncludeCipherSuites()));
+        return sslContextFactoryServer;
     }
 
     @NotNull
index 49be5aa..86b583a 100755 (executable)
@@ -30,14 +30,9 @@ import jakarta.servlet.ServletConfig;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
 import java.util.Collections;
 import java.util.List;
 import org.apache.commons.io.IOUtils;
@@ -53,7 +48,6 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.onap.dmaap.datarouter.provisioning.utils.AafPropsUtils;
 import org.onap.dmaap.datarouter.provisioning.utils.SynchronizerTask;
 import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;
 
@@ -81,20 +75,7 @@ public class ProxyServlet extends BaseServlet {
         super.init(config);
         try {
             if (Boolean.TRUE.equals(ProvRunner.getTlsEnabled())) {
-                // Set up keystore
-                String type = AafPropsUtils.KEYSTORE_TYPE_PROPERTY;
-                String store = ProvRunner.getAafPropsUtils().getKeystorePathProperty();
-                String pass = ProvRunner.getAafPropsUtils().getKeystorePassProperty();
-                KeyStore keyStore = readStore(store, pass, type);
-                // Set up truststore
-                store = ProvRunner.getAafPropsUtils().getTruststorePathProperty();
-                pass = ProvRunner.getAafPropsUtils().getTruststorePassProperty();
-                KeyStore trustStore = readStore(store, pass, AafPropsUtils.TRUESTSTORE_TYPE_PROPERTY);
-
-                // We are connecting with the node name, but the certificate will have the CNAME
-                // So we need to accept a non-matching certificate name
-                SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore,
-                    ProvRunner.getAafPropsUtils().getKeystorePassProperty(), trustStore);
+                SSLSocketFactory socketFactory = ProvRunner.getProvTlsManager().getSslSocketFactory();
                 socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
                 sch = new Scheme("https", 443, socketFactory);
             } else {
@@ -108,18 +89,6 @@ public class ProxyServlet extends BaseServlet {
         intlogger.info("ProxyServlet: inited = " + inited);
     }
 
-    private KeyStore readStore(String store, String pass, String type) throws KeyStoreException {
-        KeyStore ks = KeyStore.getInstance(type);
-        try (FileInputStream instream = new FileInputStream(new File(store))) {
-            ks.load(instream, pass.toCharArray());
-        } catch (FileNotFoundException fileNotFoundException) {
-            intlogger.error("ProxyServlet.readStore: " + fileNotFoundException.getMessage(), fileNotFoundException);
-        } catch (Exception x) {
-            intlogger.error("READING TRUSTSTORE: " + x);
-        }
-        return ks;
-    }
-
     /**
      * Return <i>true</i> if the requester has NOT set the <i>noproxy</i> CGI variable. If they have, this indicates
      * they want to forcibly turn the proxy off.
index 2ee58d6..6faecff 100644 (file)
@@ -263,66 +263,6 @@ public class SubscribeServlet extends ProxyServlet {
             }
             sub.setFeedid(feedid);
             sub.setSubscriber(bhdr);    // set from X-DMAAP-DR-ON-BEHALF-OF header
-            /*
-             * START - AAF changes
-             * TDP EPIC US# 307413
-             * CADI code - check on permissions based on Legacy/AAF users to allow to create/add subscription
-             */
-            String feedAafInstance = feed.getAafInstance();
-            String subAafInstance = sub.getAafInstance();
-            boolean subAafLegacyEmptyOrNull = (subAafInstance == null
-                                         || "".equals(subAafInstance) || "legacy".equalsIgnoreCase(subAafInstance));
-
-            // This extra check added to verify AAF feed with AAF subscriber having empty aaf instance check
-            if (feedAafInstance == null || "".equals(feedAafInstance) || "legacy".equalsIgnoreCase(feedAafInstance)) {
-                if (subAafLegacyEmptyOrNull) {
-                    AuthorizationResponse aresp = authz.decide(req);
-                    if (!aresp.isAuthorized()) {
-                        message = POLICY_ENGINE;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                } else {
-                    //If Legacy Feed and AAF instance provided in Subscriber JSON
-                    message = "AAF Subscriber can not be added to legacy Feed- " + feedid;
-                    elr.setMessage(message);
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                    eventlogger.error(elr.toString());
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                    return;
-                }
-            } else {
-                //New AAF Requirement to add legacy subscriber to AAF Feed
-                if (subAafLegacyEmptyOrNull) {
-                    AuthorizationResponse aresp = authz.decide(req);
-                    if (!aresp.isAuthorized()) {
-                        message = POLICY_ENGINE;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                } else {
-                    //New AAF Requirement to add subscriber by publisher on publisher approval only
-                    String permission = getSubscriberPermission(subAafInstance, BaseServlet.APPROVE_SUB_PERMISSION);
-                    eventlogger.info("SubscribeServlet.doPost().. Permission String - " + permission);
-                    if (!req.isUserInRole(permission)) {
-                        message = "AAF disallows access to permission - " + permission;
-                        elr.setMessage(message);
-                        elr.setResult(HttpServletResponse.SC_FORBIDDEN);
-                        eventlogger.error(elr.toString());
-                        sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);
-                        return;
-                    }
-                }
-            }
-            /*
-             * END - AAF changes
-             */
             // Check if this subscription already exists; not an error (yet), just warn
             Subscription sub2 = Subscription.getSubscriptionMatching(sub);
             if (sub2 != null) {
index 1851d03..f4f3c9b 100644 (file)
@@ -111,37 +111,6 @@ public class SubscriptionServlet extends ProxyServlet {
                 sendResponseError(resp, HttpServletResponse.SC_NOT_FOUND, message, eventlogger);\r
                 return;\r
             }\r
-            /*\r
-             * START - AAF changes\r
-             * TDP EPIC US# 307413\r
-             * CADI code - check on permissions based on Legacy/AAF users to allow to delete/remove subscription\r
-             */\r
-            String aafInstance = sub.getAafInstance();\r
-            if (aafInstance == null || "".equals(aafInstance) || "legacy".equalsIgnoreCase(aafInstance)) {\r
-                AuthorizationResponse aresp = authz.decide(req);\r
-                if (!aresp.isAuthorized()) {\r
-                    message = POLICY_ENGINE;\r
-                    elr.setMessage(message);\r
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);\r
-                    eventlogger.error(elr.toString());\r
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);\r
-                    return;\r
-                }\r
-            } else {\r
-                String permission = getSubscriberPermission(aafInstance, BaseServlet.DELETE_PERMISSION);\r
-                eventlogger.info("SubscriptionServlet.doDelete().. Permission String - " + permission);\r
-                if (!req.isUserInRole(permission)) {\r
-                    message = "AAF disallows access to permission - " + permission;\r
-                    elr.setMessage(message);\r
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);\r
-                    eventlogger.error(elr.toString());\r
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);\r
-                    return;\r
-                }\r
-            }\r
-            /*\r
-             * END - AAF changes\r
-             */\r
             // Delete Subscription\r
             if (doDelete(sub)) {\r
                 activeSubs--;\r
@@ -321,38 +290,6 @@ public class SubscriptionServlet extends ProxyServlet {
                 sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger);\r
                 return;\r
             }\r
-\r
-            /*\r
-             * START - AAF changes\r
-             * TDP EPIC US# 307413\r
-             * CADI code - check on permissions based on Legacy/AAF users to allow to delete/remove subscription\r
-             */\r
-            String aafInstance = sub.getAafInstance();\r
-            if (aafInstance == null || "".equals(aafInstance) || "legacy".equalsIgnoreCase(aafInstance)) {\r
-                AuthorizationResponse aresp = authz.decide(req);\r
-                if (!aresp.isAuthorized()) {\r
-                    message = POLICY_ENGINE;\r
-                    elr.setMessage(message);\r
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);\r
-                    eventlogger.error(elr.toString());\r
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);\r
-                    return;\r
-                }\r
-            } else {\r
-                String permission = getSubscriberPermission(aafInstance, BaseServlet.EDIT_PERMISSION);\r
-                eventlogger.info("SubscriptionServlet.doDelete().. Permission String - " + permission);\r
-                if (!req.isUserInRole(permission)) {\r
-                    message = "AAF disallows access to permission - " + permission;\r
-                    elr.setMessage(message);\r
-                    elr.setResult(HttpServletResponse.SC_FORBIDDEN);\r
-                    eventlogger.error(elr.toString());\r
-                    sendResponseError(resp, HttpServletResponse.SC_FORBIDDEN, message, eventlogger);\r
-                    return;\r
-                }\r
-            }\r
-            /*\r
-             * END - AAF changes\r
-             */\r
             sub.setSubid(oldsub.getSubid());\r
             sub.setFeedid(oldsub.getFeedid());\r
             sub.setSubscriber(bhdr);    // set from X-DMAAP-DR-ON-BEHALF-OF header\r
index c634430..af6b357 100644 (file)
@@ -77,7 +77,6 @@ public class Feed extends Syncable {
     private boolean suspended;\r
     private Date lastMod;\r
     private Date createdDate;\r
-    private String aafInstance;\r
 \r
     public Feed() {\r
         this("", "", "", "");\r
@@ -104,7 +103,6 @@ public class Feed extends Syncable {
         this.suspended = false;\r
         this.lastMod = new Date();\r
         this.createdDate = new Date();\r
-        this.aafInstance = "";\r
     }\r
 \r
     /**\r
@@ -133,7 +131,6 @@ public class Feed extends Syncable {
         this.suspended = rs.getBoolean("SUSPENDED");\r
         this.lastMod = rs.getDate("LAST_MOD");\r
         this.createdDate = rs.getTimestamp("CREATED_DATE");\r
-        this.aafInstance = rs.getString("AAF_INSTANCE");\r
     }\r
 \r
     /**\r
@@ -148,10 +145,6 @@ public class Feed extends Syncable {
             this.feedid = jo.optInt(FEED_ID, -1);\r
             this.groupid = jo.optInt("groupid");\r
             this.name = jo.getString("name");\r
-            this.aafInstance = jo.optString("aaf_instance", "legacy");\r
-            if (!("legacy".equalsIgnoreCase(aafInstance)) && aafInstance.length() > 255) {\r
-                throw new InvalidObjectException("aaf_instance field is too long");\r
-            }\r
             if (name.length() > 255) {\r
                 throw new InvalidObjectException("name field is too long");\r
             }\r
@@ -440,10 +433,6 @@ public class Feed extends Syncable {
         fl.setLog(URLUtilities.generateFeedLogURL(feedid));\r
     }\r
 \r
-    public String getAafInstance() {\r
-        return aafInstance;\r
-    }\r
-\r
     //new getter setters for groups- Rally:US708115 - 1610\r
     public int getGroupid() {\r
         return groupid;\r
@@ -553,7 +542,6 @@ public class Feed extends Syncable {
         jo.put("suspend", suspended);\r
         jo.put(LAST_MOD, lastMod.getTime());\r
         jo.put(CREATED_DATE, createdDate.getTime());\r
-        jo.put("aaf_instance", aafInstance);\r
         return jo;\r
     }\r
 \r
@@ -634,8 +622,8 @@ public class Feed extends Syncable {
             try (PreparedStatement ps = conn.prepareStatement(\r
                 "insert into FEEDS (FEEDID, NAME, VERSION, DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, "\r
                     + "PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, DELETED, SUSPENDED,"\r
-                    + "BUSINESS_DESCRIPTION, GROUPID, AAF_INSTANCE) "\r
-                    + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {\r
+                    + "BUSINESS_DESCRIPTION, GROUPID) "\r
+                    + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {\r
                 ps.setInt(1, feedid);\r
                 ps.setString(2, getName());\r
                 ps.setString(3, getVersion());\r
@@ -650,7 +638,6 @@ public class Feed extends Syncable {
                 ps.setBoolean(12, isSuspended());\r
                 ps.setString(13, getBusinessDescription());\r
                 ps.setInt(14, groupid);\r
-                ps.setString(15, getAafInstance());\r
                 ps.executeUpdate();\r
             }\r
         } catch (SQLException e) {\r
@@ -799,9 +786,6 @@ public class Feed extends Syncable {
         if (suspended != of.suspended) {\r
             return false;\r
         }\r
-        if (!aafInstance.equals(of.aafInstance)) {\r
-            return false;\r
-        }\r
         return true;\r
     }\r
 \r
index 5741881..6928add 100644 (file)
@@ -72,7 +72,6 @@ public class Subscription extends Syncable {
     private Date lastMod;\r
     private Date createdDate;\r
     private boolean privilegedSubscriber;\r
-    private String aafInstance;\r
     private boolean decompress;\r
 \r
     public Subscription() {\r
@@ -98,7 +97,6 @@ public class Subscription extends Syncable {
         this.lastMod = new Date();\r
         this.createdDate = new Date();\r
         this.privilegedSubscriber = false;\r
-        this.aafInstance = "";\r
         this.decompress = false;\r
     }\r
 \r
@@ -121,7 +119,6 @@ public class Subscription extends Syncable {
         this.lastMod = rs.getDate("LAST_MOD");\r
         this.createdDate = rs.getDate("CREATED_DATE");\r
         this.privilegedSubscriber = rs.getBoolean("PRIVILEGED_SUBSCRIBER");\r
-        this.aafInstance = rs.getString("AAF_INSTANCE");\r
         this.decompress  = rs.getBoolean("DECOMPRESS");\r
     }\r
 \r
@@ -137,10 +134,6 @@ public class Subscription extends Syncable {
             this.subid = jo.optInt(SUBID_KEY, -1);\r
             this.feedid = jo.optInt(FEEDID_KEY, -1);\r
             this.groupid = jo.optInt(GROUPID_KEY, -1); //New field is added - Groups feature Rally:US708115 - 1610\r
-            this.aafInstance = jo.optString("aaf_instance", "legacy");\r
-            if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
-                throw new InvalidObjectException("aaf_instance field is too long");\r
-            }\r
             JSONObject jdeli = jo.getJSONObject("delivery");\r
             String url = jdeli.getString("url");\r
             String user = jdeli.getString("user");\r
@@ -334,14 +327,6 @@ public class Subscription extends Syncable {
         sl.setFeed(URLUtilities.generateFeedURL(feedid));\r
     }\r
 \r
-    public String getAafInstance() {\r
-        return aafInstance;\r
-    }\r
-\r
-    public void setAafInstance(String aafInstance) {\r
-        this.aafInstance = aafInstance;\r
-    }\r
-\r
     //New getter setters for Groups feature Rally:US708115 - 1610\r
     public int getGroupid() {\r
         return groupid;\r
@@ -439,7 +424,6 @@ public class Subscription extends Syncable {
         jo.put(LAST_MOD_KEY, lastMod.getTime());\r
         jo.put(CREATED_DATE, createdDate.getTime());\r
         jo.put("privilegedSubscriber", privilegedSubscriber);\r
-        jo.put("aaf_instance", aafInstance);\r
         jo.put("decompress", decompress);\r
         return jo;\r
     }\r
@@ -490,8 +474,8 @@ public class Subscription extends Syncable {
             // Create the SUBSCRIPTIONS row\r
             String sql = "insert into SUBSCRIPTIONS (SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, "\r
                 + "DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, "\r
-                + "PRIVILEGED_SUBSCRIBER, FOLLOW_REDIRECTS, DECOMPRESS, AAF_INSTANCE) "\r
-                + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
+                + "PRIVILEGED_SUBSCRIBER, FOLLOW_REDIRECTS, DECOMPRESS) "\r
+                + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
             ps = conn.prepareStatement(sql, new String[]{SUBID_COL});\r
             ps.setInt(1, subid);\r
             ps.setInt(2, feedid);\r
@@ -506,7 +490,6 @@ public class Subscription extends Syncable {
             ps.setBoolean(11, isPrivilegedSubscriber());\r
             ps.setInt(12, isFollowRedirect() ? 1 : 0);\r
             ps.setBoolean(13, isDecompress());\r
-            ps.setString(14, getAafInstance());\r
             ps.execute();\r
             ps.close();\r
             // Update the row to set the URLs\r
@@ -630,9 +613,6 @@ public class Subscription extends Syncable {
         if (suspended != os.suspended) {\r
             return false;\r
         }\r
-        if (!aafInstance.equals(os.aafInstance)) {\r
-            return false;\r
-        }\r
         return true;\r
     }\r
 \r
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtils.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtils.java
deleted file mode 100644 (file)
index 57bc84b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dmaap.datarouter.provisioning.utils;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import org.onap.aaf.cadi.PropAccess;
-
-public class AafPropsUtils {
-
-    private static final EELFLogger eelfLogger = EELFManager.getInstance().getLogger(AafPropsUtils.class);
-
-    public static final String KEYSTORE_TYPE_PROPERTY = "PKCS12";
-    public static final String TRUESTSTORE_TYPE_PROPERTY = "jks";
-    private static final String KEYSTORE_PATH_PROPERTY = "cadi_keystore";
-    private static final String KEYSTORE_PASS_PROPERTY = "cadi_keystore_password_p12";
-    private static final String TRUSTSTORE_PATH_PROPERTY = "cadi_truststore";
-    private static final String TRUSTSTORE_PASS_PROPERTY = "cadi_truststore_password";
-
-    private final PropAccess propAccess;
-
-    public AafPropsUtils(File propsFile) throws IOException {
-        propAccess = new PropAccess();
-        try {
-            propAccess.load(new FileInputStream(propsFile));
-        } catch (IOException e) {
-            eelfLogger.error("Failed to load props file: " + propsFile + "\n" + e.getMessage(), e);
-            throw e;
-        }
-    }
-
-    private String decryptedPass(String password) {
-        String decryptedPass = null;
-        try {
-            decryptedPass = propAccess.decrypt(password, false);
-        } catch (IOException e) {
-            eelfLogger.error("Failed to decrypt " + password + " : " + e.getMessage(), e);
-        }
-        return decryptedPass;
-    }
-
-    public PropAccess getPropAccess() {
-        return propAccess;
-    }
-
-    public String getKeystorePathProperty() {
-        return propAccess.getProperty(KEYSTORE_PATH_PROPERTY);
-    }
-
-    public String getKeystorePassProperty() {
-        return decryptedPass(propAccess.getProperty(KEYSTORE_PASS_PROPERTY));
-    }
-
-    public String getTruststorePathProperty() {
-        return propAccess.getProperty(TRUSTSTORE_PATH_PROPERTY);
-    }
-
-    public String getTruststorePassProperty() {
-        return decryptedPass(propAccess.getProperty(TRUSTSTORE_PASS_PROPERTY));
-    }
-
-}
index c614c0b..a0ece41 100644 (file)
@@ -108,6 +108,7 @@ public class DRRouteCLI {
     private int width = 120;        // screen width (for list)
     private AbstractHttpClient httpclient;
 
+    @SuppressWarnings("deprecation")
     /**
      * Create a DRRouteCLI object connecting to the specified server.
      *
@@ -117,20 +118,18 @@ public class DRRouteCLI {
     public DRRouteCLI(String server) throws Exception {
         this.server = server;
         this.httpclient = new DefaultHttpClient();
-        AafPropsUtils aafPropsUtils = null;
+        ProvTlsManager provTlsManager = null;
 
         Properties provProperties = ProvRunner.getProvProperties();
         try {
-            aafPropsUtils = new AafPropsUtils(new File(provProperties.getProperty(
-                "org.onap.dmaap.datarouter.provserver.aafprops.path",
-                "/opt/app/osaaf/local/org.onap.dmaap-dr.props")));
-        } catch (IOException e) {
-            intlogger.error("NODE0314 Failed to load AAF props. Exiting", e);
+            provTlsManager = new ProvTlsManager(provProperties, false);
+        } catch (Exception e) {
+            intlogger.error("NODE0314 Failed to load TLS config. Exiting", e);
             exit(1);
         }
 
-        String truststoreFile = aafPropsUtils.getTruststorePathProperty();
-        String truststorePw = aafPropsUtils.getTruststorePassProperty();
+        String truststoreFile = provTlsManager.getTrustStoreFile();
+        String truststorePw = provTlsManager.getTrustStorePassword();
 
         KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
         if (truststoreFile == null || truststoreFile.equals("")) {
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManager.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManager.java
new file mode 100644 (file)
index 0000000..4cf5906
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * Licensed 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.datarouter.provisioning.utils;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.Properties;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+public class ProvTlsManager {
+
+    private static final EELFLogger eelfLogger = EELFManager.getInstance().getLogger(ProvTlsManager.class);
+
+    private final String keyStoreType;
+    private final String keyStorefile;
+    private final String keyStorePassword;
+    private final String keyManagerPassword;
+    private KeyStore keyStore;
+
+    private final String trustStoreType;
+    private final String trustStoreFile;
+    private final String trustStorePassword;
+    private KeyStore trustStore;
+
+    private final String[] enabledProtocols;
+
+    /**
+     * Utility class to handle Provisioning server SSL configuration
+     *
+     * @param properties DR provisioning server properties
+     * @throws Exception for any unrecoverable problem
+     */
+    public ProvTlsManager(Properties properties, boolean preLoadCerts) throws Exception {
+
+        keyStoreType = properties.getProperty("org.onap.dmaap.datarouter.provserver.keystoretype", "PKCS12");
+        keyStorefile = properties.getProperty("org.onap.dmaap.datarouter.provserver.keystorepath");
+        keyStorePassword = properties.getProperty("org.onap.dmaap.datarouter.provserver.keystorepassword");
+        keyManagerPassword = properties.getProperty("org.onap.dmaap.datarouter.provserver.keymanagerpassword");
+
+        trustStoreType = properties.getProperty("org.onap.dmaap.datarouter.provserver.truststoretype", "jks");
+        trustStoreFile = properties.getProperty("org.onap.dmaap.datarouter.provserver.truststorepath");
+        trustStorePassword = properties.getProperty("org.onap.dmaap.datarouter.provserver.truststorepassword");
+
+        if (preLoadCerts) {
+            eelfLogger.debug("ProvTlsManager: Attempting to pre load certificate data from config.");
+            setUpKeyStore();
+            setUpTrustStore();
+        }
+
+        enabledProtocols = properties.getProperty(
+            "org.onap.dmaap.datarouter.provserver.https.include.protocols",
+            "TLSv1.1|TLSv1.2").trim().split("\\|");
+    }
+
+    /**
+     * Gets an SSLSocketFactory instance constructed using the relevant SSL properties
+     *
+     * @return SSLSocketFactory
+     * @throws KeyStoreException if SSL config is invalid
+     */
+    public SSLSocketFactory getSslSocketFactory()
+        throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException {
+        eelfLogger.debug("ProvTlsManager.getSslSocketFactory: Setting up SSLSocketFactory");
+        if (this.trustStoreFile == null) {
+            eelfLogger.warn("Warning: No trust store available.");
+            return new SSLSocketFactory(this.keyStore, this.keyStorePassword);
+        }
+        return new SSLSocketFactory(this.keyStore, this.keyStorePassword, this.trustStore);
+    }
+
+    /**
+     * Gets an SslContextFactory.Server instance constructed using the relevant SSL properties
+     *
+     * @return SslContextFactory.Server
+     */
+    public SslContextFactory.Server getSslContextFactoryServer() {
+        eelfLogger.debug("ProvTlsManager.getSslContextFactoryServer: Setting up getSslContextFactoryServer");
+        SslContextFactory.Server sslContextFactoryServer = new SslContextFactory.Server();
+        sslContextFactoryServer.setKeyStoreType(this.keyStoreType);
+        sslContextFactoryServer.setKeyStorePath(this.keyStorefile);
+        sslContextFactoryServer.setKeyStorePassword(this.keyStorePassword);
+        sslContextFactoryServer.setKeyManagerPassword(this.keyManagerPassword);
+        if (this.trustStoreFile != null) {
+            sslContextFactoryServer.setTrustStoreType(this.trustStoreType);
+            sslContextFactoryServer.setTrustStorePath(this.trustStoreFile);
+            sslContextFactoryServer.setTrustStorePassword(this.trustStorePassword);
+        }
+        sslContextFactoryServer.setIncludeProtocols(this.enabledProtocols);
+        return sslContextFactoryServer;
+    }
+
+    /**
+     * Get the trust store file path from dr config
+     *
+     * @return String
+     */
+    public String getTrustStoreFile() {
+        return trustStoreFile;
+    }
+
+    /**
+     * Get the trust store password from dr config
+     *
+     * @return String
+     */
+    public String getTrustStorePassword() {
+        return trustStorePassword;
+    }
+
+    private void setUpKeyStore()
+        throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException {
+        eelfLogger.debug("ProvTlsManager.setUpKeyStore: Attempting to load keyStore {}", keyStorefile);
+        keyStore = readKeyStore(keyStorefile, keyStorePassword, keyStoreType);
+    }
+
+    private void setUpTrustStore()
+        throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException {
+        if (trustStoreFile != null && trustStorePassword != null) {
+            eelfLogger.debug("ProvTlsManager.setUpTrustStore: Attempting to load trustStore {}", trustStoreFile);
+            trustStore = readKeyStore(trustStoreFile, trustStorePassword, trustStoreType);
+        } else {
+            eelfLogger.warn("No truststore provided from properties. Skipping.");
+        }
+    }
+
+    private KeyStore readKeyStore(String keyStore, String pass, String type)
+        throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException {
+        eelfLogger.debug("ProvTlsManager.readKeyStore: Verifying load of keystore {}", keyStore);
+        KeyStore ks = KeyStore.getInstance(type);
+        try (FileInputStream stream = new FileInputStream(keyStore)) {
+            ks.load(stream, pass.toCharArray());
+        }
+        return ks;
+    }
+}
\ No newline at end of file
index ef28261..86c178a 100644 (file)
@@ -140,33 +140,7 @@ public class SynchronizerTask extends TimerTask {
         try (AbstractHttpClient hc = new DefaultHttpClient()) {
             Scheme sch;
             if (Boolean.TRUE.equals(ProvRunner.getTlsEnabled())) {
-                // Set up keystore
-                String type = AafPropsUtils.KEYSTORE_TYPE_PROPERTY;
-                String store = ProvRunner.getAafPropsUtils().getKeystorePathProperty();
-                String pass = ProvRunner.getAafPropsUtils().getKeystorePassProperty();
-                KeyStore keyStore = KeyStore.getInstance(type);
-                try (FileInputStream instream = new FileInputStream(store)) {
-                    keyStore.load(instream, pass.toCharArray());
-
-                }
-                // Set up truststore
-                store = ProvRunner.getAafPropsUtils().getTruststorePathProperty();
-                pass = ProvRunner.getAafPropsUtils().getTruststorePassProperty();
-                KeyStore trustStore = null;
-                if (store != null && store.length() > 0) {
-                    trustStore = KeyStore.getInstance(AafPropsUtils.TRUESTSTORE_TYPE_PROPERTY);
-                    try (FileInputStream instream = new FileInputStream(store)) {
-                        trustStore.load(instream, pass.toCharArray());
-
-                    }
-                }
-                // We are connecting with the node name, but the certificate will have the CNAME
-                // So we need to accept a non-matching certificate name
-                String keystorepass = ProvRunner.getAafPropsUtils().getKeystorePassProperty();
-                SSLSocketFactory socketFactory =
-                        (trustStore == null)
-                                ? new SSLSocketFactory(keyStore, keystorepass)
-                                : new SSLSocketFactory(keyStore, keystorepass, trustStore);
+                SSLSocketFactory socketFactory = ProvRunner.getProvTlsManager().getSslSocketFactory();
                 socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
                 sch = new Scheme("https", 443, socketFactory);
             } else {
@@ -180,6 +154,7 @@ public class SynchronizerTask extends TimerTask {
         } catch (Exception e) {
             logger.warn("PROV5005: Problem starting the synchronizer: " + e);
         }
+        logger.info("PROV5000: SynchronizerTask started");
     }
 
     private void setSynchTimer(String strInterval) {
index 8940348..a5eb459 100644 (file)
@@ -161,7 +161,8 @@ public class URLUtilities {
 \r
     private static String getAppropriateUrlPort() {\r
         if (Boolean.TRUE.equals(ProvRunner.getTlsEnabled())) {\r
-            return "";\r
+            return ":" + ProvRunner.getProvProperties()\r
+                .getProperty("org.onap.dmaap.datarouter.provserver.https.port", "8443");\r
         }\r
         return ":" + ProvRunner.getProvProperties()\r
             .getProperty("org.onap.dmaap.datarouter.provserver.http.port", "8080");\r
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.cred.props b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.cred.props
deleted file mode 100644 (file)
index bb86e9d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:23.012+0000
-# @copyright 2019, AT&T
-############################################################
-Challenge=enc:v6yuDc_Lu1OgeFEthckOsa7R0XW6h0iZqUQXnw4CpstwzjmN0x9VOsf27um5fC5z
-cadi_alias=dmaap-dr-prov@dmaap-dr.onap.org
-cadi_key_password=enc:CBXkw5IMQ8IeOhERa_oK4XcS1BsKy3T9BiZgAOIBqI46Nvy0USwgXCyOkTgVlJn7
-cadi_keyfile=/opt/app/osaaf/local/org.onap.dmaap-dr.keyfile
-cadi_keystore=/opt/app/osaaf/local/org.onap.dmaap-dr.p12
-cadi_keystore_password=enc:Qd78mq7KSyK4G-gmnA0YVrB4jpMLgMX_4jDmwkdkKpD-MmonHNXlDA0TzRd3oxWe
-cadi_keystore_password_jks=enc:GuyybAMtPX21LbCx_AXGnO7nz3NlPenZESuLVgrw-_cK55re75K4YOLYVzQswUYU
-cadi_keystore_password_p12=enc:Qd78mq7KSyK4G-gmnA0YVrB4jpMLgMX_4jDmwkdkKpD-MmonHNXlDA0TzRd3oxWe
-cadi_truststore=/opt/app/osaaf/local/org.onap.dmaap-dr.trust.jks
-cadi_truststore_password=enc:y10bIyzTHei-rxWnWgHUUFUD_9TfOBdxmIn6vEf0zsyZtWmeP8ZjFE1LoPn7Ri4g
-cadi_x509_issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.keyfile b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.keyfile
deleted file mode 100644 (file)
index 8609289..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-gf-I4kLSg98uxwCXpklt-W2Qfa0mFgvXDoQk_qsLs4uuLI9FmWkrdlgdqzEgISL1sf6SAhoXFXO4
-BSm8fSPPrjaFEQ-uZcho1bY63lG710ZLh7vf0Bc7WPieRXesloH07CRXXjUdTkXXU8qTP6Ufru16
-mbGODzcZ-Ygm2GLVbkLk7953CJYIvuYT0M3ggrDr51eOalpgwXA1uO2DCTmY_fyqFNpZbLEtcYAx
-EEBkbaT0KhKwSfXfPINjpfCVMNBr3eK2m75RFJzTmA4Nq_WFgQQBUJkYu6EaWR8xwKEnX3brIFN-
-uY8Xk-Wxh8hhqNQWSxaSa_w6BfbP5CwUpIk9Ex1v_gCa63NIy4WzoRxOHKuCQAS26vLJFxTTNOlP
-d_DVC0gmvL-q8VnedNVSsRw1zuDOtOzKg3iUbTjopba3YryelxwL2xUJzkxv8RiOVvTCdZ34lPP0
-vQCaGJYg52OKOCMaIs4e6bqfCFMT4nlbad--mPeZGS3X5pJ0xSAMRa8L2_ksHbTOvcjOlCvmWNDK
-puP22sdegP-mV6Ygm30Gyn7TnUodDA3bzIiA70zrkrlt8pBMhKmCbmWvGfjItoRnfGwtlsm1OU73
-Jst8pQ_mvCK486UoH4Lui1kNBTqAJIrzYT_m-MrL6w9lx7Lu-ZG0HqdDVO4zB06WTyCXT-I2r-XS
-F9ddoQ3GOUMA4kIckEeEVYfZiVaoPeizNwynSLHZDA3Xztc-kz7HEqdUCypM5pM32qGN-z4Gzbh0
-K4GO7_cGyctMGNY5za3iANK3BBBx9d3G3XKuCH2EDF9aj_kFarMaJjTHwn9-OAeD2GXtdYQqarod
-4Yw11CD8JjyF6PdYstTh9t5_iK3pZjFaLMBPlLFN_tDu_5zsVagJjM7nMjfn8iWH5o3rj7WAIqBC
-NoxZhIRUVpEmDKkhsnq9i9gdjoiKjrNwEsswX2vGsXEAf1vTXH2YsgraTjEhlW0cIb4PBLd4YoSE
-AW3MXhwu5rYFgGooHyB99OKZOX6-5Y44fA0TE0ypn8HZ5oVrERCHVHNXsiXg1pRjTHjoIYUFoSQQ
-lT8eVUo5MUxQ0SVKUi03wA7EduWrwvuD_KyLeNnvECj6IDuK7qiqH86UV7AyQhwjSZPj4N3KIlvD
-VJNLmt6s8b6SLZpO23P-ZceFEIIYG7E1IGmo2s5VkWTNTkvqD7blxoOsfBIxb-SjttnMtbKCcXPj
-aKMC1oqr5xLsvtg9XDKKXt4kELElRBiKtrud8t7qqYMfC-q6lIddmG8x_196qsYiErKd9mLyDT2H
-DG9wmz3dDds_bUnXA7_-LsriDI4t_fAqAKnvR8tLi9DjhU1g9yjlGuKn4yd3y8aK-UFFfBi1AKxA
-WoxSt2Omw_sl9Jc6bzoZ2_NHPZz7IaDhSu1imAAcAms4SIr3g-MnBffVpxarrXYsoaxurMRMoqLx
-r0DyV1Y9IZSwo-xsWk42CxrvEF31AmFWewI0ykA8bZ-zpWux3z7BfbKDqxglg3Lp5uIfVFHamds3
-ya-KMBCtaSgiJ9fB7Q183Lt0tMxrOLe3hln55I4SRgHT5blh1LEznIigIfhFEOo514JEdctkVrDS
-bDSbCO-yZE_0BcznTsjoyImwObeVRbDDu0feM9uGs4fL7zwVCbzEurGU2js-0o0rcyDiv30tsL5S
-LaxA-xz7x5HO4JAd7BeaeF4-v0-IeLKPH4HzYk0g1PKskZaZHMWBWSPaJWin68ahh9Eh44xSjsCW
-TUcoddf4-5HZS_RWlrLvbnfbEBAm7Ikbno1zLJz7_H3tmLKv2axkGEu-YWIAffb7xMzG0T9m6S3B
-Iz1jWxtJ41gTE5kGFmaezDeUGPrioaqOq0bCq6DStQMc_5kcKAIg6GffOX75ZvagC2E6E_B58AGU
-iVDzz_yi4Xcssf2jN-MIiHes0HsMQILrLAu1PLZh9qOIGOnVgLdwr0o5CGsg0h7Bxxl6jFQubwAZ
-rc2foRg7arAcRHYasoC34f9pH0hfBzHfTGg5S7bWU6mDaldpWS8Na0EoCoFoZATkdzG77w6c
\ No newline at end of file
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.location.props b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.location.props
deleted file mode 100644 (file)
index eef8aac..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:21.359+0000
-# @copyright 2019, AT&T
-############################################################
-cadi_latitude=38.0
-cadi_longitude=-72.0
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.p12 b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.p12
deleted file mode 100644 (file)
index 69948c2..0000000
Binary files a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.p12 and /dev/null differ
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.props b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.props
deleted file mode 100644 (file)
index a392a48..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:21.357+0000
-# @copyright 2019, AT&T
-############################################################
-aaf_env=DEV
-aaf_id=dmaap-dr-prov@dmaap-dr.onap.org
-aaf_locate_url=https://aaf-locate.onap:8095
-aaf_locator_app_ns=org.osaaf.aaf
-aaf_locator_container=oom
-aaf_locator_container_ns=onap
-aaf_locator_fqdn=dmaap-dr-prov
-aaf_locator_public_fqdn=aaf.osaaf.org
-aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:2.1/introspect
-aaf_oauth2_token_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:2.1/token
-aaf_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.service:2.1
-aaf_url_cm=https://AAF_LOCATE_URL/%CNS.%AAF_NS.cm:2.1
-aaf_url_fs=https://AAF_LOCATE_URL/%CNS.%AAF_NS.fs:2.1
-aaf_url_gui=https://AAF_LOCATE_URL/%CNS.%AAF_NS.gui:2.1
-aaf_url_hello=https://aaf-locate.onap:8095/locate/onap.org.osaaf.aaf.hello:2.1
-aaf_url_oauth=https://AAF_LOCATE_URL/%CNS.%AAF_NS.oauth:2.1
-cadi_prop_files=/opt/app/osaaf/local/org.onap.dmaap-dr.location.props:/opt/app/osaaf/local/org.onap.dmaap-dr.cred.props
-cadi_protocols=TLSv1.1,TLSv1.2
diff --git a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.trust.jks b/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.trust.jks
deleted file mode 100644 (file)
index 3666b96..0000000
Binary files a/datarouter-prov/src/main/resources/aaf/org.onap.dmaap-dr.trust.jks and /dev/null differ
index a1980d2..17884f6 100755 (executable)
@@ -14,8 +14,7 @@ CREATE TABLE FEEDS (
     DELETED        BOOLEAN DEFAULT FALSE,
     LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     SUSPENDED      BOOLEAN DEFAULT FALSE,
-    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    AAF_INSTANCE   VARCHAR(256)
+    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP
 );
 
 CREATE TABLE FEED_ENDPOINT_IDS (
@@ -46,9 +45,7 @@ CREATE TABLE SUBSCRIPTIONS (
     SUSPENDED                   BOOLEAN DEFAULT FALSE,
     PRIVILEGED_SUBSCRIBER       BOOLEAN DEFAULT FALSE,
     CREATED_DATE                TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    DECOMPRESS                  BOOLEAN DEFAULT FALSE,
-    AAF_INSTANCE                VARCHAR(256)
-
+    DECOMPRESS                  BOOLEAN DEFAULT FALSE
 );
 
 CREATE TABLE PARAMETERS (
@@ -145,6 +142,6 @@ INSERT INTO PARAMETERS VALUES
     ('PROV_MAXFEED_COUNT',  '10000'),
     ('PROV_MAXSUB_COUNT',   '100000'),
     ('PROV_REQUIRE_CERT', 'false'),
-    ('PROV_REQUIRE_SECURE', 'true'),
+    ('PROV_REQUIRE_SECURE', 'false'),
     ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE|DELIVERY_FILE_PROCESS_INTERVAL')
     ;
\ No newline at end of file
index 66d4e6c..2582498 100755 (executable)
@@ -31,12 +31,17 @@ org.onap.dmaap.datarouter.provserver.spooldir            = /opt/app/datartr/spoo
 org.onap.dmaap.datarouter.provserver.dbscripts           = /opt/app/datartr/etc/misc
 org.onap.dmaap.datarouter.provserver.logretention        = 30
 
-org.onap.dmaap.datarouter.provserver.aafprops.path       = /opt/app/osaaf/local/org.onap.dmaap-dr.props
 org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false
-
-org.onap.dmaap.datarouter.provserver.cadi.enabled         = false
-
 org.onap.dmaap.datarouter.provserver.tlsenabled           = false
+# If tlsenabled is true, the following keystore info must be set
+org.onap.dmaap.datarouter.provserver.keystoretype         = PKCS12
+org.onap.dmaap.datarouter.provserver.keystorepath         = /opt/app/datartr/certs/org.onap.dmaap-dr-prov.p12
+org.onap.dmaap.datarouter.provserver.keystorepassword     = secret
+org.onap.dmaap.datarouter.provserver.keymanagerpassword   = secret
+org.onap.dmaap.datarouter.provserver.truststoretype       = jks
+org.onap.dmaap.datarouter.provserver.truststorepath       = /opt/app/datartr/certs/truststore.jks
+org.onap.dmaap.datarouter.provserver.truststorepassword   = secret
+
 org.onap.dmaap.datarouter.nodeserver.https.port           = 8443
 org.onap.dmaap.datarouter.nodeserver.http.port            = 8080
 
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java b/datarouter-prov/src/test/java/datarouter/provisioning/DbTestData.java
deleted file mode 100644 (file)
index 36a2eb0..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.impl.client.AbstractHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * The DbTestData class
- *
- * @version 1.0.1
- */
-public class DbTestData {
-
-    private static boolean dbReady = false;
-
-    public static void populateDb(AbstractHttpClient httpclient, Properties props) {
-        if (!dbReady) {
-            JSONObject jo = buildFeedRequest();
-            for (int i = 0; i < 10; i++) {
-                jo.put("version", "" + System.currentTimeMillis());
-                int statusCode = -1;
-                String url = props.getProperty("test.host");
-                HttpPost httpPost = new HttpPost(url);
-                try {
-                    httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-                    String feedRequestString = jo.toString();
-                    HttpEntity body = new ByteArrayEntity(feedRequestString.getBytes(),
-                        ContentType.create(FeedServlet.FEED_CONTENT_TYPE));
-                    httpPost.setEntity(body);
-                    HttpResponse response = httpclient.execute(httpPost);
-                    statusCode = response.getStatusLine().getStatusCode();
-                    HttpEntity entity = response.getEntity();
-                    EntityUtils.consume(entity);
-                } catch (IOException e) {
-                    System.err.println(e);
-                } finally {
-                    httpPost.releaseConnection();
-                }
-                System.out.println(i + " " + statusCode);
-            }
-            dbReady = true;
-        }
-    }
-
-    private static JSONObject buildFeedRequest() {
-        JSONObject jo = new JSONObject();
-        jo.put("name", "feed");
-        jo.put("version", "" + System.currentTimeMillis());
-        jo.put("description", "Sample feed used by JUnit to test");
-
-        JSONObject jo2 = new JSONObject();
-        jo2.put("classification", "unrestricted");
-
-        JSONObject jo3 = new JSONObject();
-        jo3.put("id", "id001");
-        jo3.put("password", "re1kwelj");
-
-        JSONObject jo4 = new JSONObject();
-        jo4.put("id", "id002");
-        jo4.put("password", "o9eqlmbd");
-
-        JSONArray ja = new JSONArray();
-        ja.put(jo3);
-        ja.put(jo4);
-        jo2.put("endpoint_ids", ja);
-
-        ja = new JSONArray();
-        ja.put("10.0.0.1");
-        ja.put("192.168.0.1");
-        ja.put("135.207.136.128/25");
-        jo2.put("endpoint_addrs", ja);
-
-        jo.put("authorization", jo2);
-        return jo;
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationSuite.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationSuite.java
deleted file mode 100644 (file)
index 4d23857..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({
-    IntegrationTestDrFeedsPost.class,
-    IntegrationTestDrFeedsPut.class,
-    IntegrationTestDrFeedsDelete.class,
-    IntegrationTestFeedPut.class,
-    IntegrationTestDrFeedsGet.class,
-    IntegrationTestInternalGet.class,
-    IntegrationTestInternalMisc.class,
-    IntegrationTestPublish.class,
-    IntegrationTestSubscribePost.class,
-    IntegrationTestLogGet.class,
-    IntegrationTestFeedDelete.class,
-    IntegrationTestCleanup.class,
-    IntegrationTestRleBitSet.class
-})
-
-public class IntegrationSuite {
-
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestBase.java
deleted file mode 100755 (executable)
index 3e5e1d0..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.util.Properties;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.StatusLine;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.AbstractHttpClient;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.After;
-import org.junit.Before;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestBase {
-
-    /**
-     * The properties file to read the DB properties from.
-     */
-    private static final String CONFIG_FILE = "integration_test.properties";
-
-    public Properties props;
-    protected AbstractHttpClient httpclient;
-    String s33;
-    String s257;
-    static JSONObject db_state;
-
-    /**
-     * This is the setUp method.
-     */
-    @Before
-    public void setUp() throws Exception {
-        if (props == null) {
-            props = new Properties();
-            try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE)) {
-                props.load(inStream);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        httpclient = new DefaultHttpClient();
-        String str = "0123456789ABCDEF";
-        s33 = str + str + "!";
-        str = str + str + str + str;
-        s257 = str + str + str + str + "!";
-
-        // keystore
-        String store = props.getProperty("test.keystore");
-        String pass = props.getProperty("test.kspassword");
-        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        FileInputStream instream = new FileInputStream(new File(store));
-        try {
-            keyStore.load(instream, pass.toCharArray());
-        } catch (Exception x) {
-            System.err.println("READING KEYSTORE: " + x);
-        } finally {
-            try {
-                instream.close();
-            } catch (Exception ignore) {
-                // Ignore exception
-            }
-        }
-
-        store = props.getProperty("test.truststore");
-        pass = props.getProperty("test.tspassword");
-        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        instream = new FileInputStream(new File(store));
-        try {
-            trustStore.load(instream, pass.toCharArray());
-        } catch (Exception x) {
-            System.err.println("READING TRUSTSTORE: " + x);
-        } finally {
-            try {
-                instream.close();
-            } catch (Exception ignore) {
-                // Ignore exception
-            }
-        }
-
-        SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore, props.getProperty("test.kspassword"), trustStore);
-        Scheme sch = new Scheme("https", 443, socketFactory);
-        httpclient.getConnectionManager().getSchemeRegistry().register(sch);
-
-        //DbTestData.populateDb(httpclient, props);
-    }
-
-    /**
-     * This is the getDBstate method.
-     */
-    void getDBstate() {
-        // set db_state!
-        if (db_state == null) {
-            String url = props.getProperty("test.host") + "/internal/prov";
-            HttpGet httpGet = new HttpGet(url);
-            try {
-                httpGet.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-                HttpResponse response = httpclient.execute(httpGet);
-                HttpEntity entity = response.getEntity();
-                String ctype = entity.getContentType().getValue().trim();
-                // save the response body as db_state
-                boolean ok = ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE1);
-                ok |= ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE2);
-                if (ok) {
-                    db_state = null;
-                    try {
-                        db_state = new JSONObject(new JSONTokener(entity.getContent()));
-                    } catch (Exception e) {
-                        fail("Bad JSON: " + e.getMessage());
-                    }
-                } else {
-                    EntityUtils.consume(entity);
-                }
-            } catch (IOException e) {
-                fail(e.getMessage());
-            } finally {
-                httpGet.releaseConnection();
-            }
-        }
-    }
-
-    /**
-     * This is the tearDown method.
-     */
-    @After
-    public void tearDown() throws Exception {
-        // When HttpClient instance is no longer needed,
-        // shut down the connection manager to ensure
-        // immediate deallocation of all system resources
-        httpclient.getConnectionManager().shutdown();
-        FileUtils.deleteDirectory(new File("." + File.pathSeparator+  "unit-test-logs"));
-    }
-
-    protected void ckResponse(HttpResponse response, int expect) {
-        System.out.println(response.getStatusLine());
-        StatusLine sl = response.getStatusLine();
-        int code = sl.getStatusCode();
-        if (code != expect) {
-            fail("Unexpected response, expect " + expect + " got " + code + " " + sl.getReasonPhrase());
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestCleanup.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestCleanup.java
deleted file mode 100644 (file)
index fba7754..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestCleanup extends IntegrationTestBase {
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-    }
-
-    @Test
-    public void testNormal() {
-        // Delete all feeds w/JUnit as publisher
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject feed = ja.getJSONObject(i);
-            if (feed != null && !feed.getBoolean("deleted")) {
-                if (feed.getString("publisher").equals("JUnit")) {
-                    int feedid = feed.getInt("feedid");
-                    delete("/feed/" + feedid);
-                }
-            }
-        }
-        // Delete all subscriptions w/JUnit as subscriber
-        ja = db_state.getJSONArray("subscriptions");
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject sub = ja.getJSONObject(i);
-            if (sub != null && sub.getString("subscriber").equals("JUnit")) {
-                int subid = sub.getInt("subid");
-                delete("/subs/" + subid);
-            }
-        }
-    }
-
-    private void delete(String uri) {
-        String url = props.getProperty("test.host") + uri;;
-        HttpDelete del = new HttpDelete(url);
-        try {
-            del.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-            HttpResponse response = httpclient.execute(del);
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            del.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsDelete.java
deleted file mode 100644 (file)
index 7ebdf22..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.util.EntityUtils;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestDrFeedsDelete extends IntegrationTestBase {
-    @Test
-    public void testNotAllowed() {
-        String url = props.getProperty("test.host") + "/";
-        HttpDelete del = new HttpDelete(url);
-        try {
-            del.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(del);
-            ckResponse(response, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
-
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            del.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsGet.java
deleted file mode 100644 (file)
index 2cc5feb..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestDrFeedsGet extends IntegrationTestBase {
-    private JSONArray returnedlist;
-
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-    }
-
-    @Test
-    public void testNormal() {
-        testCommon(HttpServletResponse.SC_OK);
-        int expect = 0;
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject jo = ja.getJSONObject(i);
-            if (!jo.getBoolean("deleted")) {
-                expect++;
-            }
-        }
-        if (returnedlist.length() != expect) {
-            fail("bad length, got " + returnedlist.length() + " expect " + expect);
-        }
-    }
-
-    @Test
-    public void testNormalGoodName() {
-        JSONArray ja = db_state.getJSONArray("feeds");
-        JSONObject feed0 = ja.getJSONObject(0);
-        String name = feed0.getString("name");
-        String query = "?name=" + name;
-        int expect = 0;
-        for (int n = 0; n < ja.length(); n++) {
-            JSONObject jo = ja.getJSONObject(n);
-            if (!jo.getBoolean("deleted") && jo.getString("name").equals(name)) {
-                expect++;
-            }
-        }
-        testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        if (returnedlist.length() != expect) {
-            fail("bad length, got " + returnedlist.length() + " expect " + expect);
-        }
-    }
-
-    @Test
-    public void testNormalBadName() {
-        String query = "?name=ZZTOP123456";
-        testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        if (returnedlist.length() != 0) {
-            fail("bad length, got " + returnedlist.length() + " expect 0");
-        }
-    }
-
-    @Test
-    public void testNormalBadPath() {
-        String query = "flarg/?publisher=JUnit";
-        testCommon(HttpServletResponse.SC_NOT_FOUND, query, "text/html;charset=ISO-8859-1", "JUnit");
-    }
-
-    @Test
-    public void testNormalGoodPublisher() {
-        JSONArray ja = db_state.getJSONArray("feeds");
-        JSONObject feed0 = ja.getJSONObject(0);
-        String query = "?publisher=" + feed0.getString("publisher");
-        testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        int expect = 0;
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject jo = ja.getJSONObject(i);
-            if (jo.getString("publisher").equals(feed0.getString("publisher")) && !jo.getBoolean("deleted")) {
-                expect++;
-            }
-        }
-        if (returnedlist.length() != expect) {
-            fail("bad length, got " + returnedlist.length() + " expected " + expect);
-        }
-    }
-
-    @Test
-    public void testNormalBadPublisher() {
-        String query = "?publisher=ZZTOP123456";
-        testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        if (returnedlist.length() != 0) {
-            fail("bad length");
-        }
-    }
-
-    @Test
-    public void testNormalGoodSubscriber() {
-        JSONArray ja = db_state.getJSONArray("subscriptions");
-        if (ja.length() > 0) {
-            JSONObject sub0 = ja.getJSONObject(0);
-            String query = "?subscriber=" + sub0.getString("subscriber");
-            testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-// aarg! - this is complicated!
-//        int expect = 0;
-//        for (int i = 0; i < ja.length(); i++) {
-//            JSONObject jo = ja.getJSONObject(i);
-//            if (jo.getString("subscriber").equals(sub0.getString("subscriber")))
-//                expect++;
-//        }
-//        if (returnedlist.length() != 1)
-//            fail("bad length " + returnedlist.toString());
-        } else {
-            // There are no subscriptions yet, so use a made up name
-            testCommon(HttpServletResponse.SC_OK, "?subscriber=foo", FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        }
-    }
-
-    @Test
-    public void testNormalBadSubscriber() {
-        String query = "?subscriber=ZZTOP123456";
-        testCommon(HttpServletResponse.SC_OK, query, FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-        if (returnedlist.length() != 0) {
-            fail("bad length");
-        }
-    }
-
-    private void testCommon(int expect) {
-        testCommon(expect, "", FeedServlet.FEEDLIST_CONTENT_TYPE, "JUnit");
-    }
-
-    private void testCommon(int expect, String query, String ectype, String bhdr) {
-        String url = props.getProperty("test.host") + "/" + query;
-        HttpGet httpGet = new HttpGet(url);
-        try {
-            if (bhdr != null) {
-                httpGet.addHeader(FeedServlet.BEHALF_HEADER, bhdr);
-            }
-
-            HttpResponse response = httpclient.execute(httpGet);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue().trim();
-            if (!ctype.equals(ectype)) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ctype.equals(FeedServlet.FEEDLIST_CONTENT_TYPE)) {
-                try {
-                    returnedlist = new JSONArray(new JSONTokener(entity.getContent()));
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            httpGet.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPost.java
deleted file mode 100644 (file)
index 9f604fe..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestDrFeedsPost extends IntegrationTestBase {
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    @Test
-    public void testNormal() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_CREATED);
-    }
-
-    @Test
-    public void testNormalNoCtVersion() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_CREATED, "application/vnd.dmaap-dr.feed", "JUnit");
-    }
-
-    @Test
-    public void testBadContentType() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "bad/bad", "Junit");
-    }
-
-    @Test
-    public void testNoBehalfHeader() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST, FeedServlet.FEED_CONTENT_TYPE, null);
-    }
-
-    @Test
-    public void testMissingName() {
-        JSONObject jo = buildFeedRequest();
-        jo.remove("name");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testTooLongName() {
-        JSONObject jo = buildFeedRequest();
-        jo.put("name", "123456789012345678901234567890");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testMissingVersion() {
-        JSONObject jo = buildFeedRequest();
-        jo.remove("version");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testTooLongVersion() {
-        JSONObject jo = buildFeedRequest();
-        jo.put("version", "123456789012345678901234567890");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testTooLongDescription() {
-        // normal request
-        JSONObject jo = buildFeedRequest();
-        jo.put("description", s257);
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testMissingAuthorization() {
-        JSONObject jo = buildFeedRequest();
-        jo.remove("authorization");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testMissingClassification() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        j2.remove("classification");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testTooLongClassification() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        j2.put("classification", s33);
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testNoEndpointIds() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        j2.put("endpoint_ids", new JSONArray());
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testBadIpAddress1() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("ZZZ^&#$%@#&^%$@#&^");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testBadIpAddress2() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("135.207.136.678");  // bad IPv4 addr
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testBadIpAddress3() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("2001:1890:1110:d000:1a29::17567");  // bad IPv6 addr
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testBadNetMask() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("10.10.10.10/64");
-        testCommon(jo, 400);
-    }
-
-    @Test
-    public void testGoodIpAddress1() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("135.207.136.175"); // good IPv4 addr
-        testCommon(jo, 201);
-    }
-
-    @Test
-    public void testGoodIpAddress2() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("2001:1890:1110:d000:1a29::175"); // good IPv6 addr
-        testCommon(jo, 201);
-    }
-
-    @Test
-    public void testGoodNetMask() {
-        JSONObject jo = buildFeedRequest();
-        JSONObject j2 = jo.getJSONObject("authorization");
-        JSONArray ja = j2.getJSONArray("endpoint_addrs");
-        ja.put("2001:1890:1110:d000:1a29::175/120");
-        testCommon(jo, 201);
-    }
-
-    private void testCommon(JSONObject jo, int expect) {
-        testCommon(jo, expect, FeedServlet.FEED_CONTENT_TYPE, "JUnit");
-    }
-
-    private void testCommon(JSONObject jo, int expect, String ctype, String bhdr) {
-        String url   = props.getProperty("test.host") + "/";
-        HttpPost httpPost = new HttpPost(url);
-        try {
-            if (bhdr != null) {
-                httpPost.addHeader(FeedServlet.BEHALF_HEADER, bhdr);
-            }
-            String strJo = jo.toString();
-            HttpEntity body = new ByteArrayEntity(strJo.getBytes(), ContentType.create(ctype));
-            httpPost.setEntity(body);
-
-            HttpResponse response = httpclient.execute(httpPost);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            ctype = entity.getContentType().getValue().trim();
-            int code = response.getStatusLine().getStatusCode();
-            if (code == HttpServletResponse.SC_CREATED && !ctype.equals(FeedServlet.FEEDFULL_CONTENT_TYPE)) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            if (code == HttpServletResponse.SC_CREATED) {
-                Header[] loc = response.getHeaders("Location");
-                if (loc == null) {
-                    fail("Missing Location header.");
-                }
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ctype.equals(FeedServlet.FEEDFULL_CONTENT_TYPE)) {
-                // ck Location header!
-                JSONObject jo2 = null;
-                try {
-                    jo2 = new JSONObject(new JSONTokener(entity.getContent()));
-                    System.err.println(jo2.toString());
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-                try {
-                    jo2.getString("publisher");
-                    JSONObject jo3 = jo2.getJSONObject("links");
-                    jo3.getString("self");
-                    jo3.getString("publish");
-                    jo3.getString("subscribe");
-                    jo3.getString("log");
-                } catch (JSONException e) {
-                    fail("required field missing from result: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-    private JSONObject buildFeedRequest() {
-        JSONObject jo = new JSONObject();
-        jo.put("name", "JunitFeed");
-        jo.put("version", "" + System.currentTimeMillis());  // make version unique
-        jo.put("description", "Sample feed used by JUnit to test");
-
-        JSONObject jo2 = new JSONObject();
-        jo2.put("classification", "unrestricted");
-
-        JSONObject jo3 = new JSONObject();
-        jo3.put("id", "id001");
-        jo3.put("password", "re1kwelj");
-        JSONObject jo4 = new JSONObject();
-        jo4.put("id", "id002");
-        jo4.put("password", "o9eqlmbd");
-
-        JSONArray ja = new JSONArray();
-        ja.put(jo3);
-        ja.put(jo4);
-        jo2.put("endpoint_ids", ja);
-
-        ja = new JSONArray();
-        ja.put("10.0.0.1");
-        ja.put("192.168.0.1");
-        ja.put("135.207.136.128/25");
-        jo2.put("endpoint_addrs", ja);
-
-        jo.put("authorization", jo2);
-        return jo;
-    }
-}
-/*
-curl -v -X POST -H 'X-DMAAP-DR-ON-BEHALF-OF: tester' -H 'Content-type: application/vnd.dmaap-dr.feed' \
-    --user publisher:tomcat \
-    --data "$data" http://127.0.0.1:8080/prov/feed/
-*/
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestDrFeedsPut.java
deleted file mode 100644 (file)
index 15e7c70..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.util.EntityUtils;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestDrFeedsPut extends IntegrationTestBase {
-    @Test
-    public void testNotAllowed() {
-        String url = props.getProperty("test.host") + "/";
-        HttpPut put = new HttpPut(url);
-        try {
-            put.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(put);
-            ckResponse(response, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
-
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            put.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedDelete.java
deleted file mode 100644 (file)
index 25e6e43..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestFeedDelete extends IntegrationTestBase {
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-    }
-
-    @Test
-    public void testDeleteNormal() {
-        // Delete the first non-deleted feed in the DB
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = ja.length() - 1; i >= 0; i--) {
-            JSONObject feed = ja.getJSONObject(i);
-            if (!feed.getBoolean("deleted")) {
-                int feedid = feed.getInt("feedid");
-                testCommon(HttpServletResponse.SC_NO_CONTENT, "/feed/" + feedid);
-                return;
-            }
-        }
-    }
-
-    @Test
-    public void testDeleteNoFeedId() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "/feed/");
-    }
-
-    @Test
-    public void testDeleteNoFeed() {
-        testCommon(HttpServletResponse.SC_NOT_FOUND, "/feed/999999");
-    }
-
-    private void testCommon(int expect, String uri) {
-        String url = props.getProperty("test.host") + uri;
-        HttpDelete del = new HttpDelete(url);
-        try {
-            del.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(del);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            del.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestFeedPut.java
deleted file mode 100644 (file)
index d77bc98..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestFeedPut extends IntegrationTestBase {
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-    }
-
-    @Test
-    public void testPutNoFeedId() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST, "/feed/");
-    }
-
-    @Test
-    public void testPutNoFeed() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_NOT_FOUND, "/feed/999999");
-    }
-
-    @Test
-    public void testBadContentType() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "bad/bad", "JUnit");
-    }
-
-    @Test
-    public void testChangeName() {
-        JSONObject jo = buildFeedRequest();
-        jo.put("name", "badname");
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST, FeedServlet.FEED_CONTENT_TYPE, "JUnit");
-    }
-
-    @Test
-    public void testChangeVersion() {
-        JSONObject jo = buildFeedRequest();
-        jo.put("version", "badvers");
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST, FeedServlet.FEED_CONTENT_TYPE, "JUnit");
-    }
-
-    @Test
-    public void testBadPublisher() {
-        JSONObject jo = buildFeedRequest();
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST, FeedServlet.FEED_CONTENT_TYPE, "BadBadBad");
-    }
-
-    @Test
-    public void testChangeDescription() {
-        JSONObject jo = buildFeedRequest();
-        // change descr
-        jo.put("description", "This description HAS BEEN CHANGED!!!");
-        testCommon(jo, HttpServletResponse.SC_OK, FeedServlet.FEED_CONTENT_TYPE, "JUnit");
-    }
-
-    private void testCommon(JSONObject jo, int expect, String uri) {
-        testCommon(jo, expect, FeedServlet.FEED_CONTENT_TYPE, "Junit", uri);
-    }
-
-    private void testCommon(JSONObject jo, int expect, String ctype, String bhdr) {
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject feed0 = ja.getJSONObject(i);
-            if (!feed0.getBoolean("deleted") && feed0.getString("publisher").equals(bhdr)) {
-                int feedid = feed0.getInt("feedid");
-                testCommon(jo, expect, ctype, bhdr, "/feed/" + feedid);
-                return;
-            }
-        }
-    }
-
-    private void testCommon(JSONObject jo, int expect, String ctype, String bhdr, String uri) {
-        String url   = props.getProperty("test.host") + uri;
-        HttpPut put = new HttpPut(url);
-        try {
-            if (bhdr != null) {
-                put.addHeader(FeedServlet.BEHALF_HEADER, bhdr);
-            }
-            String strJo = jo.toString();
-            HttpEntity body = new ByteArrayEntity(strJo.getBytes(), ContentType.create(ctype));
-            put.setEntity(body);
-
-            HttpResponse response = httpclient.execute(put);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            ctype = entity.getContentType().getValue().trim();
-            int code = response.getStatusLine().getStatusCode();
-            if (code == HttpServletResponse.SC_CREATED && !ctype.equals(FeedServlet.FEEDFULL_CONTENT_TYPE)) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            if (code == HttpServletResponse.SC_CREATED) {
-                Header[] loc = response.getHeaders("Location");
-                if (loc == null) {
-                    fail("Missing Location header.");
-                }
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ctype.equals(FeedServlet.FEEDFULL_CONTENT_TYPE)) {
-                // ck Location header!
-                JSONObject jo2 = null;
-                try {
-                    jo2 = new JSONObject(new JSONTokener(entity.getContent()));
-                    System.err.println(jo2.toString());
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-                try {
-                    jo2.getString("publisher");
-                    JSONObject jo3 = jo2.getJSONObject("links");
-                    jo3.getString("self");
-                    jo3.getString("publish");
-                    jo3.getString("subscribe");
-                    jo3.getString("log");
-                } catch (JSONException e) {
-                    fail("required field missing from result: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            put.releaseConnection();
-        }
-    }
-
-    private JSONObject buildFeedRequest() {
-        JSONObject jo = new JSONObject();
-        jo.put("name", "feed");
-        jo.put("version", "1.0.0");
-        jo.put("description", "Sample feed used by JUnit to test");
-
-        JSONObject jo2 = new JSONObject();
-        jo2.put("classification", "unrestricted");
-
-        JSONObject jo3 = new JSONObject();
-        jo3.put("id", "id001");
-        jo3.put("password", "re1kwelj");
-        JSONObject jo4 = new JSONObject();
-        jo4.put("id", "id002");
-        jo4.put("password", "o9eqlmbd");
-
-        JSONArray ja = new JSONArray();
-        ja.put(jo3);
-        ja.put(jo4);
-        jo2.put("endpoint_ids", ja);
-
-        ja = new JSONArray();
-        ja.put("20.0.0.1");
-        ja.put("195.68.12.15");
-        ja.put("135.207.136.128/25");
-        jo2.put("endpoint_addrs", ja);
-
-        jo.put("authorization", jo2);
-        return jo;
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalGet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalGet.java
deleted file mode 100644 (file)
index 25397f7..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-import org.onap.dmaap.datarouter.provisioning.beans.Parameters;
-
-public class IntegrationTestInternalGet extends IntegrationTestBase {
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    @Test
-    public void testNormal() {
-        String url   = props.getProperty("test.host") + "/internal/prov";
-        HttpGet httpPost = new HttpGet(url);
-        try {
-            httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(httpPost);
-            int code = response.getStatusLine().getStatusCode();
-            if (code != 200) {
-                fail("Unexpected response, expect " + 200 + " got " + code);
-            }
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue().trim();
-            boolean ok  = ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE1);
-            ok |= ctype.equals(FeedServlet.PROVFULL_CONTENT_TYPE2);
-            if (!ok) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ok) {
-                JSONObject jo = null;
-                try {
-                    jo = new JSONObject(new JSONTokener(entity.getContent()));
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-                try {
-                    jo.getJSONArray("feeds");
-                    jo.getJSONArray("subscriptions");
-                    JSONObject jo2 = jo.getJSONObject("parameters");
-                    jo2.getJSONArray(Parameters.NODES);
-                    jo2.getString(Parameters.ACTIVE_POD);
-                    jo2.getString(Parameters.STANDBY_POD);
-                    jo2.getInt(Parameters.LOGROLL_INTERVAL);
-                    jo2.getInt(Parameters.DELIVERY_INIT_RETRY_INTERVAL);
-                    jo2.getInt(Parameters.DELIVERY_MAX_RETRY_INTERVAL);
-                    jo2.getInt(Parameters.DELIVERY_RETRY_RATIO);
-                    jo2.getInt(Parameters.DELIVERY_MAX_AGE);
-                } catch (JSONException e) {
-                    fail("required field missing from result: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestInternalMisc.java
deleted file mode 100644 (file)
index 9c30cd3..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONTokener;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestInternalMisc extends IntegrationTestBase {
-    @Test
-    public void testInternalDrlogs() {
-        String url   = props.getProperty("test.host") + "/internal/drlogs";
-        HttpGet httpPost = new HttpGet(url);
-        try {
-            httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-            HttpResponse response = httpclient.execute(httpPost);
-            int code = response.getStatusLine().getStatusCode();
-            if (code != 200) {
-                fail("Unexpected response, expect " + HttpServletResponse.SC_NOT_FOUND + " got " + code);
-            }
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue().trim();
-            boolean ok  = ctype.equals("text/plain");
-            if (!ok) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-    @Test
-    public void testInternalHalt() {
-        String url   = props.getProperty("test.host") + "/halt";
-        HttpGet httpPost = new HttpGet(url);
-        try {
-            httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(httpPost);
-            int code = response.getStatusLine().getStatusCode();
-            if (code != HttpServletResponse.SC_NOT_FOUND) {
-                fail("Unexpected response, expect " + HttpServletResponse.SC_NOT_FOUND + " got " + code);
-            }
-
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-    @SuppressWarnings("unused")
-    @Test
-    public void testInternalLogs() {
-        String url   = props.getProperty("test.host") + "/internal/logs";
-        HttpGet httpPost = new HttpGet(url);
-        try {
-            httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(httpPost);
-            int code = response.getStatusLine().getStatusCode();
-            if (code != 200) {
-                fail("Unexpected response, expect " + 200 + " got " + code);
-            }
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue().trim();
-            boolean ok  = ctype.equals("application/json");
-            if (!ok) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ok) {
-                try {
-                    new JSONArray(new JSONTokener(entity.getContent()));
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-    @Test
-    public void testInternalBadUrl() {
-        String url   = props.getProperty("test.host") + "/internal/badurl";
-        HttpGet httpPost = new HttpGet(url);
-        try {
-            httpPost.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-
-            HttpResponse response = httpclient.execute(httpPost);
-            int code = response.getStatusLine().getStatusCode();
-            if (code != HttpServletResponse.SC_NOT_FOUND) {
-                fail("Unexpected response, expect " + HttpServletResponse.SC_NOT_FOUND + " got " + code);
-            }
-
-            HttpEntity entity = response.getEntity();
-            EntityUtils.consume(entity);
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestLogGet.java
deleted file mode 100644 (file)
index 0da0f41..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestLogGet extends IntegrationTestBase {
-    private JSONArray returnedlist;
-    private int feedid = 4;
-    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
-
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-        // need to seed the DB here
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-        // need to "unseed" the DB
-    }
-
-    /**
-     * This is the setUp method.
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-//        JSONArray ja = db_state.getJSONArray("feeds");
-//        for (int i = 0; i < ja.length(); i++) {
-//            JSONObject jo = ja.getJSONObject(i);
-//            if (!jo.getBoolean("deleted"))
-//                feedid = jo.getInt("feedid");
-//        }
-    }
-
-    @Test
-    public void testNormal() {
-        testCommon(HttpServletResponse.SC_OK);
-    }
-
-    @Test
-    public void testNormalPubOnly() {
-        testCommon(HttpServletResponse.SC_OK, "?type=pub");
-    }
-
-    @Test
-    public void testNormalDelOnly() {
-        testCommon(HttpServletResponse.SC_OK, "?type=del");
-    }
-
-    @Test
-    public void testNormalExpOnly() {
-        testCommon(HttpServletResponse.SC_OK, "?type=exp");
-    }
-
-    @Test
-    public void testNormalXxxOnly() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "?type=xxx");
-    }
-
-    @Test
-    public void testNormalStatusSuccess() {
-        testCommon(HttpServletResponse.SC_OK, "?statusCode=success");
-    }
-
-    @Test
-    public void testNormalStatusRedirect() {
-        testCommon(HttpServletResponse.SC_OK, "?statusCode=redirect");
-    }
-
-    @Test
-    public void testNormalStatusFailure() {
-        testCommon(HttpServletResponse.SC_OK, "?statusCode=failure");
-    }
-
-    @Test
-    public void testNormalStatus200() {
-        testCommon(HttpServletResponse.SC_OK, "?statusCode=200");
-    }
-
-    @Test
-    public void testNormalStatusXxx() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "?statusCode=xxx");
-    }
-
-    @Test
-    public void testNormalExpiryNotRetryable() {
-        testCommon(HttpServletResponse.SC_OK, "?expiryReason=notRetryable");
-    }
-
-    @Test
-    public void testNormalExpiryRetriesExhausted() {
-        testCommon(HttpServletResponse.SC_OK, "?expiryReason=retriesExhausted");
-    }
-
-    @Test
-    public void testNormalExpiryXxx() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "?expiryReason=xxx");
-    }
-
-    @Test
-    public void testNormalPublishId() {
-        testCommon(HttpServletResponse.SC_OK, "?publishId=1366985877801.mtdvnj00-drtr.proto.research.att.com");
-    }
-
-    @Test
-    public void testNormalStart() {
-        long nowMinus5Days = System.currentTimeMillis() - (5 * 24 * 60 * 60 * 1000L);    // 5 days
-        testCommon(HttpServletResponse.SC_OK, String.format("?start=%s", sdf.format(nowMinus5Days)));
-    }
-
-    @Test
-    public void testBadStart() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "?start=xxx");
-    }
-
-    @Test
-    public void testLongEnd() {
-        testCommon(HttpServletResponse.SC_OK, "?end=1364837896220");
-    }
-
-    @Test
-    public void testBadEnd() {
-        testCommon(HttpServletResponse.SC_BAD_REQUEST, "?end=2013-04-25T11:01:25Q");
-    }
-
-    private void testCommon(int expect) {
-        testCommon(expect, "");
-    }
-
-    private void testCommon(int expect, String query) {
-        String url = props.getProperty("test.host") + "/feedlog/" + feedid + query;
-        HttpGet httpGet = new HttpGet(url);
-        try {
-            HttpResponse response = httpclient.execute(httpGet);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue().trim();
-            if (expect == HttpServletResponse.SC_OK) {
-                if (!ctype.equals(FeedServlet.LOGLIST_CONTENT_TYPE)) {
-                    fail("Got wrong content type: " + ctype);
-                }
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ctype.equals(FeedServlet.LOGLIST_CONTENT_TYPE)) {
-                try {
-                    returnedlist = new JSONArray(new JSONTokener(entity.getContent()));
-                    int returnedListLength = returnedlist.length();
-                    if (returnedListLength != 0) {
-                        System.err.println(returnedListLength + " items");
-                    }
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            httpGet.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestPublish.java
deleted file mode 100644 (file)
index 5c84a67..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.Header;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.RedirectStrategy;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.impl.client.DefaultRedirectStrategy;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-
-public class IntegrationTestPublish extends IntegrationTestBase {
-    private String publishUrl;
-
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    /**
-     * This is the setUp method.
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-        // Get publish URL from first feed
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = ja.length() - 1; i >= 0; i--) {
-            JSONObject feed = ja.getJSONObject(i);
-            if (!feed.getBoolean("deleted")) {
-                publishUrl = feed.getJSONObject("links").getString("publish");
-                publishUrl += "/" + System.currentTimeMillis();
-                return;
-            }
-        }
-    }
-
-    @Test
-    public void testDelete() {
-        HttpDelete httpDelete = new HttpDelete(publishUrl);
-        testCommon(httpDelete);
-    }
-
-    @Test
-    public void testGet() {
-        HttpGet httpGet = new HttpGet(publishUrl);
-        testCommon(httpGet);
-    }
-
-    @Test
-    public void testPut() {
-        HttpPut httpPut = new HttpPut(publishUrl);
-        testCommon(httpPut);
-    }
-
-    @Test
-    public void testPost() {
-        HttpPost httpPost = new HttpPost(publishUrl);
-        testCommon(httpPost);
-    }
-
-    private void testCommon(HttpRequestBase rb) {
-        try {
-            rb.addHeader(FeedServlet.BEHALF_HEADER, "JUnit");
-            RedirectStrategy strategy = new DefaultRedirectStrategy() {
-                protected boolean isRedirectable(String method) {
-                    return false;
-                }
-            };
-            httpclient.setRedirectStrategy(strategy);
-            HttpResponse response = httpclient.execute(rb);
-            ckResponse(response, HttpServletResponse.SC_MOVED_PERMANENTLY);
-
-            // Make sure there is a Location hdr
-            Header[] loc = response.getHeaders("Location");
-            if (loc == null || loc.length == 0) {
-                fail("No location header");
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            rb.releaseConnection();
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRleBitSet.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRleBitSet.java
deleted file mode 100644 (file)
index 133e7dc..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.util.Iterator;
-
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.utils.RLEBitSet;
-
-public class IntegrationTestRleBitSet {
-    @Test
-    public void testBasicConstructor() {
-        RLEBitSet bs = new RLEBitSet();
-        if (!bs.isEmpty()) {
-            fail("bit set not empty");
-        }
-    }
-
-    @Test
-    public void testStringConstructor() {
-        RLEBitSet bs = new RLEBitSet("1-10");
-        if (bs.isEmpty()) {
-            fail("bit set is empty");
-        }
-        if (!bs.toString().equals("1-10")) {
-            fail("bad value");
-        }
-        bs = new RLEBitSet("69,70,71");
-        if (bs.isEmpty()) {
-            fail("bit set is empty");
-        }
-        if (!bs.toString().equals("69-71")) {
-            fail("bad value");
-        }
-        bs = new RLEBitSet("555 444    443  442");
-        if (!bs.toString().equals("442-444,555")) {
-            fail("bad value");
-        }
-    }
-
-    @Test
-    public void testLength() {
-        RLEBitSet bs = new RLEBitSet();
-        if (bs.length() != 0) {
-            fail("testLength fail " + bs + " " + bs.length());
-        }
-        bs = new RLEBitSet("1-10");
-        if (bs.length() != 11) {
-            fail("testLength fail " + bs + " " + bs.length());
-        }
-        bs = new RLEBitSet("1-20,100000000-100000005");
-        if (bs.length() != 100000006) {
-            fail("testLength fail " + bs + " " + bs.length());
-        }
-    }
-
-    @Test
-    public void testGet() {
-        RLEBitSet bs = new RLEBitSet("1-10");
-        if (!bs.get(5)) {
-            fail("get");
-        }
-        if (bs.get(69)) {
-            fail("get");
-        }
-    }
-
-    @Test
-    public void testSetOneBit() {
-        RLEBitSet bs = new RLEBitSet();
-        for (int i = 12; i < 200; i++) {
-            bs.set(i);
-        }
-        bs.set(690);
-        for (int i = 305; i < 309; i++) {
-            bs.set(i);
-        }
-        bs.set(304);
-        if (!bs.toString().equals("12-199,304-308,690")) {
-            fail("testSetOneBit fail " + bs);
-        }
-    }
-
-    @Test
-    public void testSetString() {
-        RLEBitSet bs = new RLEBitSet();
-        bs.set("1-100");
-        if (!bs.toString().equals("1-100")) {
-            fail("testSetString fail " + bs);
-        }
-    }
-
-    @Test
-    public void testSetRange() {
-        RLEBitSet bs = new RLEBitSet();
-        bs.set(50,60);
-        if (!bs.toString().equals("50-59")) {
-            fail("testSetRange fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearOneBit() {
-        RLEBitSet bs = new RLEBitSet("1-10");
-        bs.clear(5);
-        if (!bs.toString().equals("1-4,6-10")) {
-            fail("testClearOneBit fail");
-        }
-        bs = new RLEBitSet("1-10");
-        bs.clear(11);
-        if (!bs.toString().equals("1-10")) {
-            fail("testClearOneBit fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearRangeLeft() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(40,50);
-        if (!bs.toString().equals("100-200")) {
-            fail("testClearRangeLeft fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearRangeRight() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(400,500);
-        if (!bs.toString().equals("100-200")) {
-            fail("testClearRangeRight fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearRangeMiddle() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(120,130);
-        if (!bs.toString().equals("100-119,130-200")) {
-            fail("testClearRangeRight fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearRangeIntersect() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(100,200);
-        if (!bs.toString().equals("200")) {
-            fail("testClearRangeIntersect fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearOverlapLeft() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(50,150);
-        if (!bs.toString().equals("150-200")) {
-            fail("testClearOverlapLeft fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearOverlapRight() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(150,250);
-        if (!bs.toString().equals("100-149")) {
-            fail("testClearOverlapRight fail " + bs);
-        }
-    }
-
-    @Test
-    public void testClearOverlapAll() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        bs.clear(50,250);
-        if (!bs.toString().equals("")) {
-            fail("testClearOverlapAll fail " + bs);
-        }
-    }
-
-    @Test
-    public void testAnd() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        RLEBitSet b2 = new RLEBitSet("150-400");
-        bs.and(b2);
-        if (!bs.toString().equals("150-200")) {
-            fail("testAnd fail " + bs);
-        }
-        bs = new RLEBitSet("100-200");
-        b2 = new RLEBitSet("1500-4000");
-        bs.and(b2);
-        if (!bs.isEmpty()) {
-            fail("testAnd fail " + bs);
-        }
-    }
-
-    @Test
-    public void testAndNot() {
-        RLEBitSet bs = new RLEBitSet("100-200");
-        RLEBitSet b2 = new RLEBitSet("150-159");
-        bs.andNot(b2);
-        if (!bs.toString().equals("100-149,160-200")) {
-            fail("testAndNot fail " + bs);
-        }
-    }
-
-    @Test
-    public void testIsEmpty() {
-        RLEBitSet bs = new RLEBitSet("");
-        if (!bs.isEmpty()) {
-            fail("testIsEmpty fail " + bs);
-        }
-        bs.set(1);
-        if (bs.isEmpty()) {
-            fail("testIsEmpty fail " + bs);
-        }
-    }
-
-    @Test
-    public void testCardinality() {
-        RLEBitSet bs = new RLEBitSet("1-120,10000000-10000005");
-        if (bs.cardinality() != 126) {
-            fail("testCardinality fail 1");
-        }
-    }
-
-    @Test
-    public void testIterator() {
-        RLEBitSet rleBitSet = new RLEBitSet("1,5,10-12");
-        Iterator<Long[]> rleBitSetRangeIterator = rleBitSet.getRangeIterator();
-        if (!rleBitSetRangeIterator.hasNext()) {
-            fail("iterator fail 1");
-        }
-        Long[] ll = rleBitSetRangeIterator.next();
-        if (ll == null || ll[0] != 1 || ll[1] != 1) {
-            fail("iterator fail 2");
-        }
-
-        if (!rleBitSetRangeIterator.hasNext()) {
-            fail("iterator fail 3");
-        }
-        ll = rleBitSetRangeIterator.next();
-        if (ll == null || ll[0] != 5 || ll[1] != 5) {
-            fail("iterator fail 4");
-        }
-
-        if (!rleBitSetRangeIterator.hasNext()) {
-            fail("iterator fail 5");
-        }
-        ll = rleBitSetRangeIterator.next();
-        if (ll == null || ll[0] != 10 || ll[1] != 12) {
-            fail("iterator fail 6");
-        }
-
-        if (rleBitSetRangeIterator.hasNext()) {
-            fail("iterator fail 7");
-        }
-    }
-
-    @Test
-    public void testClone() {
-        RLEBitSet bs1 = new RLEBitSet("1,5,10-12");
-        RLEBitSet bs2 = (RLEBitSet) bs1.clone();
-        if (!bs1.toString().equals(bs2.toString())) {
-            fail("clone");
-        }
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRouteApi.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestRouteApi.java
deleted file mode 100644 (file)
index 365ceab..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-public class IntegrationTestRouteApi extends IntegrationTestBase {
-
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java b/datarouter-prov/src/test/java/datarouter/provisioning/IntegrationTestSubscribePost.java
deleted file mode 100644 (file)
index dfcdeff..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-
-package datarouter.provisioning;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.FeedServlet;
-import org.onap.dmaap.datarouter.provisioning.SubscribeServlet;
-
-public class IntegrationTestSubscribePost extends IntegrationTestBase {
-    private int feednum = 0;
-
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-    }
-
-    /**
-     * This is the setUp method.
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        getDBstate();
-        // use the first feed to subscribe to
-        JSONArray ja = db_state.getJSONArray("feeds");
-        for (int i = 0; i < ja.length(); i++) {
-            JSONObject feed0 = ja.getJSONObject(i);
-            if (feed0 != null && !feed0.getBoolean("deleted")) {
-                feednum = feed0.getInt("feedid");
-                return;
-            }
-        }
-    }
-
-    @Test
-    public void testNormal() {
-        JSONObject jo = buildSubRequest();
-        testCommon(jo, HttpServletResponse.SC_CREATED);
-    }
-
-    @Test
-    public void testMissingUrl() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").remove("url");
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testTooLongUrl() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").put("url", "https://" + s257);
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testMissingUser() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").remove("user");
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testTooLongUser() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").put("user", s33);
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testMissingPassword() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").remove("password");
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testTooLongPassword() {
-        JSONObject jo = buildSubRequest();
-        jo.getJSONObject("delivery").put("password", s33);
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    @Test
-    public void testNonBooleanMetadata() {
-        JSONObject jo = buildSubRequest();
-        jo.put("metadataOnly", s33);
-        testCommon(jo, HttpServletResponse.SC_BAD_REQUEST);
-    }
-
-    private void testCommon(JSONObject jo, int expect) {
-        String url   = props.getProperty("test.host") + "/subscribe/" + feednum;
-        HttpPost httpPost = new HttpPost(url);
-        try {
-            httpPost.addHeader(SubscribeServlet.BEHALF_HEADER, "JUnit");
-            String strJo = jo.toString();
-            HttpEntity body = new ByteArrayEntity(strJo.getBytes(),
-                    ContentType.create(SubscribeServlet.SUB_CONTENT_TYPE));
-            httpPost.setEntity(body);
-
-            HttpResponse response = httpclient.execute(httpPost);
-            ckResponse(response, expect);
-
-            HttpEntity entity = response.getEntity();
-            String ctype = entity.getContentType().getValue();
-            int code = response.getStatusLine().getStatusCode();
-            if (code == HttpServletResponse.SC_CREATED && !ctype.equals(SubscribeServlet.SUBFULL_CONTENT_TYPE)) {
-                fail("Got wrong content type: " + ctype);
-            }
-
-            // do something useful with the response body and ensure it is fully consumed
-            if (ctype.equals(FeedServlet.SUBFULL_CONTENT_TYPE)) {
-                JSONObject jo2 = null;
-                try {
-                    jo2 = new JSONObject(new JSONTokener(entity.getContent()));
-                } catch (Exception e) {
-                    fail("Bad JSON: " + e.getMessage());
-                }
-                try {
-                    jo2.getString("subscriber");
-                    JSONObject jo3 = jo2.getJSONObject("links");
-                    jo3.getString("self");
-                    jo3.getString("feed");
-                    jo3.getString("log");
-                } catch (JSONException e) {
-                    fail("required field missing from result: " + e.getMessage());
-                }
-            } else {
-                EntityUtils.consume(entity);
-            }
-        } catch (IOException e) {
-            fail(e.getMessage());
-        } finally {
-            httpPost.releaseConnection();
-        }
-    }
-
-    private JSONObject buildSubRequest() {
-        JSONObject jo2 = new JSONObject();
-        jo2.put("url", "https://www.att.com/");
-        jo2.put("user", "dmr");
-        jo2.put("password", "passw0rd");
-        jo2.put("use100", true);
-
-        JSONObject jo = new JSONObject();
-        jo.put("delivery", jo2);
-        jo.put("metadataOnly", Boolean.FALSE);
-        return jo;
-    }
-}
diff --git a/datarouter-prov/src/test/java/datarouter/provisioning/package.html b/datarouter-prov/src/test/java/datarouter/provisioning/package.html
deleted file mode 100644 (file)
index d0383b8..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed 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.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
-<html>
-<body>
-<p>
-This package provides JUnit tests for the provisioning server.
-</p>
-</body>
-</html>
index 84244dc..fa22891 100755 (executable)
@@ -257,24 +257,4 @@ public class BaseServletTest extends DrServletTestBase {
         assertNotEquals(hashed_sub_pass.getJSONObject("delivery").get("password").toString(), "PASSWORD");
 
     }
-
-    @Test
-    public void Given_BaseServlet_Verify_Cadi_Feed_Permission() {
-        assertEquals("org.onap.dmaap-dr.feed|legacy|publish", baseServlet.getFeedPermission("legacy", "publish"));
-        assertEquals("org.onap.dmaap-dr.feed|legacy|suspend", baseServlet.getFeedPermission("legacy", "suspend"));
-        assertEquals("org.onap.dmaap-dr.feed|legacy|restore", baseServlet.getFeedPermission("legacy", "restore"));
-        assertEquals("org.onap.dmaap-dr.feed|org.onap.dmaap-dr.NoInstanceDefined|restore", baseServlet.getFeedPermission(null, "restore"));
-        assertEquals("org.onap.dmaap-dr.feed|legacy|*", baseServlet.getFeedPermission("legacy", "default"));
-    }
-
-    @Test
-    public void Given_BaseServlet_Verify_Cadi_Sub_Permission() {
-        assertEquals("org.onap.dmaap-dr.feed|legacy|subscribe", baseServlet.getSubscriberPermission("legacy", "subscribe"));
-        assertEquals("org.onap.dmaap-dr.sub|legacy|suspend", baseServlet.getSubscriberPermission("legacy", "suspend"));
-        assertEquals("org.onap.dmaap-dr.sub|legacy|restore", baseServlet.getSubscriberPermission("legacy", "restore"));
-        assertEquals("org.onap.dmaap-dr.sub|legacy|publish", baseServlet.getSubscriberPermission("legacy", "publish"));
-        assertEquals("org.onap.dmaap-dr.sub|org.onap.dmaap-dr.NoInstanceDefined|restore", baseServlet.getSubscriberPermission(null, "restore"));
-        assertEquals("org.onap.dmaap-dr.sub|legacy|*", baseServlet.getSubscriberPermission("legacy", "default"));
-    }
-
 }
index 9993334..dca7523 100755 (executable)
@@ -219,114 +219,6 @@ public class DRFeedsServletTest extends DrServletTestBase {
             .sendError(eq(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE), anyString());
     }
 
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_CadiEnabled_Is_True_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated()
-        throws Exception {
-        setAuthoriserToReturnRequestNotAuthorized();
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isCadiEnabled", "true", true);
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("true");
-        JSONObject JSObject = buildRequestJsonObject();
-        DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "not_stub_name");
-                jo.put("version", "1.0");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "legacy");
-                return jo;
-            }
-        };
-        drfeedsServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_CadiEnabled_Is_False_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated()
-            throws Exception {
-        setAuthoriserToReturnRequestNotAuthorized();
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isCadiEnabled", "false", true);
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("true");
-        JSONObject JSObject = buildRequestJsonObject();
-        DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "not_stub_name");
-                jo.put("version", "1.0");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "legacy");
-                return jo;
-            }
-        };
-        drfeedsServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_DRFeed_And_Exclude_AAF_Is_True_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("true");
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isCadiEnabled", "true", true);
-        JSONObject JSObject = buildRequestJsonObject();
-        DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "not_stub_name");
-                jo.put("version", "1.0");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "https://aaf-onap-test.osaaf.org:8095");
-                return jo;
-            }
-        };
-        drfeedsServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("Invalid request exclude_AAF"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_DRFeed_And_Exclude_AAF_Is_False_Without_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("false");
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isCadiEnabled", "true", true);
-        JSONObject JSObject = buildRequestJsonObject();
-        DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "not_stub_name");
-                jo.put("version", "1.0");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "*");
-                return jo;
-            }
-        };
-        drfeedsServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF disallows access to permission"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_DRFeed_And_Exclude_AAF_Is_False_With_Permissions_Then_Created_OK_Response_Is_Generated() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isCadiEnabled", "true", true);
-        ServletOutputStream outStream = mock(ServletOutputStream.class);
-        when(response.getOutputStream()).thenReturn(outStream);
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("false");
-        JSONObject JSObject = buildRequestJsonObject();
-        when(request.isUserInRole("org.onap.dmaap-dr.feed|*|create")).thenReturn(true);
-        DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "not_stub_name");
-                jo.put("version", "1.0");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "*");
-                return jo;
-            }
-
-            @Override
-            protected boolean doInsert(Insertable bean) {
-                return true;
-            }
-        };
-        drfeedsServlet.doPost(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_CREATED));
-        verifyEnteringExitCalled(listAppender);
-    }
-
     @Test
     public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated()
         throws Exception {
@@ -363,18 +255,15 @@ public class DRFeedsServletTest extends DrServletTestBase {
     @Test
     public void Given_Request_Is_HTTP_POST_And_Feed_Already_Exists_Bad_Request_Response_Is_Generated()
         throws Exception {
-        when(request.getParameter("name")).thenReturn("AafFeed");
+        when(request.getParameter("name")).thenReturn("Feed1");
         when(request.getParameter("version")).thenReturn("v0.1");
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("false");
-        when(request.isUserInRole("org.onap.dmaap-dr.feed|*|create")).thenReturn(true);
         JSONObject JSObject = buildRequestJsonObject();
         DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
+                jo.put("name", "Feed1");
                 jo.put("version", "v0.1");
                 jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "*");
                 return jo;
             }
         };
@@ -385,14 +274,12 @@ public class DRFeedsServletTest extends DrServletTestBase {
     @Test
     public void Given_Request_Is_HTTP_POST_And_POST_Fails_Bad_Request_Response_Is_Generated() throws Exception {
         JSONObject JSObject = buildRequestJsonObject();
-        when(request.getHeader(DRFeedsServlet.EXCLUDE_AAF_HEADER)).thenReturn("true");
         DRFeedsServlet drfeedsServlet = new DRFeedsServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
                 jo.put("name", "stub_name");
                 jo.put("version", "2.0");
                 jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "legacy");
                 return jo;
             }
 
index 066b51f..656876f 100755 (executable)
@@ -34,6 +34,8 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.core.read.ListAppender;
 import jakarta.servlet.ServletInputStream;
 import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.HashSet;
@@ -41,8 +43,6 @@ import java.util.Set;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Persistence;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
 import org.apache.commons.lang3.reflect.FieldUtils;
 import org.jetbrains.annotations.NotNull;
 import org.json.JSONArray;
@@ -138,26 +138,11 @@ public class FeedServletTest extends DrServletTestBase {
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", true, true);
         feedServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
     }
 
-    @Test
-    public void Given_Request_Is_HTTP_DELETE_And_AAF_Feed_Without_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getPathInfo()).thenReturn("/2");
-        feedServlet.doDelete(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF disallows access to permission"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_DELETE_And_AAF_Feed_With_Permissions_Then_A_NO_CONTENT_Response_Is_Generated() {
-        when(request.getPathInfo()).thenReturn("/3");
-        when(request.isUserInRole("org.onap.dmaap-dr.feed|*|delete")).thenReturn(true);
-        feedServlet.doDelete(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_NO_CONTENT));
-        verifyEnteringExitCalled(listAppender);
-    }
-
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Delete_On_Database_Fails_An_Internal_Server_Error_Is_Reported()
         throws Exception {
@@ -343,7 +328,7 @@ public class FeedServletTest extends DrServletTestBase {
         FeedServlet feedServlet = new FeedServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
+                jo.put("name", "Feed22");
                 jo.put("version", "v0.2");
                 jo.put("authorization", JSObject);
                 return jo;
@@ -356,64 +341,20 @@ public class FeedServletTest extends DrServletTestBase {
     @Test
     public void Given_Request_Is_HTTP_PUT_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", true, true);
         when(request.getPathInfo()).thenReturn("/2");
         JSONObject JSObject = buildRequestJsonObject();
         FeedServlet feedServlet = new FeedServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
-                jo.put("version", "v0.1");
-                jo.put("authorization", JSObject);
-                return jo;
-            }
-        };
-        feedServlet.doPut(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("Policy Engine disallows access"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_PUT_And_AAF_Feed_Without_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getPathInfo()).thenReturn("/2");
-        JSONObject JSObject = buildRequestJsonObject();
-        FeedServlet feedServlet = new FeedServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
-                jo.put("version", "v0.1");
-                jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "https://aaf-onap-test.osaaf.org:8095");
-                return jo;
-            }
-        };
-        feedServlet.doPut(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF disallows access to permission"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_PUT_And_AAF_Feed_With_Permissions_Then_STATUS_OK__Response_Is_Generated() throws Exception {
-        ServletOutputStream outStream = mock(ServletOutputStream.class);
-        when(response.getOutputStream()).thenReturn(outStream);
-        when(request.getPathInfo()).thenReturn("/2");
-        when(request.isUserInRole("org.onap.dmaap-dr.feed|*|edit")).thenReturn(true);
-        JSONObject JSObject = buildRequestJsonObject();
-        FeedServlet feedServlet = new FeedServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
+                jo.put("name", "Feed22");
                 jo.put("version", "v0.1");
                 jo.put("authorization", JSObject);
-                jo.put("aaf_instance", "*");
                 return jo;
             }
-            @Override
-            protected boolean doUpdate(Updateable bean) {
-                return true;
-            }
-
         };
         feedServlet.doPut(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_OK));
-        verifyEnteringExitCalled(listAppender);
+        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("Client certificate is missing."));
     }
 
     @Test
@@ -425,7 +366,7 @@ public class FeedServletTest extends DrServletTestBase {
         FeedServlet feedServlet = new FeedServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
+                jo.put("name", "Feed22");
                 jo.put("version", "v0.1");
                 jo.put("authorization", JSObject);
                 return jo;
@@ -449,7 +390,7 @@ public class FeedServletTest extends DrServletTestBase {
         FeedServlet feedServlet = new FeedServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
-                jo.put("name", "AafFeed");
+                jo.put("name", "Feed22");
                 jo.put("version", "v0.1");
                 jo.put("authorization", JSObject);
                 return jo;
index a915fa8..1528a56 100644 (file)
 
 package org.onap.dmaap.datarouter.provisioning;
 
-import java.io.File;
-import java.io.IOException;
 import org.apache.commons.lang3.reflect.FieldUtils;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.onap.dmaap.datarouter.provisioning.utils.AafPropsUtils;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.modules.junit4.PowerMockRunner;
 
+@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
 public class ProvServerTest {
 
-    private AafPropsUtils aafPropsUtils;
-
-    @Before
-    public void setUp() {
-        try {
-            aafPropsUtils = new AafPropsUtils(new File("src/test/resources/aaf/org.onap.dmaap-dr.props"));
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
     @BeforeClass
     public static void init() {
         System.setProperty(
             "org.onap.dmaap.datarouter.provserver.properties",
-            "src/test/resources/h2DatabaseTlsDisabled.properties");
+            "src/test/resources/h2Database.properties");
     }
 
     @Test
     public void Verify_Prov_Server_Is_Configured_Correctly() throws IllegalAccessException {
-        FieldUtils.writeDeclaredStaticField(ProvRunner.class, "aafPropsUtils", aafPropsUtils, true);
+        FieldUtils.writeDeclaredStaticField(ProvRunner.class, "tlsEnabled", false, true);
         Assert.assertNotNull(ProvServer.getServerInstance());
     }
 }
index bf2371f..41d5b1d 100755 (executable)
@@ -188,10 +188,10 @@ public class SubscribeServletTest extends DrServletTestBase {
     }
 
     @Test
-    public void Given_Request_Is_HTTP_POST_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
-        setAuthoriserToReturnRequestNotAuthorized();
+    public void Given_Request_Is_HTTP_POST_And_Password_Is_Too_Long_Then_Bad_Request_Response_Is_Generated() throws Exception {
         when(request.getPathInfo()).thenReturn("/1");
         JSONObject JSObject = buildRequestJsonObject();
+        JSObject.put("password", "aervaervaervgaervaestbnswtrnsrnsrdtnsrtnsrtnydstyndtrynsrnsrtnsrtnsrtnswtrnswtrn");
         SubscribeServlet subscribeServlet = new SubscribeServlet() {
              public JSONObject getJSONfromInput(HttpServletRequest req) {
                 JSONObject jo = new JSONObject();
@@ -203,115 +203,10 @@ public class SubscribeServletTest extends DrServletTestBase {
                 jo.put("sync", false);
                 return jo;
             }
-            @Override
-            protected boolean doInsert(Insertable bean) {
-                return false;
-            }
-        };
-        subscribeServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_Subscriber_Added_To_Legacy_Feed_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getPathInfo()).thenReturn("/1");
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscribeServlet subscribeServlet = new SubscribeServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "*");
-                jo.put("follow_redirect", false);
-                jo.put("sync", false);
-                return jo;
-            }
-            @Override
-            protected boolean doInsert(Insertable bean) {
-                return false;
-            }
-        };
-        subscribeServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF Subscriber can not be added to legacy Feed"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_Legacy_Subscriber_Added_To_AAF_Feed_And_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
-        setAuthoriserToReturnRequestNotAuthorized();
-        when(request.getPathInfo()).thenReturn("/2");
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscribeServlet subscribeServlet = new SubscribeServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
-                jo.put("follow_redirect", false);
-                jo.put("sync", false);
-                return jo;
-            }
-        };
-        subscribeServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("Policy Engine disallows access."));
-    }
 
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_Subscriber_Added_To_AAF_Feed_Without_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getPathInfo()).thenReturn("/2");
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscribeServlet subscribeServlet = new SubscribeServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "*");
-                jo.put("follow_redirect", false);
-                jo.put("sync", false);
-                return jo;
-            }
         };
         subscribeServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF disallows access to permission"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_POST_And_AAF_Subscriber_Added_To_AAF_Feed_With_Permissions_Then_OK_Response_Is_Generated() throws Exception {
-        ServletOutputStream outStream = mock(ServletOutputStream.class);
-        when(response.getOutputStream()).thenReturn(outStream);
-        when(request.getPathInfo()).thenReturn("/2");
-        when(request.isUserInRole("org.onap.dmaap-dr.feed|*|approveSub")).thenReturn(true);
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscribeServlet subscribeServlet = new SubscribeServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "*");
-                jo.put("follow_redirect", false);
-                jo.put("sync", false);
-                return jo;
-            }
-
-            @Override
-            protected boolean doInsert(Insertable bean) {
-                return true;
-            }
-        };
-        subscribeServlet.doPost(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_CREATED));
-        verifyEnteringExitCalled(listAppender);
+        verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), anyString());
     }
 
     @Test
@@ -345,7 +240,7 @@ public class SubscribeServletTest extends DrServletTestBase {
 
     @Test
     public void Given_Request_Is_HTTP_POST_And_POST_Fails_Bad_Request_Response_Is_Generated() throws Exception {
-        when(request.getPathInfo()).thenReturn("/2");
+        when(request.getPathInfo()).thenReturn("/1");
         JSONObject JSObject = buildRequestJsonObject();
         SubscribeServlet subscribeServlet = new SubscribeServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
@@ -355,7 +250,6 @@ public class SubscribeServletTest extends DrServletTestBase {
                 jo.put("metadataOnly", true);
                 jo.put("suspend", true);
                 jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
                 jo.put("follow_redirect", false);
                 jo.put("sync", false);
                 return jo;
index d5badd3..f428e1e 100755 (executable)
@@ -88,7 +88,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
         em = emf.createEntityManager();
         System.setProperty(
             "org.onap.dmaap.datarouter.provserver.properties",
-            "src/test/resources/h2DatabaseTlsDisabled.properties");
+            "src/test/resources/h2Database.properties");
     }
 
     @AfterClass
@@ -140,6 +140,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", true, true);
         subscriptionServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
     }
@@ -155,17 +156,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
         verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), anyString());
     }
 
-    @Test
-    public void Given_Request_Is_HTTP_DELETE_And_AAF_CADI_Is_Enabled_With_Permissions_Then_A_NO_CONTENT_Response_Is_Generated() throws Exception {
-        when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0");
-        when(request.getPathInfo()).thenReturn("/2");
-        when(request.isUserInRole("org.onap.dmaap-dr.sub|*|delete")).thenReturn(true);
-        subscriptionServlet.doDelete(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_NO_CONTENT));
-        verifyEnteringExitCalled(listAppender);
-        resetAafSubscriptionInDB();
-    }
-
     @Test
     public void Given_Request_Is_HTTP_GET_And_Is_Not_Secure_When_HTTPS_Is_Required_Then_Forbidden_Response_Is_Generated() throws Exception {
         when(request.isSecure()).thenReturn(false);
@@ -244,6 +234,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
     public void Given_Request_Is_HTTP_PUT_And_Request_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated() throws Exception {
         setAuthoriserToReturnRequestNotAuthorized();
         when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0");
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "requireCert", true, true);
         JSONObject JSObject = buildRequestJsonObject();
         SubscriptionServlet subscriptionServlet = new SubscriptionServlet() {
             public JSONObject getJSONfromInput(HttpServletRequest req) {
@@ -253,7 +244,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
                 jo.put("metadataOnly", true);
                 jo.put("suspend", true);
                 jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
                 jo.put("follow_redirect", false);
                 jo.put("decompress", true);
                 jo.put("sync", true);
@@ -265,60 +255,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), anyString());
     }
 
-    @Test
-    public void Given_Request_Is_HTTP_PUT_And_AAF_CADI_Is_Enabled_Without_Permissions_Then_Forbidden_Response_Is_Generated() throws Exception {
-        when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0");
-        when(request.getPathInfo()).thenReturn("/3");
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscriptionServlet subscriptionServlet = new SubscriptionServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "*");
-                jo.put("follow_redirect", false);
-                jo.put("sync", true);
-                jo.put("changeowner", true);
-                return jo;
-            }
-        };
-        subscriptionServlet.doPut(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains("AAF disallows access"));
-    }
-
-    @Test
-    public void Given_Request_Is_HTTP_PUT_And_AAF_CADI_Is_Enabled_With_Permissions_Then_OK_Response_Is_Generated() throws Exception {
-        ServletOutputStream outStream = mock(ServletOutputStream.class);
-        when(response.getOutputStream()).thenReturn(outStream);
-        when(request.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")).thenReturn("stub_subjectGroup");
-        when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.subscription; version=1.0");
-        when(request.getPathInfo()).thenReturn("/3");
-        when(request.isUserInRole("org.onap.dmaap-dr.sub|*|edit")).thenReturn(true);
-        JSONObject JSObject = buildRequestJsonObject();
-        SubscriptionServlet subscriptionServlet = new SubscriptionServlet() {
-            public JSONObject getJSONfromInput(HttpServletRequest req) {
-                JSONObject jo = new JSONObject();
-                jo.put("name", "stub_name");
-                jo.put("version", "2.0");
-                jo.put("metadataOnly", true);
-                jo.put("suspend", true);
-                jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "*");
-                jo.put("follow_redirect", false);
-                jo.put("sync", true);
-                return jo;
-            }
-        };
-        subscriptionServlet.doPut(request, response);
-        verify(response).setStatus(eq(HttpServletResponse.SC_OK));
-        resetAafSubscriptionInDB();
-        addNewSubscriptionInDB();
-        verifyEnteringExitCalled(listAppender);
-    }
-
     @Test
     public void Given_Request_Is_HTTP_PUT_And_Content_Header_Is_Not_Supported_Type_Then_Unsupported_Media_Type_Response_Is_Generated() throws Exception {
         when(request.getContentType()).thenReturn("stub_ContentType");
@@ -363,7 +299,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
                 jo.put("privilegedSubscriber", true);
                 jo.put("decompress", true);
                 jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
                 jo.put("follow_redirect", false);
                 jo.put("subscriber", "differentSubscriber");
                 jo.put("sync", true);
@@ -388,7 +323,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
                 jo.put("suspend", true);
                 jo.put("privilegedSubscriber", true);
                 jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
                 jo.put("decompress", true);
                 jo.put("follow_redirect", false);
                 jo.put("sync", true);
@@ -421,7 +355,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
                 jo.put("privilegedSubscriber", true);
                 jo.put("decompress", true);
                 jo.put("delivery", JSObject);
-                jo.put("aaf_instance", "legacy");
                 jo.put("follow_redirect", false);
                 jo.put("sync", true);
                 jo.put("changeowner", true);
@@ -430,7 +363,7 @@ public class SubscriptionServletTest extends DrServletTestBase {
         };
         subscriptionServlet.doPut(request, response);
         verify(response).setStatus(eq(HttpServletResponse.SC_OK));
-        changeSubscriptionBackToNormal();
+        //changeSubscriptionBackToNormal();
         verifyEnteringExitCalled(listAppender);
     }
 
@@ -523,7 +456,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
                 jo.put("suspend", true);
                 jo.put("delivery", JSObject);
                 jo.put("privilegedSubscriber", false);
-                jo.put("aaf_instance", "legacy");
                 jo.put("follow_redirect", false);
                 jo.put("decompress", false);
                 jo.put("failed", false);
@@ -616,7 +548,6 @@ public class SubscriptionServletTest extends DrServletTestBase {
         subscription.setGroupid(1);
         subscription.setMetadataOnly(false);
         subscription.setSuspended(false);
-        subscription.setAafInstance("https://aaf-onap-test.osaaf.org:8095");
         subscription.setDecompress(false);
         subscription.setPrivilegedSubscriber(false);
         try (Connection conn = ProvDbUtils.getInstance().getConnection()) {
index 5e87d3a..87ac7ed 100644 (file)
@@ -98,8 +98,8 @@ public class FeedTest {
 
     @Test
     public void Given_doDelete_Succeeds_Then_doInsert_To_Put_Feed_Back_And_Bool_Is_True() throws SQLException {
-        Boolean bool = feed.doDelete(provDbUtils.getConnection());
-        Assert.assertEquals(true, bool);
+        boolean bool = feed.doDelete(provDbUtils.getConnection());
+        Assert.assertTrue(bool);
         JSONObject jo = new JSONObject();
         jo.put("self","self_link");
         jo.put("publish","publish_link");
@@ -107,7 +107,7 @@ public class FeedTest {
         jo.put("log","log_link");
         feed.setLinks(new FeedLinks(jo));
         bool = feed.doInsert(provDbUtils.getConnection());
-        Assert.assertEquals(true, bool);
+        Assert.assertTrue(bool);
     }
 
     @Test
@@ -133,7 +133,7 @@ public class FeedTest {
     public void Given_doDelete_Throws_SQLException_Then_Returns_False() throws SQLException {
         Connection spyConnection = CreateSpyForDbConnection();
         Mockito.doThrow(new SQLException()).when(spyConnection).prepareStatement(anyString());
-        Assert.assertEquals(feed.doDelete(spyConnection), false);
+        Assert.assertFalse(feed.doDelete(spyConnection));
     }
 
     @Test
@@ -147,7 +147,7 @@ public class FeedTest {
         fa.setEndpointIDS(setA);
         fa.setEndpointAddrs(setB);
         feed.setAuthorization(fa);
-        Assert.assertEquals(feed.doInsert(connection), false);
+        Assert.assertFalse(feed.doInsert(connection));
 
     }
 
@@ -155,7 +155,7 @@ public class FeedTest {
     public void Given_doUpdate_Throws_SQLException_Then_Returns_False() throws SQLException {
         Connection spyConnection = CreateSpyForDbConnection();
         Mockito.doThrow(new SQLException()).when(spyConnection).prepareStatement(anyString());
-        Assert.assertEquals(feed.doUpdate(spyConnection), false);
+        Assert.assertFalse(feed.doUpdate(spyConnection));
 
     }
 
@@ -174,7 +174,7 @@ public class FeedTest {
         Assert.assertEquals(feed.getGroupid(), 1);
         Assert.assertEquals(feed.getDescription(), "test feed");
         Assert.assertEquals(feed.getBusinessDescription(), "test feed");
-        Assert.assertEquals(feed.isSuspended(), false);
+        Assert.assertFalse(feed.isSuspended());
         Assert.assertEquals(feed.getPublisher(), "publish");
     }
 
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtilsTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/AafPropsUtilsTest.java
deleted file mode 100644 (file)
index 4f2f3ee..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.dmaap.datarouter.provisioning.utils;
-
-import java.io.File;
-import java.io.IOException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AafPropsUtilsTest {
-
-    private static AafPropsUtils aafPropsUtils;
-
-    @BeforeClass
-    public static void init() throws Exception {
-        aafPropsUtils = new AafPropsUtils(new File("src/test/resources/aaf/org.onap.dmaap-dr.props"));
-    }
-
-    @Test
-    public void Assert_AaafPropsUtils_Decrypt_KeyStorePass() {
-        Assert.assertEquals("b.Qo{*!a(a;jmeOfKbA&vHx#", aafPropsUtils.getKeystorePassProperty());
-    }
-
-    @Test
-    public void Assert_AaafPropsUtils_Decrypt_TruststorePass() {
-        Assert.assertEquals("YeXhcTw6%G[od1a43+P!yhoN", aafPropsUtils.getTruststorePassProperty());
-    }
-
-    @Test
-    public void Assert_AaafPropsUtils_Get_KeyStorePathProp() {
-        Assert.assertEquals("src/test/resources/aaf/org.onap.dmaap-dr.p12", aafPropsUtils.getKeystorePathProperty());
-    }
-
-    @Test
-    public void Assert_AaafPropsUtils_Get_TrustStorePathProp() {
-        Assert.assertEquals("src/test/resources/aaf/org.onap.dmaap-dr.trust.jks", aafPropsUtils.getTruststorePathProperty());
-    }
-
-    @Test
-    public void Assert_AaafPropsUtils_Get_PropAccessObj() {
-        Assert.assertNotNull(aafPropsUtils.getPropAccess());
-    }
-
-}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManagerTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/ProvTlsManagerTest.java
new file mode 100644 (file)
index 0000000..680a483
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.datarouter.provisioning.utils;
+
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.dmaap.datarouter.provisioning.ProvRunner;
+import org.onap.dmaap.datarouter.provisioning.ProvServer;
+
+public class ProvTlsManagerTest {
+
+    ProvTlsManager provTlsManager;
+
+    @BeforeClass
+    public static void init() {
+        System.setProperty(
+            "org.onap.dmaap.datarouter.provserver.properties",
+            "src/test/resources/h2Database.properties");
+    }
+
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    @Test
+    public void Verify_Prov_Tls_Manager_Is_Configured_Correctly_And_Returns_Non_Null() throws Exception {
+        provTlsManager = new ProvTlsManager(ProvRunner.getProvProperties(), true);
+        Assert.assertNotNull(provTlsManager.getSslContextFactoryServer());
+        Assert.assertNotNull(provTlsManager.getSslSocketFactory());
+        Assert.assertEquals(provTlsManager.getTrustStoreFile(), "src/test/resources/certs/truststore.jks");
+        Assert.assertEquals(provTlsManager.getTrustStorePassword(), "secret");
+    }
+
+    @Test
+    public void Verify_Prov_Tls_Manager_Is_Configured_Correctly_When_Load_Certs_Is_False() throws Exception {
+        provTlsManager = new ProvTlsManager(ProvRunner.getProvProperties(), false);
+        Assert.assertEquals(provTlsManager.getTrustStorePassword(), "secret");
+    }
+}
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/UrlUtilsTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/utils/UrlUtilsTest.java
new file mode 100644 (file)
index 0000000..ac95044
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.datarouter.provisioning.utils;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.dmaap.datarouter.provisioning.BaseServlet;
+import org.onap.dmaap.datarouter.provisioning.ProvRunner;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
+public class UrlUtilsTest {
+
+    @BeforeClass
+    public static void init() {
+        System.setProperty(
+            "org.onap.dmaap.datarouter.provserver.properties",
+            "src/test/resources/h2Database.properties");
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "initialActivePod", "mypod1", true);
+        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "initialStandbyPod", "mypod2", true);
+        FieldUtils.writeDeclaredStaticField(ProvRunner.class, "tlsEnabled", false, true);
+    }
+
+    @Test
+    public void Verify_UrlUtils_generatePeerProvURL_Returns_Valid_Http_Url() {
+        Assert.assertEquals(URLUtilities.generatePeerProvURL(), "http://mypod2:8080/internal/prov");
+    }
+
+    @Test
+    public void Verify_UrlUtils_generatePeerLogsURL_Returns_Valid_Http_Url() {
+        Assert.assertEquals(URLUtilities.generatePeerLogsURL(), "http://mypod2:8080/internal/drlogs/");
+    }
+
+}
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.cred.props b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.cred.props
deleted file mode 100644 (file)
index bf3feda..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:23.012+0000
-# @copyright 2019, AT&T
-############################################################
-Challenge=enc:v6yuDc_Lu1OgeFEthckOsa7R0XW6h0iZqUQXnw4CpstwzjmN0x9VOsf27um5fC5z
-cadi_alias=dmaap-dr-prov@dmaap-dr.onap.org
-cadi_key_password=enc:CBXkw5IMQ8IeOhERa_oK4XcS1BsKy3T9BiZgAOIBqI46Nvy0USwgXCyOkTgVlJn7
-cadi_keyfile=src/test/resources/aaf/org.onap.dmaap-dr.keyfile
-cadi_keystore=src/test/resources/aaf/org.onap.dmaap-dr.p12
-cadi_keystore_password=enc:Qd78mq7KSyK4G-gmnA0YVrB4jpMLgMX_4jDmwkdkKpD-MmonHNXlDA0TzRd3oxWe
-cadi_keystore_password_jks=enc:GuyybAMtPX21LbCx_AXGnO7nz3NlPenZESuLVgrw-_cK55re75K4YOLYVzQswUYU
-cadi_keystore_password_p12=enc:Qd78mq7KSyK4G-gmnA0YVrB4jpMLgMX_4jDmwkdkKpD-MmonHNXlDA0TzRd3oxWe
-cadi_truststore=src/test/resources/aaf/org.onap.dmaap-dr.trust.jks
-cadi_truststore_password=enc:y10bIyzTHei-rxWnWgHUUFUD_9TfOBdxmIn6vEf0zsyZtWmeP8ZjFE1LoPn7Ri4g
-cadi_x509_issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.keyfile b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.keyfile
deleted file mode 100644 (file)
index 8609289..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-gf-I4kLSg98uxwCXpklt-W2Qfa0mFgvXDoQk_qsLs4uuLI9FmWkrdlgdqzEgISL1sf6SAhoXFXO4
-BSm8fSPPrjaFEQ-uZcho1bY63lG710ZLh7vf0Bc7WPieRXesloH07CRXXjUdTkXXU8qTP6Ufru16
-mbGODzcZ-Ygm2GLVbkLk7953CJYIvuYT0M3ggrDr51eOalpgwXA1uO2DCTmY_fyqFNpZbLEtcYAx
-EEBkbaT0KhKwSfXfPINjpfCVMNBr3eK2m75RFJzTmA4Nq_WFgQQBUJkYu6EaWR8xwKEnX3brIFN-
-uY8Xk-Wxh8hhqNQWSxaSa_w6BfbP5CwUpIk9Ex1v_gCa63NIy4WzoRxOHKuCQAS26vLJFxTTNOlP
-d_DVC0gmvL-q8VnedNVSsRw1zuDOtOzKg3iUbTjopba3YryelxwL2xUJzkxv8RiOVvTCdZ34lPP0
-vQCaGJYg52OKOCMaIs4e6bqfCFMT4nlbad--mPeZGS3X5pJ0xSAMRa8L2_ksHbTOvcjOlCvmWNDK
-puP22sdegP-mV6Ygm30Gyn7TnUodDA3bzIiA70zrkrlt8pBMhKmCbmWvGfjItoRnfGwtlsm1OU73
-Jst8pQ_mvCK486UoH4Lui1kNBTqAJIrzYT_m-MrL6w9lx7Lu-ZG0HqdDVO4zB06WTyCXT-I2r-XS
-F9ddoQ3GOUMA4kIckEeEVYfZiVaoPeizNwynSLHZDA3Xztc-kz7HEqdUCypM5pM32qGN-z4Gzbh0
-K4GO7_cGyctMGNY5za3iANK3BBBx9d3G3XKuCH2EDF9aj_kFarMaJjTHwn9-OAeD2GXtdYQqarod
-4Yw11CD8JjyF6PdYstTh9t5_iK3pZjFaLMBPlLFN_tDu_5zsVagJjM7nMjfn8iWH5o3rj7WAIqBC
-NoxZhIRUVpEmDKkhsnq9i9gdjoiKjrNwEsswX2vGsXEAf1vTXH2YsgraTjEhlW0cIb4PBLd4YoSE
-AW3MXhwu5rYFgGooHyB99OKZOX6-5Y44fA0TE0ypn8HZ5oVrERCHVHNXsiXg1pRjTHjoIYUFoSQQ
-lT8eVUo5MUxQ0SVKUi03wA7EduWrwvuD_KyLeNnvECj6IDuK7qiqH86UV7AyQhwjSZPj4N3KIlvD
-VJNLmt6s8b6SLZpO23P-ZceFEIIYG7E1IGmo2s5VkWTNTkvqD7blxoOsfBIxb-SjttnMtbKCcXPj
-aKMC1oqr5xLsvtg9XDKKXt4kELElRBiKtrud8t7qqYMfC-q6lIddmG8x_196qsYiErKd9mLyDT2H
-DG9wmz3dDds_bUnXA7_-LsriDI4t_fAqAKnvR8tLi9DjhU1g9yjlGuKn4yd3y8aK-UFFfBi1AKxA
-WoxSt2Omw_sl9Jc6bzoZ2_NHPZz7IaDhSu1imAAcAms4SIr3g-MnBffVpxarrXYsoaxurMRMoqLx
-r0DyV1Y9IZSwo-xsWk42CxrvEF31AmFWewI0ykA8bZ-zpWux3z7BfbKDqxglg3Lp5uIfVFHamds3
-ya-KMBCtaSgiJ9fB7Q183Lt0tMxrOLe3hln55I4SRgHT5blh1LEznIigIfhFEOo514JEdctkVrDS
-bDSbCO-yZE_0BcznTsjoyImwObeVRbDDu0feM9uGs4fL7zwVCbzEurGU2js-0o0rcyDiv30tsL5S
-LaxA-xz7x5HO4JAd7BeaeF4-v0-IeLKPH4HzYk0g1PKskZaZHMWBWSPaJWin68ahh9Eh44xSjsCW
-TUcoddf4-5HZS_RWlrLvbnfbEBAm7Ikbno1zLJz7_H3tmLKv2axkGEu-YWIAffb7xMzG0T9m6S3B
-Iz1jWxtJ41gTE5kGFmaezDeUGPrioaqOq0bCq6DStQMc_5kcKAIg6GffOX75ZvagC2E6E_B58AGU
-iVDzz_yi4Xcssf2jN-MIiHes0HsMQILrLAu1PLZh9qOIGOnVgLdwr0o5CGsg0h7Bxxl6jFQubwAZ
-rc2foRg7arAcRHYasoC34f9pH0hfBzHfTGg5S7bWU6mDaldpWS8Na0EoCoFoZATkdzG77w6c
\ No newline at end of file
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.location.props b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.location.props
deleted file mode 100644 (file)
index eef8aac..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:21.359+0000
-# @copyright 2019, AT&T
-############################################################
-cadi_latitude=38.0
-cadi_longitude=-72.0
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12 b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12
deleted file mode 100644 (file)
index 69948c2..0000000
Binary files a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12 and /dev/null differ
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.props b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.props
deleted file mode 100644 (file)
index 985939b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2022-03-22T12:34:21.357+0000
-# @copyright 2019, AT&T
-############################################################
-aaf_env=DEV
-aaf_id=dmaap-dr-prov@dmaap-dr.onap.org
-aaf_locate_url=https://aaf-locate.onap:8095
-aaf_locator_app_ns=org.osaaf.aaf
-aaf_locator_container=oom
-aaf_locator_container_ns=onap
-aaf_locator_fqdn=dmaap-dr-prov
-aaf_locator_public_fqdn=aaf.osaaf.org
-aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:2.1/introspect
-aaf_oauth2_token_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:2.1/token
-aaf_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.service:2.1
-aaf_url_cm=https://AAF_LOCATE_URL/%CNS.%AAF_NS.cm:2.1
-aaf_url_fs=https://AAF_LOCATE_URL/%CNS.%AAF_NS.fs:2.1
-aaf_url_gui=https://AAF_LOCATE_URL/%CNS.%AAF_NS.gui:2.1
-aaf_url_hello=https://aaf-locate.onap:8095/locate/onap.org.osaaf.aaf.hello:2.1
-aaf_url_oauth=https://AAF_LOCATE_URL/%CNS.%AAF_NS.oauth:2.1
-cadi_prop_files=src/test/resources/aaf/org.onap.dmaap-dr.location.props:src/test/resources/aaf/org.onap.dmaap-dr.cred.props
-cadi_protocols=TLSv1.1,TLSv1.2
diff --git a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks
deleted file mode 100644 (file)
index 3666b96..0000000
Binary files a/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks and /dev/null differ
diff --git a/datarouter-prov/src/test/resources/certs/org.onap.dmaap-dr-prov.p12 b/datarouter-prov/src/test/resources/certs/org.onap.dmaap-dr-prov.p12
new file mode 100755 (executable)
index 0000000..1393fb0
Binary files /dev/null and b/datarouter-prov/src/test/resources/certs/org.onap.dmaap-dr-prov.p12 differ
diff --git a/datarouter-prov/src/test/resources/certs/truststore.jks b/datarouter-prov/src/test/resources/certs/truststore.jks
new file mode 100644 (file)
index 0000000..91547c6
Binary files /dev/null and b/datarouter-prov/src/test/resources/certs/truststore.jks differ
index 06150ab..0fbd109 100755 (executable)
@@ -14,8 +14,7 @@ CREATE TABLE FEEDS (
     DELETED        BOOLEAN DEFAULT FALSE,
     LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     SUSPENDED      BOOLEAN DEFAULT FALSE,
-    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    AAF_INSTANCE   VARCHAR(256)
+    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP
 );
 
 CREATE TABLE FEED_ENDPOINT_IDS (
@@ -46,9 +45,7 @@ CREATE TABLE SUBSCRIPTIONS (
     SUSPENDED                   BOOLEAN DEFAULT FALSE,
     PRIVILEGED_SUBSCRIBER       BOOLEAN DEFAULT FALSE,
     CREATED_DATE                TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    DECOMPRESS                  BOOLEAN DEFAULT FALSE,
-    AAF_INSTANCE                VARCHAR(256)
-
+    DECOMPRESS                  BOOLEAN DEFAULT FALSE
 );
 
 CREATE TABLE PARAMETERS (
@@ -152,17 +149,17 @@ INSERT INTO PARAMETERS VALUES
 INSERT INTO GROUPS(GROUPID, AUTHID, NAME, DESCRIPTION, CLASSIFICATION, MEMBERS)
 VALUES (1, 'Basic dXNlcjE6cGFzc3dvcmQx', 'Group1', 'First Group for testing', 'Class1', 'Member1');
 
-INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER, AAF_INSTANCE, DECOMPRESS)
-VALUES (1, 1, 'https://172.100.0.5:8080', 0, 'user1', 'password1', true, false, 'user1', false, 1, false, 'legacy', false);
+INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER, DECOMPRESS)
+VALUES (1, 1, 'https://172.100.0.5:8080', 0, 'user1', 'password1', true, false, 'user1', false, 1, false, false);
 
-INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, AAF_INSTANCE)
-VALUES (2, 1, 'https://172.100.0.5:8080', 0, 'user2', 'password2', true, true, 'subsc2', false, 1, '*');
+INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID)
+VALUES (2, 1, 'https://172.100.0.5:8080', 0, 'user2', 'password2', true, true, 'subsc2', false, 1);
 
-INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, AAF_INSTANCE)
-VALUES (3, 1, 'https://172.100.0.5:8080', 0, 'user3', 'password3', true, true, 'subsc3', false, 1, '*');
+INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID)
+VALUES (3, 1, 'https://172.100.0.5:8080', 0, 'user3', 'password3', true, true, 'subsc3', false, 1);
 
-INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK, AAF_INSTANCE)
-VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink', 'legacy');
+INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK)
+VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink');
 
 INSERT INTO FEED_ENDPOINT_IDS(FEEDID, USERID, PASSWORD)
 VALUES (1, 'USER', 'PASSWORD');
@@ -173,11 +170,11 @@ VALUES (1, '172.0.0.1');
 INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK)
 VALUES (1, 1,'Feed1','v0.1', 'First Feed for testing', 'First Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link');
 
-INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, AAF_INSTANCE)
-VALUES (2, 1,'AafFeed','v0.1', 'AAF Feed for testing', 'AAF Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link','*');
+INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK)
+VALUES (2, 1,'Feed22','v0.1', '2nd Feed for testing', 'Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link');
 
-INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, AAF_INSTANCE)
-VALUES (3, 1,'DeleteableAafFeed','v0.1', 'AAF Feed3 for testing', 'AAF Feed3 for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link','*');
+INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK)
+VALUES (3, 1,'DeleteableFeed','v0.1', 'Feed3 for testing', 'Feed3 for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link');
 
 insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET)
 VALUES (1,1,'user','172.100.0.0/25',2);
index 9596871..1aa631d 100755 (executable)
 org.onap.dmaap.datarouter.db.driver                        = org.h2.Driver
 org.onap.dmaap.datarouter.db.url                           = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
 org.onap.dmaap.datarouter.provserver.isaddressauthenabled  = true
-org.onap.dmaap.datarouter.provserver.cadi.enabled          = true
 org.onap.dmaap.datarouter.provserver.https.relaxation      = false
 org.onap.dmaap.datarouter.provserver.accesslog.dir         = unit-test-logs
 org.onap.dmaap.datarouter.provserver.spooldir              = src/test/resources
 org.onap.dmaap.datarouter.provserver.dbscripts             = src/test/resources
 org.onap.dmaap.datarouter.provserver.localhost             = 127.0.0.1
 org.onap.dmaap.datarouter.provserver.tlsenabled            = true
+org.onap.dmaap.datarouter.provserver.keystoretype          = PKCS12
+org.onap.dmaap.datarouter.provserver.keystorepath          = src/test/resources/certs/org.onap.dmaap-dr-prov.p12
+org.onap.dmaap.datarouter.provserver.keystorepassword      = secret
+org.onap.dmaap.datarouter.provserver.keymanagerpassword    = secret
+org.onap.dmaap.datarouter.provserver.truststoretype        = jks
+org.onap.dmaap.datarouter.provserver.truststorepath        = src/test/resources/certs/truststore.jks
+org.onap.dmaap.datarouter.provserver.truststorepassword    = secret
 org.onap.dmaap.datarouter.nodeserver.https.port            = 8443
 org.onap.dmaap.datarouter.nodeserver.http.port             = 8080
diff --git a/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties b/datarouter-prov/src/test/resources/h2DatabaseTlsDisabled.properties
deleted file mode 100644 (file)
index b7f5aa9..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#-------------------------------------------------------------------------------
-# ============LICENSE_START==================================================
-# * org.onap.dmaap
-# * ===========================================================================
-# * Copyright ? 2017 AT&T Intellectual Property. All rights reserved.
-# * ===========================================================================
-# * Licensed 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.
-# * ============LICENSE_END====================================================
-# *
-# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# *
-#-------------------------------------------------------------------------------
-
-# Database access
-org.onap.dmaap.datarouter.db.driver                        = org.h2.Driver
-org.onap.dmaap.datarouter.db.url                           = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
-org.onap.dmaap.datarouter.provserver.isaddressauthenabled  = true
-org.onap.dmaap.datarouter.provserver.cadi.enabled          = false
-org.onap.dmaap.datarouter.provserver.https.relaxation      = true
-org.onap.dmaap.datarouter.provserver.accesslog.dir         = unit-test-logs
-org.onap.dmaap.datarouter.provserver.spooldir              = src/test/resources
-org.onap.dmaap.datarouter.provserver.dbscripts             = src/test/resources
-org.onap.dmaap.datarouter.provserver.localhost             = 127.0.0.1
-org.onap.dmaap.datarouter.provserver.tlsenabled            = false
-org.onap.dmaap.datarouter.nodeserver.https.port            = 8443
-org.onap.dmaap.datarouter.nodeserver.http.port             = 8080
diff --git a/datarouter-prov/src/test/resources/integration_test.properties b/datarouter-prov/src/test/resources/integration_test.properties
deleted file mode 100644 (file)
index 9ac1850..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-test.keystore=aaf_certs/org.onap.dmaap-dr.jks
-test.kspassword=Qgw77oaQcdP*F8Pwa[&.,.Ab
-test.truststore=aaf_certs/org.onap.dmaap-dr.trust.jks
-test.tspassword=9M?)?:KAj1z6gpLhNrVUG@0T
-test.host=https://dmaap-dr-prov:8443
\ No newline at end of file
index 80ff6fa..be5e6e8 100644 (file)
@@ -22,7 +22,6 @@
       "feedid": 1,
       "name": "Default PM Feed",
       "business_description": "Default Feed",
-      "aaf_instance": "legacy",
       "publisher": "dradmin",
       "links": {
         "subscribe": "http://dmaap-dr-prov/subscribe/1",
@@ -60,7 +59,6 @@
       "feedid": 1,
       "follow_redirect": false,
       "decompress": true,
-      "aaf_instance": "legacy",
       "links": {
         "feed": "http://dmaap-dr-prov/feed/1",
         "log": "http://dmaap-dr-prov/sublog/1",
index 1ac74a0..3a8c901 100755 (executable)
@@ -14,8 +14,7 @@ CREATE TABLE FEEDS (
     DELETED        BOOLEAN DEFAULT FALSE,
     LAST_MOD       TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     SUSPENDED      BOOLEAN DEFAULT FALSE,
-    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    AAF_INSTANCE   VARCHAR(256)
+    CREATED_DATE   TIMESTAMP DEFAULT CURRENT_TIMESTAMP
 );
 
 CREATE TABLE FEED_ENDPOINT_IDS (
@@ -46,9 +45,7 @@ CREATE TABLE SUBSCRIPTIONS (
     SUSPENDED                   BOOLEAN DEFAULT FALSE,
     PRIVILEGED_SUBSCRIBER       BOOLEAN DEFAULT FALSE,
     CREATED_DATE                TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-    DECOMPRESS                  BOOLEAN DEFAULT FALSE,
-    AAF_INSTANCE                VARCHAR(256)
-
+    DECOMPRESS                  BOOLEAN DEFAULT FALSE
 );
 
 CREATE TABLE PARAMETERS (