diff options
author | Jennie Jia <Jennie.Jia@amdocs.com> | 2018-09-11 15:06:39 +0000 |
---|---|---|
committer | Jennie Jia <Jennie.Jia@amdocs.com> | 2018-09-11 21:31:32 +0000 |
commit | 5a34dbbd091db590a9a38e5398140933ae9ed639 (patch) | |
tree | 5d328b1fbe880311718de905b6dbc159f55d1abe /src/test | |
parent | 797bf1d50236fddcbbb2ca091729e2e64b047f73 (diff) |
Update API and common model mapping
Issue-ID: LOG-646
Change-Id: Ie56d3f697abbafecf9c2d9f73fa52bee1833a469
Signed-off-by: Jennie Jia <Jennie.Jia@amdocs.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/logging_analytics/pomba/pomba_aai_context_builder/RestUtilTest.java | 122 |
1 files changed, 48 insertions, 74 deletions
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 { |