Update MRI projects for Aluminium
[openflowplugin.git] / applications / bulk-o-matic / src / test / java / org / opendaylight / openflowplugin / applications / bulk / o / matic / TableWriterTest.java
index 5ca5a582065a4d5930b483f3daab133018253099..6d359a555e808a0a32abb81b95ffcc1087078d98 100644 (file)
@@ -1,16 +1,14 @@
-/**
+/*
  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.bulk.o.matic;
 
 import static org.mockito.Mockito.doReturn;
 
-import com.google.common.util.concurrent.Futures;
 import java.util.concurrent.ExecutorService;
 import org.junit.Before;
 import org.junit.Test;
@@ -18,22 +16,18 @@ import org.junit.runner.RunWith;
 import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Test for {@link FlowWriterSequential}.
  */
 @RunWith(MockitoJUnitRunner.class)
 public class TableWriterTest {
-    private static final Logger LOG = LoggerFactory.getLogger(TableWriterTest.class);
-
     private static final int TABLES_PER_DPN = 100;
     private static final int DPN_COUNT = 1;
     private static final short START_TABLE_ID = 0;
@@ -49,33 +43,32 @@ public class TableWriterTest {
     private TableWriter tableWriter;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
 
         doReturn(writeTransaction).when(mockDataBroker).newWriteOnlyTransaction();
-        Mockito.when(writeTransaction.submit()).thenReturn(Futures.immediateCheckedFuture(null));
+        doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit();
 
         Mockito.doAnswer(invocation -> {
             ((Runnable) invocation.getArguments()[0]).run();
             return null;
-        }).when(mockTablePusher).execute(ArgumentMatchers.<Runnable>any());
+        }).when(mockTablePusher).execute(ArgumentMatchers.any());
 
         tableWriter = new TableWriter(mockDataBroker, mockTablePusher);
     }
 
     @Test
-    public void testAddTables() throws Exception {
+    public void testAddTables() {
         tableWriter.addTables(DPN_COUNT, START_TABLE_ID, END_TABLE_ID);
         Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN))
-                .put(ArgumentMatchers.<LogicalDatastoreType>any(),
-                        ArgumentMatchers.<InstanceIdentifier<DataObject>>any(), ArgumentMatchers.<DataObject>any(),
-                        ArgumentMatchers.anyBoolean());
+                .mergeParentStructurePut(ArgumentMatchers.any(),
+                        ArgumentMatchers.any(), ArgumentMatchers.any());
     }
 
     @Test
-    public void testDeleteTables() throws Exception {
+    public void testDeleteTables() {
         tableWriter.deleteTables(DPN_COUNT, START_TABLE_ID, END_TABLE_ID);
         Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN))
-                .delete(ArgumentMatchers.<LogicalDatastoreType>any(),
+                .delete(ArgumentMatchers.any(),
                         ArgumentMatchers.<InstanceIdentifier<DataObject>>any());
     }
 }