diff options
author | 2018-03-09 15:02:18 -0500 | |
---|---|---|
committer | 2018-03-09 15:08:14 -0500 | |
commit | 96b5a685d0c3afddb632e4a68ca7483f933b55dc (patch) | |
tree | 246399de05a3d429bf45ef1e5af2b9b0218d99f3 /mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java | |
parent | 4475278c81668109b2b37a1d2720d8f2910641c4 (diff) |
Revert Reduce log noise/warnings
This reverts commit 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e.
It is seriously impeding our ability complete the promised merge of AT&T
1802 code.
While I'm all for coding standards, if we are serious about using spaces
instead of tabs, then I think we need to (1) agree with the community when
this will happen, (2) do consistently in all files, and (3) enforce it.
Change-Id: Ib9b996f6b6c7d81ac9ac95d58b0c7d8cc39675ff
Issue-ID: SO-368
Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java | 396 |
1 files changed, 196 insertions, 200 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java index ac0fec076a..9c9ebaee35 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java @@ -43,206 +43,202 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; public class VnfRequestHandlerTest { - VnfRequestHandler handler = null; - UriInfo uriInfo = null; - - @Before - public void setup() throws Exception { - - uriInfo = Mockito.mock(UriInfo.class); - Class<?> clazz = VnfRequestHandler.class; - handler = (VnfRequestHandler) clazz.newInstance(); - - Field f1 = handler.getClass().getDeclaredField("uriInfo"); - - f1.setAccessible(true); + VnfRequestHandler handler = null; + UriInfo uriInfo = null; + + @Before + public void setup() throws Exception{ + + uriInfo = Mockito.mock(UriInfo.class); + Class<?> clazz = VnfRequestHandler.class; + handler = (VnfRequestHandler)clazz.newInstance(); + + Field f1 = handler.getClass().getDeclaredField("uriInfo"); + + f1.setAccessible(true); f1.set(handler, uriInfo); - } - - @Test - public void manageVnfRequestTestV2() { - Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); - assertTrue(null != resp); - } - - @Test - public void manageVnfRequestTestv1() { - Response resp = handler.manageVnfRequest("<name>Test</name>", "v1"); - assertTrue(null != resp); - } - - @Test - public void manageVnfRequestTestv3() { - Response resp = handler.manageVnfRequest("<name>Test</name>", "v3"); - assertTrue(null != resp); - } - - @Test - public void manageVnfRequestTestInvalidVersion() { - Response resp = handler.manageVnfRequest("<name>Test</name>", "v30"); - assertTrue(null != resp); - } - - @Test - public void manageVnfRequest2Test() { - Mockito.when(uriInfo.getRequestUri()) - .thenReturn(URI.create("http://localhost:8080/test")); - - new MockUp<MsoPropertiesUtils>() { - @Mock - public synchronized final boolean getNoPropertiesState() { - return false; - } - }; - Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); - assertTrue(null != resp); - } - - @Test - public void fillVnfRequestTest() { - VnfRequest qr = new VnfRequest(); - InfraRequests ar = new InfraRequests(); - ar.setVnfId("1003"); - ar.setVnfName("vnf"); - ar.setVnfType("vnt"); - ar.setTenantId("48889690"); - ar.setProvStatus("uuu"); - ar.setVolumeGroupName("volume"); - ar.setVolumeGroupId("38838"); - ar.setServiceType("vnf"); - ar.setAicNodeClli("djerfe"); - ar.setAaiServiceId("599499"); - ar.setAicCloudRegion("south"); - ar.setVfModuleName("m1"); - ar.setVfModuleId("39949"); - ar.setVfModuleModelName("test"); - ar.setAaiServiceId("37728"); - ar.setVnfParams("test"); - handler.fillVnfRequest(qr, ar, "v1"); - String param = (String) qr.getVnfParams(); - assertTrue(param.equals("test")); - } - - @Test - public void fillVnfRequestTestV2() { - VnfRequest qr = new VnfRequest(); - InfraRequests ar = new InfraRequests(); - ar.setVnfId("1003"); - ar.setVnfName("vnf"); - ar.setVnfType("vnt"); - ar.setTenantId("48889690"); - ar.setProvStatus("uuu"); - ar.setVolumeGroupName("volume"); - ar.setVolumeGroupId("38838"); - ar.setServiceType("vnf"); - ar.setAicNodeClli("djerfe"); - ar.setAaiServiceId("599499"); - ar.setAicCloudRegion("south"); - ar.setVfModuleName("m1"); - ar.setVfModuleId("39949"); - ar.setVfModuleModelName("test"); - ar.setAaiServiceId("37728"); - ar.setVnfParams("test"); - handler.fillVnfRequest(qr, ar, "v2"); - String param = (String) qr.getVnfParams(); - assertTrue(param.equals("test")); - } - - @Test - public void fillVnfRequestTestV3() { - VnfRequest qr = new VnfRequest(); - InfraRequests ar = new InfraRequests(); - ar.setVnfId("1003"); - ar.setVnfName("vnf"); - ar.setVnfType("vnt"); - ar.setTenantId("48889690"); - ar.setProvStatus("uuu"); - ar.setVolumeGroupName("volume"); - ar.setVolumeGroupId("38838"); - ar.setServiceType("vnf"); - ar.setAicNodeClli("djerfe"); - ar.setAaiServiceId("599499"); - ar.setAicCloudRegion("south"); - ar.setVfModuleName("m1"); - ar.setVfModuleId("39949"); - ar.setVfModuleModelName("test"); - ar.setAaiServiceId("37728"); - ar.setVnfParams("test"); - ar.setServiceInstanceId("38829"); - handler.fillVnfRequest(qr, ar, "v3"); - String param = (String) qr.getVnfParams(); - assertTrue(param.equals("test")); - } - - @Test - public void queryFiltersTest() { - new MockUp<RequestsDatabase>() { - @Mock - public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, - String queryValue, - String requestType) { - List<InfraActiveRequests> list = new ArrayList<>(); - InfraActiveRequests req = new InfraActiveRequests(); - req.setAaiServiceId("299392"); - req.setAction("CREATE"); - req.setRequestStatus("COMPLETE"); - req.setProgress(10001L); - req.setSource("test"); - req.setStartTime(new Timestamp(10020100)); - req.setEndTime(new Timestamp(20020100)); - req.setStatusMessage("message"); - list.add(req); - return list; - } - }; - Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1"); - assertTrue(resp.getEntity().toString() != null); - } - - @Test - public void queryFiltersTestNullVnfType() { - new MockUp<RequestsDatabase>() { - @Mock - public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, - String queryValue, - String requestType) { - List<InfraActiveRequests> list = new ArrayList<>(); - InfraActiveRequests req = new InfraActiveRequests(); - req.setAaiServiceId("299392"); - req.setAction("CREATE"); - req.setRequestStatus("COMPLETE"); - req.setProgress(10001L); - req.setSource("test"); - req.setStartTime(new Timestamp(10020100)); - req.setEndTime(new Timestamp(20020100)); - req.setStatusMessage("message"); - list.add(req); - return list; - } - }; - Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1"); - assertTrue(resp.getEntity().toString() != null); - } - - @Test - public void getRequestTest() { - new MockUp<RequestsDatabase>() { - @Mock - public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) { - InfraActiveRequests req = new InfraActiveRequests(); - req.setAaiServiceId("299392"); - req.setAction("CREATE"); - req.setRequestStatus("COMPLETE"); - req.setProgress(10001L); - req.setSource("test"); - req.setStartTime(new Timestamp(10020100)); - req.setEndTime(new Timestamp(20020100)); - req.setStatusMessage("message"); - return req; - } - }; - Response resp = handler.getRequest("388293", "v1"); - assertTrue(resp.getEntity().toString() != null); - } + } + + @Test + public void manageVnfRequestTestV2(){ + Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + @Test + public void manageVnfRequestTestv1(){ + Response resp = handler.manageVnfRequest("<name>Test</name>", "v1"); + assertTrue(null != resp); + } + @Test + public void manageVnfRequestTestv3(){ + Response resp = handler.manageVnfRequest("<name>Test</name>", "v3"); + assertTrue(null != resp); + } + @Test + public void manageVnfRequestTestInvalidVersion(){ + Response resp = handler.manageVnfRequest("<name>Test</name>", "v30"); + assertTrue(null != resp); + } + + @Test + public void manageVnfRequest2Test(){ + Mockito.when(uriInfo.getRequestUri()) + .thenReturn(URI.create("http://localhost:8080/test")); + + new MockUp<MsoPropertiesUtils>() { + @Mock + public synchronized final boolean getNoPropertiesState() { + return false; + } + }; + Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + assertTrue(null != resp); + } + + @Test + public void fillVnfRequestTest(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v1"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + + @Test + public void fillVnfRequestTestV2(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + handler.fillVnfRequest(qr, ar, "v2"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + @Test + public void fillVnfRequestTestV3(){ + VnfRequest qr = new VnfRequest(); + InfraRequests ar = new InfraRequests(); + ar.setVnfId("1003"); + ar.setVnfName("vnf"); + ar.setVnfType("vnt"); + ar.setTenantId("48889690"); + ar.setProvStatus("uuu"); + ar.setVolumeGroupName("volume"); + ar.setVolumeGroupId("38838"); + ar.setServiceType("vnf"); + ar.setAicNodeClli("djerfe"); + ar.setAaiServiceId("599499"); + ar.setAicCloudRegion("south"); + ar.setVfModuleName("m1"); + ar.setVfModuleId("39949"); + ar.setVfModuleModelName("test"); + ar.setAaiServiceId("37728"); + ar.setVnfParams("test"); + ar.setServiceInstanceId("38829"); + handler.fillVnfRequest(qr, ar, "v3"); + String param = (String)qr.getVnfParams(); + assertTrue(param.equals("test")); + } + + @Test + public void queryFiltersTest(){ + new MockUp<RequestsDatabase>() { + @Mock + public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, + String queryValue, + String requestType) { + List <InfraActiveRequests> list = new ArrayList<>(); + InfraActiveRequests req = new InfraActiveRequests(); + req.setAaiServiceId("299392"); + req.setAction("CREATE"); + req.setRequestStatus("COMPLETE"); + req.setProgress(10001L); + req.setSource("test"); + req.setStartTime(new Timestamp(10020100)); + req.setEndTime(new Timestamp(20020100)); + req.setStatusMessage("message"); + list.add(req); + return list; + } + }; + Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void queryFiltersTestNullVnfType(){ + new MockUp<RequestsDatabase>() { + @Mock + public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, + String queryValue, + String requestType) { + List <InfraActiveRequests> list = new ArrayList<>(); + InfraActiveRequests req = new InfraActiveRequests(); + req.setAaiServiceId("299392"); + req.setAction("CREATE"); + req.setRequestStatus("COMPLETE"); + req.setProgress(10001L); + req.setSource("test"); + req.setStartTime(new Timestamp(10020100)); + req.setEndTime(new Timestamp(20020100)); + req.setStatusMessage("message"); + list.add(req); + return list; + } + }; + Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1"); + assertTrue(resp.getEntity().toString() != null); + } + + @Test + public void getRequestTest(){ + new MockUp<RequestsDatabase>() { + @Mock + public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) { + InfraActiveRequests req = new InfraActiveRequests(); + req.setAaiServiceId("299392"); + req.setAction("CREATE"); + req.setRequestStatus("COMPLETE"); + req.setProgress(10001L); + req.setSource("test"); + req.setStartTime(new Timestamp(10020100)); + req.setEndTime(new Timestamp(20020100)); + req.setStatusMessage("message"); + return req; + } + }; + Response resp = handler.getRequest("388293", "v1"); + assertTrue(resp.getEntity().toString() != null); + } } |