Minor changes

Increased the TCP timeouts
Made managedElementId in GET rics mandatory (bugfix)

Change-Id: Ie2683d1fdd7e0abfc15877f4f4039e2f82f62eea
Issue-ID: NONRTRIC-164
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
index 0289db9..83592ec 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
@@ -20,16 +20,24 @@
 
 package org.oransc.policyagent.clients;
 
+import io.netty.channel.ChannelOption;
+import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.handler.timeout.WriteTimeoutHandler;
+
 import java.lang.invoke.MethodHandles;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.reactive.ReactorClientHttpConnector;
 import org.springframework.lang.Nullable;
 import org.springframework.web.reactive.function.client.WebClient;
 import org.springframework.web.reactive.function.client.WebClient.RequestHeadersSpec;
+
 import reactor.core.publisher.Mono;
+import reactor.netty.http.client.HttpClient;
+import reactor.netty.tcp.TcpClient;
 
 /**
  * Generic reactive REST client.
@@ -40,7 +48,21 @@
     private final String baseUrl;
 
     public AsyncRestClient(String baseUrl) {
-        this.client = WebClient.create(baseUrl);
+
+        TcpClient tcpClient = TcpClient.create() //
+            .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
+            .doOnConnected(connection -> {
+                connection.addHandler(new ReadTimeoutHandler(10));
+                connection.addHandler(new WriteTimeoutHandler(30));
+            });
+        HttpClient httpClient = HttpClient.from(tcpClient);
+        ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
+
+        this.client = WebClient.builder() //
+            .clientConnector(connector) //
+            .baseUrl(baseUrl) //
+            .build();
+
         this.baseUrl = baseUrl;
     }
 
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfigParser.java b/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfigParser.java
index dcfbc64..dd35e5b 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfigParser.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfigParser.java
@@ -215,7 +215,6 @@
         } catch (MalformedURLException e) {
             throw new ServiceException("Could not parse the URL", e);
         }
-
     }
 
     private static @NotNull String getAsString(JsonObject obj, String memberName) throws ServiceException {
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
index 465ee78..33a301c 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
@@ -67,14 +67,14 @@
             @ApiResponse(code = 404, message = "RIC is not fond", response = String.class) //
         })
     public ResponseEntity<String> getRic(
-        @RequestParam(name = "managedElementId", required = false, defaultValue = "") String managedElementId) {
+        @RequestParam(name = "managedElementId", required = true) String managedElementId) {
 
         Optional<Ric> ric = this.rics.lookupRicForManagedElement(managedElementId);
 
         if (ric.isPresent()) {
             return new ResponseEntity<>(ric.get().name(), HttpStatus.OK);
         } else {
-            return new ResponseEntity<>("", HttpStatus.NOT_FOUND);
+            return new ResponseEntity<>("No RIC found", HttpStatus.NOT_FOUND);
         }
     }