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/test/java/org/onap/vid/config | |
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/test/java/org/onap/vid/config')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java index 56ac28d2..e5b3c365 100644 --- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java +++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java @@ -21,13 +21,20 @@ package org.onap.vid.config; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; import org.hibernate.SessionFactory; import org.mockito.Mockito; import org.onap.portalsdk.core.service.DataAccessService; 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.util.HttpsAuthClient; import org.onap.vid.aai.util.SSLContextProvider; import org.onap.vid.aai.util.SystemPropertyHelper; +import org.onap.vid.client.SyncRestClient; import org.onap.vid.job.JobAdapter; import org.onap.vid.job.JobsBrokerService; import org.onap.vid.job.command.InProgressStatusCommand; @@ -84,12 +91,41 @@ public class JobCommandsConfigWithMockedMso { } @Bean + public AaiOverTLSClientInterface AaiOverTLSClient(){ + 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()); + } + + @Bean public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService, JobAdapter jobAdapter, JobsBrokerService jobsBrokerService, SessionFactory sessionFactory, - AaiClientInterface aaiClient) { - return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient); + AaiClientInterface aaiClient, + AaiOverTLSClientInterface aaiOverTLSClientInterface) { + return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient, aaiOverTLSClientInterface); } @Bean |