729211641270355fdfb4554578e5bad1fb0576a7
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / test / java / org / opendaylight / mdsal / dom / store / inmemory / InMemoryDOMDataTreeShardProducerTest.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.mdsal.dom.store.inmemory;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Matchers.anyCollectionOf;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
14 import static org.mockito.Mockito.verify;
15 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.DOM_DATA_TREE_IDENTIFIER;
16 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.resetMocks;
17
18 import com.google.common.collect.ImmutableSet;
19 import org.junit.Test;
20 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
21
22 public class InMemoryDOMDataTreeShardProducerTest {
23
24     @Test
25     public void basicTest() throws Exception {
26         final InMemoryDOMDataTreeShard inMemoryDOMDataTreeShard = mock(InMemoryDOMDataTreeShard.class);
27         final InmemoryDOMDataTreeShardWriteTransaction inmemoryDOMDataTreeShardWriteTransaction =
28                 mock(InmemoryDOMDataTreeShardWriteTransaction.class);
29         doReturn(inmemoryDOMDataTreeShardWriteTransaction).when(inMemoryDOMDataTreeShard)
30                 .createTransaction(anyCollectionOf((DOMDataTreeIdentifier.class)));
31
32         final InMemoryDOMDataTreeShardProducer inMemoryDOMDataTreeShardProducer =
33                 new InMemoryDOMDataTreeShardProducer(inMemoryDOMDataTreeShard,
34                         ImmutableSet.of(DOM_DATA_TREE_IDENTIFIER));
35
36         assertNotNull(inMemoryDOMDataTreeShardProducer.createTransaction());
37         verify(inMemoryDOMDataTreeShard).createTransaction(anyCollectionOf(DOMDataTreeIdentifier.class));
38         resetMocks();
39     }
40 }