diff options
author | 2018-03-07 18:17:22 -0800 | |
---|---|---|
committer | 2018-03-08 09:17:48 -0800 | |
commit | 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (patch) | |
tree | 0d943226962ae31c0bf2fd0696e91c6bb41d099c /mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java | |
parent | dee036198ee09d71bfdd50247c1d23a7f472df87 (diff) |
Reduce log noise/warnings format to conventions
Reduce build log warnings by formatting tests
to ONAP code conventions (removing tabs etc.)
Issue-ID: SO-368
Change-Id: I48c6d359b83617aebeb79db4e30c1d72d31f7eec
Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java | 309 |
1 files changed, 155 insertions, 154 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java index 5f2f39606f..04175fd113 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java @@ -22,6 +22,7 @@ package org.openecomp.mso.apihandlerinfra; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+
import java.io.IOException;
import javax.ws.rs.core.Response;
@@ -43,159 +44,159 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe public class OrchestrationRequestsTest {
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- @Mock
- private static RequestsDatabase db;
- private static OrchestrationRequests orReq;
- private static GetOrchestrationResponse orRes;
-
- @Test
- public void testGetOrchestrationRequest() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setRequestType("createInstance");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
- infraRequests.setRequestStatus("IN_PROGRESS");
- infraRequests.setRequestorId("ab1234");
- String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
- infraRequests.setRequestBody(body);
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- ///// mock mapInfraActiveRequestToRequest()
- Request request = new Request();
- request.setRequestId(infraRequests.getRequestId());
- request.setRequestScope(infraRequests.getRequestScope());
- request.setRequestType(infraRequests.getRequestAction());
-
- InstanceReferences ir = new InstanceReferences();
- if (infraRequests.getNetworkId() != null)
- ir.setNetworkInstanceId(infraRequests.getNetworkId());
- if (infraRequests.getNetworkName() != null)
- ir.setNetworkInstanceName(infraRequests.getNetworkName());
- if (infraRequests.getServiceInstanceId() != null)
- ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
- if (infraRequests.getServiceInstanceName() != null)
- ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
- if (infraRequests.getVfModuleId() != null)
- ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
- if (infraRequests.getVfModuleName() != null)
- ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
- if (infraRequests.getVnfId() != null)
- ir.setVnfInstanceId(infraRequests.getVnfId());
- if (infraRequests.getVnfName() != null)
- ir.setVnfInstanceName(infraRequests.getVnfName());
- if (infraRequests.getVolumeGroupId() != null)
- ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
- if (infraRequests.getVolumeGroupName() != null)
- ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
- if (infraRequests.getRequestorId() != null)
- ir.setRequestorId(infraRequests.getRequestorId());
-
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
-
- request.setRequestStatus(status);
- // RequestStatus reqStatus = request.getRequestStatus();
- orRes.setRequest(request);
- Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
- Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
-
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
- "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
- "19123c2924c648eb8e42a3c1f14b7682");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
- "bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
- "IN_PROGRESS");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
- "ab1234");
- assertEquals(request.getInstanceReferences().getServiceInstanceId(),"bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(request.getInstanceReferences().getRequestorId(),"ab1234");
- assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testGetOrchestrationRequestNotPresent() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- RequestStatus status = new RequestStatus();
- request.setRequestStatus(status);
- orRes.setRequest(request);
- assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testUnlockOrchestrationRequest()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
-
- MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- msoRequest.parseOrchestration(sir);
-
- //create object instead of a DB call.
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
- infraRequests.setRequestStatus("IN-PROGRESS");
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- InstanceReferences ir = new InstanceReferences();
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
- request.setRequestStatus(status);
- RequestStatus reqStatus = request.getRequestStatus();
-
- assertEquals(reqStatus.getRequestState(),"IN-PROGRESS");
-
- if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")){
- reqStatus.setRequestState(Status.UNLOCKED.toString ());
- }
- assertEquals(reqStatus.getRequestState(),"UNLOCKED");
-
- }
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ @Mock
+ private static RequestsDatabase db;
+ private static OrchestrationRequests orReq;
+ private static GetOrchestrationResponse orRes;
+
+ @Test
+ public void testGetOrchestrationRequest() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setRequestType("createInstance");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
+ infraRequests.setRequestStatus("IN_PROGRESS");
+ infraRequests.setRequestorId("ab1234");
+ String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
+ infraRequests.setRequestBody(body);
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ ///// mock mapInfraActiveRequestToRequest()
+ Request request = new Request();
+ request.setRequestId(infraRequests.getRequestId());
+ request.setRequestScope(infraRequests.getRequestScope());
+ request.setRequestType(infraRequests.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if (infraRequests.getNetworkId() != null)
+ ir.setNetworkInstanceId(infraRequests.getNetworkId());
+ if (infraRequests.getNetworkName() != null)
+ ir.setNetworkInstanceName(infraRequests.getNetworkName());
+ if (infraRequests.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
+ if (infraRequests.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
+ if (infraRequests.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
+ if (infraRequests.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
+ if (infraRequests.getVnfId() != null)
+ ir.setVnfInstanceId(infraRequests.getVnfId());
+ if (infraRequests.getVnfName() != null)
+ ir.setVnfInstanceName(infraRequests.getVnfName());
+ if (infraRequests.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
+ if (infraRequests.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
+ if (infraRequests.getRequestorId() != null)
+ ir.setRequestorId(infraRequests.getRequestorId());
+
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+
+ request.setRequestStatus(status);
+ // RequestStatus reqStatus = request.getRequestStatus();
+ orRes.setRequest(request);
+ Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
+ Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
+
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
+ "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
+ "19123c2924c648eb8e42a3c1f14b7682");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
+ "bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
+ "IN_PROGRESS");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
+ "ab1234");
+ assertEquals(request.getInstanceReferences().getServiceInstanceId(), "bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(request.getInstanceReferences().getRequestorId(), "ab1234");
+ assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testGetOrchestrationRequestNotPresent() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ RequestStatus status = new RequestStatus();
+ request.setRequestStatus(status);
+ orRes.setRequest(request);
+ assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testUnlockOrchestrationRequest()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
+
+ MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest.parseOrchestration(sir);
+
+ //create object instead of a DB call.
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
+ infraRequests.setRequestStatus("IN-PROGRESS");
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ InstanceReferences ir = new InstanceReferences();
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+ request.setRequestStatus(status);
+ RequestStatus reqStatus = request.getRequestStatus();
+
+ assertEquals(reqStatus.getRequestState(), "IN-PROGRESS");
+
+ if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")) {
+ reqStatus.setRequestState(Status.UNLOCKED.toString());
+ }
+ assertEquals(reqStatus.getRequestState(), "UNLOCKED");
+
+ }
}
|