From 02b460468fe94e344c357af9d98e40640474be62 Mon Sep 17 00:00:00 2001 From: "arul.nambi" Date: Fri, 1 Sep 2017 13:18:55 -0400 Subject: [AAI-259] Changing self link Issure-ID: AAI-259 Change-Id: Iceab79a87852579b732f2d2c03dd0cb19e6c6814 Signed-off-by: arul.nambi --- .../dal/aai/config/ActiveInventoryConfigTest.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/test/java') diff --git a/src/test/java/org/openecomp/sparky/dal/aai/config/ActiveInventoryConfigTest.java b/src/test/java/org/openecomp/sparky/dal/aai/config/ActiveInventoryConfigTest.java index 483c792..be51f74 100644 --- a/src/test/java/org/openecomp/sparky/dal/aai/config/ActiveInventoryConfigTest.java +++ b/src/test/java/org/openecomp/sparky/dal/aai/config/ActiveInventoryConfigTest.java @@ -179,4 +179,35 @@ public class ActiveInventoryConfigTest { assertEquals("https://aai-host:9191/aai/v10/business/customers/customer/1234", config.repairSelfLink("/aai/v10/business/customers/customer/1234")); } + + @Test + public void validateResourcePathExtraction() throws Exception { + // https with API version + assertEquals("/aai/v10/business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("https://aai-host:9191/aai/v10/business/customers/customer/1234")); + + // https without API version + assertEquals("/business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("https://aai-host:9191/business/customers/customer/1234")); + + // http with API version + assertEquals("/aai/v10/business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("http://aai-host:9191/aai/v10/business/customers/customer/1234")); + + // http without API verison + assertEquals("/business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("http://aai-host:9191/business/customers/customer/1234")); + + // no scheme, host, or port + assertEquals("business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("business/customers/customer/1234")); + + // no scheme, host, or port with API version + assertEquals("/aai/v10/business/customers/customer/1234", ActiveInventoryConfig + .extractResourcePath("/aai/v10/business/customers/customer/1234")); + + // no scheme, host, or port with API version + assertEquals("", ActiveInventoryConfig + .extractResourcePath("")); + } } \ No newline at end of file -- cgit 1.2.3-korg