import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowplugin.applications.frsync.SyncReactor;
-import org.opendaylight.openflowplugin.applications.frsync.util.SemaphoreKeeperGuavaImpl;
import org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
@Before
public void setUp() throws Exception {
- final SemaphoreKeeperGuavaImpl semaphoreKeeper = new SemaphoreKeeperGuavaImpl<InstanceIdentifier<FlowCapableNode>>(1, true);
- reactor = new SyncReactorGuardDecorator(delegate, semaphoreKeeper);
- InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
+ reactor = new SyncReactorGuardDecorator(delegate);
+ InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
+ .child(Node.class, new NodeKey(NODE_ID));
fcNodePath = nodePath.augmentation(FlowCapableNode.class);
final Node operationalNode = Mockito.mock(Node.class);
Mockito.when(operationalNode.getId()).thenReturn(NODE_ID);
- Mockito.when(operationalNode.getAugmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode);
+ Mockito.when(operationalNode.augmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode);
}
@Test
- public void testSyncupSuccess() throws Exception {
- Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Matchers.<SyncupEntry>any()))
+ public void testSyncupSuccess() {
+ Mockito.when(delegate.syncup(Matchers.any(), Matchers.any()))
.thenReturn(Futures.immediateFuture(Boolean.TRUE));
reactor.syncup(fcNodePath, syncupEntry);
}
@Test
- public void testSyncupFail() throws Exception {
- Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Matchers.<SyncupEntry>any()))
+ public void testSyncupFail() {
+ Mockito.when(delegate.syncup(Matchers.any(), Matchers.any()))
.thenReturn(Futures.immediateFailedFuture(new Exception()));
reactor.syncup(fcNodePath, syncupEntry);
Mockito.verify(delegate).syncup(fcNodePath, syncupEntry);
Mockito.verifyNoMoreInteractions(delegate);
-
}
-
-}
\ No newline at end of file
+}