aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server/src/main/java/org')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java13
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java10
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java30
5 files changed, 27 insertions, 28 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java
index 0cf07a0f..74de87b0 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java
@@ -52,6 +52,7 @@ import java.util.Optional;
@Primary
public class CbsConfiguration extends PrhAppConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(CbsConfiguration.class);
+ private static final String CBS_CONFIG_MISSING = "CBS config missing";
private AaiClientConfiguration aaiClientCBSConfiguration;
private MessageRouterPublisher messageRouterPublisher;
private MessageRouterSubscriber messageRouterSubscriber;
@@ -111,31 +112,31 @@ public class CbsConfiguration extends PrhAppConfig {
@Override
public MessageRouterPublisher getMessageRouterPublisher() {
- return Optional.ofNullable(messageRouterPublisher).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(messageRouterPublisher).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
@Override
public MessageRouterSubscriber getMessageRouterSubscriber() {
- return Optional.ofNullable(messageRouterSubscriber).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(messageRouterSubscriber).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
@Override
public MessageRouterPublishRequest getMessageRouterPublishRequest() {
- return Optional.ofNullable(messageRouterCBSPublishRequest).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(messageRouterCBSPublishRequest).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
@Override
public MessageRouterPublishRequest getMessageRouterUpdatePublishRequest() {
- return Optional.ofNullable(messageRouterCBSUpdatePublishRequest).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(messageRouterCBSUpdatePublishRequest).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
@Override
public AaiClientConfiguration getAaiClientConfiguration() {
- return Optional.ofNullable(aaiClientCBSConfiguration).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(aaiClientCBSConfiguration).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
@Override
public MessageRouterSubscribeRequest getMessageRouterSubscribeRequest() {
- return Optional.ofNullable(messageRouterCBSSubscribeRequest).orElseThrow(() -> new RuntimeException("CBS config missing"));
+ return Optional.ofNullable(messageRouterCBSSubscribeRequest).orElseThrow(() -> new RuntimeException(CBS_CONFIG_MISSING));
}
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java
index b30d199f..ed0cbcd9 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java
@@ -35,11 +35,11 @@ import java.util.stream.Stream;
@Component
public class AaiQueryTaskImpl implements AaiQueryTask {
- public final static String ACTIVE_STATUS = "Active";
- public final static String RELATED_TO = "service-instance";
- public final static String CUSTOMER = "customer.global-customer-id";
- public final static String SERVICE_TYPE = "service-subscription.service-type";
- public final static String SERVICE_INSTANCE_ID = "service-instance.service-instance-id";
+ static final String ACTIVE_STATUS = "Active";
+ static final String RELATED_TO = "service-instance";
+ static final String CUSTOMER = "customer.global-customer-id";
+ static final String SERVICE_TYPE = "service-subscription.service-type";
+ static final String SERVICE_INSTANCE_ID = "service-instance.service-instance-id";
private final AaiHttpClient<AaiModel, AaiPnfResultModel> getPnfModelClient;
private final AaiHttpClient<AaiServiceInstanceQueryModel, AaiServiceInstanceResultModel> getServiceClient;
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
index 5efeae9a..2deafd8d 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
@@ -27,6 +27,7 @@ import reactor.core.publisher.Flux;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
+@FunctionalInterface
interface DmaapConsumerTask {
Flux<ConsumerDmaapModel> execute();
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
index d1a42c4d..0cdc40ea 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
@@ -28,6 +28,7 @@ import reactor.core.publisher.Flux;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/23/18
*/
+@FunctionalInterface
public interface DmaapPublisherTask {
Flux<MessageRouterPublishResponse> execute(ConsumerDmaapModel consumerDmaapModel) throws PrhTaskException;
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
index ba18f7b2..dbcde5c8 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
@@ -25,11 +25,7 @@ import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.logging.MdcVariables;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
+import org.slf4j.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
@@ -90,12 +86,12 @@ public class ScheduledTasks {
}
static class State {
- public final ConsumerDmaapModel DmaapModel;
- public final Boolean ActivationStatus;
+ public final ConsumerDmaapModel dmaapModel;
+ public final Boolean activationStatus;
- public State(final ConsumerDmaapModel DmaapModel, final Boolean ActivationStatus) {
- this.DmaapModel = DmaapModel;
- this.ActivationStatus = ActivationStatus;
+ public State(final ConsumerDmaapModel dmaapModel, final Boolean activationStatus) {
+ this.dmaapModel = dmaapModel;
+ this.activationStatus = activationStatus;
}
}
@@ -169,10 +165,10 @@ public class ScheduledTasks {
private Mono<State> publishToAaiConfiguration(final State state) {
try {
- return state.ActivationStatus
+ return state.activationStatus
? Mono.just(state)
: aaiProducerTask
- .execute(state.DmaapModel)
+ .execute(state.dmaapModel)
.map(x -> state);
} catch (PrhTaskException | SSLException e) {
return Mono.error(e);
@@ -180,24 +176,24 @@ public class ScheduledTasks {
}
private Mono<State> processAdditionalFields(final State state) {
- if (state.ActivationStatus) {
+ if (state.activationStatus) {
LOGGER.debug("Re-registration - Logical links won't be updated.");
return Mono.just(state);
}
- return bbsActionsTask.execute(state.DmaapModel).map(x -> state);
+ return bbsActionsTask.execute(state.dmaapModel).map(x -> state);
}
private Flux<MessageRouterPublishResponse>
publishToDmaapConfiguration(final State state) {
try {
- if (state.ActivationStatus) {
+ if (state.activationStatus) {
LOGGER.debug("Re-registration - Using PNF_UPDATE DMaaP topic.");
- return dmaapUpdateProducerTask.execute(state.DmaapModel);
+ return dmaapUpdateProducerTask.execute(state.dmaapModel);
}
- return dmaapReadyProducerTask.execute(state.DmaapModel);
+ return dmaapReadyProducerTask.execute(state.dmaapModel);
} catch (PrhTaskException e) {
return Flux.error(e);
}