Adding API version in rest endpoints 01/12401/1
authorambrishest <ambrish.singh@est.tech>
Thu, 21 Dec 2023 12:32:22 +0000 (12:32 +0000)
committerambrishest <ambrish.singh@est.tech>
Thu, 21 Dec 2023 12:32:36 +0000 (12:32 +0000)
Issue-ID: NONRTRIC-944
Change-Id: I811e9333dd693e24acd71d82c34ef5cfc5f38100
Signed-off-by: ambrishest <ambrish.singh@est.tech>
test/servicestub/service-stub-build-start.sh
test/servicestub/src/main/java/org/oran/helloworld/rest/HelloWorldController.java
test/servicestub/src/test/java/org/oran/helloworld/rest/HelloWorldControllerTest.java

index b798e86..885bd77 100644 (file)
@@ -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"
index 994e151..057191e 100644 (file)
@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;\r
 \r
 @RestController\r
-@RequestMapping("/helloworld")\r
+@RequestMapping("/v1/helloworld")\r
 public class HelloWorldController {\r
 \r
     @RequestMapping("")\r
index 0d29c8b..36f335f 100644 (file)
@@ -43,7 +43,7 @@ public class HelloWorldControllerTest {
     public void testHelloWorldEndpoint() throws Exception {\r
         when(helloWorldController.helloWorld()).thenReturn("Hello World from service stub\n");\r
 \r
-        mockMvc.perform(get("/helloworld"))\r
+        mockMvc.perform(get("/v1/helloworld"))\r
             .andExpect(status().isOk())\r
             .andExpect(content().string("Hello World from service stub\n"));\r
     }\r
@@ -52,7 +52,7 @@ public class HelloWorldControllerTest {
     public void testHelloWorldSmeEndpoint() throws Exception {\r
         when(helloWorldController.helloWorldSme()).thenReturn("Hello World from SME\n");\r
 \r
-        mockMvc.perform(get("/helloworld/sme"))\r
+        mockMvc.perform(get("/v1/helloworld/sme"))\r
             .andExpect(status().isOk())\r
             .andExpect(content().string("Hello World from SME\n"));\r
     }\r