Update docs conf.yaml version to Sulfur
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / impl / NbiNotificationsImplTest.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.nbinotifications.impl;
9
10 import static org.junit.Assert.assertNull;
11
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;
26
27 public class NbiNotificationsImplTest extends AbstractTest {
28     private NbiNotificationsImpl nbiNotificationsImpl;
29
30     @Before
31     public void setUp() {
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");
37     }
38
39     @Test
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());
45     }
46
47     @Test
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());
56     }
57
58     @Test
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());
67     }
68 }