From adb2ad2d16e851fbf8dcc71af68949a74463204d Mon Sep 17 00:00:00 2001 From: efiacor Date: Wed, 23 Oct 2019 15:31:43 +0100 Subject: More bug fix and refactoring Signed-off-by: efiacor Change-Id: I4fce4e73faa86573d0c716882bb014b9f83026ee Issue-ID: DMAAP-1284 --- .../datarouter/provisioning/ProvServerTest.java | 57 +++++++++++++++++++++ .../provisioning/utils/AafPropsUtilsTest.java | 3 +- .../src/test/resources/aaf/org.onap.dmaap-dr.p12 | Bin 0 -> 4233 bytes .../test/resources/aaf/org.onap.dmaap-dr.trust.jks | Bin 0 -> 1413 bytes .../src/test/resources/h2Database.properties | 1 + datarouter-prov/src/test/resources/prov_data.json | 2 +- 6 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java create mode 100644 datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12 create mode 100644 datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks (limited to 'datarouter-prov/src/test') diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java new file mode 100644 index 00000000..78d2eaa7 --- /dev/null +++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/ProvServerTest.java @@ -0,0 +1,57 @@ +/*- + * ============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; + +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; + +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/h2Database.properties"); + } + + @Test + public void Verify_Prov_Server_Is_Configured_Correctly() throws IllegalAccessException { + FieldUtils.writeDeclaredStaticField(ProvRunner.class, "aafPropsUtils", aafPropsUtils, true); + Assert.assertNotNull(ProvServer.getServerInstance()); + } +} 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 index 09d4a819..64c5e492 100644 --- 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 @@ -32,8 +32,7 @@ public class AafPropsUtilsTest { @BeforeClass public static void init() throws Exception { - AafPropsUtils.init(new File("src/test/resources/aaf/org.onap.dmaap-dr.props")); - aafPropsUtils = AafPropsUtils.getInstance(); + aafPropsUtils = new AafPropsUtils(new File("src/test/resources/aaf/org.onap.dmaap-dr.props")); } @Test 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 new file mode 100644 index 00000000..bd60d26e Binary files /dev/null and b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.p12 differ 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 new file mode 100644 index 00000000..0c9da2e5 Binary files /dev/null and b/datarouter-prov/src/test/resources/aaf/org.onap.dmaap-dr.trust.jks differ diff --git a/datarouter-prov/src/test/resources/h2Database.properties b/datarouter-prov/src/test/resources/h2Database.properties index a9c831a3..61d76fac 100755 --- a/datarouter-prov/src/test/resources/h2Database.properties +++ b/datarouter-prov/src/test/resources/h2Database.properties @@ -25,6 +25,7 @@ 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 diff --git a/datarouter-prov/src/test/resources/prov_data.json b/datarouter-prov/src/test/resources/prov_data.json index 32536316..cf455c71 100644 --- a/datarouter-prov/src/test/resources/prov_data.json +++ b/datarouter-prov/src/test/resources/prov_data.json @@ -71,7 +71,7 @@ ], "parameters": { "ACTIVE_POD": "dmaap-dr-prov", - "DELIVERY_FILE_PROCESS_INTERVAL": 10, + "DELIVERY_FILE_PROCESS_INTERVAL": 600, "DELIVERY_INIT_RETRY_INTERVAL": 10, "DELIVERY_MAX_AGE": 86400, "DELIVERY_MAX_RETRY_INTERVAL": 3600, -- cgit 1.2.3-korg