Bug 7805: Add make-leader-local rpc for module based shard.
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / actors / dds / FailedDataTreeModificationTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.controller.cluster.databroker.actors.dds;
9
10 import static org.mockito.MockitoAnnotations.initMocks;
11
12 import java.util.function.Supplier;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.mockito.Mock;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
19
20 public class FailedDataTreeModificationTest {
21
22     private FailedDataTreeModification failedDataTreeModification;
23
24     @Mock
25     private YangInstanceIdentifier instanceIdentifier;
26     @Mock
27     private NormalizedNode normalizedNode;
28     @Mock
29     private DataTreeModificationCursor dataTreeModificationCursor;
30
31     @Before
32     public void setUp() throws Exception {
33         initMocks(this);
34         final Supplier supplier = () -> new RuntimeException("Operation failed.");
35         failedDataTreeModification = new FailedDataTreeModification(supplier);
36     }
37
38     @Test(expected = RuntimeException.class)
39     public void testReadNode() throws Exception {
40         failedDataTreeModification.readNode(instanceIdentifier);
41     }
42
43     @Test(expected = RuntimeException.class)
44     public void testNewModification() throws Exception {
45         failedDataTreeModification.newModification();
46     }
47
48     @Test(expected = RuntimeException.class)
49     public void testDelete() throws Exception {
50         failedDataTreeModification.delete(instanceIdentifier);
51     }
52
53     @Test(expected = RuntimeException.class)
54     public void testMerge() throws Exception {
55         failedDataTreeModification.merge(instanceIdentifier, normalizedNode);
56     }
57
58     @Test(expected = RuntimeException.class)
59     public void testWrite() throws Exception {
60         failedDataTreeModification.write(instanceIdentifier, normalizedNode);
61     }
62
63     @Test(expected = RuntimeException.class)
64     public void testReady() throws Exception {
65         failedDataTreeModification.ready();
66     }
67
68     @Test(expected = RuntimeException.class)
69     public void testApplyToCursor() throws Exception {
70         failedDataTreeModification.applyToCursor(dataTreeModificationCursor);
71     }
72
73     @Test(expected = RuntimeException.class)
74     public void testCreateCursor() throws Exception {
75         failedDataTreeModification.createCursor(instanceIdentifier);
76     }
77 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.