* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.controlloop.actor.test;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import java.util.List;
import java.util.function.BiConsumer;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
+import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
*
* @param <Q> request type
*/
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation {
protected static final String MY_SINK = "my-sink";
protected static final String MY_SOURCE = "my-source";
private TopicServer<Q> topicServer;
- /**
- * Constructs the object using a default actor and operation name.
- */
- public BasicBidirectionalTopicOperation() {
- super();
- }
/**
* Constructs the object.
* @param actor actor name
* @param operation operation name
*/
- public BasicBidirectionalTopicOperation(String actor, String operation) {
+ protected BasicBidirectionalTopicOperation(String actor, String operation) {
super(actor, operation);
}
/**
* Starts the topic.
+ *
+ * @throws InterruptedException if interrupted
+ * @throws BidirectionalTopicClientException if the client cannot be built
*/
- protected static void initBeforeClass(String sinkTopic, String sourceTopic) throws Exception {
+ protected static void initBeforeClass(String sinkTopic, String sourceTopic)
+ throws InterruptedException, BidirectionalTopicClientException {
Util.buildDmaapSim();
// note: the sink and source names are swapped for the simulator
- TopicParameters ptopic = new TopicParameters();
+ var ptopic = new TopicParameters();
ptopic.setTopic(sourceTopic);
ptopic.setManaged(true);
ptopic.setServers(List.of("localhost"));
* Initializes a configuration.
*/
protected void initConfig() {
- when(config.getTopicHandler()).thenReturn(topicHandler);
- when(config.getForwarder()).thenReturn(forwarder);
- when(config.getTimeoutMs()).thenReturn(TIMEOUT_MS);
+ lenient().when(config.getTopicHandler()).thenReturn(topicHandler);
+ lenient().when(config.getForwarder()).thenReturn(forwarder);
+ lenient().when(config.getTimeoutMs()).thenReturn(TIMEOUT_MS);
}
/**