import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.GetNotificationListOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
+@ExtendWith(MockitoExtension.class)
public class NbiNotificationsImplTest extends AbstractTest {
- private NbiNotificationsImpl nbiNotificationsImpl;
+
+ @Mock
+ RpcProviderService rpcProviderRegistry;
+ @Mock
+ private NotificationService notificationService;
+
+ private NbiNotificationsProvider nbiNotifications;
public static NetworkTransactionService networkTransactionService;
private TopicManager topicManager;
private JsonStringConverter<NotificationProcessService> converterProcess;
topicManager.setTapiConverter(converterTapi);
NotificationServiceDataUtils.createTapiContext(networkTransactionService);
- nbiNotificationsImpl = new NbiNotificationsImpl(converterProcess, converterAlarm, converterTapi,
- "localhost:8080", networkTransactionService, topicManager);
+ nbiNotifications = new NbiNotificationsProvider("localhost:8080", "localhost:8080",
+ rpcProviderRegistry, notificationService, getDataStoreContextUtil().getBindingDOMCodecServices(),
+ networkTransactionService);
}
@Test
@Test
void createTapiNotificationSubscriptionServiceTest() throws InterruptedException, ExecutionException {
ListenableFuture<RpcResult<CreateNotificationSubscriptionServiceOutput>> result =
- new CreateNotificationSubscriptionServiceImpl(nbiNotificationsImpl, topicManager)
+ new CreateNotificationSubscriptionServiceImpl(nbiNotifications, topicManager)
.invoke(NotificationServiceDataUtils.buildNotificationSubscriptionServiceInputBuilder().build());
assertNotNull(result.get().getResult().getSubscriptionService().getUuid().toString(),
"Should receive UUID for subscription service");
@Test
void getTapiNotificationsServiceTest() throws InterruptedException, ExecutionException {
ListenableFuture<RpcResult<CreateNotificationSubscriptionServiceOutput>> result =
- new CreateNotificationSubscriptionServiceImpl(nbiNotificationsImpl, topicManager)
+ new CreateNotificationSubscriptionServiceImpl(nbiNotifications, topicManager)
.invoke(NotificationServiceDataUtils.buildNotificationSubscriptionServiceInputBuilder().build());
ListenableFuture<RpcResult<GetNotificationListOutput>> result2 =
new GetNotificationListImpl(converterTapi, "localhost:8080", networkTransactionService, topicManager)