Enable sample SME invoker to query dicovered endpoint 89/12789/1 master
authoraravind.est <aravindhan.a@est.tech>
Fri, 26 Apr 2024 09:45:30 +0000 (10:45 +0100)
committeraravind.est <aravindhan.a@est.tech>
Fri, 26 Apr 2024 09:45:30 +0000 (10:45 +0100)
SME invoker queries the endpoint received from SME service discovery.

Issue-ID: NONRTRIC-981
Change-Id: I532aeecf53734d338189fc81740a99355ee2e1a1
Signed-off-by: aravind.est <aravindhan.a@est.tech>
sample-services/hello-world-sme-invoker/src/main/java/org/oransc/nonrtric/sample/rest/HelloWorldSmeInvokerComponent.java

index 7d76b4f..7902a3b 100644 (file)
@@ -60,24 +60,22 @@ public class HelloWorldSmeInvokerComponent {
                 throw new CapifAccessException("Unexpected error");\r
             }\r
 \r
-            //TODO The below should be uncommented once SME Manager provides an accessible URI\r
-\r
-//            String helloWorldEndpoint = "";\r
-//            List<String> apiSetEndpoints = getApiSetEndpoints(apiResponse, baseUrl);\r
-//            if (apiSetEndpoints != null && !apiSetEndpoints.isEmpty()) {\r
-//                helloWorldEndpoint = apiSetEndpoints.get(0);\r
-//            }\r
-//\r
-//            if (helloWorldEndpoint != null && !helloWorldEndpoint.isEmpty()) {\r
-//                try {\r
-//                    String responseHelloWorld = restTemplate.getForObject(helloWorldEndpoint, String.class);\r
-//                    logger.info("Response :- ", responseHelloWorld);\r
-//                } catch (IllegalArgumentException e) {\r
-//                    throw new CapifAccessException("Error accessing the URL :- " + helloWorldEndpoint);\r
-//                } catch (Exception e) {\r
-//                    throw new CapifAccessException("Unexpected error");\r
-//                }\r
-//            }\r
+            String helloWorldEndpoint = "";\r
+            List<String> apiSetEndpoints = getApiSetEndpoints(apiResponse, baseUrl);\r
+            if (apiSetEndpoints != null && !apiSetEndpoints.isEmpty()) {\r
+                helloWorldEndpoint = apiSetEndpoints.get(0);\r
+            }\r
+\r
+            if (helloWorldEndpoint != null && !helloWorldEndpoint.isEmpty()) {\r
+                try {\r
+                    String responseHelloWorld = restTemplate.getForObject(helloWorldEndpoint, String.class);\r
+                    logger.info("rApp SME Provider Response : {}", responseHelloWorld);\r
+                } catch (IllegalArgumentException e) {\r
+                    throw new CapifAccessException("Error accessing the URL :- " + helloWorldEndpoint);\r
+                } catch (Exception e) {\r
+                    throw new CapifAccessException("Unexpected error");\r
+                }\r
+            }\r
         }\r
     }\r
 \r