aboutsummaryrefslogtreecommitdiffstats
path: root/feature-legacy-config/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-01-26 15:28:56 +0000
committerAdheli Tavares <adheli.tavares@est.tech>2024-02-09 10:31:15 +0000
commitcc1d3d352771d1fa35d297e90663539e34b022f6 (patch)
treeb1b00d678b0157742b91be1262fbf614a62063b1 /feature-legacy-config/src
parentcce79248655f484e007769ba81b092148f940d27 (diff)
Removing deprecated DMAAP library
Issue-ID: POLICY-4402 Change-Id: I4ce5b303cb3a775010683d3c7102b0bd065280ea Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'feature-legacy-config/src')
-rw-r--r--feature-legacy-config/src/main/feature/config/feature-legacy-config.properties33
-rw-r--r--feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java6
-rw-r--r--feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java23
-rw-r--r--feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java24
-rw-r--r--feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java19
5 files changed, 48 insertions, 57 deletions
diff --git a/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties b/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties
index 15a35b8b..47a4e229 100644
--- a/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties
+++ b/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties
@@ -2,6 +2,7 @@
# ONAP
# ================================================================================
# Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2024 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,25 +17,13 @@
# limitations under the License.
# ============LICENSE_END=========================================================
-dmaap.source.topics=PDPD-CONFIGURATION
-
-dmaap.source.topics.PDPD-CONFIGURATION.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.PDPD-CONFIGURATION.effectiveTopic=${envd:PDPD_CONFIGURATION_TOPIC}
-dmaap.source.topics.PDPD-CONFIGURATION.apiKey=${envd:PDPD_CONFIGURATION_API_KEY}
-dmaap.source.topics.PDPD-CONFIGURATION.apiSecret=${envd:PDPD_CONFIGURATION_API_SECRET}
-dmaap.source.topics.PDPD-CONFIGURATION.consumerGroup=${envd:PDPD_CONFIGURATION_CONSUMER_GROUP}
-dmaap.source.topics.PDPD-CONFIGURATION.consumerInstance=${envd:PDPD_CONFIGURATION_CONSUMER_INSTANCE}
-dmaap.source.topics.PDPD-CONFIGURATION.managed=false
-dmaap.source.topics.PDPD-CONFIGURATION.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=pdpd-configuration
-#kafka.source.topics.fetchTimeout=15000
-#kafka.source.topics.pdpd-configuration.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.pdpd-configuration.effectiveTopic=${envd:PDPD_CONFIGURATION_TOPIC}
-#kafka.source.topics.pdpd-configuration.apiKey=${envd:PDPD_CONFIGURATION_API_KEY}
-#kafka.source.topics.pdpd-configuration.apiSecret=${envd:PDPD_CONFIGURATION_API_SECRET}
-#kafka.source.topics.pdpd-configuration.consumerGroup=${envd:PDPD_CONFIGURATION_CONSUMER_GROUP}
-#kafka.source.topics.pdpd-configuration.consumerInstance=${envd:PDPD_CONFIGURATION_CONSUMER_INSTANCE}
-#kafka.source.topics.pdpd-configuration.managed=false
-#kafka.source.topics.pdpd-configuration.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics=pdpd-configuration
+kafka.source.topics.fetchTimeout=15000
+kafka.source.topics.pdpd-configuration.servers=${envd:KAFKA_SERVERS}
+kafka.source.topics.pdpd-configuration.effectiveTopic=${envd:PDPD_CONFIGURATION_TOPIC}
+kafka.source.topics.pdpd-configuration.apiKey=${envd:PDPD_CONFIGURATION_API_KEY}
+kafka.source.topics.pdpd-configuration.apiSecret=${envd:PDPD_CONFIGURATION_API_SECRET}
+kafka.source.topics.pdpd-configuration.consumerGroup=${envd:PDPD_CONFIGURATION_CONSUMER_GROUP}
+kafka.source.topics.pdpd-configuration.consumerInstance=${envd:PDPD_CONFIGURATION_CONSUMER_INSTANCE}
+kafka.source.topics.pdpd-configuration.managed=false
+kafka.source.topics.pdpd-configuration.https=${envd:KAFKA_HTTPS:true}
diff --git a/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java b/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java
index 01cc3b34..7ca4632c 100644
--- a/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java
+++ b/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,16 +37,15 @@ import org.slf4j.LoggerFactory;
/**
* Legacy Configurator.
*/
+@Getter
public class LegacyConfig implements Startable, TopicListener {
private static final Logger logger = LoggerFactory.getLogger(LegacyConfig.class);
private static final String CONFIGURATION_PROPERTIES_NAME = "feature-legacy-config";
- @Getter
private final Properties properties;
- @Getter
- private TopicSource source;
+ private final TopicSource source;
/**
* Constructor.
diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java
index d73817b8..c8371895 100644
--- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java
+++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,25 +21,25 @@
package org.onap.policy.drools.legacy.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
import org.onap.policy.drools.system.PolicyEngineConstants;
-public class LegacyConfigFeatureTest {
+class LegacyConfigFeatureTest {
private LegacyConfigFeature configF;
/**
* Set up.
*/
- @Before
+ @BeforeEach
public void setUp() {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
configF = new LegacyConfigFeature();
@@ -47,7 +48,7 @@ public class LegacyConfigFeatureTest {
/**
* Tear down.
*/
- @After
+ @AfterEach
public void tearDown() {
NoopTopicFactories.getSourceFactory().destroy();
NoopTopicFactories.getSinkFactory().destroy();
@@ -55,12 +56,12 @@ public class LegacyConfigFeatureTest {
}
@Test
- public void getSequenceNumber() {
+ void getSequenceNumber() {
assertEquals(LegacyConfigFeature.SEQNO, new LegacyConfigFeature().getSequenceNumber());
}
@Test
- public void afterOpenBeforeShutdown() {
+ void afterOpenBeforeShutdown() {
assertFalse(LegacyConfigFeature.getLegacyConfig().isAlive());
configF.afterOpen(PolicyEngineConstants.getManager());
assertTrue(LegacyConfigFeature.getLegacyConfig().isAlive());
diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java
index eb8860d2..09e03b3e 100644
--- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java
+++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java
@@ -22,26 +22,26 @@
package org.onap.policy.drools.legacy.config;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
-public class LegacyConfigTest {
+class LegacyConfigTest {
private static final String PDPD_CONFIGURATION_TOPIC = "pdpd-configuration";
/**
* Set up.
*/
- @Before
+ @BeforeEach
public void setUp() {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
}
@@ -49,7 +49,7 @@ public class LegacyConfigTest {
/**
* Tear down.
*/
- @After
+ @AfterEach
public void tearDown() {
NoopTopicFactories.getSourceFactory().destroy();
NoopTopicFactories.getSinkFactory().destroy();
@@ -57,7 +57,7 @@ public class LegacyConfigTest {
}
@Test
- public void testStartStop() {
+ void testStartStop() {
LegacyConfig config = new LegacyConfig();
assertFalse(config.isAlive());
@@ -75,7 +75,7 @@ public class LegacyConfigTest {
}
@Test
- public void testConstructors() {
+ void testConstructors() {
LegacyConfig config = new LegacyConfig();
assertNotNull(config.getProperties());
assertEquals(PDPD_CONFIGURATION_TOPIC, config.getSource().getTopic());
diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java
index 46bdb0f8..5180c486 100644
--- a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java
+++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +19,14 @@
package org.onap.policy.drools.server.restful;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import jakarta.ws.rs.core.Response;
import java.util.Properties;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
@@ -45,7 +46,7 @@ public class RestLegacyConfigTest {
/**
* Set up.
*/
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
@@ -79,7 +80,7 @@ public class RestLegacyConfigTest {
/**
* Tear down.
*/
- @AfterClass
+ @AfterAll
public static void tearDown() {
LegacyConfigFeature.getLegacyConfig().shutdown();
HttpClientFactoryInstance.getClientFactory().destroy();
@@ -88,7 +89,7 @@ public class RestLegacyConfigTest {
}
@Test
- public void properties() {
+ void properties() {
Response response = client.get("properties");
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertEquals(LegacyConfigFeature.getLegacyConfig().getProperties(),
@@ -96,7 +97,7 @@ public class RestLegacyConfigTest {
}
@Test
- public void topic() {
+ void topic() {
Response response = client.get("source");
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus());
}