/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import lombok.ToString;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Class to represent the PARTICIPANT_UPDATE message that the control loop runtime sends to a participant.
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.springframework.web.reactive.function.client.WebClientResponseException;
public class HttpWebClientException extends WebClientResponseException {
+ private static final long serialVersionUID = 1L;
public HttpWebClientException(int statusCode, String statusText) {
super(statusCode, statusText, null, null, null);
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.clamp.controlloop.participant.http.parameters;
import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
- private static final Coder CODER = new StandardCoder();
private static final String TEST_KEY_NAME = "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Abstract Listener for Participant Ack messages sent by runtime.
*/
public abstract class ParticipantAckListener<T extends ParticipantAckMessage> extends ScoListener<T>
- implements Listener {
+ implements Listener<T> {
private final ParticipantHandler participantHandler;
private final Consumer<T> consumer;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Abstract Listener for Participant messages sent by CLAMP.
*/
-public abstract class ParticipantListener<T extends ParticipantMessage> extends ScoListener<T> implements Listener {
+public abstract class ParticipantListener<T extends ParticipantMessage> extends ScoListener<T> implements Listener<T> {
private final ParticipantHandler participantHandler;
private final Consumer<T> consumer;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @param publishers list of Publishers
* @param listeners list of Listeners
*/
- public IntermediaryActivator(final ParticipantParameters parameters,
+ public <T> IntermediaryActivator(final ParticipantParameters parameters,
ParticipantIntermediaryApi participantIntermediaryApi, List<Publisher> publishers,
- List<Listener> listeners) {
+ List<Listener<T>> listeners) {
this.participantIntermediaryApi = participantIntermediaryApi;
topicSinks = TopicEndpointManager.getManager()
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.common.endpoints.listeners.ScoListener;
-public interface Listener {
+public interface Listener<T> {
/**
* Get the type of message of interest to the listener.
*
* @return listener to register
*/
- <T> ScoListener<T> getScoListener();
+ ScoListener<T> getScoListener();
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.common.endpoints.listeners.ScoListener;
-public interface Listener {
+public interface Listener<T> {
/**
* Get the type of message of interest to the listener.
*
* @return listener to register
*/
- <T> ScoListener<T> getScoListener();
+ ScoListener<T> getScoListener();
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @param listeners list of Listeners
* @throws ControlLoopRuntimeException if the activator does not start
*/
- public MessageDispatcherActivator(final ClRuntimeParameterGroup clRuntimeParameterGroup, List<Publisher> publishers,
- List<Listener> listeners) {
+ public <T> MessageDispatcherActivator(final ClRuntimeParameterGroup clRuntimeParameterGroup,
+ List<Publisher> publishers, List<Listener<T>> listeners) {
topicSinks = TopicEndpointManager.getManager()
.addTopicSinks(clRuntimeParameterGroup.getTopicParameterGroup().getTopicSinks());
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ControlLoopStateChangeAck messages sent by participants.
*/
@Component
-public class ControlLoopStateChangeAckListener extends ScoListener<ControlLoopAck> implements Listener {
+public class ControlLoopStateChangeAckListener extends ScoListener<ControlLoopAck> implements Listener<ControlLoopAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopStateChangeAckListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ControlLoopUpdateAck messages sent by participants.
*/
@Component
-public class ControlLoopUpdateAckListener extends ScoListener<ControlLoopAck> implements Listener {
+public class ControlLoopUpdateAckListener extends ScoListener<ControlLoopAck> implements Listener<ControlLoopAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopUpdateAckListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ParticipantDeregister messages sent by participants.
*/
@Component
-public class ParticipantDeregisterListener extends ScoListener<ParticipantDeregister> implements Listener {
+public class ParticipantDeregisterListener extends ScoListener<ParticipantDeregister>
+ implements Listener<ParticipantDeregister> {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantDeregisterListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ParticipantRegister messages sent by participants.
*/
@Component
-public class ParticipantRegisterListener extends ScoListener<ParticipantRegister> implements Listener {
+public class ParticipantRegisterListener extends ScoListener<ParticipantRegister>
+ implements Listener<ParticipantRegister> {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantRegisterListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ParticipantStatus messages sent by participants.
*/
@Component
-public class ParticipantStatusListener extends ScoListener<ParticipantStatus> implements Listener {
+public class ParticipantStatusListener extends ScoListener<ParticipantStatus> implements Listener<ParticipantStatus> {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Listener for ParticipantUpdateAck messages sent by participants.
*/
@Component
-public class ParticipantUpdateAckListener extends ScoListener<ParticipantUpdateAck> implements Listener {
+public class ParticipantUpdateAckListener extends ScoListener<ParticipantUpdateAck>
+ implements Listener<ParticipantUpdateAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantUpdateAckListener.class);
private final SupervisionHandler supervisionHandler;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.List;
import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusListener;
import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData;
when(listenerSecond.getType()).thenReturn(TOPIC_SECOND);
when(listenerSecond.getScoListener()).thenReturn(listenerSecond);
- List<Listener> listeners = List.of(listenerFirst, listenerSecond);
+ List<Listener<ParticipantStatus>> listeners = List.of(listenerFirst, listenerSecond);
try (var activator = new MessageDispatcherActivator(parameterGroup, publishers, listeners)) {