2 * Copyright (c) 2016 Cisco Systems, 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.mdsal.dom.spi;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertThrows;
13 import static org.junit.Assert.assertTrue;
15 import java.util.List;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
20 public class AbstractRegistrationTreeTest extends AbstractRegistrationTree<Object> {
22 public void basicTest() throws Exception {
23 final NodeIdentifier pathArgument = new NodeIdentifier(QName.create("", "pathArgument"));
24 final RegistrationTreeNode<Object> registrationTreeNodeParent = new RegistrationTreeNode<>(null, pathArgument);
25 final RegistrationTreeNode<Object> registrationTreeNode =
26 new RegistrationTreeNode<>(registrationTreeNodeParent, pathArgument);
28 final Object registration = new Object();
30 addRegistration(registrationTreeNode, registration);
31 assertTrue(registrationTreeNode.getRegistrations().contains(registration));
34 removeRegistration(registrationTreeNode, registration);
35 assertFalse(registrationTreeNode.getRegistrations().contains(registration));
37 assertNotNull(findNodeFor(List.of(pathArgument)));
38 assertNotNull(takeSnapshot());
42 public void unlockTest() throws Exception {
43 assertThrows(IllegalMonitorStateException.class, this::releaseLock);