use of org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute in project yangtools by opendaylight.
the class LeafRefContextTreeBuilderTest method leafRefContextUtilsTest3.
@Test
public void leafRefContextUtilsTest3() {
final QName q16 = QName.create(tst, "con1");
final Absolute con1 = Absolute.of(q16);
final List<LeafRefContext> allLeafRefChilds = rootLeafRefContext.findAllLeafRefChilds(con1);
assertNotNull(allLeafRefChilds);
assertFalse(allLeafRefChilds.isEmpty());
assertEquals(4, allLeafRefChilds.size());
List<LeafRefContext> allChildsReferencedByLeafRef = rootLeafRefContext.findAllChildsReferencedByLeafRef(Absolute.of(QName.create(tst, "odl-contributor")));
assertNotNull(allChildsReferencedByLeafRef);
assertFalse(allChildsReferencedByLeafRef.isEmpty());
assertEquals(1, allChildsReferencedByLeafRef.size());
allChildsReferencedByLeafRef = rootLeafRefContext.findAllChildsReferencedByLeafRef(con1);
assertNotNull(allChildsReferencedByLeafRef);
assertTrue(allChildsReferencedByLeafRef.isEmpty());
}
use of org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute in project netconf by opendaylight.
the class NotificationListenerTest method notifi_grpTest.
@Test
public void notifi_grpTest() {
final Absolute schemaPathNotifi = Absolute.of(QName.create(MODULE, "notifi-grp"));
final DOMNotification notificationData = mock(DOMNotification.class);
final LeafNode<String> leaf = mockLeaf(QName.create(MODULE, "lf"));
final ContainerNode notifiBody = mockCont(schemaPathNotifi.lastNodeIdentifier(), leaf);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
when(notificationData.getBody()).thenReturn(notifiBody);
final String result = prepareJson(notificationData, schemaPathNotifi);
assertTrue(result.contains("ietf-restconf:notification"));
assertTrue(result.contains("event-time"));
assertTrue(result.contains("lf" + '"' + ":" + '"' + "value"));
}
use of org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute in project netconf by opendaylight.
the class NotificationListenerTest method notifi_augmTest.
@Test
public void notifi_augmTest() {
final Absolute schemaPathNotifi = Absolute.of(QName.create(MODULE, "notifi-augm"));
final DOMNotification notificationData = mock(DOMNotification.class);
final LeafNode<String> leaf = mockLeaf(QName.create(MODULE, "lf-augm"));
final AugmentationNode augm = mockAugm(leaf);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.lastNodeIdentifier(), augm);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
when(notificationData.getBody()).thenReturn(notifiBody);
final String result = prepareJson(notificationData, schemaPathNotifi);
assertTrue(result.contains("ietf-restconf:notification"));
assertTrue(result.contains("event-time"));
assertTrue(result.contains("lf-augm" + '"' + ":" + '"' + "value"));
}
use of org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute in project netconf by opendaylight.
the class NotificationListenerTest method notifi_cont_leafTest.
@Test
public void notifi_cont_leafTest() {
final Absolute schemaPathNotifi = Absolute.of(QName.create(MODULE, "notifi-cont"));
final DOMNotification notificationData = mock(DOMNotification.class);
final LeafNode<String> leaf = mockLeaf(QName.create(MODULE, "lf"));
final ContainerNode cont = mockCont(QName.create(MODULE, "cont"), leaf);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.lastNodeIdentifier(), cont);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
when(notificationData.getBody()).thenReturn(notifiBody);
final String result = prepareJson(notificationData, schemaPathNotifi);
assertTrue(result.contains("ietf-restconf:notification"));
assertTrue(result.contains("event-time"));
assertTrue(result.contains("notifi-module:notifi-cont"));
assertTrue(result.contains("cont"));
assertTrue(result.contains("lf" + '"' + ":" + '"' + "value"));
}
use of org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute in project netconf by opendaylight.
the class NetconfDeviceNotificationServiceTest method setUp.
@Before
public void setUp() throws Exception {
final Absolute path1 = Absolute.of(QName.create("namespace1", "path1"));
final Absolute path2 = Absolute.of(QName.create("namespace2", "path2"));
service = new NetconfDeviceNotificationService();
service.registerNotificationListener(listener1, path1);
registration = service.registerNotificationListener(listener2, path2);
doReturn(path1).when(notification1).getType();
doReturn(path2).when(notification2).getType();
}
Aggregations