diff options
author | golabek <tomasz.golabek@nokia.com> | 2018-08-29 15:29:56 +0200 |
---|---|---|
committer | golabek <tomasz.golabek@nokia.com> | 2018-09-26 09:32:01 +0200 |
commit | 8e7db0db55f8910b19898d2b401e6ea15e115b33 (patch) | |
tree | b048149aefd32a88ae96a87255ecda91c4fb2121 /vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java | |
parent | e40ad0f69d7e1241dbb0fd17412067353c44eb85 (diff) |
Nodes query rewritten to generic rest client
Added AAI Rest Client based on new generic client
Change-Id: I561f8a5d95ec35fdddc648b24965dd9dac03c9a4
Issue-ID: VID-269
Signed-off-by: golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java index 0f4b536a..fb8b5195 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java +++ b/vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java @@ -21,9 +21,14 @@ package org.onap.vid.controllers; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import org.onap.vid.aai.AaiClient; import org.onap.vid.aai.AaiClientInterface; +import org.onap.vid.aai.AaiOverTLSClient; +import org.onap.vid.aai.AaiOverTLSClientInterface; +import org.onap.vid.aai.AaiOverTLSPropertySupplier; import org.onap.vid.aai.AaiResponseTranslator; import org.onap.vid.aai.PombaClientImpl; import org.onap.vid.aai.PombaClientInterface; @@ -48,7 +53,6 @@ import org.onap.vid.services.VidService; import org.onap.vid.services.VidServiceImpl; import org.onap.vid.scheduler.SchedulerRestInterface; import org.onap.vid.scheduler.SchedulerRestInterfaceIfc; -import org.onap.vid.services.*; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -161,4 +165,34 @@ public class WebConfig { public SchedulerRestInterfaceIfc getSchedulerRestInterface(){ return new SchedulerRestInterface(); } + + + @Bean + public AaiOverTLSClientInterface getAaiOverTLSClientInterface() { + + io.joshworks.restclient.http.mapper.ObjectMapper objectMapper = new io.joshworks.restclient.http.mapper.ObjectMapper() { + + ObjectMapper om = new ObjectMapper(); + + @Override + public <T> T readValue(String s, Class<T> aClass) { + try { + return om.readValue(s, aClass); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public String writeValue(Object o) { + try { + return om.writeValueAsString(o); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + }; + + return new AaiOverTLSClient(new SyncRestClient(objectMapper), new AaiOverTLSPropertySupplier()); + } } |