diff options
author | 2019-11-12 09:48:58 +0200 | |
---|---|---|
committer | 2019-11-12 09:38:53 +0000 | |
commit | 722fe8e3930fb50bbe51bcd9b6f0681813c6daaa (patch) | |
tree | 06e606b01244f908434c23fea0775f8b17fb1203 /vid-automation/src | |
parent | 94a4b28106871d54d8b159acb75e926609ab7db1 (diff) |
Allow API tests even when VID's certificate is invalid (more occurrences)
Issue-ID: VID-701
Change-Id: I3428f253044f5bd647e1a5e002cbdca65dee2543
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation/src')
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/ChangeManagementApiTest.java | 78 | ||||
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/VersionControllerApiTest.java | 7 |
2 files changed, 53 insertions, 32 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/ChangeManagementApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ChangeManagementApiTest.java index b7f28f820..6625d2a41 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ChangeManagementApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ChangeManagementApiTest.java @@ -1,17 +1,62 @@ package org.onap.vid.api; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.onap.vid.api.TestUtils.getNestedPropertyInMap; +import static org.testng.AssertJUnit.assertEquals; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.onap.simulator.presetGenerator.presets.aaf.AAFGetBasicAuthPreset; +import org.onap.simulator.presetGenerator.presets.aaf.AAFGetUrlServicePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.mso.changeManagement.PresetMsoChangeManagementBase; import org.onap.simulator.presetGenerator.presets.mso.changeManagement.PresetMsoVnfInPlaceSoftwareUpdate; import org.onap.simulator.presetGenerator.presets.mso.changeManagement.PresetMsoVnfReplace; import org.onap.simulator.presetGenerator.presets.mso.changeManagement.PresetMsoVnfUpdate; -import org.onap.simulator.presetGenerator.presets.aaf.*; -import org.onap.vid.model.mso.*; -import org.onap.vid.model.workflow.*; +import org.onap.vid.model.mso.ChangeManagementRequest; +import org.onap.vid.model.mso.ChangeManagementRequestDetails; +import org.onap.vid.model.mso.CloudConfiguration; +import org.onap.vid.model.mso.MsoExceptionResponse; +import org.onap.vid.model.mso.MsoResponseWrapper2; +import org.onap.vid.model.mso.RelatedInstance; +import org.onap.vid.model.mso.RelatedInstanceList; +import org.onap.vid.model.mso.RequestInfo; +import org.onap.vid.model.mso.RequestParameters; +import org.onap.vid.model.workflow.GetVnfWorkflowRelationRequest; +import org.onap.vid.model.workflow.GetWorkflowsResponse; +import org.onap.vid.model.workflow.VnfDetails; +import org.onap.vid.model.workflow.VnfDetailsWithWorkflows; +import org.onap.vid.model.workflow.VnfWorkflowRelationAllResponse; +import org.onap.vid.model.workflow.VnfWorkflowRelationRequest; +import org.onap.vid.model.workflow.VnfWorkflowRelationResponse; +import org.onap.vid.model.workflow.WorkflowsDetail; import org.onap.vid.more.LoggerFormatTest; import org.springframework.http.HttpStatus; import org.springframework.util.StopWatch; @@ -22,32 +67,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.services.SimulatorApi; import vid.automation.test.services.SimulatorApi.RegistrationStrategy; +import vid.automation.test.utils.InsecureHttpsClient; import vid.automation.test.utils.ReadFile; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.onap.vid.api.TestUtils.getNestedPropertyInMap; -import static org.testng.AssertJUnit.assertEquals; - //This is integration test that require running tomcat public class ChangeManagementApiTest extends BaseApiTest { @@ -473,7 +495,7 @@ public class ChangeManagementApiTest extends BaseApiTest { Response response = callChangeManagementUpdate(vnfIds, changeManagementRequest); MsoResponseWrapper2 body = response.readEntity(MsoResponseWrapper2.class); assertForHappyPath(vnfIds, body, requestType); - RestTemplate manualRestTemplate = new RestTemplate(); + RestTemplate manualRestTemplate = InsecureHttpsClient.newRestTemplate(); super.loginWithChosenRESTClient(getUserCredentials(), manualRestTemplate); SimulatorApi.registerExpectationFromPreset( new PresetAAIGetSubscribersGet(), RegistrationStrategy.APPEND); LoggerFormatTest diff --git a/vid-automation/src/test/java/org/onap/vid/api/VersionControllerApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/VersionControllerApiTest.java index 4dc799193..0574cec17 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/VersionControllerApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/VersionControllerApiTest.java @@ -1,19 +1,18 @@ package org.onap.vid.api; +import java.util.HashMap; import org.junit.Assert; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; import org.testng.annotations.Test; - -import java.util.HashMap; +import vid.automation.test.utils.InsecureHttpsClient; public class VersionControllerApiTest extends BaseApiTest { @Test public void probeRequest_returnsResponseAsExpected() { // without log-in - ResponseEntity<HashMap<String, String>> response = new RestTemplate().exchange( + ResponseEntity<HashMap<String, String>> response = InsecureHttpsClient.newRestTemplate().exchange( uri + "/version", org.springframework.http.HttpMethod.GET, null, |