X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fconfig%2FE2ManagerConfiguration.java;h=92bef319f2c25f21a5266f0077c238992ade7cf9;hb=a91a1032725b91b493c060937b3f27ac9e62807e;hp=1983623036d001b86202f3ad63ebf29026c5f955;hpb=dd3e10c0442cb16c08e9a8ecee429576396accac;p=portal%2Fric-dashboard.git diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java index 19836230..92bef319 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java @@ -20,6 +20,8 @@ package org.oransc.ric.portal.dashboard.config; import java.lang.invoke.MethodHandles; +import java.net.MalformedURLException; +import java.net.URL; import org.oransc.ric.e2mgr.client.api.HealthCheckApi; import org.oransc.ric.e2mgr.client.api.NodebApi; @@ -31,7 +33,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import org.springframework.util.Assert; import org.springframework.web.client.RestTemplate; /** @@ -44,18 +45,18 @@ public class E2ManagerConfiguration { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); // Populated by the autowired constructor - private final String e2mgrBasepath; + private final String e2mgrUrl; @Autowired - public E2ManagerConfiguration(@Value("${e2mgr.basepath}") final String e2mgrBasepath) { - Assert.notNull(e2mgrBasepath, "base path must not be null"); - logger.info("Configuring E2 Manager at base path {}", e2mgrBasepath); - this.e2mgrBasepath = e2mgrBasepath; + public E2ManagerConfiguration(@Value("${e2mgr.url}") final String url) throws MalformedURLException { + logger.info("Configuring E2 Manager at base path {}", url); + new URL(url); + this.e2mgrUrl = url; } private ApiClient apiClient() { ApiClient apiClient = new ApiClient(new RestTemplate()); - apiClient.setBasePath(e2mgrBasepath); + apiClient.setBasePath(e2mgrUrl); return apiClient; }