Merge "Remove redundant type specifiers"
[openflowplugin.git] / applications / forwardingrules-manager / src / test / java / test / mock / GroupListenerTest.java
index f77ffa107e74f712f68d7176d1836df85b53680b..de3076fd4263c9084b8b7498f4ebe5f17fd0398d 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -18,15 +18,16 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
 import org.opendaylight.openflowplugin.applications.frm.impl.DeviceMastershipManager;
 import org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
 import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
+import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
@@ -52,27 +53,33 @@ public class GroupListenerTest extends FRMTest {
     private ForwardingRulesManagerImpl forwardingRulesManager;
     private static final NodeId NODE_ID = new NodeId("testnode:1");
     private static final NodeKey NODE_KEY = new NodeKey(NODE_ID);
-    RpcProviderRegistry rpcProviderRegistryMock = new RpcProviderRegistryMock();
+    RpcProviderRegistryMock rpcProviderRegistryMock = new RpcProviderRegistryMock();
     @Mock
     ClusterSingletonServiceProvider clusterSingletonService;
     @Mock
     DeviceMastershipManager deviceMastershipManager;
     @Mock
-    private NotificationProviderService notificationService;
-    @Mock
     private ReconciliationManager reconciliationManager;
-
+    @Mock
+    private OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
+    @Mock
+    private ServiceRecoveryRegistry serviceRecoveryRegistry;
+    @Mock
+    private MastershipChangeServiceManager mastershipChangeServiceManager;
 
     @Before
     public void setUp() {
         forwardingRulesManager = new ForwardingRulesManagerImpl(
                 getDataBroker(),
                 rpcProviderRegistryMock,
+                rpcProviderRegistryMock,
                 getConfig(),
+                mastershipChangeServiceManager,
                 clusterSingletonService,
-                notificationService,
                 getConfigurationService(),
-                reconciliationManager);
+                reconciliationManager,
+                openflowServiceRecoveryHandler,
+                serviceRecoveryRegistry);
 
         forwardingRulesManager.start();
         // TODO consider tests rewrite (added because of complicated access)
@@ -91,7 +98,7 @@ public class GroupListenerTest extends FRMTest {
 
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getAddGroupCalls()), equalTo(1));
         List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
@@ -104,7 +111,7 @@ public class GroupListenerTest extends FRMTest {
         group = new GroupBuilder().withKey(groupKey).setGroupName("Group1").build();
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getAddGroupCalls()), equalTo(2));
         addGroupCalls = salGroupService.getAddGroupCalls();
@@ -123,7 +130,7 @@ public class GroupListenerTest extends FRMTest {
 
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getAddGroupCalls()), equalTo(1));
         List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
@@ -133,7 +140,7 @@ public class GroupListenerTest extends FRMTest {
         group = new GroupBuilder().withKey(groupKey).setGroupName("Group2").build();
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getUpdateGroupCalls()), equalTo(1));
         List<UpdateGroupInput> updateGroupCalls = salGroupService.getUpdateGroupCalls();
@@ -152,7 +159,7 @@ public class GroupListenerTest extends FRMTest {
 
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getAddGroupCalls()), equalTo(1));
         List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
@@ -161,7 +168,7 @@ public class GroupListenerTest extends FRMTest {
 
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.delete(LogicalDatastoreType.CONFIGURATION, groupII);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
         salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
         await().until(listSize(salGroupService.getRemoveGroupCalls()), equalTo(1));
         List<RemoveGroupInput> removeGroupCalls = salGroupService.getRemoveGroupCalls();
@@ -180,7 +187,7 @@ public class GroupListenerTest extends FRMTest {
 
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
-        assertCommit(writeTx.submit());
+        assertCommit(writeTx.commit());
     }
 
     @After