diff options
9 files changed, 29 insertions, 40 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 e412bff5..3f018b53 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 @@ -43,6 +43,7 @@ import java.util.Optional; @Configuration public class CbsConfiguration implements Config { 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; @@ -105,31 +106,31 @@ public class CbsConfiguration implements Config { @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); } diff --git a/prh-app-server/src/test/resources/bbs_action/correct_logical_link.json b/prh-app-server/src/test/resources/bbs_action/correct_logical_link.json deleted file mode 100644 index e49a45ba..00000000 --- a/prh-app-server/src/test/resources/bbs_action/correct_logical_link.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "link-name": "some-link", - "link-type": "attachmentPoint", - "relationship-list": [ - { - "relationship": { - "related-link": "/network/pnfs/pnf/NOKQTFCOC540002E" - } - } - ] -}
\ No newline at end of file diff --git a/prh-app-server/src/test/resources/not_json_object.json b/prh-app-server/src/test/resources/not_json_object.json deleted file mode 100644 index f50456ee..00000000 --- a/prh-app-server/src/test/resources/not_json_object.json +++ /dev/null @@ -1 +0,0 @@ -["a", "d", "d"] diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/Relationship.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/Relationship.java index 17eb600a..1abeddf3 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/Relationship.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/Relationship.java @@ -25,6 +25,7 @@ import org.immutables.value.Value; @Value.Immutable @Gson.TypeAdapters(fieldNamingStrategy = true) +@FunctionalInterface public interface Relationship { @SerializedName(value = "related-link") diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/RelationshipWrapper.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/RelationshipWrapper.java index b6e1bad5..dcf81c0f 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/RelationshipWrapper.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/bbs/RelationshipWrapper.java @@ -25,6 +25,7 @@ import org.immutables.value.Value; @Value.Immutable @Gson.TypeAdapters(fieldNamingStrategy = true) +@FunctionalInterface public interface RelationshipWrapper { @SerializedName(value = "relationship") |