Sample producer consumer to get kafka broker from ICS
[nonrtric.git] / 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