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%2FA1MediatorConfiguration.java;h=fd1bcbc92ef1db62a31e5c732586638ace6ecc57;hb=662cc613e80c4079fdf5a54ce3135652cb9ad9a1;hp=240522b04f3c7a81e4d533ea497ab8d49ad40d07;hpb=81c5a43871449332f9a9560c7cf25d07cf714d8e;p=portal%2Fric-dashboard.git diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java index 240522b0..fd1bcbc9 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java @@ -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.a1med.client.api.A1MediatorApi; import org.oransc.ric.a1med.client.invoker.ApiClient; @@ -33,13 +31,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 A1 mediator client as a bean to be managed by the Spring * container. */ @Configuration -@Profile("!mock") +@Profile("!test") public class A1MediatorConfiguration { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -48,10 +47,12 @@ public class A1MediatorConfiguration { private final String a1medUrl; @Autowired - public A1MediatorConfiguration(@Value("${a1med.url}") final String url) throws MalformedURLException { - logger.info("Configuring A1 Mediator at base URL {}", url); - new URL(url); - this.a1medUrl = url; + public A1MediatorConfiguration(@Value("${a1med.url.prefix}") final String urlPrefix, // + @Value("${a1med.url.suffix}") final String urlSuffix) { + logger.debug("ctor prefix '{}' suffix '{}'", urlPrefix, urlSuffix); + a1medUrl = new DefaultUriBuilderFactory(urlPrefix.trim()).builder().path(urlSuffix.trim()).build().normalize() + .toString(); + logger.info("Configuring A1 Mediator at URL {}", a1medUrl); } private ApiClient apiClient() {