3 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 package org.opendaylight.controller.cluster.datastore;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.mockito.Mockito;
16 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
17 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
18 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
19 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
20 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
21 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
23 public class TransactionChainProxyTest {
24 ActorContext actorContext = Mockito.mock(ActorContext.class);
25 SchemaContext schemaContext = Mockito.mock(SchemaContext.class);
27 public void testNewReadOnlyTransaction() throws Exception {
29 DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadOnlyTransaction();
30 Assert.assertTrue(dst instanceof DOMStoreReadTransaction);
35 public void testNewReadWriteTransaction() throws Exception {
36 DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadWriteTransaction();
37 Assert.assertTrue(dst instanceof DOMStoreReadWriteTransaction);
42 public void testNewWriteOnlyTransaction() throws Exception {
43 DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newWriteOnlyTransaction();
44 Assert.assertTrue(dst instanceof DOMStoreWriteTransaction);
48 @Test(expected=UnsupportedOperationException.class)
49 public void testClose() throws Exception {
50 new TransactionChainProxy(actorContext, schemaContext).close();