Revise user controller to answer real data
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / config / AppManagerConfiguration.java
index f2ffca6..94ba357 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * O-RAN-SC
  * %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@
 package org.oransc.ric.portal.dashboard.config;
 
 import java.lang.invoke.MethodHandles;
-import java.net.MalformedURLException;
-import java.net.URL;
 
 import org.oransc.ric.plt.appmgr.client.api.HealthApi;
 import org.oransc.ric.plt.appmgr.client.api.XappApi;
@@ -34,13 +32,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Profile;
 import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.DefaultUriBuilderFactory;
 
 /**
  * Creates an xApp manager client as a bean to be managed by the Spring
  * container.
  */
 @Configuration
-@Profile("!mock")
+@Profile("!test")
 public class AppManagerConfiguration {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -49,10 +48,12 @@ public class AppManagerConfiguration {
        private final String xappMgrUrl;
 
        @Autowired
-       public AppManagerConfiguration(@Value("${xappmgr.url}") final String url) throws MalformedURLException {
-               logger.info("Configuring xApp Manager at base URL {}", url);
-               new URL(url);
-               this.xappMgrUrl = url;
+       public AppManagerConfiguration(@Value("${appmgr.url.prefix}") final String urlPrefix,
+                       @Value("${appmgr.url.suffix}") final String urlSuffix) {
+               logger.debug("ctor prefix '{}' suffix '{}'", urlPrefix, urlSuffix);
+               xappMgrUrl = new DefaultUriBuilderFactory(urlPrefix.trim()).builder().path(urlSuffix.trim()).build().normalize()
+                               .toString();
+               logger.info("Configuring App Manager at URL {}", xappMgrUrl);
        }
 
        private ApiClient apiClient() {