@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;
@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));
}
}
@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;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
+@FunctionalInterface
interface DmaapConsumerTask {
Flux<ConsumerDmaapModel> execute();
}
/**
* @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;
}
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;
}
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;
}
}
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);
}
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);
}
+++ /dev/null
-{
- "link-name": "some-link",
- "link-type": "attachmentPoint",
- "relationship-list": [
- {
- "relationship": {
- "related-link": "/network/pnfs/pnf/NOKQTFCOC540002E"
- }
- }
- ]
-}
\ No newline at end of file
+++ /dev/null
-["a", "d", "d"]
@Value.Immutable
@Gson.TypeAdapters(fieldNamingStrategy = true)
+@FunctionalInterface
public interface Relationship {
@SerializedName(value = "related-link")
@Value.Immutable
@Gson.TypeAdapters(fieldNamingStrategy = true)
+@FunctionalInterface
public interface RelationshipWrapper {
@SerializedName(value = "relationship")