aboutsummaryrefslogtreecommitdiffstats
path: root/so-sdn-clients
diff options
context:
space:
mode:
Diffstat (limited to 'so-sdn-clients')
-rw-r--r--so-sdn-clients/pom.xml2
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java (renamed from so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java)33
-rw-r--r--so-sdn-clients/src/test/resources/logback-test.xml36
3 files changed, 68 insertions, 3 deletions
diff --git a/so-sdn-clients/pom.xml b/so-sdn-clients/pom.xml
index 96d47445de..dbcf527c81 100644
--- a/so-sdn-clients/pom.xml
+++ b/so-sdn-clients/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-sdn-clients</artifactId>
diff --git a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
index a8816e1b04..fa3bf1d16c 100644
--- a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2021 - Nokia
+ * ================================================================================
* 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
@@ -18,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdn.common;
+package org.onap.so.client.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.util.LinkedHashMap;
@@ -29,7 +32,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SdnCommonTasks;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -101,4 +103,31 @@ public class SdnCommonTasksTest {
sdnCommonTasks.validateSDNResponse(responseMap);
}
+ @Test
+ public void validateSDNResponse_emptyWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ String result = sdnCommonTasks.validateSDNResponse(output);
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void validateSDNGetResponse_success() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", "value1");
+ String result = sdnCommonTasks.validateSDNGetResponse(output);
+ assertThat(result).isEqualTo("{\"key1\":\"value1\"}");
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ sdnCommonTasks.validateSDNGetResponse(output);
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenMapEmpty() throws Exception {
+ sdnCommonTasks.validateSDNGetResponse(new LinkedHashMap<>());
+ }
}
diff --git a/so-sdn-clients/src/test/resources/logback-test.xml b/so-sdn-clients/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..bb4aee6e05
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/logback-test.xml
@@ -0,0 +1,36 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP - SO
+ ================================================================================
+ Copyright (C) 2021 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=========================================================
+-->
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.reflections" level="ERROR" />
+ <logger name="org.onap" level="DEBUG" />
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>