Update .gitreview to stable/neon
[ovsdb.git] / southbound / southbound-impl / src / test / java / org / opendaylight / ovsdb / southbound / ovsdb / transact / ControllerUpdateCommandTest.java
1 /*
2  * Copyright (c) 2015 Inocybe Technologies. 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.ovsdb.southbound.ovsdb.transact;
9
10 import static org.mockito.Mockito.mock;
11 import static org.mockito.Mockito.when;
12
13 import java.util.Map;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17 import org.mockito.Mock;
18 import org.mockito.Mockito;
19 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
20 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24 import org.powermock.api.mockito.PowerMockito;
25 import org.powermock.core.classloader.annotations.PrepareForTest;
26 import org.powermock.modules.junit4.PowerMockRunner;
27
28 @PrepareForTest({ControllerUpdateCommand.class, TransactUtils.class})
29 @RunWith(PowerMockRunner.class)
30 public class ControllerUpdateCommandTest {
31
32     @Mock private ControllerUpdateCommand contUpdateCmd;
33     @Mock private DataChangeEvent changes;
34     @Mock private DataChangeEvent returnChanges;
35     @Mock private Map<InstanceIdentifier<ControllerEntry>, ControllerEntry> controllers;
36     @Mock private Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> bridges;
37
38     @Before
39     public void setUp() throws Exception {
40         contUpdateCmd = mock(ControllerUpdateCommand.class, Mockito.CALLS_REAL_METHODS);
41     }
42
43     @Test
44     public void testExecute() {
45         PowerMockito.mockStatic(TransactUtils.class);
46         when(TransactUtils.extractCreated(changes, ControllerEntry.class)).thenReturn(controllers);
47         when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(bridges);
48
49         TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS);
50         contUpdateCmd.execute(transaction, mock(BridgeOperationalState.class), changes,
51                 mock(InstanceIdentifierCodec.class));
52
53         // TODO Actually verify something
54     }
55
56 }