Revert "Unify ORv1 and IIv5"
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / NotificationStmtTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, 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.yangtools.yang.stmt;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertNotNull;
12
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.AnyxmlSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
17
18 class NotificationStmtTest extends AbstractYangTest {
19     @Test
20     void notificationTest() {
21         final var result = assertEffectiveModel("/model/baz.yang", "/model/bar.yang");
22
23         final var testModule = result.findModules("baz").iterator().next();
24         assertNotNull(testModule);
25
26         final var notifications = testModule.getNotifications();
27         assertEquals(1, notifications.size());
28
29         final var notification = notifications.iterator().next();
30         assertEquals("event", notification.getQName().getLocalName());
31         assertEquals(3, notification.getChildNodes().size());
32
33         var leaf = (LeafSchemaNode) notification.getDataChildByName(QName.create(testModule.getQNameModule(),
34             "event-class"));
35         assertNotNull(leaf);
36         leaf = (LeafSchemaNode) notification.getDataChildByName(QName.create(testModule.getQNameModule(), "severity"));
37         assertNotNull(leaf);
38         final var anyXml = (AnyxmlSchemaNode) notification.getDataChildByName(QName.create(
39             testModule.getQNameModule(), "reporting-entity"));
40         assertNotNull(anyXml);
41     }
42 }