aboutsummaryrefslogtreecommitdiffstats
path: root/models-sim/policy-models-simulators/src/test
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2024-01-29 09:23:58 +0000
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2024-02-08 14:29:41 +0000
commit49f07db935d114b72a44e446867b16262dd552aa (patch)
treef6867985541acb76f1e5279ed4104c86dc7adffb /models-sim/policy-models-simulators/src/test
parent71be21fd5b9b52c613bb855f00a79a51e81906dd (diff)
Remove dmaap from models
Issue-ID: POLICY-4402 Change-Id: Icead1601984f463e557b969f2792f0f0aa05f060 Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
Diffstat (limited to 'models-sim/policy-models-simulators/src/test')
-rw-r--r--models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java31
-rw-r--r--models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java85
-rw-r--r--models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java48
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json10
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json10
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json7
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json35
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json10
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/logback-test.xml6
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/missingSink.json26
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/missingSource.json26
-rw-r--r--models-sim/policy-models-simulators/src/test/resources/simParameters.json72
12 files changed, 3 insertions, 363 deletions
diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
index 73eb69f7a..09064f472 100644
--- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
+++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java
@@ -113,12 +113,6 @@ public class MainTest {
}
}
- @Test
- public void testConstructor() throws Exception {
- assertThatIllegalArgumentException().isThrownBy(() -> new Main("invalidDmaapProvider.json"))
- .withMessage("invalid simulator parameters");
- }
-
/**
* Verifies that all the simulators are brought up and that HTTPS works with at
* least one of them.
@@ -243,30 +237,5 @@ public class MainTest {
assertThat(ex.getCause()).hasMessageStartingWith("interrupted while building");
}
- /**
- * Tests buildTopicServer() when the provider class is invalid.
- */
- @Test
- public void testBuildTopicServerInvalidProvider() {
- assertThatThrownBy(() -> new Main("invalidTopicServer.json").start())
- .hasCauseInstanceOf(IllegalArgumentException.class);
- }
-
- /**
- * Tests buildTopicServer() when the sink is missing.
- */
- @Test
- public void testBuildTopicServerNoSink() {
- assertThatThrownBy(() -> new Main("missingSink.json").start())
- .hasCauseInstanceOf(IllegalArgumentException.class);
- }
- /**
- * Tests buildTopicServer() when the sink is missing.
- */
- @Test
- public void testBuildTopicServerNoSource() {
- assertThatThrownBy(() -> new Main("missingSource.json").start())
- .hasCauseInstanceOf(IllegalArgumentException.class);
- }
}
diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java
deleted file mode 100644
index 8094ca419..000000000
--- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020 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=========================================================
- */
-
-package org.onap.policy.models.simulators;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-import org.junit.Test;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-
-public class SimulatorParametersTest {
-
- @Test
- public void testValidate() throws CoderException {
- SimulatorParameters params = new StandardCoder().decode(new File("src/test/resources/simParameters.json"),
- SimulatorParameters.class);
- assertNull(params.validate("ValidParams").getResult());
- }
-
- @Test
- public void testValidateEmptyRestServer() throws CoderException {
- SimulatorParameters params = new StandardCoder()
- .decode(new File("src/test/resources/emptyRestServer.json"), SimulatorParameters.class);
- assertNull(params.validate("ValidParams").getResult());
- }
-
- @Test
- public void testValidateInvalidDmaapProvider() throws CoderException {
- SimulatorParameters params = new StandardCoder()
- .decode(new File("src/test/resources/invalidDmaapProvider.json"), SimulatorParameters.class);
- BeanValidationResult result = params.validate("InvalidDmaapParams");
- assertFalse(result.isValid());
- assertNotNull(result.getResult());
- }
-
- @Test
- public void testValidateInvalidDmaapName() throws CoderException {
- SimulatorParameters params = new StandardCoder().decode(
- new File("src/test/resources/invalidDmaapName.json"), SimulatorParameters.class);
- BeanValidationResult result = params.validate("InvalidDmaapParams");
- assertFalse(result.isValid());
- assertThat(result.getResult()).contains("item \"name\" value \"null\"");
- }
-
- @Test
- public void testValidateInvalidTopicSweep() throws CoderException {
- SimulatorParameters params = new StandardCoder().decode(
- new File("src/test/resources/invalidTopicSweep.json"), SimulatorParameters.class);
- BeanValidationResult result = params.validate("InvalidDmaapParams");
- assertFalse(result.isValid());
- assertThat(result.getResult()).contains("topicSweepSec");
- }
-
- @Test
- public void testValidateInvalidGrpcServer() throws CoderException {
- SimulatorParameters params = new StandardCoder()
- .decode(new File("src/test/resources/invalidGrpcServer.json"), SimulatorParameters.class);
- BeanValidationResult result = params.validate("InvalidGrpcParams");
- assertFalse(result.isValid());
- assertNotNull(result.getResult());
- }
-}
diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java
deleted file mode 100644
index 2d182d8fb..000000000
--- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2020 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=========================================================
- */
-
-package org.onap.policy.models.simulators;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-
-public class TopicServerParametersTest {
-
- @Test
- public void testValidateString() throws CoderException {
- // some fields missing
- ValidationResult result = new TopicServerParameters().validate("InvalidParams");
- assertFalse(result.isValid());
- assertNotNull(result.getResult());
-
- // everything populated
- SimulatorParameters simParams = new StandardCoder()
- .decode(new File("src/test/resources/simParameters.json"), SimulatorParameters.class);
- TopicServerParameters params = simParams.getTopicServers().get(0);
- assertNull(params.validate("ValidParams").getResult());
- }
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json
index 4a86253da..ca4841eca 100644
--- a/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json
+++ b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json
@@ -1,11 +1,3 @@
{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec": 300,
- "restServerParameters": {}
- },
- "restServers": [],
- "topicSinks": [],
- "topicSources": [],
- "topicServers": []
+ "restServers": []
}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json
deleted file mode 100644
index 889c4c844..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "dmaapProvider": {
- "name": null,
- "topicSweepSec":300
- },
- "restServers": [],
- "topicSinks": [],
- "topicSources": [],
- "topicServers": []
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json
deleted file mode 100644
index ff6790144..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "dmaapProvider": {},
- "restServers": [],
- "topicSinks": [],
- "topicSources": [],
- "topicServers": []
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json b/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json
deleted file mode 100644
index b3d31f6b4..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec": 300,
- "restServerParameters": {
-
- }
- },
- "topicSinks": [
- {
- "topic": "APPC-LCM-READ",
- "servers": ["localhost"],
- "port": 3905,
- "topicCommInfrastructure": "DMAAP",
- "https": true
- }
- ],
- "topicSources": [
- {
- "topic": "APPC-LCM-WRITE",
- "servers": ["localhost"],
- "port": 3905,
- "topicCommInfrastructure": "DMAAP",
- "https": true
- }
- ],
- "topicServers": [
- {
- "name": "Invalid Topic simulator",
- "providerClass": "org.onap.policy.simulators.InvalidTopicServer",
- "sink": "APPC-LCM-READ",
- "source": "APPC-LCM-WRITE"
- }
- ]
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json b/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json
deleted file mode 100644
index 11a37d5c4..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec":0
- },
- "restServers": [],
- "topicSinks": [],
- "topicSources": [],
- "topicServers": []
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/logback-test.xml b/models-sim/policy-models-simulators/src/test/resources/logback-test.xml
index e599a94a8..05a097bef 100644
--- a/models-sim/policy-models-simulators/src/test/resources/logback-test.xml
+++ b/models-sim/policy-models-simulators/src/test/resources/logback-test.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 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.
@@ -41,9 +42,4 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap.policy.models.sim.dmaap" level="debug"
- additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
</configuration>
diff --git a/models-sim/policy-models-simulators/src/test/resources/missingSink.json b/models-sim/policy-models-simulators/src/test/resources/missingSink.json
deleted file mode 100644
index e7d63e04f..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/missingSink.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec": 300,
- "restServerParameters": {
-
- }
- },
- "topicSources": [
- {
- "topic": "APPC-LCM-WRITE",
- "servers": ["localhost"],
- "port": 3905,
- "topicCommInfrastructure": "DMAAP",
- "https": true
- }
- ],
- "topicServers": [
- {
- "name": "APPC-LCM simulator",
- "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer",
- "sink": "APPC-LCM-READ",
- "source": "APPC-LCM-WRITE"
- }
- ]
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/missingSource.json b/models-sim/policy-models-simulators/src/test/resources/missingSource.json
deleted file mode 100644
index 0f02e4095..000000000
--- a/models-sim/policy-models-simulators/src/test/resources/missingSource.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec": 300,
- "restServerParameters": {
-
- }
- },
- "topicSinks": [
- {
- "topic": "APPC-LCM-READ",
- "servers": ["localhost"],
- "port": 3905,
- "topicCommInfrastructure": "DMAAP",
- "https": true
- }
- ],
- "topicServers": [
- {
- "name": "APPC-LCM simulator",
- "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer",
- "sink": "APPC-LCM-READ",
- "source": "APPC-LCM-WRITE"
- }
- ]
-}
diff --git a/models-sim/policy-models-simulators/src/test/resources/simParameters.json b/models-sim/policy-models-simulators/src/test/resources/simParameters.json
index 325998fef..6d3ae3acd 100644
--- a/models-sim/policy-models-simulators/src/test/resources/simParameters.json
+++ b/models-sim/policy-models-simulators/src/test/resources/simParameters.json
@@ -1,17 +1,6 @@
{
- "dmaapProvider": {
- "name": "DMaaP simulator",
- "topicSweepSec": 300
- },
"restServers": [
{
- "name": "DMaaP simulator",
- "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1",
- "host": "localhost",
- "port": 3905,
- "https": true
- },
- {
"name": "A&AI simulator",
"providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs",
"host": "localhost",
@@ -47,66 +36,7 @@
"https": true
}
],
- "topicSinks": [
- {
- "topic": "appc-cl",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- },
- {
- "topic": "appc-lcm-write",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- },
- {
- "topic": "sdnr-cl",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- }
- ],
- "topicSources": [
- {
- "topic": "appc-cl",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- },
- {
- "topic": "appc-lcm-read",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- },
- {
- "topic": "sdnr-cl-rsp",
- "servers": ["localhost"],
- "topicCommInfrastructure": "DMAAP",
- "useHttps": true
- }
- ],
- "topicServers": [
- {
- "name": "APPC Legacy simulator",
- "providerClass": "org.onap.policy.simulators.AppcLegacyTopicServer",
- "sink": "appc-cl",
- "source": "appc-cl"
- },
- {
- "name": "APPC-LCM simulator",
- "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer",
- "sink": "appc-lcm-write",
- "source": "appc-lcm-read"
- },
- {
- "name": "SDNR simulator",
- "providerClass": "org.onap.policy.simulators.SdnrTopicServer",
- "sink": "sdnr-cl",
- "source": "sdnr-cl-rsp"
- }
- ],
+
"grpcServer": {
"name": "CDS simulator",
"providerClass": "org.onap.policy.simulators.CdsSimulator",