2 * Copyright © 2020 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.nbinotifications.impl;
10 import static org.junit.Assert.assertNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import java.util.concurrent.ExecutionException;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
17 import org.opendaylight.transportpce.test.AbstractTest;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
19 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceInputBuilder;
20 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutput;
21 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceInputBuilder;
22 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutput;
23 import org.opendaylight.yangtools.yang.common.RpcResult;
25 public class NbiNotificationsImplTest extends AbstractTest {
26 private NbiNotificationsImpl nbiNotificationsImpl;
30 JsonStringConverter<org.opendaylight.yang.gen.v1
31 .nbi.notifications.rev210628.NotificationService> converter = new JsonStringConverter<>(
32 getDataStoreContextUtil().getBindingDOMCodecServices());
33 JsonStringConverter<org.opendaylight.yang.gen.v1
34 .nbi.notifications.rev210628.NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
35 getDataStoreContextUtil().getBindingDOMCodecServices());
36 nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080");
40 public void getNotificationsServiceEmptyDataTest() throws InterruptedException, ExecutionException {
41 ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
42 nbiNotificationsImpl.getNotificationsService(new GetNotificationsServiceInputBuilder().build());
43 assertNull("Should be null", result.get().getResult().getNotificationService());
47 public void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
48 GetNotificationsServiceInputBuilder builder = new GetNotificationsServiceInputBuilder()
49 .setGroupId("groupId")
50 .setIdConsumer("consumerId")
51 .setConnectionType(ConnectionType.Service);
52 ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
53 nbiNotificationsImpl.getNotificationsService(builder.build());
54 assertNull("Should be null", result.get().getResult().getNotificationService());
58 public void getNotificationsAlarmServiceTest() throws InterruptedException, ExecutionException {
59 GetNotificationsAlarmServiceInputBuilder builder = new GetNotificationsAlarmServiceInputBuilder()
60 .setGroupId("groupId")
61 .setIdConsumer("consumerId")
62 .setConnectionType(ConnectionType.Service);
63 ListenableFuture<RpcResult<GetNotificationsAlarmServiceOutput>> result =
64 nbiNotificationsImpl.getNotificationsAlarmService(builder.build());
65 assertNull("Should be null", result.get().getResult().getNotificationAlarmService());