From: ambrishest Date: Thu, 21 Dec 2023 12:32:22 +0000 (+0000) Subject: Adding API version in rest endpoints X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=3c504be356d2ac9fc5195eb45692e1b756caa9f3;p=nonrtric.git Adding API version in rest endpoints Issue-ID: NONRTRIC-944 Change-Id: I811e9333dd693e24acd71d82c34ef5cfc5f38100 Signed-off-by: ambrishest --- diff --git a/test/servicestub/service-stub-build-start.sh b/test/servicestub/service-stub-build-start.sh index b798e867..885bd772 100644 --- a/test/servicestub/service-stub-build-start.sh +++ b/test/servicestub/service-stub-build-start.sh @@ -30,11 +30,11 @@ docker run --rm -d -p 8080:8080 --name $NAME $IMAGE_NAME sleep 10 echo "Make an HTTP request to the Hello World endpoint and display the response" -response=$(curl -s http://localhost:8080/helloworld/sme) +response=$(curl -s http://localhost:8080/v1/helloworld/sme) -echo "Response from the /helloworld/sme endpoint: " +echo "Response from the /v1/helloworld/sme endpoint: " echo "$response" -response2=$(curl -s http://localhost:8080/helloworld) -echo "Response from the /helloworld endpoint: " +response2=$(curl -s http://localhost:8080/v1/helloworld) +echo "Response from the /v1/helloworld endpoint: " echo "$response2" diff --git a/test/servicestub/src/main/java/org/oran/helloworld/rest/HelloWorldController.java b/test/servicestub/src/main/java/org/oran/helloworld/rest/HelloWorldController.java index 994e1513..057191ec 100644 --- a/test/servicestub/src/main/java/org/oran/helloworld/rest/HelloWorldController.java +++ b/test/servicestub/src/main/java/org/oran/helloworld/rest/HelloWorldController.java @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/helloworld") +@RequestMapping("/v1/helloworld") public class HelloWorldController { @RequestMapping("") diff --git a/test/servicestub/src/test/java/org/oran/helloworld/rest/HelloWorldControllerTest.java b/test/servicestub/src/test/java/org/oran/helloworld/rest/HelloWorldControllerTest.java index 0d29c8bd..36f335f4 100644 --- a/test/servicestub/src/test/java/org/oran/helloworld/rest/HelloWorldControllerTest.java +++ b/test/servicestub/src/test/java/org/oran/helloworld/rest/HelloWorldControllerTest.java @@ -43,7 +43,7 @@ public class HelloWorldControllerTest { public void testHelloWorldEndpoint() throws Exception { when(helloWorldController.helloWorld()).thenReturn("Hello World from service stub\n"); - mockMvc.perform(get("/helloworld")) + mockMvc.perform(get("/v1/helloworld")) .andExpect(status().isOk()) .andExpect(content().string("Hello World from service stub\n")); } @@ -52,7 +52,7 @@ public class HelloWorldControllerTest { public void testHelloWorldSmeEndpoint() throws Exception { when(helloWorldController.helloWorldSme()).thenReturn("Hello World from SME\n"); - mockMvc.perform(get("/helloworld/sme")) + mockMvc.perform(get("/v1/helloworld/sme")) .andExpect(status().isOk()) .andExpect(content().string("Hello World from SME\n")); }