aboutsummaryrefslogtreecommitdiffstats
path: root/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2019-04-26 08:46:13 +0000
committerByung-Woo Jun <byung-woo.jun@est.tech>2019-05-02 12:12:06 +0000
commitfa628a82ce084a70db99df70e7d7273044963d8d (patch)
tree645fb2b6392edde21c0691e6264761b94285ccee /vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
parent0149a3b05af8417fa544c7b4138e8e3f8507e1cf (diff)
VNFM simulator implementation for instantiate flow
Issue-ID: SO-1773 Change-Id: I710fe6905d650df29f7550f4eafde2f672301bc4 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech> (cherry picked from commit c0b9d01cbc3a3d3b1ce32178394e8fd74a10de65)
Diffstat (limited to 'vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java')
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
new file mode 100644
index 0000000000..91b79754a5
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
@@ -0,0 +1,43 @@
+package org.onap.svnfm.simulator.config;
+
+import java.net.InetAddress;
+import java.util.Arrays;
+import org.onap.svnfm.simulator.constants.Constant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.concurrent.ConcurrentMapCache;
+import org.springframework.cache.support.SimpleCacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ApplicationConfig implements ApplicationRunner {
+
+ private static final String PORT = "local.server.port";
+
+ @Autowired
+ private Environment environment;
+
+ private String baseUrl;
+
+ @Override
+ public void run(final ApplicationArguments args) throws Exception {
+ baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT);
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ @Bean
+ public CacheManager cacheManager() {
+ Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ SimpleCacheManager manager = new SimpleCacheManager();
+ manager.setCaches(Arrays.asList(inlineResponse201));
+ return manager;
+ }
+}