aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2018-02-20 18:03:30 +0200
committerOfir Sonsino <os0695@intl.att.com>2018-02-27 14:47:52 +0200
commitefedea1c5d80532f5b1180d57c8dafce5dcb302a (patch)
treec4bdefe8758b01f31c9e91a9ded0ab989daeb5e2 /vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java
parentb94bd70f1595fad9546c3506393613f68504f495 (diff)
org.onap migration
Change-Id: I5e2d01a6da21d4003c910b5fe0702b35c2089a77 Issue-ID: VID-86 Signed-off-by: Ofir Sonsino <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java b/vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java
new file mode 100644
index 000000000..d87fab473
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/controllers/LocalWebConfig.java
@@ -0,0 +1,70 @@
+package org.onap.vid.controllers;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.io.IOUtils;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.onap.vid.aai.AaiClient;
+import org.onap.vid.aai.AaiClientInterface;
+import org.onap.vid.asdc.AsdcClient;
+import org.onap.vid.asdc.local.LocalAsdcClient;
+import org.onap.vid.asdc.parser.ToscaParserImpl2;
+import org.onap.vid.controllers.VidController;
+import org.onap.vid.services.AaiService;
+import org.onap.vid.services.AaiServiceImpl;
+import org.onap.vid.services.VidService;
+import org.onap.vid.services.VidServiceImpl;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+@Configuration
+public class LocalWebConfig {
+
+ /**
+ * Gets the object mapper.
+ *
+ * @return the object mapper
+ */
+ @Bean
+ public ObjectMapper getObjectMapper() {
+ return new ObjectMapper();
+ }
+
+
+ @Bean
+ public VidService vidService(AsdcClient asdcClient) {
+ return new VidServiceImpl(asdcClient);
+ }
+
+ @Bean
+ public AaiService getAaiService() {
+ return new AaiServiceImpl();
+ }
+
+ @Bean
+ public AaiClientInterface getAaiClientInterface() {
+ return new AaiClient();
+ }
+
+ @Bean
+ public AsdcClient asdcClient() throws IOException {
+
+
+ final InputStream asdcServicesFile = VidController.class.getClassLoader().getResourceAsStream("sdcservices.json");
+
+ final JSONTokener jsonTokener = new JSONTokener(IOUtils.toString(asdcServicesFile));
+ final JSONObject sdcServicesCatalog = new JSONObject(jsonTokener);
+
+ return new LocalAsdcClient.Builder().catalog(sdcServicesCatalog).build();
+
+ }
+
+ @Bean
+ public ToscaParserImpl2 getToscaParser() {
+ return new ToscaParserImpl2();
+ }
+
+}