aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/UuiServerApplication.java9
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/config/SDCClientConfig.java14
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/config/SDCClientProperties.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java5
-rw-r--r--server/src/main/resources/application.properties5
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java10
6 files changed, 24 insertions, 24 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/UuiServerApplication.java b/server/src/main/java/org/onap/usecaseui/server/UuiServerApplication.java
index a1e36435..e98248b1 100644
--- a/server/src/main/java/org/onap/usecaseui/server/UuiServerApplication.java
+++ b/server/src/main/java/org/onap/usecaseui/server/UuiServerApplication.java
@@ -15,6 +15,9 @@
*/
package org.onap.usecaseui.server;
+import org.onap.usecaseui.server.config.AAIClientProperties;
+import org.onap.usecaseui.server.config.SDCClientProperties;
+import org.onap.usecaseui.server.config.SOClientProperties;
import org.onap.usecaseui.server.util.DmaapSubscriber;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
@@ -31,7 +34,11 @@ import org.springframework.web.client.RestTemplate;
import jakarta.servlet.MultipartConfigElement;
@SpringBootApplication
-@EnableConfigurationProperties
+@EnableConfigurationProperties({
+ AAIClientProperties.class,
+ SDCClientProperties.class,
+ SOClientProperties.class
+})
@ComponentScan(basePackages = "org.onap.usecaseui.server")
@EnableAutoConfiguration(exclude={JpaRepositoriesAutoConfiguration.class})
public class UuiServerApplication {
diff --git a/server/src/main/java/org/onap/usecaseui/server/config/SDCClientConfig.java b/server/src/main/java/org/onap/usecaseui/server/config/SDCClientConfig.java
index 5b02713d..6682363e 100644
--- a/server/src/main/java/org/onap/usecaseui/server/config/SDCClientConfig.java
+++ b/server/src/main/java/org/onap/usecaseui/server/config/SDCClientConfig.java
@@ -20,11 +20,11 @@ import java.io.IOException;
import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.vfc.VfcService;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
+import lombok.RequiredArgsConstructor;
import okhttp3.Credentials;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
@@ -33,14 +33,10 @@ import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;
@Configuration
+@RequiredArgsConstructor
public class SDCClientConfig {
- @Value("${uui-server.client.sdc.baseUrl}")
- String baseUrl;
- @Value("${uui-server.client.sdc.username}")
- String username;
- @Value("${uui-server.client.sdc.password}")
- String password;
+ private final SDCClientProperties clientProperties;
OkHttpClient okHttpClient() {
return new OkHttpClient().newBuilder().addInterceptor(new Interceptor() {
@@ -48,7 +44,7 @@ public class SDCClientConfig {
public okhttp3.Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
Request.Builder builder = originalRequest.newBuilder()
- .header("Authorization", Credentials.basic(username, password))
+ .header("Authorization", Credentials.basic(clientProperties.getUsername(), clientProperties.getPassword()))
.header(HttpHeaders.ACCEPT, "application/json")
.header("X-ECOMP-InstanceID", "777");
Request newRequest = builder.build();
@@ -59,7 +55,7 @@ public class SDCClientConfig {
Retrofit retrofit() {
return new Retrofit.Builder()
- .baseUrl(baseUrl)
+ .baseUrl(clientProperties.getBaseUrl())
.addConverterFactory(JacksonConverterFactory.create())
.client(okHttpClient())
.build();
diff --git a/server/src/main/java/org/onap/usecaseui/server/config/SDCClientProperties.java b/server/src/main/java/org/onap/usecaseui/server/config/SDCClientProperties.java
index e5f70812..c7b1e0f8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/config/SDCClientProperties.java
+++ b/server/src/main/java/org/onap/usecaseui/server/config/SDCClientProperties.java
@@ -16,14 +16,15 @@
package org.onap.usecaseui.server.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
+import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import lombok.Data;
@Data
-@Configuration
+@ConfigurationPropertiesScan
@ConfigurationProperties(prefix = "uui-server.client.sdc")
public class SDCClientProperties {
+ String baseUrl;
String username;
String password;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
index 5605394c..87b4ecb6 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java
@@ -35,14 +35,11 @@ import org.onap.usecaseui.server.bean.intent.IntentResponseBody;
import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult;
import org.onap.usecaseui.server.constant.IntentConstant;
import org.onap.usecaseui.server.service.csmf.SlicingService;
-import org.onap.usecaseui.server.service.intent.IntentApiService;
import org.onap.usecaseui.server.service.intent.IntentInstanceService;
import org.onap.usecaseui.server.service.intent.IntentService;
import org.onap.usecaseui.server.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -65,8 +62,6 @@ public class IntentController {
@Resource(name = "IntentInstanceService")
private IntentInstanceService intentInstanceService;
- private final IntentApiService intentApiService;
-
private ObjectMapper omAlarm = new ObjectMapper();
@Resource(name = "SlicingService")
diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties
index 03840869..5aef428f 100644
--- a/server/src/main/resources/application.properties
+++ b/server/src/main/resources/application.properties
@@ -22,8 +22,8 @@ spring.http.multipart.max-request-size=128MB
## App DB Properties
spring.datasource.url=jdbc:postgresql://${POSTGRES_IP:127.0.0.1}:${POSTGRES_PORT:5432}/${POSTGRES_DB_NAME:uui}
-spring.datasource.username=${POSTGRES_USERNAME}
-spring.datasource.password=${POSTGRES_PASSWORD}
+spring.datasource.username=${POSTGRES_USERNAME:uui}
+spring.datasource.password=${POSTGRES_PASSWORD:uui}
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
spring.database.driver.classname=org.postgresql.Driver
spring.jpa.show-sql=false
@@ -61,6 +61,7 @@ uui-server.client.aai.password=AAI
uui-server.client.so.baseUrl=http://so.onap:8080
uui-server.client.so.username=InfraPortalClient
uui-server.client.so.password=password1
+uui-server.client.sdc.base-url=http://sdc-be.onap:8080
uui-server.client.sdc.username=aai
uui-server.client.sdc.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
uui-server.slicing.service-invariant-uuid=defaultServiceInvariantUuid
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java
index 8897d03d..9a4035a3 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java
@@ -26,28 +26,28 @@ import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.usecaseui.server.config.AAIClientConfig;
import org.onap.usecaseui.server.config.SDCClientConfig;
+import org.onap.usecaseui.server.config.SDCClientProperties;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.http.HttpHeaders;
import org.wiremock.spring.EnableWireMock;
import lombok.SneakyThrows;
@EnableWireMock
+@EnableConfigurationProperties(SDCClientProperties.class)
@SpringBootTest(
- webEnvironment = WebEnvironment.RANDOM_PORT,
classes = {
- AAIClientConfig.class, SDCClientConfig.class, DefaultServiceTemplateService.class
+ AAIClientConfig.class, SDCClientConfig.class , DefaultServiceTemplateService.class
},
properties = {
- "spring.main.web-application-type=none", // only temporary
"client.aai.baseUrl=${wiremock.server.baseUrl}",
"client.aai.username=AAI",
"client.aai.password=AAI",
- "uui-server.client.sdc.baseUrl=${wiremock.server.baseUrl}",
+ "uui-server.client.sdc.base-url=${wiremock.server.baseUrl}",
"uui-server.client.sdc.username=someUser",
"uui-server.client.sdc.password=somePassword",
})