Make methods static
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / services / sal / SalTableServiceImplTest.java
index 2743236acd65d0bac959cd873eb34c73eafd17e4..a73ed9aa46eab22014765aee35b55819810d990f 100644 (file)
@@ -15,7 +15,6 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import org.junit.Assert;
 import org.junit.Test;
@@ -23,8 +22,7 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory;
 import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
@@ -36,19 +34,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 
 public class SalTableServiceImplTest extends ServiceMocking {
 
     @Mock
-    RpcProviderRegistry mockedRpcProviderRegistry;
+    RpcProviderService mockedRpcProviderRegistry;
 
     private SettableFuture<Object> handleResultFuture;
     private SalTableServiceImpl salTableService;
@@ -63,7 +59,7 @@ public class SalTableServiceImplTest extends ServiceMocking {
             return null;
         })
                 .when(mockedOutboundQueue).commitEntry(
-                anyLong(), ArgumentMatchers.<OfHeader>any(), ArgumentMatchers.<FutureCallback<OfHeader>>any());
+                anyLong(), ArgumentMatchers.any(), ArgumentMatchers.any());
 
         final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext,
@@ -71,13 +67,13 @@ public class SalTableServiceImplTest extends ServiceMocking {
     }
 
     @Test
-    public void testUpdateTableFail1() throws ExecutionException, InterruptedException {
+    public void testUpdateTableFail1() {
         Mockito.doAnswer((Answer<Void>) invocation -> {
             final RpcResult<List<MultipartReply>> rpcResult =
                     RpcResultBuilder.<List<MultipartReply>>failed().build();
             handleResultFuture.set(rpcResult);
             return null;
-        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
 
         final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
         Assert.assertNotNull(rpcResultFuture);
@@ -85,14 +81,14 @@ public class SalTableServiceImplTest extends ServiceMocking {
     }
 
     @Test
-    public void testUpdateTableFail2() throws ExecutionException, InterruptedException {
+    public void testUpdateTableFail2() {
         Mockito.doAnswer((Answer<Void>) invocation -> {
             final RpcResult<List<MultipartReply>> rpcResult =
                     RpcResultBuilder.success(Collections.<MultipartReply>emptyList())
                     .build();
             handleResultFuture.set(rpcResult);
             return null;
-        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
 
         final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
         Assert.assertNotNull(rpcResultFuture);
@@ -100,13 +96,13 @@ public class SalTableServiceImplTest extends ServiceMocking {
     }
 
     @Test
-    public void testUpdateTableSuccess() throws ExecutionException, InterruptedException {
+    public void testUpdateTableSuccess() {
         Mockito.doAnswer((Answer<Void>) invocation -> {
             TableFeaturesBuilder tableFeaturesBld = new TableFeaturesBuilder()
                     .setTableId((short) 0)
                     .setName("Zafod")
                     .setMaxEntries(42L)
-                    .setTableFeatureProperties(Collections.<TableFeatureProperties>emptyList());
+                    .setTableFeatureProperties(Collections.emptyList());
             MultipartReplyTableFeaturesBuilder mpTableFeaturesBld = new MultipartReplyTableFeaturesBuilder()
                     .setTableFeatures(Collections.singletonList(tableFeaturesBld.build()));
             MultipartReplyTableFeaturesCaseBuilder mpBodyBld = new MultipartReplyTableFeaturesCaseBuilder()
@@ -120,17 +116,17 @@ public class SalTableServiceImplTest extends ServiceMocking {
                     .build();
             handleResultFuture.set(rpcResult);
             return null;
-        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.<EventIdentifier>any());
+        }).when(multiMessageCollector).endCollecting(ArgumentMatchers.any());
 
         final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
         Assert.assertNotNull(rpcResultFuture);
         verify(mockedRequestContextStack).createRequestContext();
     }
 
-    private UpdateTableInput prepareUpdateTable() {
+    private static UpdateTableInput prepareUpdateTable() {
         UpdateTableInputBuilder updateTableInputBuilder = new UpdateTableInputBuilder();
         UpdatedTableBuilder updatedTableBuilder = new UpdatedTableBuilder();
-        updatedTableBuilder.setTableFeatures(Collections.<TableFeatures>emptyList());
+        updatedTableBuilder.setTableFeatures(Collections.emptyList());
         updateTableInputBuilder.setUpdatedTable(updatedTableBuilder.build());
         return updateTableInputBuilder.build();
     }