summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/test
diff options
context:
space:
mode:
authorPiotr Bocheński <piotr.bochenski@nokia.com>2019-02-08 13:38:02 +0100
committerPiotr Bocheński <piotr.bochenski@nokia.com>2019-02-08 13:38:57 +0100
commit2ce68d3c8423d644056becc8ef1e3bb0df731c42 (patch)
treea6c0f836f32a092de7ca9ac595454685cf308692 /prh-app-server/src/test
parent72aa0aaf4561f0cfd9c7e1dbe47a13f8571bf1db (diff)
Add git info to PRH + cleanup
Change-Id: Id518d56373f6ccab9dd4195ad08b67589e0d9b4f Issue-ID: DCAEGEN2-1030 Signed-off-by: Piotr Bocheński <piotr.bochenski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
index 42acc592..249fccc3 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 NOKIA 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.
@@ -20,17 +20,6 @@
package org.onap.dcaegen2.services.prh.configuration;
-import static java.lang.ClassLoader.getSystemResource;
-import static java.nio.file.Files.readAllBytes;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Paths;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -38,11 +27,18 @@ import org.onap.dcaegen2.services.prh.integration.junit5.mockito.MockitoExtensio
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
+import java.io.*;
+import java.nio.file.Paths;
+
+import static java.lang.ClassLoader.getSystemResource;
+import static java.nio.file.Files.readAllBytes;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
*/
-@ExtendWith({MockitoExtension.class})
+@ExtendWith({ MockitoExtension.class })
class PrhAppConfigTest {
private static final String CORRECT_CONFIG_FILE = "correct_config.json";
@@ -58,7 +54,7 @@ class PrhAppConfigTest {
@Test
void whenTheConfigurationFits() throws Exception {
InputStream inputStream = createInputStream(CORRECT_CONFIG_FILE);
- appConfig.setResourceFile(new InputStreamResource(inputStream));
+ appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
appConfig.initFileStreamReader();
assertNotNull(appConfig.getDmaapConsumerConfiguration());
@@ -71,7 +67,7 @@ class PrhAppConfigTest {
InputStream inputStream = createInputStream(CORRECT_CONFIG_FILE);
Resource resource = spy(new InputStreamResource(inputStream));
when(resource.getInputStream()).thenThrow(new IOException());
- appConfig.setResourceFile(resource);
+ appConfig.setPrhEndpoints(resource);
appConfig.initFileStreamReader();
assertNull(appConfig.getAaiClientConfiguration());
@@ -82,7 +78,7 @@ class PrhAppConfigTest {
@Test
void whenFileExistsButDmaapPublisherJsonConfigurationIsIncorrect() throws Exception {
InputStream inputStream = createInputStream(INCORRECT_CONFIG_FILE);
- appConfig.setResourceFile(new InputStreamResource(inputStream));
+ appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
appConfig.initFileStreamReader();
assertNotNull(appConfig.getAaiClientConfiguration());
@@ -93,7 +89,7 @@ class PrhAppConfigTest {
@Test
void whenRootElementIsNotAJsonObject() throws Exception {
InputStream inputStream = createInputStream(NOT_JSON_OBJECT_FILE);
- appConfig.setResourceFile(new InputStreamResource(inputStream));
+ appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
appConfig.initFileStreamReader();
@@ -105,4 +101,4 @@ class PrhAppConfigTest {
private InputStream createInputStream(String jsonFile) throws Exception {
return new ByteArrayInputStream(readAllBytes(Paths.get(getSystemResource(jsonFile).toURI())));
}
-} \ No newline at end of file
+}