import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+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.transportpce.nbinotifications.impl.NbiNotificationsImpl;
+import org.opendaylight.transportpce.nbinotifications.impl.NbiNotificationsProvider;
import org.opendaylight.transportpce.nbinotifications.impl.rpc.CreateNotificationSubscriptionServiceImpl;
import org.opendaylight.transportpce.nbinotifications.serialization.ConfigConstants;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
public class PublisherTest extends AbstractTest {
+
private static NetworkTransactionService networkTransactionService;
+ @Mock
+ RpcProviderService rpcProviderRegistry;
+ @Mock
+ private NotificationService notificationService;
+
private JsonStringConverter<NotificationProcessService> converterService;
private JsonStringConverter<NotificationAlarmService> converterAlarm;
private JsonStringConverter<NotificationTapiService> converterTapiService;
private MockProducer<String, NotificationProcessService> mockProducer;
private MockProducer<String, NotificationAlarmService> mockAlarmProducer;
private MockProducer<String, NotificationTapiService> mockTapiProducer;
- private NbiNotificationsImpl nbiNotificationsImpl;
+ private NbiNotificationsProvider nbiNotifications;
private TopicManager topicManager;
networkTransactionService = new NetworkTransactionImpl(getDataBroker());
topicManager.setTapiConverter(converterTapiService);
NotificationServiceDataUtils.createTapiContext(networkTransactionService);
- nbiNotificationsImpl = new NbiNotificationsImpl(converterService, converterAlarm, converterTapiService,
- "localhost:8080", networkTransactionService, topicManager);
+ nbiNotifications = new NbiNotificationsProvider("localhost:8080", "localhost:8080",
+ rpcProviderRegistry, notificationService, getDataStoreContextUtil().getBindingDOMCodecServices(),
+ networkTransactionService);
}
@Test
.build();
builder.setSubscriptionFilter(subscriptionFilter);
- new CreateNotificationSubscriptionServiceImpl(nbiNotificationsImpl, topicManager).invoke(builder.build());
+ new CreateNotificationSubscriptionServiceImpl(nbiNotifications, topicManager).invoke(builder.build());
String json = Files.readString(Paths.get("src/test/resources/tapi_event.json"));
NotificationTapiService notificationTapiService = converterTapiService
.createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationTapiService.QNAME),