diff options
45 files changed, 272 insertions, 376 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java index 774b2363..4e4ec2d5 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java @@ -60,7 +60,8 @@ public class SwaggerConfig { "<li>A1 Policy creation, modification and deletion.</li>" + // "<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs</li>" + // "<li>Maintaining a view of supported Near-RT RIC policy types</li>" + // - "<li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.</li>" + // + "<li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.</li>" + + // "</ul>" + // "<h2>APIs provided by the service</h2>" + // H3 + PolicyController.API_NAME + H3_END + // diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java index 04dd08ee..75ba2515 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java @@ -95,7 +95,7 @@ public class A1ClientFactory { } private ControllerConfig getControllerConfig(Ric ric) throws ServiceException { - String controllerName = ric.getConfig().controllerName(); + String controllerName = ric.getConfig().getControllerName(); if (controllerName.isEmpty()) { ric.setProtocolVersion(A1ProtocolType.UNKNOWN); throw new ServiceException("No controller configured for Near-RT RIC: " + ric.id()); @@ -110,7 +110,7 @@ public class A1ClientFactory { private A1Client createCustomAdapter(Ric ric) throws ServiceException { try { - Class<?> clazz = Class.forName(ric.getConfig().customAdapterClass()); + Class<?> clazz = Class.forName(ric.getConfig().getCustomAdapterClass()); if (A1Client.class.isAssignableFrom(clazz)) { Constructor<?> constructor = clazz.getConstructor(RicConfig.class, AsyncRestClientFactory.class); return (A1Client) constructor.newInstance(ric.getConfig(), this.restClientFactory); @@ -121,14 +121,14 @@ public class A1ClientFactory { throw new ServiceException("The custom class must either implement A1Client.Factory or A1Client"); } } catch (ClassNotFoundException e) { - throw new ServiceException("Could not find class: " + ric.getConfig().customAdapterClass(), e); + throw new ServiceException("Could not find class: " + ric.getConfig().getCustomAdapterClass(), e); } catch (Exception e) { - throw new ServiceException("Cannot create custom adapter: " + ric.getConfig().customAdapterClass(), e); + throw new ServiceException("Cannot create custom adapter: " + ric.getConfig().getCustomAdapterClass(), e); } } private void assertNoControllerConfig(Ric ric, A1ProtocolType version) throws ServiceException { - if (!ric.getConfig().controllerName().isEmpty()) { + if (!ric.getConfig().getControllerName().isEmpty()) { ric.setProtocolVersion(A1ProtocolType.UNKNOWN); throw new ServiceException( "Controller config should be empty, ric: " + ric.id() + " when using protocol version: " + version); @@ -152,9 +152,7 @@ public class A1ClientFactory { .doOnNext(ric::setProtocolVersion) .doOnNext(version -> logger.debug("Established protocol version:{} for Near-RT RIC: {}", version, ric.id())) // - .doOnError(notUsed -> logger.warn("Could not get protocol version from Near-RT RIC: {}", ric.id())) // - .onErrorResume( - notUsed -> Mono.error(new ServiceException("Protocol negotiation failed for " + ric.id()))); + .doOnError(notUsed -> logger.warn("Could not get protocol version from Near-RT RIC: {}", ric.id())); } else { return Mono.just(ric.getProtocolVersion()); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java index 959d85e2..c4afdb2f 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java @@ -154,8 +154,8 @@ public class AsyncRestClient { } private boolean isHttpProxyConfigured() { - return httpProxyConfig != null && httpProxyConfig.httpProxyPort() > 0 - && !httpProxyConfig.httpProxyHost().isEmpty(); + return httpProxyConfig != null && httpProxyConfig.getHttpProxyPort() > 0 + && !httpProxyConfig.getHttpProxyHost().isEmpty(); } private HttpClient buildHttpClient() { @@ -172,7 +172,7 @@ public class AsyncRestClient { if (isHttpProxyConfigured()) { httpClient = httpClient.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP) - .host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort())); + .host(httpProxyConfig.getHttpProxyHost()).port(httpProxyConfig.getHttpProxyPort())); } return httpClient; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java index 844db540..204af9c0 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientFactory.java @@ -60,7 +60,7 @@ public class AsyncRestClientFactory { public AsyncRestClientFactory(WebClientConfig clientConfig, SecurityContext securityContext) { if (clientConfig != null) { this.sslContextFactory = new CachingSslContextFactory(clientConfig); - this.httpProxyConfig = clientConfig.httpProxyConfig(); + this.httpProxyConfig = clientConfig.getHttpProxyConfig(); } else { logger.warn("No configuration for web client defined, HTTPS will not work"); this.sslContextFactory = null; @@ -105,8 +105,8 @@ public class AsyncRestClientFactory { private SslContext createSslContext(KeyManagerFactory keyManager) throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException { if (this.clientConfig.isTrustStoreUsed()) { - return createSslContextRejectingUntrustedPeers(this.clientConfig.trustStore(), - this.clientConfig.trustStorePassword(), keyManager); + return createSslContextRejectingUntrustedPeers(this.clientConfig.getTrustStore(), + this.clientConfig.getTrustStorePassword(), keyManager); } else { // Trust anyone return SslContextBuilder.forClient() // @@ -154,10 +154,10 @@ public class AsyncRestClientFactory { private KeyManagerFactory createKeyManager() throws NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableKeyException, KeyStoreException { final KeyManagerFactory keyManager = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.keyStoreType()); - final String keyStoreFile = this.clientConfig.keyStore(); - final String keyStorePassword = this.clientConfig.keyStorePassword(); - final String keyPassword = this.clientConfig.keyPassword(); + final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.getKeyStoreType()); + final String keyStoreFile = this.clientConfig.getKeyStore(); + final String keyStorePassword = this.clientConfig.getKeyStorePassword(); + final String keyPassword = this.clientConfig.getKeyPassword(); try (final InputStream inputStream = new FileInputStream(keyStoreFile)) { keyStore.load(inputStream, keyStorePassword.toCharArray()); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java index c3f00407..cb4e2ebb 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java @@ -29,7 +29,8 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; -import org.immutables.value.Value; +import lombok.Getter; + import org.json.JSONObject; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; @@ -50,20 +51,30 @@ public class CcsdkA1AdapterClient implements A1Client { static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC - @Value.Immutable - @org.immutables.gson.Gson.TypeAdapters - public interface AdapterRequest { - public String nearRtRicUrl(); + @Getter + public static class AdapterRequest { + private String nearRtRicUrl = null; + private String body = null; + + public AdapterRequest(String url, String body) { + this.nearRtRicUrl = url; + this.body = body; + } - public Optional<String> body(); + public AdapterRequest() {} } - @Value.Immutable - @org.immutables.gson.Gson.TypeAdapters - public interface AdapterOutput { - public Optional<String> body(); + @Getter + public static class AdapterOutput { + private String body = null; + private int httpStatus = 0; - public int httpStatus(); + public AdapterOutput(int status, String body) { + this.httpStatus = status; + this.body = body; + } + + public AdapterOutput() {} } static com.google.gson.Gson gson = new GsonBuilder() // @@ -93,7 +104,7 @@ public class CcsdkA1AdapterClient implements A1Client { public CcsdkA1AdapterClient(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig, AsyncRestClientFactory restClientFactory) { this(protocolType, ricConfig, controllerConfig, - restClientFactory.createRestClientNoHttpProxy(controllerConfig.baseUrl() + "/restconf/operations")); + restClientFactory.createRestClientNoHttpProxy(controllerConfig.getBaseUrl() + "/restconf/operations")); } /** @@ -119,7 +130,7 @@ public class CcsdkA1AdapterClient implements A1Client { this.ricConfig = ricConfig; this.protocolType = protocolType; this.controllerConfig = controllerConfig; - logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.ricId(), controllerConfig); + logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.getRicId(), controllerConfig); } else { throw new IllegalArgumentException("Not handeled protocolversion: " + protocolType); } @@ -265,29 +276,27 @@ public class CcsdkA1AdapterClient implements A1Client { } private Mono<String> post(String rpcName, String ricUrl, Optional<String> body) { - AdapterRequest inputParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(ricUrl) // - .body(body) // - .build(); + AdapterRequest inputParams = new AdapterRequest(ricUrl, body.isPresent() ? body.get() : null); + final String inputJsonString = A1AdapterJsonHelper.createInputJsonString(inputParams); logger.debug("POST inputJsonString = {}", inputJsonString); return restClient - .postWithAuthHeader(controllerUrl(rpcName), inputJsonString, this.controllerConfig.userName(), - this.controllerConfig.password()) // + .postWithAuthHeader(controllerUrl(rpcName), inputJsonString, this.controllerConfig.getUserName(), + this.controllerConfig.getPassword()) // .flatMap(this::extractResponseBody); } private Mono<String> extractResponse(JSONObject responseOutput) { - AdapterOutput output = gson.fromJson(responseOutput.toString(), ImmutableAdapterOutput.class); - Optional<String> optionalBody = output.body(); - String body = optionalBody.isPresent() ? optionalBody.get() : ""; - if (HttpStatus.valueOf(output.httpStatus()).is2xxSuccessful()) { + AdapterOutput output = gson.fromJson(responseOutput.toString(), AdapterOutput.class); + + String body = output.body == null ? "" : output.body; + if (HttpStatus.valueOf(output.httpStatus).is2xxSuccessful()) { return Mono.just(body); } else { - logger.debug("Error response: {} {}", output.httpStatus(), body); + logger.debug("Error response: {} {}", output.httpStatus, body); byte[] responseBodyBytes = body.getBytes(StandardCharsets.UTF_8); - HttpStatus httpStatus = HttpStatus.valueOf(output.httpStatus()); + HttpStatus httpStatus = HttpStatus.valueOf(output.httpStatus); WebClientResponseException responseException = new WebClientResponseException(httpStatus.value(), httpStatus.getReasonPhrase(), null, responseBodyBytes, StandardCharsets.UTF_8, null); diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java index 78a418ab..dfe33e7d 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java @@ -110,7 +110,7 @@ public class OscA1Client implements A1Client { } private String baseUri() { - return ricConfig.baseUrl() + "/a1-p"; + return ricConfig.getBaseUrl() + "/a1-p"; } } @@ -125,7 +125,7 @@ public class OscA1Client implements A1Client { public OscA1Client(RicConfig ricConfig, AsyncRestClient restClient) { this.restClient = restClient; - logger.debug("OscA1Client for ric: {}", ricConfig.ricId()); + logger.debug("OscA1Client for ric: {}", ricConfig.getRicId()); uri = new UriBuilder(ricConfig); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java index b158ad25..5eae7759 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java @@ -75,7 +75,7 @@ public class StdA1ClientVersion1 implements A1Client { } private String baseUri() { - return ricConfig.baseUrl() + "/A1-P/v1"; + return ricConfig.getBaseUrl() + "/A1-P/v1"; } private String policiesBaseUri() { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java index b91edee3..0022057b 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java @@ -121,7 +121,7 @@ public class StdA1ClientVersion2 implements A1Client { } private String baseUri() { - return ricConfig.baseUrl() + "/A1-P/v2"; + return ricConfig.getBaseUrl() + "/A1-P/v2"; } } @@ -136,7 +136,7 @@ public class StdA1ClientVersion2 implements A1Client { public StdA1ClientVersion2(RicConfig ricConfig, AsyncRestClient restClient) { this.restClient = restClient; - logger.debug("OscA1Client for ric: {}", ricConfig.ricId()); + logger.debug("OscA1Client for ric: {}", ricConfig.getRicId()); uriBuiler = new OranV2UriBuilder(ricConfig); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java index 236d4381..0e2294fc 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java @@ -100,13 +100,13 @@ public class ApplicationConfig { public WebClientConfig getWebClientConfig() { if (this.webClientConfig == null) { - HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() // + HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() // .httpProxyHost(this.httpProxyHost) // .httpProxyPort(this.httpProxyPort) // .httpProxyType(ProxyProvider.Proxy.valueOf(this.httpProxyType)) // .build(); - this.webClientConfig = ImmutableWebClientConfig.builder() // + this.webClientConfig = WebClientConfig.builder() // .keyStoreType(this.sslKeyStoreType) // .keyStorePassword(this.sslKeyStorePassword) // .keyStore(this.sslKeyStore) // @@ -156,23 +156,23 @@ public class ApplicationConfig { ApplicationConfigParser.ConfigParserResult parserResult) { Collection<RicConfigUpdate> modifications = new ArrayList<>(); - this.controllerConfigs = parserResult.controllerConfigs(); + this.controllerConfigs = parserResult.getControllerConfigs(); - this.dmaapConsumerTopicUrl = parserResult.dmaapConsumerTopicUrl(); - this.dmaapProducerTopicUrl = parserResult.dmaapProducerTopicUrl(); + this.dmaapConsumerTopicUrl = parserResult.getDmaapConsumerTopicUrl(); + this.dmaapProducerTopicUrl = parserResult.getDmaapProducerTopicUrl(); Map<String, RicConfig> newRicConfigs = new HashMap<>(); - for (RicConfig newConfig : parserResult.ricConfigs()) { - RicConfig oldConfig = this.ricConfigs.get(newConfig.ricId()); - this.ricConfigs.remove(newConfig.ricId()); + for (RicConfig newConfig : parserResult.getRicConfigs()) { + RicConfig oldConfig = this.ricConfigs.get(newConfig.getRicId()); + this.ricConfigs.remove(newConfig.getRicId()); if (oldConfig == null) { - newRicConfigs.put(newConfig.ricId(), newConfig); + newRicConfigs.put(newConfig.getRicId(), newConfig); modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.ADDED)); } else if (!newConfig.equals(oldConfig)) { modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.CHANGED)); - newRicConfigs.put(newConfig.ricId(), newConfig); + newRicConfigs.put(newConfig.getRicId(), newConfig); } else { - newRicConfigs.put(oldConfig.ricId(), oldConfig); + newRicConfigs.put(oldConfig.getRicId(), oldConfig); } } for (RicConfig deletedConfig : this.ricConfigs.values()) { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java index fc1985ac..3990bc7b 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java @@ -41,8 +41,9 @@ import java.util.Set; import javax.validation.constraints.NotNull; -import org.immutables.gson.Gson; -import org.immutables.value.Value; +import lombok.Builder; +import lombok.Getter; + import org.json.JSONObject; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; import org.slf4j.Logger; @@ -63,16 +64,19 @@ public class ApplicationConfigParser { this.applicationConfig = applicationConfig; } - @Value.Immutable - @Gson.TypeAdapters - public interface ConfigParserResult { - List<RicConfig> ricConfigs(); + @Builder + @Getter + public static class ConfigParserResult { + private List<RicConfig> ricConfigs; - Map<String, ControllerConfig> controllerConfigs(); + @Builder.Default + private Map<String, ControllerConfig> controllerConfigs = new HashMap<>(); - String dmaapConsumerTopicUrl(); + @Builder.Default + private String dmaapConsumerTopicUrl = ""; - String dmaapProducerTopicUrl(); + @Builder.Default + private String dmaapProducerTopicUrl = ""; } @@ -103,7 +107,7 @@ public class ApplicationConfigParser { Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(pmsConfigJson); checkConfigurationConsistency(ricConfigs, controllerConfigs); - return ImmutableConfigParserResult.builder() // + return ConfigParserResult.builder() // .dmaapConsumerTopicUrl(dmaapConsumerTopicUrl) // .dmaapProducerTopicUrl(dmaapProducerTopicUrl) // .ricConfigs(ricConfigs) // @@ -147,15 +151,15 @@ public class ApplicationConfigParser { Set<String> ricUrls = new HashSet<>(); Set<String> ricNames = new HashSet<>(); for (RicConfig ric : ricConfigs) { - if (!ricUrls.add(ric.baseUrl())) { - throw new ServiceException("Configuration error, more than one RIC URL: " + ric.baseUrl()); + if (!ricUrls.add(ric.getBaseUrl())) { + throw new ServiceException("Configuration error, more than one RIC URL: " + ric.getBaseUrl()); } - if (!ricNames.add(ric.ricId())) { - throw new ServiceException("Configuration error, more than one RIC with name: " + ric.ricId()); + if (!ricNames.add(ric.getRicId())) { + throw new ServiceException("Configuration error, more than one RIC with name: " + ric.getRicId()); } - if (!ric.controllerName().isEmpty() && controllerConfigs.get(ric.controllerName()) == null) { + if (!ric.getControllerName().isEmpty() && controllerConfigs.get(ric.getControllerName()) == null) { throw new ServiceException( - "Configuration error, controller configuration not found: " + ric.controllerName()); + "Configuration error, controller configuration not found: " + ric.getControllerName()); } } } @@ -164,17 +168,17 @@ public class ApplicationConfigParser { List<RicConfig> result = new ArrayList<>(); for (JsonElement ricElem : getAsJsonArray(config, "ric")) { JsonObject ricJsonObj = ricElem.getAsJsonObject(); - RicConfig ricConfig = ImmutableRicConfig.builder() // + RicConfig ricConfig = RicConfig.builder() // .ricId(get(ricJsonObj, "name", "id", "ricId").getAsString()) // .baseUrl(get(ricJsonObj, "baseUrl").getAsString()) // .managedElementIds(parseManagedElementIds(get(ricJsonObj, "managedElementIds").getAsJsonArray())) // .controllerName(getString(ricJsonObj, CONTROLLER, "")) .customAdapterClass(getString(ricJsonObj, "customAdapterClass", "")) // .build(); - if (!ricConfig.baseUrl().isEmpty()) { + if (!ricConfig.getBaseUrl().isEmpty()) { result.add(ricConfig); } else { - logger.error("RIC configuration error {}, baseUrl is empty", ricConfig.ricId()); + logger.error("RIC configuration error {}, baseUrl is empty", ricConfig.getRicId()); } } return result; @@ -195,16 +199,16 @@ public class ApplicationConfigParser { Map<String, ControllerConfig> result = new HashMap<>(); for (JsonElement element : getAsJsonArray(config, CONTROLLER)) { JsonObject controllerAsJson = element.getAsJsonObject(); - ImmutableControllerConfig controllerConfig = ImmutableControllerConfig.builder() // + ControllerConfig controllerConfig = ControllerConfig.builder() // .name(get(controllerAsJson, "name").getAsString()) // .baseUrl(get(controllerAsJson, "baseUrl").getAsString()) // .password(get(controllerAsJson, "password").getAsString()) // .userName(get(controllerAsJson, "userName").getAsString()) // ) .build(); - if (result.put(controllerConfig.name(), controllerConfig) != null) { + if (result.put(controllerConfig.getName(), controllerConfig) != null) { throw new ServiceException( - "Configuration error, more than one controller with name: " + controllerConfig.name()); + "Configuration error, more than one controller with name: " + controllerConfig.getName()); } } return result; diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ControllerConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ControllerConfig.java index 5f00cf69..1c52edc2 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ControllerConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ControllerConfig.java @@ -20,19 +20,22 @@ package org.onap.ccsdk.oran.a1policymanagementservice.configuration; -import org.immutables.value.Value; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.ToString; -@Value.Immutable -@Value.Style(redactedMask = "####") +@Builder +@Getter +@EqualsAndHashCode +@ToString +public class ControllerConfig { + private String name; -public interface ControllerConfig { - public String name(); + private String baseUrl; - public String baseUrl(); - - public String userName(); - - @Value.Redacted - public String password(); + private String userName; + @ToString.Exclude + private String password; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/RicConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/RicConfig.java index 251be5e7..ffe853f5 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/RicConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/RicConfig.java @@ -20,20 +20,29 @@ package org.onap.ccsdk.oran.a1policymanagementservice.configuration; -import com.google.common.collect.ImmutableList; +import java.util.ArrayList; +import java.util.Collection; -import org.immutables.value.Value; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.ToString; -@Value.Immutable -public interface RicConfig { - public String ricId(); +@Builder +@Getter +@EqualsAndHashCode +@ToString +public class RicConfig { + private String ricId; - public String controllerName(); + @Builder.Default + private String controllerName = ""; - public String baseUrl(); + private String baseUrl; - public ImmutableList<String> managedElementIds(); - - public String customAdapterClass(); + @Builder.Default + private Collection<String> managedElementIds = new ArrayList<>(); + @Builder.Default + private String customAdapterClass = ""; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java index 1e5d7ffa..e71f8557 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java @@ -20,38 +20,41 @@ package org.onap.ccsdk.oran.a1policymanagementservice.configuration; -import org.immutables.value.Value; +import lombok.Builder; +import lombok.Getter; +import lombok.ToString; import reactor.netty.transport.ProxyProvider; -@Value.Immutable -@Value.Style(redactedMask = "####") -public interface WebClientConfig { - public String keyStoreType(); +@Builder +@Getter +@ToString +public class WebClientConfig { + private String keyStoreType; - @Value.Redacted - public String keyStorePassword(); + private String keyStorePassword; - public String keyStore(); + private String keyStore; - @Value.Redacted - public String keyPassword(); + @ToString.Exclude + private String keyPassword; - public boolean isTrustStoreUsed(); + private boolean isTrustStoreUsed; - @Value.Redacted - public String trustStorePassword(); + private String trustStorePassword; - public String trustStore(); + private String trustStore; - @Value.Immutable - public interface HttpProxyConfig { - public String httpProxyHost(); + @Builder + @Getter + @ToString + public static class HttpProxyConfig { + private String httpProxyHost; - public int httpProxyPort(); + private int httpProxyPort; - public ProxyProvider.Proxy httpProxyType(); + private ProxyProvider.Proxy httpProxyType; } - public HttpProxyConfig httpProxyConfig(); + private HttpProxyConfig httpProxyConfig; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java index 7d89206c..c5436cd3 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java @@ -25,9 +25,6 @@ import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "service_callback_info_v2", description = "Information transferred as in Service callbacks (callback_url)") public class ServiceCallbackInfo { @@ -35,7 +32,6 @@ public class ServiceCallbackInfo { private static final String EVENT_TYPE_DESCRIPTION = "values:\n" // + "AVAILABLE: the Near-RT RIC has become available for A1 Policy management"; - @Gson.TypeAdapters @Schema(name = "event_type_v2", description = EVENT_TYPE_DESCRIPTION) public enum EventType { AVAILABLE diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java index 754d1694..6470abfe 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java @@ -22,9 +22,6 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "void", description = "Void/empty") public class VoidResponse { private VoidResponse() {} diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java index cc9b83aa..4e55c506 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policy_id_list_v2", description = "A list of policy identities") public class PolicyIdList { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java index 2e19a3de..55a9343d 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java @@ -25,9 +25,6 @@ import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policy_info_v2", description = "Information for one A1-P Policy") public class PolicyInfo { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java index 08923fd9..04f7e1ec 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policy_info_list_v2", description = "List of policy information") public class PolicyInfoList { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java index bc95e54f..c19c4a0d 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.time.Instant; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policy_status_info_v2", description = "Status for one A1-P Policy") public class PolicyStatusInfo { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java index deedf2f7..c2610b07 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policytype_id_list_v2", description = "Information about policy types") public class PolicyTypeIdList { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java index b619e44b..591c1caf 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java @@ -27,9 +27,6 @@ import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "policytype_v2", description = "Policy type") public class PolicyTypeInfo { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java index 38797cae..44927707 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java @@ -27,13 +27,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "ric_info_v2", description = "Information for a Near-RT RIC") public class RicInfo { - @Gson.TypeAdapters @Schema(name = "ric_state_v2", description = "Represents the states for a Near-RT RIC") public enum RicState { UNAVAILABLE, AVAILABLE, SYNCHRONIZING, CONSISTENCY_CHECK diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java index 05b9569e..f5612f9c 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "ric_info_list_v2", description = "List of Near-RT RIC information") public class RicInfoList { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java index 17277c9a..0f975c24 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java @@ -25,9 +25,6 @@ import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "service_registration_info_v2", description = "Information for one service") public class ServiceRegistrationInfo { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java index 02869485..f25aff0e 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java @@ -25,9 +25,6 @@ import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "service_status_v2") public class ServiceStatus { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java index 981c95b6..e6aa8d41 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java @@ -27,9 +27,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.util.Collection; -import org.immutables.gson.Gson; - -@Gson.TypeAdapters @Schema(name = "service_list_v2", description = "List of service information") public class ServiceStatusList { diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java index df9dfd19..28d434b7 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java @@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import org.immutables.gson.Gson; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -45,7 +44,6 @@ public class StatusController { public static final String API_NAME = "Health Check"; public static final String API_DESCRIPTION = ""; - @Gson.TypeAdapters @Schema(name = "status_info_v2") class StatusInfo { @Schema(description = "status text") diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java index 012f1f62..2971feb2 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java @@ -30,11 +30,14 @@ import lombok.Setter; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Holds information about a Near-RT RIC. */ public class Ric { + private static final Logger logger = LoggerFactory.getLogger(Ric.class); @Setter private RicConfig ricConfig; @@ -54,11 +57,11 @@ public class Ric { */ public Ric(RicConfig ricConfig) { this.ricConfig = ricConfig; - this.lock = new Lock(ricConfig.ricId()); + this.lock = new Lock(ricConfig.getRicId()); } public String id() { - return ricConfig.ricId(); + return ricConfig.getRicId(); } public RicConfig getConfig() { @@ -70,11 +73,12 @@ public class Ric { } public synchronized void setState(RicState state) { + logger.debug("Ric {} state set to {}", getConfig().getRicId(), state); this.state = state; } public synchronized A1ProtocolType getProtocolVersion() { - if (this.ricConfig.customAdapterClass().isEmpty()) { + if (this.ricConfig.getCustomAdapterClass().isEmpty()) { return this.protocolVersion; } else { return A1ProtocolType.CUSTOM_PROTOCOL; @@ -87,7 +91,7 @@ public class Ric { * @return a vector containing the nodes managed by this Ric. */ public synchronized Collection<String> getManagedElementIds() { - return new Vector<>(ricConfig.managedElementIds()); + return new Vector<>(ricConfig.getManagedElementIds()); } /** @@ -97,7 +101,7 @@ public class Ric { * @return true if the given node is managed by this Ric. */ public synchronized boolean isManaging(String managedElementId) { - return ricConfig.managedElementIds().contains(managedElementId); + return ricConfig.getManagedElementIds().contains(managedElementId); } /** @@ -143,7 +147,7 @@ public class Ric { @Override public synchronized String toString() { return Ric.class.getSimpleName() + ": " + "name: " + id() + ", state: " + state + ", baseUrl: " - + ricConfig.baseUrl() + ", managedNodes: " + ricConfig.managedElementIds(); + + ricConfig.getBaseUrl() + ", managedNodes: " + ricConfig.getManagedElementIds(); } /** diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java index e3d489b5..fea242ae 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java @@ -195,7 +195,7 @@ public class RefreshConfigTask { public Mono<RicConfigUpdate.Type> handleUpdatedRicConfig(RicConfigUpdate updatedInfo) { synchronized (this.rics) { - String ricId = updatedInfo.getRicConfig().ricId(); + String ricId = updatedInfo.getRicConfig().getRicId(); RicConfigUpdate.Type event = updatedInfo.getType(); if (event == RicConfigUpdate.Type.ADDED) { logger.debug("RIC added {}", ricId); diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java index 8926ec16..e4711c98 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java @@ -64,11 +64,11 @@ public class RicSupervision { private final Services services; private final AsyncRestClientFactory restClientFactory; - private static class SynchStartedException extends ServiceException { + private static class SynchNeededException extends ServiceException { private static final long serialVersionUID = 1L; - public SynchStartedException(String message) { - super(message); + public SynchNeededException(RicData ric) { + super("SynchNeededException for " + ric.ric.id()); } } @@ -113,41 +113,34 @@ public class RicSupervision { } private Mono<RicData> checkOneRic(RicData ricData) { - return checkRicState(ricData) // - .flatMap(x -> ricData.ric.getLock().lock(LockType.EXCLUSIVE, "checkOneRic")) // - .flatMap(notUsed -> setRicState(ricData)) // + if (ricData.ric.getState() == RicState.CONSISTENCY_CHECK || ricData.ric.getState() == RicState.SYNCHRONIZING) { + return Mono.empty(); // Skip, already in progress + } + return ricData.ric.getLock().lock(LockType.EXCLUSIVE, "checkOneRic") // + .flatMap(lock -> synchIfUnavailable(ricData)) // + .doOnNext(ric -> ric.ric.setState(RicState.CONSISTENCY_CHECK)) // .flatMap(x -> checkRicPolicies(ricData)) // .flatMap(x -> checkRicPolicyTypes(ricData)) // .doOnNext(x -> onRicCheckedOk(ricData)) // - .doOnError(t -> onRicCheckedError(t, ricData)) // + .onErrorResume(t -> onRicCheckedError(t, ricData)) // + .doFinally(sig -> ricData.ric.getLock().unlockBlocking()) // .onErrorResume(throwable -> Mono.empty()); } - private void onRicCheckedError(Throwable t, RicData ricData) { + private Mono<RicData> onRicCheckedError(Throwable t, RicData ricData) { logger.debug("Ric: {} check stopped, exception: {}", ricData.ric.id(), t.getMessage()); - if (!(t instanceof SynchStartedException)) { - // If synch is started, the synch will set the final state - ricData.ric.setState(RicState.UNAVAILABLE); + ricData.ric.setState(RicState.UNAVAILABLE); + if ((t instanceof SynchNeededException)) { + return startSynchronization(ricData); + } else { + logger.warn("RicSupervision, ric: {}, exception: {}", ricData.ric.id(), t.getMessage()); + return Mono.empty(); } - ricData.ric.getLock().unlockBlocking(); } private void onRicCheckedOk(RicData ricData) { logger.debug("Ric: {} checked OK", ricData.ric.id()); ricData.ric.setState(RicState.AVAILABLE); - ricData.ric.getLock().unlockBlocking(); - } - - @SuppressWarnings("squid:S2445") // Blocks should be synchronized on "private final" fields - private Mono<RicData> setRicState(RicData ric) { - synchronized (ric) { - if (ric.ric.getState() == RicState.CONSISTENCY_CHECK) { - logger.debug("Ric: {} is already being checked", ric.ric.getConfig().ricId()); - return Mono.empty(); - } - ric.ric.setState(RicState.CONSISTENCY_CHECK); - return Mono.just(ric); - } } private Mono<RicData> createRicData(Ric ric) { @@ -156,13 +149,9 @@ public class RicSupervision { .map(a1Client -> new RicData(ric, a1Client)); } - private Mono<RicData> checkRicState(RicData ric) { + private Mono<RicData> synchIfUnavailable(RicData ric) { if (ric.ric.getState() == RicState.UNAVAILABLE) { - logger.debug("RicSupervision, starting ric: {} synchronization (state == UNAVAILABLE)", ric.ric.id()); - return startSynchronization(ric) // - .onErrorResume(t -> Mono.empty()); - } else if (ric.ric.getState() == RicState.SYNCHRONIZING || ric.ric.getState() == RicState.CONSISTENCY_CHECK) { - return Mono.empty(); + return Mono.error(new SynchNeededException(ric)); } else { return Mono.just(ric); } @@ -178,14 +167,14 @@ public class RicSupervision { if (ricPolicies.size() != policies.getForRic(ric.ric.id()).size()) { logger.debug("RicSupervision, starting ric: {} synchronization (noOfPolicices == {}, expected == {})", ric.ric.id(), ricPolicies.size(), policies.getForRic(ric.ric.id()).size()); - return startSynchronization(ric); + return Mono.error(new SynchNeededException(ric)); } for (String policyId : ricPolicies) { if (!policies.containsPolicy(policyId)) { logger.debug("RicSupervision, starting ric: {} synchronization (unexpected policy in RIC: {})", ric.ric.id(), policyId); - return startSynchronization(ric); + return Mono.error(new SynchNeededException(ric)); } } return Mono.just(ric); @@ -202,22 +191,23 @@ public class RicSupervision { logger.debug( "RicSupervision, starting ric: {} synchronization (unexpected numer of policy types in RIC: {}, expected: {})", ric.ric.id(), ricTypes.size(), ric.ric.getSupportedPolicyTypes().size()); - return startSynchronization(ric); + return Mono.error(new SynchNeededException(ric)); } for (String typeName : ricTypes) { if (!ric.ric.isSupportingType(typeName)) { logger.debug("RicSupervision, starting ric: {} synchronization (unexpected policy type: {})", ric.ric.id(), typeName); - return startSynchronization(ric); + return Mono.error(new SynchNeededException(ric)); } } return Mono.just(ric); } private Mono<RicData> startSynchronization(RicData ric) { + logger.debug("RicSupervision, starting ric: {} synchronization, state: {}", ric.ric.id(), ric.ric.getState()); RicSynchronizationTask synchronizationTask = createSynchronizationTask(); return synchronizationTask.synchronizeRic(ric.ric) // - .flatMap(notUsed -> Mono.error(new SynchStartedException("Syncronization started"))); + .flatMap(notUsed -> Mono.just(ric)); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java index 6305abf0..94e873ed 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java @@ -37,10 +37,8 @@ import org.onap.ccsdk.oran.a1policymanagementservice.repository.Services; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import reactor.core.publisher.BaseSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.core.publisher.SignalType; /** * Synchronizes the content of a Near-RT RIC with the content in the repository. @@ -78,27 +76,22 @@ public class RicSynchronizationTask { } public void run(Ric ric) { - logger.debug("Ric synchronization task created: {}", ric.getConfig().ricId()); + logger.debug("Ric synchronization task created: {}", ric.getConfig().getRicId()); if (ric.getState() == RicState.SYNCHRONIZING) { - logger.debug("Ric: {} is already being synchronized", ric.getConfig().ricId()); + logger.debug("Ric: {} is already being synchronized", ric.getConfig().getRicId()); return; } ric.getLock().lock(LockType.EXCLUSIVE, "RicSynchronizationTask") // .flatMap(notUsed -> synchronizeRic(ric)) // - .subscribe(new BaseSubscriber<Object>() { - - @Override - protected void hookFinally(SignalType type) { - ric.getLock().unlockBlocking(); - } - }); + .doFinally(sig -> ric.getLock().unlockBlocking()) // + .subscribe(); } public Mono<Ric> synchronizeRic(Ric ric) { - return setRicState(ric) // - .flatMap(lock -> this.a1ClientFactory.createA1Client(ric)) // + return this.a1ClientFactory.createA1Client(ric) // + .doOnNext(client -> ric.setState(RicState.SYNCHRONIZING)) // .flatMapMany(client -> runSynchronization(ric, client)) // .onErrorResume(throwable -> deleteAllPolicyInstances(ric, throwable)) // .collectList() // @@ -115,24 +108,11 @@ public class RicSynchronizationTask { return a1Client.getPolicyTypeIdentities() // .doOnNext(x -> ric.clearSupportedPolicyTypes()) // .flatMapMany(Flux::fromIterable) // - .doOnNext(typeId -> logger.debug("For ric: {}, handling type: {}", ric.getConfig().ricId(), typeId)) // + .doOnNext(typeId -> logger.debug("For ric: {}, handling type: {}", ric.getConfig().getRicId(), typeId)) // .flatMap(policyTypeId -> getPolicyType(policyTypeId, a1Client), CONCURRENCY_RIC) // .doOnNext(ric::addSupportedPolicyType); // } - @SuppressWarnings("squid:S2445") // Blocks should be synchronized on "private final" fields - private Mono<Ric> setRicState(Ric ric) { - synchronized (ric) { - if (ric.getState() == RicState.SYNCHRONIZING) { - logger.debug("Ric: {} is already being synchronized", ric.getConfig().ricId()); - return Mono.empty(); - } - logger.debug("Ric state set to SYNCHRONIZING: {}", ric.getConfig().ricId()); - ric.setState(RicState.SYNCHRONIZING); - return Mono.just(ric); - } - } - private Flux<Object> runSynchronization(Ric ric, A1Client a1Client) { Flux<PolicyType> synchronizedTypes = synchronizePolicyTypes(ric, a1Client); Flux<?> policiesDeletedInRic = a1Client.deleteAllPolicies(); @@ -188,7 +168,7 @@ public class RicSynchronizationTask { } private Flux<Policy> putPolicy(Policy policy, Ric ric, A1Client a1Client) { - logger.trace("Recreating policy: {}, for ric: {}", policy.getId(), ric.getConfig().ricId()); + logger.trace("Recreating policy: {}, for ric: {}", policy.getId(), ric.getConfig().getRicId()); return a1Client.putPolicy(policy) // .flatMapMany(notUsed -> Flux.just(policy)); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java index 499889a6..424668fc 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java @@ -27,8 +27,6 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -import java.util.Vector; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,8 +36,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableControllerConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Ric; @@ -70,17 +66,16 @@ class A1ClientFactoryTest { private Ric ric; private A1ClientFactory factoryUnderTest; - private static ImmutableRicConfig ricConfig(String controllerName, String customAdapter) { - return ImmutableRicConfig.builder() // + private static RicConfig ricConfig(String controllerName, String customAdapter) { + return RicConfig.builder() // .ricId(RIC_NAME) // .baseUrl("baseUrl") // - .managedElementIds(new Vector<>()) // .controllerName(controllerName) // .customAdapterClass(customAdapter) // .build(); } - private static ImmutableRicConfig ricConfig(String controllerName) { + private static RicConfig ricConfig(String controllerName) { return ricConfig(controllerName, ""); } @@ -193,7 +188,7 @@ class A1ClientFactoryTest { } private void whenGetGetControllerConfigReturn() throws ServiceException { - ControllerConfig controllerCfg = ImmutableControllerConfig.builder() // + ControllerConfig controllerCfg = ControllerConfig.builder() // .name("name") // .baseUrl("baseUrl") // .password("pass") // diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java index 3090f64a..56dc7ed6 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.Vector; import org.json.JSONObject; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy; import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyType; @@ -45,11 +44,9 @@ public class A1ClientHelper { } protected static Ric createRic(String url) { - RicConfig cfg = ImmutableRicConfig.builder().ricId("ric") // + RicConfig cfg = RicConfig.builder().ricId("ric") // .baseUrl(url) // .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) // - .controllerName("") // - .customAdapterClass("") // .build(); return new Ric(cfg); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java index f49020ee..15e4983c 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java @@ -35,7 +35,6 @@ import java.net.URL; import java.nio.file.Files; import java.util.Arrays; import java.util.List; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -45,9 +44,7 @@ import org.mockito.stubbing.OngoingStubbing; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType; import org.onap.ccsdk.oran.a1policymanagementservice.clients.CcsdkA1AdapterClient.AdapterOutput; import org.onap.ccsdk.oran.a1policymanagementservice.clients.CcsdkA1AdapterClient.AdapterRequest; -import org.onap.ccsdk.oran.a1policymanagementservice.clients.ImmutableAdapterOutput.Builder; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableControllerConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClientResponseException; @@ -74,7 +71,7 @@ class CcsdkA1AdapterClientTest { AsyncRestClient asyncRestClientMock; private ControllerConfig controllerConfig() { - return ImmutableControllerConfig.builder() // + return ControllerConfig.builder() // .name("name") // .baseUrl("baseUrl") // .password(CONTROLLER_PASSWORD) // @@ -113,9 +110,8 @@ class CcsdkA1AdapterClientTest { assertEquals(1, policyTypeIds.size()); assertEquals(POLICY_TYPE_1_ID, policyTypeIds.get(0)); - ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .build(); + AdapterRequest expectedParams = new AdapterRequest(expUrl, null); + String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams); verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD); @@ -160,9 +156,8 @@ class CcsdkA1AdapterClientTest { assertEquals(policyTypeId, respJson.getAsJsonObject().get("title").getAsString(), "title should be updated to contain policyType ID"); - ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .build(); + AdapterRequest expectedParams = new AdapterRequest(expUrl, null); + String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams); verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME, @@ -205,9 +200,8 @@ class CcsdkA1AdapterClientTest { assertEquals(1, returned.size()); for (String expUrl : expUrls) { - ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .build(); + AdapterRequest expectedParams = new AdapterRequest(expUrl, null); + String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams); verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD); @@ -246,10 +240,7 @@ class CcsdkA1AdapterClientTest { .block(); assertEquals("OK", returned); - AdapterRequest expectedInputParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .body(POLICY_JSON_VALID) // - .build(); + AdapterRequest expectedInputParams = new AdapterRequest(expUrl, POLICY_JSON_VALID); String expInput = A1AdapterJsonHelper.createInputJsonString(expectedInputParams); verify(asyncRestClientMock).postWithAuthHeader(PUT_A1_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD); @@ -282,10 +273,7 @@ class CcsdkA1AdapterClientTest { controllerConfig(), asyncRestClientMock); final String policyJson = "{}"; - AdapterOutput adapterOutput = ImmutableAdapterOutput.builder() // - .body("NOK") // - .httpStatus(HttpStatus.BAD_REQUEST.value()) // ERROR - .build(); + AdapterOutput adapterOutput = new AdapterOutput(HttpStatus.BAD_REQUEST.value(), "NOK"); String resp = A1AdapterJsonHelper.createOutputJsonString(adapterOutput); whenAsyncPostThenReturn(Mono.just(resp)); @@ -311,9 +299,8 @@ class CcsdkA1AdapterClientTest { clientUnderTest.deleteAllPolicies().blockLast(); - ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .build(); + AdapterRequest expectedParams = new AdapterRequest(expUrl, null); + String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams); verify(asyncRestClientMock).postWithAuthHeader(DELETE_A1_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD); @@ -363,9 +350,8 @@ class CcsdkA1AdapterClientTest { assertEquals("OK", response); String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/type1/policies/policy1/status"; - ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() // - .nearRtRicUrl(expUrl) // - .build(); + AdapterRequest expectedParams = new AdapterRequest(expUrl, null); + String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams); verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_STATUS_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD); @@ -392,21 +378,14 @@ class CcsdkA1AdapterClientTest { } private String createOkResponseWithBody(Object body) { - AdapterOutput output = ImmutableAdapterOutput.builder() // - .body(gson().toJson(body)) // - .httpStatus(HttpStatus.OK.value()) // - .build(); + AdapterOutput output = new AdapterOutput(HttpStatus.OK.value(), gson().toJson(body)); return A1AdapterJsonHelper.createOutputJsonString(output); } private String createOkResponseString(boolean withBody) { - Builder responseBuilder = ImmutableAdapterOutput.builder().httpStatus(HttpStatus.OK.value()); - if (withBody) { - responseBuilder.body(HttpStatus.OK.name()); - } else { - responseBuilder.body(Optional.empty()); - } - return A1AdapterJsonHelper.createOutputJsonString(responseBuilder.build()); + String body = withBody ? HttpStatus.OK.name() : null; + AdapterOutput output = new AdapterOutput(HttpStatus.OK.value(), body); + return A1AdapterJsonHelper.createOutputJsonString(output); } private OngoingStubbing<Mono<String>> whenAsyncPostThenReturn(Mono<String> response) { diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java index 13379633..2ff07f15 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java @@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -35,7 +34,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import reactor.core.publisher.Flux; @@ -66,12 +64,9 @@ class OscA1ClientTest { @BeforeEach void init() { - RicConfig ricConfig = ImmutableRicConfig.builder() // + RicConfig ricConfig = RicConfig.builder() // .ricId("name") // .baseUrl("RicBaseUrl") // - .managedElementIds(new ArrayList<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); asyncRestClientMock = mock(AsyncRestClient.class); clientUnderTest = new OscA1Client(ricConfig, asyncRestClientMock); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java index b4709767..db4c79cd 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientTest.java @@ -80,7 +80,7 @@ class StdA1ClientTest { @Test void testGetPolicyIdentities() { - doReturn(RIC_URL).when(ricConfigMock).baseUrl(); + doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString()); when(asyncRestClientMock.get(anyString())).thenReturn(policyIds); @@ -98,7 +98,7 @@ class StdA1ClientTest { @Test void testPutPolicyValidResponse() { - doReturn(RIC_URL).when(ricConfigMock).baseUrl(); + doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.just(POLICY_JSON)); Mono<String> policyMono = @@ -110,7 +110,7 @@ class StdA1ClientTest { @Test void testDeletePolicy() { - doReturn(RIC_URL).when(ricConfigMock).baseUrl(); + doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); final String url = policiesBaseUrl() + POLICY_1_ID; when(asyncRestClientMock.delete(url)).thenReturn(Mono.empty()); @@ -122,7 +122,7 @@ class StdA1ClientTest { @Test void testDeleteAllPolicies() { - doReturn(RIC_URL).when(ricConfigMock).baseUrl(); + doReturn(RIC_URL).when(ricConfigMock).getBaseUrl(); Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString()); when(asyncRestClientMock.get(policiesUrl())).thenReturn(policyIds); when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty()); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java index 4b6d17b0..95c20426 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java @@ -28,7 +28,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -38,7 +37,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import reactor.core.publisher.Flux; @@ -69,12 +67,9 @@ class StdA1ClientV2Test { @BeforeEach void init() { - RicConfig ricConfig = ImmutableRicConfig.builder() // + RicConfig ricConfig = RicConfig.builder() // .ricId("name") // .baseUrl(RIC_URL) // - .managedElementIds(new ArrayList<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); asyncRestClientMock = mock(AsyncRestClient.class); clientUnderTest = new StdA1ClientVersion2(ricConfig, asyncRestClientMock); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java index 4a4e8a33..8e3e3a5d 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java @@ -59,25 +59,27 @@ class ApplicationConfigParserTest { ApplicationConfigParser.ConfigParserResult result = parserUnderTest.parse(jsonRootObject); - String topicUrl = result.dmaapProducerTopicUrl(); + String topicUrl = result.getDmaapProducerTopicUrl(); assertEquals("http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE", topicUrl, "controller contents"); - topicUrl = result.dmaapConsumerTopicUrl(); + topicUrl = result.getDmaapConsumerTopicUrl(); assertEquals( "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100", topicUrl, "controller contents"); - Map<String, ControllerConfig> controllers = result.controllerConfigs(); + Map<String, ControllerConfig> controllers = result.getControllerConfigs(); assertEquals(1, controllers.size(), "size"); - ImmutableControllerConfig expectedControllerConfig = ImmutableControllerConfig.builder() // + ControllerConfig expectedControllerConfig = ControllerConfig.builder() // .baseUrl("http://localhost:8083/") // .name("controller1") // .userName("user") // .password("password") // .build(); // - assertEquals(expectedControllerConfig, controllers.get("controller1"), "controller contents"); - assertEquals(2, result.ricConfigs().size()); + ControllerConfig actual = controllers.get("controller1"); + assertEquals(expectedControllerConfig, actual, "controller contents"); + + assertEquals(2, result.getRicConfigs().size()); } private JsonObject getJsonRootObject() throws JsonIOException, JsonSyntaxException, IOException { diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java index fd77eb8f..abf91f20 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java @@ -26,7 +26,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.Vector; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -37,32 +36,23 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationCo @ExtendWith(MockitoExtension.class) class ApplicationConfigTest { - private static final ImmutableRicConfig RIC_CONFIG_1 = ImmutableRicConfig.builder() // + private static final RicConfig RIC_CONFIG_1 = RicConfig.builder() // .ricId("ric1") // .baseUrl("ric1_url") // - .managedElementIds(new Vector<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); - private static final ImmutableRicConfig RIC_CONFIG_2 = ImmutableRicConfig.builder() // + private static final RicConfig RIC_CONFIG_2 = RicConfig.builder() // .ricId("ric2") // .baseUrl("ric1_url") // - .managedElementIds(new Vector<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); - private static final ImmutableRicConfig RIC_CONFIG_3 = ImmutableRicConfig.builder() // + private static final RicConfig RIC_CONFIG_3 = RicConfig.builder() // .ricId("ric3") // .baseUrl("ric1_url") // - .managedElementIds(new Vector<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); ConfigParserResult configParserResult(RicConfig... rics) { - return ImmutableConfigParserResult.builder() // + return ConfigParserResult.builder() // .ricConfigs(Arrays.asList(rics)) // .dmaapConsumerTopicUrl("dmaapConsumerTopicUrl") // .dmaapProducerTopicUrl("dmaapProducerTopicUrl") // @@ -80,7 +70,7 @@ class ApplicationConfigTest { assertEquals(RicConfigUpdate.Type.ADDED, update.get(0).getType()); assertTrue(appConfigUnderTest.getRicConfigs().contains(RIC_CONFIG_1), "Ric not added to configurations."); - assertEquals(RIC_CONFIG_1, appConfigUnderTest.getRic(RIC_CONFIG_1.ricId()), + assertEquals(RIC_CONFIG_1, appConfigUnderTest.getRic(RIC_CONFIG_1.getRicId()), "Not correct Ric retrieved from configurations."); update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).collectList().block(); @@ -101,12 +91,9 @@ class ApplicationConfigTest { .setConfiguration(configParserResult(RIC_CONFIG_1, RIC_CONFIG_2, RIC_CONFIG_3)).collectList().block(); assertEquals(3, update.size()); - ImmutableRicConfig changedRicConfig = ImmutableRicConfig.builder() // - .ricId(RIC_CONFIG_1.ricId()) // + RicConfig changedRicConfig = RicConfig.builder() // + .ricId(RIC_CONFIG_1.getRicId()) // .baseUrl("changed_ric1_url") // - .managedElementIds(new Vector<>()) // - .controllerName("") // - .customAdapterClass("") // .build(); update = appConfigUnderTest.setConfiguration(configParserResult(changedRicConfig, RIC_CONFIG_2, RIC_CONFIG_3)) @@ -114,7 +101,7 @@ class ApplicationConfigTest { assertEquals(1, update.size()); assertEquals(RicConfigUpdate.Type.CHANGED, update.get(0).getType()); - assertEquals(changedRicConfig, appConfigUnderTest.getRic(RIC_CONFIG_1.ricId()), + assertEquals(changedRicConfig, appConfigUnderTest.getRic(RIC_CONFIG_1.getRicId()), "Changed Ric not retrieved from configurations."); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java index 174add3b..dcb03a5a 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java @@ -53,8 +53,6 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFact import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig.RicConfigUpdate; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableWebClientConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.WebClientConfig; import org.onap.ccsdk.oran.a1policymanagementservice.controllers.ServiceCallbackInfo; @@ -948,15 +946,15 @@ class ApplicationTest { private AsyncRestClient restClient(String baseUrl, boolean useTrustValidation) { WebClientConfig config = this.applicationConfig.getWebClientConfig(); - config = ImmutableWebClientConfig.builder() // - .keyStoreType(config.keyStoreType()) // - .keyStorePassword(config.keyStorePassword()) // - .keyStore(config.keyStore()) // - .keyPassword(config.keyPassword()) // + config = WebClientConfig.builder() // + .keyStoreType(config.getKeyStoreType()) // + .keyStorePassword(config.getKeyStorePassword()) // + .keyStore(config.getKeyStore()) // + .keyPassword(config.getKeyPassword()) // .isTrustStoreUsed(useTrustValidation) // - .trustStore(config.trustStore()) // - .trustStorePassword(config.trustStorePassword()) // - .httpProxyConfig(config.httpProxyConfig()) // + .trustStore(config.getTrustStore()) // + .trustStorePassword(config.getTrustStorePassword()) // + .httpProxyConfig(config.getHttpProxyConfig()) // .build(); AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext("")); @@ -1041,12 +1039,10 @@ class ApplicationTest { if (managedElement != null) { mes.add(managedElement); } - return ImmutableRicConfig.builder() // + return RicConfig.builder() // .ricId(ricId) // .baseUrl(ricId) // .managedElementIds(mes) // - .controllerName("") // - .customAdapterClass("") // .build(); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java index d500ba3e..f876a13c 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java @@ -36,7 +36,6 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableWebClientConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.WebClientConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Rics; import org.onap.ccsdk.oran.a1policymanagementservice.tasks.RefreshConfigTask; @@ -166,15 +165,15 @@ class ConfigurationControllerTest { private AsyncRestClient restClient() { WebClientConfig config = this.applicationConfig.getWebClientConfig(); - config = ImmutableWebClientConfig.builder() // - .keyStoreType(config.keyStoreType()) // - .keyStorePassword(config.keyStorePassword()) // - .keyStore(config.keyStore()) // - .keyPassword(config.keyPassword()) // + config = WebClientConfig.builder() // + .keyStoreType(config.getKeyStoreType()) // + .keyStorePassword(config.getKeyStorePassword()) // + .keyStore(config.getKeyStore()) // + .keyPassword(config.getKeyPassword()) // .isTrustStoreUsed(false) // - .trustStore(config.trustStore()) // - .trustStorePassword(config.trustStorePassword()) // - .httpProxyConfig(config.httpProxyConfig()) // + .trustStore(config.getTrustStore()) // + .trustStorePassword(config.getTrustStorePassword()) // + .httpProxyConfig(config.getHttpProxyConfig()) // .build(); AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext("")); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java index fc565305..203cc3e5 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java @@ -38,7 +38,6 @@ import java.io.IOException; import java.net.URL; import java.time.Duration; import java.util.Arrays; -import java.util.HashMap; import java.util.Optional; import java.util.Properties; import java.util.Vector; @@ -55,8 +54,6 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationCo import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser.ConfigParserResult; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ConfigurationFile; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableConfigParserResult; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies; import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyTypes; @@ -77,12 +74,10 @@ class RefreshConfigTaskTest { ConfigurationFile configurationFileMock; private static final String RIC_1_NAME = "ric1"; - private static final RicConfig CORRECT_RIC_CONIFG = ImmutableRicConfig.builder() // + private static final RicConfig CORRECT_RIC_CONIFG = RicConfig.builder() // .ricId(RIC_1_NAME) // .baseUrl("http://localhost:8080/") // .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) // - .controllerName("") // - .customAdapterClass("") // .build(); private RefreshConfigTask createTestObject(boolean configFileExists) { @@ -148,11 +143,8 @@ class RefreshConfigTaskTest { } ConfigParserResult configParserResult(RicConfig... rics) { - return ImmutableConfigParserResult.builder() // + return ConfigParserResult.builder() // .ricConfigs(Arrays.asList(rics)) // - .dmaapConsumerTopicUrl("") // - .dmaapProducerTopicUrl("") // - .controllerConfigs(new HashMap<>()) // .build(); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java index 320d1fb0..875698a8 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java @@ -45,7 +45,7 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; +import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock.LockType; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies; @@ -65,12 +65,11 @@ class RicSupervisionTest { .schema("") // .build(); - private static final Ric RIC_1 = new Ric(ImmutableRicConfig.builder() // + private static final Ric RIC_1 = new Ric(RicConfig.builder() // .ricId("ric_1") // .baseUrl("baseUrl1") // .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) // .controllerName("controllerName") // - .customAdapterClass("") // .build()); private static final String POLICY_1_ID = "policyId1"; @@ -150,6 +149,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).checkAllRics(); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.AVAILABLE); } @Test @@ -169,6 +169,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).createSynchronizationTask(); verify(synchronizationTaskMock).synchronizeRic(RIC_1); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); } @Test @@ -183,6 +184,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).checkAllRics(); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.SYNCHRONIZING); } @Test @@ -223,6 +225,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).createSynchronizationTask(); verify(synchronizationTaskMock).synchronizeRic(RIC_1); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); } @Test @@ -246,6 +249,8 @@ class RicSupervisionTest { verify(supervisorUnderTest).createSynchronizationTask(); verify(synchronizationTaskMock).synchronizeRic(RIC_1); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); + } @Test @@ -263,6 +268,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).checkAllRics(); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); } @Test @@ -287,6 +293,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).createSynchronizationTask(); verify(synchronizationTaskMock).synchronizeRic(RIC_1); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); } @Test @@ -315,6 +322,7 @@ class RicSupervisionTest { verify(supervisorUnderTest).createSynchronizationTask(); verify(synchronizationTaskMock).synchronizeRic(RIC_1); verifyNoMoreInteractions(supervisorUnderTest); + assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE); } @SuppressWarnings("unchecked") diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java index e7e0a561..2e5424db 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java @@ -46,7 +46,7 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; +import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy; import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyType; @@ -105,12 +105,10 @@ class RicSynchronizationTaskTest { @BeforeEach void init() { - ric1 = new Ric(ImmutableRicConfig.builder() // + ric1 = new Ric(RicConfig.builder() // .ricId(RIC_1_NAME) // .baseUrl("baseUrl1") // - .managedElementIds(Collections.emptyList()) // .controllerName("controllerName") // - .customAdapterClass("") // .build()); policy1 = createPolicy("policyId1", false); policyTypes = new PolicyTypes(appConfig); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java index 8cdf2cc7..c8c7c723 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/ServiceSupervisionTest.java @@ -34,7 +34,6 @@ import ch.qos.logback.core.read.ListAppender; import java.time.Duration; import java.time.Instant; -import java.util.Collections; import org.awaitility.Durations; import org.junit.jupiter.api.Test; @@ -44,7 +43,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client; import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; -import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy; @@ -70,12 +68,9 @@ class ServiceSupervisionTest { private Services services; private Service service; private Policies policies; - private RicConfig ricConfig = ImmutableRicConfig.builder() // + private RicConfig ricConfig = RicConfig.builder() // .ricId(RIC_NAME) // .baseUrl("baseUrl") // - .managedElementIds(Collections.emptyList()) // - .controllerName("") // - .customAdapterClass("") // .build(); private Ric ric = new Ric(ricConfig); private PolicyType policyType = PolicyType.builder() // |