Modify method calls in A1 client
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / configuration / EnvironmentProcessor.java
index c2033f4..5987c94 100644 (file)
  */
 
 package org.oransc.policyagent.configuration;
+
 import java.util.Optional;
 import java.util.Properties;
+
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.EnvProperties;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.ImmutableEnvProperties;
 import org.oransc.policyagent.exceptions.EnvironmentLoaderException;
@@ -41,11 +43,11 @@ class EnvironmentProcessor {
         EnvProperties envProperties;
         try {
             envProperties = ImmutableEnvProperties.builder() //
-                    .consulHost(getConsulHost(systemEnvironment)) //
-                    .consulPort(getConsultPort(systemEnvironment)) //
-                    .cbsName(getConfigBindingService(systemEnvironment)) //
-                    .appName(getService(systemEnvironment)) //
-                    .build();
+                .consulHost(getConsulHost(systemEnvironment)) //
+                .consulPort(getConsultPort(systemEnvironment)) //
+                .cbsName(getConfigBindingService(systemEnvironment)) //
+                .appName(getService(systemEnvironment)) //
+                .build();
         } catch (EnvironmentLoaderException e) {
             return Mono.error(e);
         }
@@ -55,27 +57,27 @@ class EnvironmentProcessor {
 
     private static String getConsulHost(Properties systemEnvironments) throws EnvironmentLoaderException {
         return Optional.ofNullable(systemEnvironments.getProperty("CONSUL_HOST"))
-                .orElseThrow(() -> new EnvironmentLoaderException("$CONSUL_HOST environment has not been defined"));
+            .orElseThrow(() -> new EnvironmentLoaderException("$CONSUL_HOST environment has not been defined"));
     }
 
     private static Integer getConsultPort(Properties systemEnvironments) {
         return Optional.ofNullable(systemEnvironments.getProperty("CONSUL_PORT")) //
-                .map(Integer::valueOf) //
-                .orElseGet(EnvironmentProcessor::getDefaultPortOfConsul);
+            .map(Integer::valueOf) //
+            .orElseGet(EnvironmentProcessor::getDefaultPortOfConsul);
     }
 
     private static String getConfigBindingService(Properties systemEnvironments) throws EnvironmentLoaderException {
         return Optional.ofNullable(systemEnvironments.getProperty("CONFIG_BINDING_SERVICE")) //
-                .orElseThrow(
-                        () -> new EnvironmentLoaderException("$CONFIG_BINDING_SERVICE environment has not been defined"));
+            .orElseThrow(
+                () -> new EnvironmentLoaderException("$CONFIG_BINDING_SERVICE environment has not been defined"));
     }
 
     private static String getService(Properties systemEnvironments) throws EnvironmentLoaderException {
         return Optional
-                .ofNullable(Optional.ofNullable(systemEnvironments.getProperty("HOSTNAME"))
-                        .orElse(systemEnvironments.getProperty("SERVICE_NAME")))
-                .orElseThrow(() -> new EnvironmentLoaderException(
-                        "Neither $HOSTNAME/$SERVICE_NAME have not been defined as system environment"));
+            .ofNullable(Optional.ofNullable(systemEnvironments.getProperty("HOSTNAME"))
+                .orElse(systemEnvironments.getProperty("SERVICE_NAME")))
+            .orElseThrow(() -> new EnvironmentLoaderException(
+                "Neither $HOSTNAME/$SERVICE_NAME have not been defined as system environment"));
     }
 
     private static Integer getDefaultPortOfConsul() {