diff options
author | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2018-11-11 13:37:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-11-11 13:37:32 +0000 |
commit | 46608cf8013fa8cca14641fa13bbb39393300bb7 (patch) | |
tree | 1c31641836e7a94c6a09f4131021bc1a38db1382 /vid-app-common/src/main/java/org/onap/vid/controllers/WebConfig.java | |
parent | 9603e39ff0b5f3b409c7938c5315b0ea0a940dd5 (diff) | |
parent | 8e7db0db55f8910b19898d2b401e6ea15e115b33 (diff) |
Merge "Nodes query rewritten to generic rest client"
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 0f4b536a1..fb8b5195c 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()); + } } |