aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java
diff options
context:
space:
mode:
authorMichal Kabaj <michal.kabaj@nokia.com>2019-10-17 15:08:15 +0200
committerMichal Kabaj <michal.kabaj@nokia.com>2019-10-17 15:08:15 +0200
commitf09e8d114804e4237e79f27ed492835ecb1b17b0 (patch)
tree096665eb907d529d9d54321347d1df7e43d52085 /vid-app-common/src/test/java
parent809dd1050faf1bb3687807be384940ccbb28ff22 (diff)
AaiController tests
added new unit tests to AaiControllerTest Issue-ID: VID-684 Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com> Change-Id: Ib6a7aaa932ff2909b8a1fd81d5128713d1dc3eb5
Diffstat (limited to 'vid-app-common/src/test/java')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
index 83cc61ea4..51bdec882 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
@@ -50,6 +50,8 @@ import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.AaiResponseTranslator;
import org.onap.vid.aai.AaiResponseTranslator.PortMirroringConfigData;
@@ -531,5 +533,33 @@ public class AaiControllerTest {
.andExpect(content().json(objectMapper.writeValueAsString(expectedPnfs)));
}
+ @Test
+ public void getUserID_shouldReturnOKResponse_withExtractedUserId() throws Exception {
+ String userPropertyKey = "user";
+ String expectedUserLoginId = "testUserLoginId";
+ User user = new User();
+ user.setLoginId(expectedUserLoginId);
+ given(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).willReturn(userPropertyKey);
+
+ mockMvc.perform(get("/getuserID")
+ .contentType(MediaType.APPLICATION_JSON)
+ .accept(MediaType.APPLICATION_JSON)
+ .sessionAttr(userPropertyKey, user))
+ .andExpect(status().isOk())
+ .andExpect(content().string(expectedUserLoginId));
+ }
+
+ @Test
+ public void getTargetProvStatus_shouldReturnProperty() throws Exception {
+ String expectedResponse = "targetProvStatus";
+ given(systemPropertiesWrapper.getProperty("aai.vnf.provstatus")).willReturn(expectedResponse);
+
+ mockMvc.perform(get("/get_system_prop_vnf_prov_status")
+ .contentType(MediaType.APPLICATION_JSON)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().string(expectedResponse));
+ }
+
}