aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test/java/org
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-01-30 16:39:49 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-01-30 16:39:50 -0500
commitf388c24c982a51c47d6b00c72d9252c5e430f44d (patch)
treedbe020213b8fde10c97a3f400dfd77917749608a /adapters/mso-openstack-adapters/src/test/java/org
parent98fce84d19c8aa1eb11fc24a8dddb5b0deb38d7a (diff)
Remove Valet from openstack adapter
Remove Valet from openstack adapter Clean up CI, so it passes on dev branch Fixed bad merge regarding correct method name. Added try catch around createIfNotExists methods to avoid failing sim. Fix broken Fabric Tests from merge Update logging jar dependency for CI Issue-ID: SO-2623 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I572276f751b132ec78d7ab5763f1c76bfc8256c5
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java/org')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java18
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java127
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java29
3 files changed, 11 insertions, 163 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
index ea9512bfa7..5bafe2b1d6 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
@@ -20,6 +20,9 @@
package org.onap.so;
+import org.junit.Test;
+import org.onap.so.openpojo.rules.ToStringTester;
+import org.springframework.stereotype.Component;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
import com.openpojo.reflection.filters.FilterEnum;
@@ -27,11 +30,11 @@ import com.openpojo.reflection.filters.FilterNonConcrete;
import com.openpojo.reflection.filters.FilterPackageInfo;
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.*;
-import com.openpojo.validation.test.impl.*;
-import org.junit.Test;
-import org.onap.so.openpojo.rules.ToStringTester;
-import org.springframework.stereotype.Component;
+import com.openpojo.validation.rule.impl.NoPublicFieldsExceptStaticFinalRule;
+import com.openpojo.validation.rule.impl.NoStaticExceptFinalRule;
+import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
public class BeansTest {
@@ -50,8 +53,6 @@ public class BeansTest {
test("org.onap.so.adapters.vnf.async.client");
test("org.onap.so.adapters.network");
test("org.onap.so.adapters.vnf");
- test("org.onap.so.adapters.valet");
- test("org.onap.so.adapters.valet.beans");
test("org.onap.so.vdu.utils");
}
@@ -68,18 +69,21 @@ public class BeansTest {
}
private static class FilterTestClasses implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return !pojoClass.getSourcePath().contains("/test-classes/");
}
}
private static class FilterTestNestedClasses implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return !pojoClass.isNestedClass();
}
}
private static class FilterBeans implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return pojoClass.getAnnotations().stream().filter(o -> o instanceof Component).count() <= 0;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
deleted file mode 100644
index 61d2d08590..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 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.adapters.valet;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetConfirmPutRequest_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePostResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePutResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetDeleteDeleteResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetRollbackPutRequest_200;
-import java.io.File;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
-import org.onap.so.adapters.valet.beans.ValetCreateResponse;
-import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
-import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
-import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ValetClientTest extends BaseRestTestUtils {
- @Autowired
- protected ValetClient client;
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Before
- public void init() {
- client.baseUrl = "http://localhost:" + wireMockPort;
- }
-
- @Test
- public void testCallValetCreateRequest() throws Exception {
- ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"),
- ValetCreateResponse.class);
- GenericValetResponse<ValetCreateResponse> expected =
- new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
-
- mockValetCreatePostResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vcr));
-
- GenericValetResponse<ValetCreateResponse> actual =
- client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId",
- "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetUpdateRequest() throws Exception {
- ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"),
- ValetUpdateResponse.class);
- GenericValetResponse<ValetUpdateResponse> expected =
- new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur);
-
- mockValetCreatePutResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vur));
-
- GenericValetResponse<ValetUpdateResponse> actual =
- client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId",
- "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetDeleteRequest() throws Exception {
- ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"),
- ValetDeleteResponse.class);
- GenericValetResponse<ValetDeleteResponse> expected =
- new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr);
-
- mockValetDeleteDeleteResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vdr));
-
- GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId",
- "ownerId", "tenantId", "vfModuleId", "vfModuleName");
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetConfirmRequest() throws Exception {
- ValetConfirmResponse vcr = new ValetConfirmResponse();
- GenericValetResponse<ValetConfirmResponse> expected =
- new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
-
- mockValetConfirmPutRequest_200(wireMockServer, "requestId", "{}");
-
- GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId");
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetRollbackRequest() throws Exception {
- ValetRollbackResponse vrr = new ValetRollbackResponse();
- GenericValetResponse<ValetRollbackResponse> expected =
- new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr);
-
- mockValetRollbackPutRequest_200(wireMockServer, "requestId", "{}");
-
- GenericValetResponse<ValetRollbackResponse> actual =
- client.callValetRollbackRequest("requestId", "stackId", true, "error");
-
- assertThat(actual, sameBeanAs(expected));
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
index bb00700b60..73bac86b74 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
@@ -454,35 +454,6 @@ public class StubOpenStack {
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetCreatePostResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer
- .stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetCreatePutResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetDeleteDeleteResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer
- .stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetConfirmPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(
- put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetRollbackPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(
- put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
private static String getBodyFromFileVnfAdapter(String replaceWith) throws IOException {
String temp = readFile("src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json");
if (replaceWith == null) {