summaryrefslogtreecommitdiffstats
path: root/bpmn/MSORESTClient/src/test/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-05 11:00:36 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-05 17:03:14 -0500
commit61affc6311906aee71b16ee8632c1e7468cd1990 (patch)
tree5dec424176ff959080cc7f801c6d4cb0c60ca949 /bpmn/MSORESTClient/src/test/java/org/onap
parent6fa3d2b80d2384b830e3231fe69a8daf7884a35e (diff)
Catchup commits for Dublin
added property for retry timer multiplier for testing Infra APIH table, fixed test assertNull condition. Infra APIH table, added tests for request-url = null. Infra APIH should write request_url to infra_active_requests. Return SelfLink URL on ServiceInstantiation SyncResponse. Added JUNITS. Added helper method to get AAI ResourceUri to faciliate unit test. Fixed code to correctly extract related generic vnf or vce id. updated unit test coverage for update network Handle REST NotFoundException for serviceInstance nodes query. Process should continue for new order request and throw exception only for SUPP request. Added disconnect functionality to the gw vnf test tool. Added conversion of vnf management option to dhv change speed sync subnet status with network update updated macroData vol assigned delete continue script Correct the name of DeleteVfModuleBB subprocess. fix the custom resolver to not convert int in string to int Write the returned value from Homing to gBBInput Use explicit conversion to JSON to read cloudConfiguration settings. added property for retry timer multiplier for testing avoid storing AAI yang models in execution added handlingCode to rollback test in workflowactionbb passed in alacarte flag to execute layer for rainy day added test cases for RollbackToAssigned rainy day hand added rollback to assign in catalog db rainy day hand Updated vnf adapter delete stubs to be a post for test. Added a javadoc to basic auth override method Added a check to not add blank headers to the headerMap in httpClient. Added check for if entity exist before calling readEntity. Fixed failing junits and updated way the body is obtained Added missing import statement for http client. Fixed mistakes and made updates caught during review. Removed post and httpPost methods from RESTClient and refactored references Refactored multiple http post references to use httpClient instead. Removed close connection method and randomized port in unit test Added http client unit test, coverage is currently at 90 percent Resolve conflict in sdnc adapter reste v1 method Began removing http delete and delete methods from RESTClient and aaiUtil. Removed http put method and executeput method, refactored references. fixed broken tests in the branch in jenkins build Fix Springboot 2.0 start up issues, and other issues added in implementation to generate self link if there isnt one removed dbcp2 from poms that still had them added rollbackstatusmessage to stub in testprocess added rollback_status_message to the schema sql file Added variable for rollbackStatusMessage Added rollbackStatusMessage to get response added rollback status message to archived infra request set rollback status message to successful on boolean added logic to split rollback and regular error message added rollback status message to infra active requests pushing the cloud config changes as well Added media type and fixed cast plural issue. Made various updated and fixes to code that was changed. Removed all no longer used RESTClient imports from classes Removed and refactored references for aaiUtil methods and all remaining RESTClient methods, removed RESTClient project and updated poms. Return canonical stack id on multicloud create Fix OOF Config Ingestion Fix variable to retrieve sdnc endpoint Prepare resources for service uuid req Fix swapped parameters for multicloud DELETE Update msb-java-sdk to resolve license issues cloud owner support for SDNC interface correlationId is now read from userParams Fix up request body of multicloud adapter body removed LinkedHashMap<?,?> from java classes Cut over logging project to release not snapshot Update unit tests, revert test code, fix comments Fix remaining number of Unit Tests, on avpn flow Fix JUNITS add callback url, fix BPMN issues Update SDNC interaction to support a-sync updated bpm assert import and corrected tests updated test case to be mockito 2 compliant additional changes to import statements and tests Change the place where the data for multistage gets set Update treatment of PENDING_ACTIVATION VF_MODULE CREATE entries to SILENT_SUCCESS to support first stage of multistage. Implement second stage of multistage design VF Module Creation removed LinkedHashMap<?,?> from java classes Removed SNAPSHOT from dependency Cut over logging project to release not snapshot Fixed failing BBInputSetup tests Update unit tests, revert test code, fix comments Updated apih tests to use networkInstanceGroup Updated ModelType enum and fixed compilation issues Fix remaining number of Unit Tests, on avpn flow Fix JUNITS add callback url, fix BPMN issues Implementation of the first stage of multistage design for VF Module creation. Update SDNC interaction to support a-sync no longer leave modified files after test runs Remove generated CSAR, that occurs during JUNIT Update Camunda Pods to use Flyway Migration in 1902 Updated hashcode method and removed comment. Added aggregate routes to the sdnw request and updated pom sdnw dependency. Began to set aggreagate route information for vrf configuration. modified remaining files with att-aic references Correct rollbackData setting and protect against potential null objects. correct AAIObjectPlurals enum value name Update POJO to use type URL for selfLink. Optional<URL> - construct SelfLink Url format. Construct SelfLink Url format from full Url. added missing properties to application-test.yaml fixed compliation error after merge of unit test restored files which should not have been deleted Fix SO vulnerabilities with cxf Fixing bpmn infra endpoint in so-monitoring yaml removed att-aic from codebase default cloud owner now configurable Set homingService in WorkflowAction Fix Java Ex in Homing Version should be 1.3.1 to release new dockers Pnf Spring Environment correction test property now has dynamic wiremock port removed test specific wiremock rule that was causing problems re-enabled and corrected integration tests for so-bpmn-tasks Test to get sniro homing v2 test working by splitting test suites for each spring application Reverted changes to old migration scripts.. Fixed spring context issue with test HomingV2. Removed unused import to fix compilation errors Fixed onap changes to homing, migrated homingV2 to homingBB, fixed broken junits again. - Updated isUseHttpsWithDmaapTest to check assertTrue rather than assertFalse. - Upgraded code to make the isUseHttpsWithDmaap configurable. It will default to true if no value is found in the config file. moved workflowaction test class to the test section added status message update for retry and rollback beefed up error message debug logging and req db msg added debug lines to workflowactionbbtasks reqdbcall Issue-ID: SO-1187 Change-Id: Iec1aff4ed30a43c0e0b2cdb06c28d8db8a99a830 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSORESTClient/src/test/java/org/onap')
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java57
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java40
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java184
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java42
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java40
5 files changed, 0 insertions, 363 deletions
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java
deleted file mode 100644
index 2c81fda32b..0000000000
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/APIResponseTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 AT&T 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.
- * 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.
- * ============LICENSE_END=========================================================
-*/
-
-package org.onap.so.rest;
-
-import static org.junit.Assert.assertEquals;
-
-import org.json.JSONObject;
-import org.junit.Test;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.ProtocolVersion;
-import org.apache.http.HttpEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.message.BasicHttpResponse;
-
-public class APIResponseTest {
-
- @Test
- public void test() throws Exception {
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("firstName", "firstName1");
- jsonObject.put("lastName", "lastName1");
- String jsonObjectAsString= jsonObject.toString();
- HttpEntity entity = new StringEntity(jsonObjectAsString, ContentType.APPLICATION_JSON);
- ProtocolVersion ver = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse response = new BasicHttpResponse(ver, 1, "Ok");
- response.setStatusLine(ver, 200);
- response.setEntity(entity);
- response.setHeader("name", "value");
- response.setStatusCode(200);
- APIResponse apiResponse = new APIResponse(response);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonObject.toString(), apiResponse.getResponseBodyAsString());
- assertEquals("value", apiResponse.getFirstHeader("name"));
- assertEquals(1, apiResponse.getAllHeaders().length);
- assertEquals(49, apiResponse.getResponseBodyAsByteArray().length);
- }
-}
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java
deleted file mode 100644
index bc096687b7..0000000000
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/HttpHeaderTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
-*/
-
-package org.onap.so.rest;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class HttpHeaderTest {
-
- @Test
- public void test() {
- HttpHeader hth= new HttpHeader("name", "value");
- assertEquals("name", hth.getName());
- assertEquals("value", hth.getValue());
- }
-
- @Test (expected = IllegalArgumentException.class)
- public void testException() {
- HttpHeader httpHeader = new HttpHeader(null, "value"); //null
- }
-}
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
deleted file mode 100644
index a79f0aa536..0000000000
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
-*/
-
-package org.onap.so.rest;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.spy;
-
-import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.springframework.http.HttpStatus;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class RESTClientTest {
-
- private RESTClient restClient;
- private JSONObject jsonPayload;
- private JSONObject jsonResponse;
- private String jsonObjectAsString;
- private String jsonResponseAsString;
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
-
- @Before
- public void before() throws Exception {
- jsonPayload = new JSONObject();
- jsonPayload.put("firstName", "firstName1");
- jsonPayload.put("lastName", "lastName1");
- jsonObjectAsString = jsonPayload.toString();
- jsonResponse = new JSONObject();
- jsonResponse.put("response", "responseValue");
- jsonResponseAsString = jsonResponse.toString();
- restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port());
- }
-
- @Test
- public void testHeadersParameters() throws Exception {
- restClient.setHeader("name", "value");
- restClient.setParameter("name", "value");
- assertEquals("[value]", restClient.getParameters().get("name").toString());
- assertEquals("[value]", restClient.getHeaders().get("name").toString());
- restClient.setHeader("name", "value2");
- assertEquals("[value2]", restClient.getHeaders().get("name").toString());
- restClient.setParameter("name", "value2");
- assertEquals("[value2]", restClient.getParameters().get("name").toString());
- restClient.addParameter("name", "value");
- assertEquals(1, restClient.getParameters().size());
- restClient.addAuthorizationHeader("token");
- assertEquals("[token]", restClient.getHeaders().get("Authorization").toString());
- assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL());
- restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1");
- assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL());
- }
-
- @Test
- public void testHttpPost() throws Exception {
- RESTClient restClientMock = mock(RESTClient.class);
- restClientMock = spy(restClient);
- wireMockRule.stubFor(post(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClientMock.httpPost(jsonObjectAsString);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- verify(restClientMock, times(2)).getURL();
- }
-
- @Test
- public void testPost() throws Exception {
- wireMockRule.stubFor(post(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.post();
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testHttpPut() throws Exception {
- wireMockRule.stubFor(put(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- restClient.setParameter("name", "value");
- APIResponse apiResponse = restClient.httpPut(jsonObjectAsString);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
-
- }
-
- @Test
- public void testHttpPatch() throws Exception {
- wireMockRule.stubFor(patch(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.httpPatch(jsonObjectAsString);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testPatch_withParameter() throws Exception {
- wireMockRule.stubFor(patch(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- restClient.setParameter("name", "value");
- APIResponse apiResponse = restClient.patch(jsonObjectAsString);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testHttpDelete_withPayload() throws Exception {
- wireMockRule.stubFor(delete(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.httpDelete(jsonObjectAsString);
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testHttpDelete() throws Exception {
- wireMockRule.stubFor(delete(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.httpDelete();
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testDelete() throws Exception {
- wireMockRule.stubFor(delete(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.delete();
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
- @Test
- public void testHttpGet() throws Exception {
- wireMockRule.stubFor(get(urlPathMatching("/example/*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value()).withBody(jsonResponseAsString)));
- APIResponse apiResponse = restClient.httpGet();
- assertEquals(200, apiResponse.getStatusCode());
- assertEquals(jsonResponseAsString, apiResponse.getResponseBodyAsString());
- assertEquals("application/json", apiResponse.getFirstHeader("Content-Type"));
- }
-
-}
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java
deleted file mode 100644
index 82c3c37be0..0000000000
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTConfigTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
-*/
-
-package org.onap.so.rest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import org.junit.Test;
-
-public class RESTConfigTest {
-
- @Test
- public void test() {
- RESTConfig rcfg=mock(RESTConfig.class);
- RESTConfig rcf=new RESTConfig("URL");
- RESTConfig rcfi=new RESTConfig("URL", true);
- RESTConfig rcfo=new RESTConfig("URL", "10.2.3.101", 5020);
- RESTConfig rcfn=new RESTConfig("URL", "10.2.3.101", 5020, true);
- assert(rcfo.getProxyHost().equals("10.2.3.101"));
- assertEquals(5020,rcfn.getProxyPort());
- assert(rcf.getURL().equals("URL"));
- assertTrue(rcfn.trustAllCerts());
- }
-}
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java
deleted file mode 100644
index 19339a187d..0000000000
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTExceptionTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
-*/
-
-package org.onap.so.rest;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import org.junit.Test;
-
-public class RESTExceptionTest {
-
- @Test
- public void test() {
- RESTException rexm=mock(RESTException.class);
- RESTException rex=new RESTException("Error");
- RESTException recpt=new RESTException(200, "Error");
- assert(rex.getErrorMessage().equals("Error"));
- assertEquals(200,recpt.getStatusCode());
- Throwable throwable = mock(Throwable.class);
- RESTException restException = new RESTException(throwable);
- assertEquals(-1, restException.getStatusCode());
- }
-}