From 5a34dbbd091db590a9a38e5398140933ae9ed639 Mon Sep 17 00:00:00 2001 From: Jennie Jia Date: Tue, 11 Sep 2018 15:06:39 +0000 Subject: Update API and common model mapping Issue-ID: LOG-646 Change-Id: Ie56d3f697abbafecf9c2d9f73fa52bee1833a469 Signed-off-by: Jennie Jia --- .../pomba_aai_context_builder/RestUtilTest.java | 122 ++++++++------------- 1 file changed, 48 insertions(+), 74 deletions(-) (limited to 'src/test') diff --git a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java index f8991c1..8b3fe63 100644 --- a/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java +++ b/src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java @@ -61,80 +61,54 @@ public class RestUtilTest { @Rule public WireMockRule aaiEnricherRule = new WireMockRule(wireMockConfig().port(9808)); - @Test - public void testValidateURL() { - // Missing ServiceInstanceId or it is null - try { - RestUtil.validateURL("", "modelVersionId", "modelInvariantId", "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId")); - } - - try { - RestUtil.validateURL(null, "modelVersionId", "modelInvariantId", "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId")); - } - - // Missing ModelVersionId or it is null - try { - RestUtil.validateURL("serviceInstanceId", "", "modelInvariantId", "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId")); - } - - try { - RestUtil.validateURL("serviceInstanceId", null, "modelInvariantId", "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId")); - } - - // Missing ModelInvariantId or it is null - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", "", "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId")); - } - - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", null, "serviceType", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId")); - } - - // Missing ServiceType or it is null - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "", "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceType")); - } - - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", null, "customerId"); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceType")); - } - - // Missing CustomerId or it is null - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "serviceType", ""); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: customerId")); - } - - - try { - RestUtil.validateURL("serviceInstanceId", "modelVersionId", "modelInvariantId", "serviceType", null); - } catch (AuditException e) { - assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: customerId")); - } - } - - @Test - public void testIsEmptyJson() { - assertTrue(RestUtil.isEmptyJson("{}")); - assertTrue(!RestUtil.isEmptyJson("{Not Empty}")); - } + @Test + public void testValidateURL() { + // Missing ServiceInstanceId or it is null + try { + RestUtil.validateURL("", "modelVersionId", "modelInvariantId"); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId")); + } + + try { + RestUtil.validateURL(null, "modelVersionId", "modelInvariantId"); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: serviceInstanceId")); + } + + // Missing ModelVersionId or it is null + try { + RestUtil.validateURL("serviceInstanceId", "", "modelInvariantId"); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId")); + } + + try { + RestUtil.validateURL("serviceInstanceId", null, "modelInvariantId"); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelVersionId")); + } + + // Missing ModelInvariantId or it is null + try { + RestUtil.validateURL("serviceInstanceId", "modelVersionId", ""); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId")); + } + + try { + RestUtil.validateURL("serviceInstanceId", "modelVersionId", null); + } catch (AuditException e) { + assertTrue(e.getMessage().contains("Invalid request URL, missing parameter: modelInvariantId")); + } + + } + + @Test + public void testIsEmptyJson() { + assertTrue(RestUtil.isEmptyJson("{}")); + assertTrue(!RestUtil.isEmptyJson("{Not Empty}")); + } @Test public void testObtainResouceLinkBasedOnServiceInstanceFromAAI() throws Exception { -- cgit 1.2.3-korg