diff options
Diffstat (limited to 'vid-app-common/src/test/java')
7 files changed, 29 insertions, 14 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/HealthCheckControllerTest.java index 49e6645bc..76ee5617b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/HealthCheckControllerTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; import org.apache.log4j.BasicConfigurator; import org.junit.Before; @@ -26,6 +26,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.vid.controller.open.HealthCheckController; import org.onap.vid.dao.FnAppDoaImpl; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MaintenanceControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/MaintenanceControllerTest.java index b9193810a..3e78828f0 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/MaintenanceControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/MaintenanceControllerTest.java @@ -1,4 +1,4 @@ -package org.onap.vid.controller; +package org.onap.vid.controller.open; /*- * ============LICENSE_START======================================================= @@ -35,6 +35,7 @@ import org.onap.vid.category.AddCategoryOptionResponse; import org.onap.vid.category.AddCategoryOptionsRequest; import org.onap.vid.category.CategoryParameterOptionRep; import org.onap.vid.category.CategoryParametersResponse; +import org.onap.vid.controller.open.MaintenanceController; import org.onap.vid.model.CategoryParameter; import org.onap.vid.model.CategoryParameterOption; import org.onap.vid.services.CategoryParameterService; diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/RoleGeneratorControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/RoleGeneratorControllerTest.java index c5b4a55dc..c1509d956 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/RoleGeneratorControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/RoleGeneratorControllerTest.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -32,6 +32,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; +import org.onap.vid.controller.open.RoleGeneratorController; import org.onap.vid.services.RoleGeneratorService; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/VersionControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/VersionControllerTest.java index f92a26ea7..835ea4a66 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/VersionControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/VersionControllerTest.java @@ -18,8 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.vid.controller; +package org.onap.vid.controller.open; +import org.onap.vid.controller.open.VersionController; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java index 4cba53785..102c89ac1 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java @@ -24,11 +24,11 @@ import io.joshworks.restclient.request.HttpRequest; import org.glassfish.jersey.client.JerseyInvocation; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.aai.util.HttpsAuthClient; import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.vid.mso.rest.RequestDetails; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; @@ -72,15 +72,19 @@ public class RestMsoImplementationTest { @Mock private JerseyInvocation jerseyInvocation; + @Mock + private SystemPropertiesWrapper systemProperties; + @InjectMocks - private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient); + private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient, systemProperties); - String path = "/test_path/"; - String rawData = "test-row-data"; + private String path = "/test_path/"; + private String rawData = "test-row-data"; @BeforeClass public void setUp(){ initMocks(this); + when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz"); } @Test @@ -127,7 +131,8 @@ public class RestMsoImplementationTest { RestObject<HttpRequest> restObject = new RestObject<>(); prepareMocks("",HttpStatus.ACCEPTED.value(),""); - when(mockClient.target(SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL))).thenThrow(new MsoTestException("test-target-exception")); + when(systemProperties.getProperty(MsoProperties.MSO_SERVER_URL)).thenReturn("SAMPLE_URL"); + when(mockClient.target("SAMPLE_URL")).thenThrow(new MsoTestException("test-target-exception")); // when restMsoImplementation.Get(httpRequest, "", restObject,false); @@ -418,4 +423,4 @@ public class RestMsoImplementationTest { } } -}
\ No newline at end of file +} diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java index 12fd4a519..832aa098a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java @@ -45,6 +45,7 @@ import org.onap.vid.mso.MsoProperties; import org.onap.vid.mso.MsoResponseWrapper; import org.onap.vid.mso.MsoResponseWrapperInterface; import org.onap.vid.mso.RestObject; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.test.context.ContextConfiguration; @ContextConfiguration(classes = {SystemProperties.class}) @@ -473,10 +474,10 @@ public class MsoRestClientNewTest { private MsoRestClientNew msoRestClient() { final WebConfig webConfig = new WebConfig(); - return new MsoRestClientNew(new SyncRestClient(webConfig.unirestFasterxmlObjectMapper(new ObjectMapper())), baseUrl(),null); + return new MsoRestClientNew(new SyncRestClient(webConfig.unirestFasterxmlObjectMapper(new ObjectMapper())), baseUrl(), null, new SystemPropertiesWrapper()); } private MsoRestClientNew createTestSubject() { - return new MsoRestClientNew(null, "",null); + return new MsoRestClientNew(null, "", null, new SystemPropertiesWrapper()); } } diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java index 839e6e6c1..050fa0dce 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java @@ -44,12 +44,14 @@ import org.onap.vid.changeManagement.WorkflowRequestDetail; import org.onap.vid.client.SyncRestClient; import org.onap.vid.controller.LocalWebConfig; import org.onap.vid.model.RequestReferencesContainer; +import org.onap.vid.mso.MsoProperties; import org.onap.vid.mso.MsoResponseWrapper; import org.onap.vid.mso.MsoResponseWrapperInterface; import org.onap.vid.mso.MsoUtil; import org.onap.vid.mso.RestObject; import org.onap.vid.mso.model.CloudConfiguration; import org.onap.vid.mso.model.RequestReferences; +import org.onap.vid.utils.SystemPropertiesWrapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.web.WebAppConfiguration; import org.testng.annotations.BeforeClass; @@ -75,6 +77,8 @@ public class MsoRestClientTest { @Mock private SyncRestClient client; + @Mock + private SystemPropertiesWrapper systemProperties; private MsoRestClientNew restClient; @@ -82,8 +86,9 @@ public class MsoRestClientTest { @BeforeClass private void setUp(){ initMocks(this); - restClient = new MsoRestClientNew(client,baseUrl,null); - + when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz"); + when(systemProperties.getProperty("app_display_name")).thenReturn("vid"); + restClient = new MsoRestClientNew(client,baseUrl,null,systemProperties); } @Test |