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.rev211210.ConnectionType;
19 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInputBuilder;
20 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput;
21 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInputBuilder;
22 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput;
23 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
24 import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
25 import org.opendaylight.yangtools.yang.common.RpcResult;
27 public class NbiNotificationsImplTest extends AbstractTest {
28 private NbiNotificationsImpl nbiNotificationsImpl;
32 JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
33 getDataStoreContextUtil().getBindingDOMCodecServices());
34 JsonStringConverter<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<GetNotificationsProcessServiceOutput>> result =
42 nbiNotificationsImpl.getNotificationsProcessService(
43 new GetNotificationsProcessServiceInputBuilder().build());
44 assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
48 public void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
49 GetNotificationsProcessServiceInputBuilder builder = new GetNotificationsProcessServiceInputBuilder()
50 .setGroupId("groupId")
51 .setIdConsumer("consumerId")
52 .setConnectionType(ConnectionType.Service);
53 ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
54 nbiNotificationsImpl.getNotificationsProcessService(builder.build());
55 assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
59 public void getNotificationsAlarmServiceTest() throws InterruptedException, ExecutionException {
60 GetNotificationsAlarmServiceInputBuilder builder = new GetNotificationsAlarmServiceInputBuilder()
61 .setGroupId("groupId")
62 .setIdConsumer("consumerId")
63 .setConnectionType(ConnectionType.Service);
64 ListenableFuture<RpcResult<GetNotificationsAlarmServiceOutput>> result =
65 nbiNotificationsImpl.getNotificationsAlarmService(builder.build());
66 assertNull("Should be null", result.get().getResult().getNotificationsAlarmService());