FRS - sonar issues and repackage 96/42696/1
authorAndrej Leitner <anleitne@cisco.com>
Thu, 28 Jul 2016 09:53:36 +0000 (11:53 +0200)
committerAndrej Leitner <anleitne@cisco.com>
Thu, 28 Jul 2016 10:57:12 +0000 (12:57 +0200)
 - forwarders moved to strategy package
 - functions converted to labmdas
 - simplified statements
 - remove comments

Change-Id: I103d02f0dab3234ca9338f207a4102d814da2019
Signed-off-by: Andrej Leitner <anleitne@cisco.com>
21 files changed:
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/ForwardingRulesSyncProvider.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureDecorator.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/clustering/DeviceMastershipManager.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java [moved from applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/FlowForwarder.java with 98% similarity]
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarder.java [moved from applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/GroupForwarder.java with 98% similarity]
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarder.java [moved from applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/MeterForwarder.java with 98% similarity]
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java [moved from applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/TableForwarder.java with 97% similarity]
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtil.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/SyncupEntry.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorClusterDecoratorTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorFutureZipDecoratorTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorGuardDecoratorTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorRetryDecoratorTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java [moved from applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/FlowForwarderTest.java with 99% similarity]
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarderTest.java [moved from applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/GroupForwarderTest.java with 99% similarity]
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarderTest.java [moved from applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/MeterForwarderTest.java with 99% similarity]
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java [moved from applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/TableForwarderTest.java with 99% similarity]

index 5292ac13f28a059d0dc0018a880b6ef775f79343..996f3ef4c06d3a40e81d82fc32d831d8e32474a2 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOd
 import org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao;
 import org.opendaylight.openflowplugin.applications.frsync.impl.clustering.DeviceMastershipManager;
 import org.opendaylight.openflowplugin.applications.frsync.impl.strategy.SyncPlanPushStrategyFlatBatchImpl;
+import org.opendaylight.openflowplugin.applications.frsync.impl.strategy.TableForwarder;
 import org.opendaylight.openflowplugin.applications.frsync.util.ReconciliationRegistry;
 import org.opendaylight.openflowplugin.applications.frsync.util.SemaphoreKeeperGuavaImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.SalFlatBatchService;
index 9907d605d4617b753601a65cb8625c1f99716d18..ba3a1d8c59e9d858a8c85b78f70b047ecb9c3226 100644 (file)
@@ -41,7 +41,7 @@ public class SyncReactorFutureDecorator implements SyncReactor {
         final NodeId nodeId = PathUtil.digNodeId(flowcapableNodePath);
         LOG.trace("syncup future decorator: {}", nodeId.getValue());
 
-        final ListenableFuture<Boolean> syncup = executorService.submit(() -> {
+        return executorService.submit(() -> {
             final String oldThreadName = updateThreadName(nodeId);
 
             try {
@@ -56,8 +56,6 @@ public class SyncReactorFutureDecorator implements SyncReactor {
                 updateThreadName(oldThreadName);
             }
         });
-
-        return syncup;
     }
 
     protected ListenableFuture<Boolean> doSyncupInFuture(final InstanceIdentifier<FlowCapableNode> flowcapableNodePath,
index 0a9a8be9b6278f5df9337735f7f003e8e48d2a9f..41f736c05d8d2c199bd6192acfce006f406d7d64 100644 (file)
@@ -55,11 +55,7 @@ public class DeviceMastershipManager {
     }
 
     public boolean isDeviceMastered(final NodeId nodeId) {
-        if (deviceMasterships.get(nodeId) == null) {
-            return false;
-        } else {
-            return deviceMasterships.get(nodeId).isDeviceMastered();
-        }
+        return deviceMasterships.get(nodeId) != null && deviceMasterships.get(nodeId).isDeviceMastered();
     }
 
     @VisibleForTesting
@@ -1,12 +1,12 @@
-/**
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2016 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.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import com.google.common.base.Preconditions;
 import java.util.concurrent.Future;
@@ -1,12 +1,12 @@
-/**
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2016 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.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
@@ -1,12 +1,12 @@
-/**
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2016 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.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
index 99f5df16f80b55ce9a2115fc21ccd9be492b302a..70ce219708a1480efdca8f214dd9e51898e689f9 100644 (file)
@@ -24,7 +24,6 @@ import java.util.Map;
 import java.util.concurrent.Future;
 import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.applications.frsync.SyncPlanPushStrategy;
-import org.opendaylight.openflowplugin.applications.frsync.impl.TableForwarder;
 import org.opendaylight.openflowplugin.applications.frsync.util.FxChainUtil;
 import org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox;
 import org.opendaylight.openflowplugin.applications.frsync.util.PathUtil;
@@ -144,7 +143,8 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
 
                 final ProcessFlatBatchInput flatBatchInput = new ProcessFlatBatchInputBuilder()
                         .setNode(new NodeRef(PathUtil.digNodePath(diffInput.getNodeIdent())))
-                        .setExitOnFirstError(false) // TODO: propagate from input
+                        // TODO: propagate from input
+                        .setExitOnFirstError(false)
                         .setBatch(batchBag)
                         .build();
 
@@ -382,23 +382,21 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
     @VisibleForTesting
     static int assembleRemoveMeters(final List<Batch> batchBag, int batchOrder, final ItemSyncBox<Meter> meterItemSyncBox) {
         // process meter remove
-        if (meterItemSyncBox != null) {
-            if (!meterItemSyncBox.getItemsToPush().isEmpty()) {
-                final List<FlatBatchRemoveMeter> flatBatchRemoveMeterBag =
-                        new ArrayList<>(meterItemSyncBox.getItemsToUpdate().size());
-                int itemOrder = 0;
-                for (Meter meter : meterItemSyncBox.getItemsToPush()) {
-                    flatBatchRemoveMeterBag.add(new FlatBatchRemoveMeterBuilder(meter).setBatchOrder(itemOrder++).build());
-                }
-                final Batch batch = new BatchBuilder()
-                        .setBatchChoice(new FlatBatchRemoveMeterCaseBuilder()
-                                .setFlatBatchRemoveMeter(flatBatchRemoveMeterBag)
-                                .build())
-                        .setBatchOrder(batchOrder)
-                        .build();
-                batchOrder += itemOrder;
-                batchBag.add(batch);
+        if (meterItemSyncBox != null && !meterItemSyncBox.getItemsToPush().isEmpty()) {
+            final List<FlatBatchRemoveMeter> flatBatchRemoveMeterBag =
+                    new ArrayList<>(meterItemSyncBox.getItemsToUpdate().size());
+            int itemOrder = 0;
+            for (Meter meter : meterItemSyncBox.getItemsToPush()) {
+                flatBatchRemoveMeterBag.add(new FlatBatchRemoveMeterBuilder(meter).setBatchOrder(itemOrder++).build());
             }
+            final Batch batch = new BatchBuilder()
+                    .setBatchChoice(new FlatBatchRemoveMeterCaseBuilder()
+                            .setFlatBatchRemoveMeter(flatBatchRemoveMeterBag)
+                            .build())
+                    .setBatchOrder(batchOrder)
+                    .build();
+            batchOrder += itemOrder;
+            batchBag.add(batch);
         }
         return batchOrder;
     }
index 3f4b53efdb850e00fbe6792a3000fc50d54eb415..6d8ca69066e8ae0e1bc80e2ee0ed498d06231340 100644 (file)
@@ -18,10 +18,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import org.opendaylight.openflowplugin.applications.frsync.SyncPlanPushStrategy;
-import org.opendaylight.openflowplugin.applications.frsync.impl.FlowForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.GroupForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.MeterForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.TableForwarder;
 import org.opendaylight.openflowplugin.applications.frsync.util.CrudCounts;
 import org.opendaylight.openflowplugin.applications.frsync.util.FxChainUtil;
 import org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox;
@@ -67,9 +63,9 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
     private static final Logger LOG = LoggerFactory.getLogger(SyncPlanPushStrategyIncrementalImpl.class);
 
     private FlowForwarder flowForwarder;
-    private TableForwarder tableForwarder;
     private MeterForwarder meterForwarder;
     private GroupForwarder groupForwarder;
+    private TableForwarder tableForwarder;
     private FlowCapableTransactionService transactionService;
 
     @Override
@@ -153,9 +149,9 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
 
 
     ListenableFuture<RpcResult<Void>> addMissingFlows(final NodeId nodeId,
-                                                                final InstanceIdentifier<FlowCapableNode> nodeIdent,
-                                                                final Map<TableKey, ItemSyncBox<Flow>> flowsInTablesSyncBox,
-                                                                final SyncCrudCounters counters) {
+                                                      final InstanceIdentifier<FlowCapableNode> nodeIdent,
+                                                      final Map<TableKey, ItemSyncBox<Flow>> flowsInTablesSyncBox,
+                                                      final SyncCrudCounters counters) {
         if (flowsInTablesSyncBox.isEmpty()) {
             LOG.trace("no tables in config for node: {} -> SKIPPING", nodeId.getValue());
             return RpcResultBuilder.<Void>success().buildFuture();
@@ -204,22 +200,14 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 Futures.allAsList(allUpdateResults),
                 ReconcileUtil.<UpdateFlowOutput>createRpcResultCondenser("flow updating"));
 
-        final ListenableFuture<RpcResult<Void>> summaryResult = Futures.transform(
-                Futures.allAsList(singleVoidAddResult, singleVoidUpdateResult),
+        return Futures.transform(Futures.allAsList(singleVoidAddResult, singleVoidUpdateResult),
                 ReconcileUtil.<Void>createRpcResultCondenser("flow add/update"));
-
-        return summaryResult;
-
-        /*
-        return Futures.transform(summaryResult,
-                ReconcileUtil.chainBarrierFlush(PathUtil.digNodePath(nodeIdent), transactionService));
-                */
     }
 
     ListenableFuture<RpcResult<Void>> removeRedundantFlows(final NodeId nodeId,
-                                                                     final InstanceIdentifier<FlowCapableNode> nodeIdent,
-                                                                     final Map<TableKey, ItemSyncBox<Flow>> removalPlan,
-                                                                     final SyncCrudCounters counters) {
+                                                           final InstanceIdentifier<FlowCapableNode> nodeIdent,
+                                                           final Map<TableKey, ItemSyncBox<Flow>> removalPlan,
+                                                           final SyncCrudCounters counters) {
         if (removalPlan.isEmpty()) {
             LOG.trace("no tables in operational for node: {} -> SKIPPING", nodeId.getValue());
             return RpcResultBuilder.<Void>success().buildFuture();
@@ -250,9 +238,9 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
     }
 
     ListenableFuture<RpcResult<Void>> removeRedundantMeters(final NodeId nodeId,
-                                                                      final InstanceIdentifier<FlowCapableNode> nodeIdent,
-                                                                      final ItemSyncBox<Meter> meterRemovalPlan,
-                                                                      final SyncCrudCounters counters) {
+                                                            final InstanceIdentifier<FlowCapableNode> nodeIdent,
+                                                            final ItemSyncBox<Meter> meterRemovalPlan,
+                                                            final SyncCrudCounters counters) {
         if (meterRemovalPlan.isEmpty()) {
             LOG.trace("no meters on device for node: {} -> SKIPPING", nodeId.getValue());
             return RpcResultBuilder.<Void>success().buildFuture();
@@ -271,14 +259,8 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
             meterCrudCounts.incRemoved();
         }
 
-        final ListenableFuture<RpcResult<Void>> singleVoidResult = Futures.transform(
-                Futures.allAsList(allResults),
+        return Futures.transform(Futures.allAsList(allResults),
                 ReconcileUtil.<RemoveMeterOutput>createRpcResultCondenser("meter remove"));
-        return singleVoidResult;
-        /*
-        return Futures.transform(singleVoidResult,
-                ReconcileUtil.chainBarrierFlush(PathUtil.digNodePath(nodeIdent), transactionService));
-                */
     }
 
     ListenableFuture<RpcResult<Void>> removeRedundantGroups(final NodeId nodeId,
@@ -407,15 +389,14 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 ReconcileUtil.<Void>createRpcResultCondenser("group add/update"));
 
 
-        return Futures.transform(summaryResult,
-                ReconcileUtil.chainBarrierFlush(
-                        PathUtil.digNodePath(nodeIdent), transactionService));
+        return Futures.transform(summaryResult, ReconcileUtil.chainBarrierFlush(
+                PathUtil.digNodePath(nodeIdent), transactionService));
     }
 
     ListenableFuture<RpcResult<Void>> addMissingMeters(final NodeId nodeId,
-                                                                 final InstanceIdentifier<FlowCapableNode> nodeIdent,
-                                                                 final ItemSyncBox<Meter> syncBox,
-                                                                 final SyncCrudCounters counters) {
+                                                       final InstanceIdentifier<FlowCapableNode> nodeIdent,
+                                                       final ItemSyncBox<Meter> syncBox,
+                                                       final SyncCrudCounters counters) {
         if (syncBox.isEmpty()) {
             LOG.trace("no meters configured for node: {} -> SKIPPING", nodeId.getValue());
             return RpcResultBuilder.<Void>success().buildFuture();
@@ -451,22 +432,14 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 Futures.allAsList(allUpdateResults),
                 ReconcileUtil.<UpdateMeterOutput>createRpcResultCondenser("meter update"));
 
-        final ListenableFuture<RpcResult<Void>> summaryResults = Futures.transform(
-                Futures.allAsList(singleVoidUpdateResult, singleVoidAddResult),
+        return Futures.transform(Futures.allAsList(singleVoidUpdateResult, singleVoidAddResult),
                 ReconcileUtil.<Void>createRpcResultCondenser("meter add/update"));
-
-        return summaryResults;
-
-        /*
-        return Futures.transform(summaryResults,
-                ReconcileUtil.chainBarrierFlush(PathUtil.digNodePath(nodeIdent), transactionService));
-                */
     }
 
     ListenableFuture<RpcResult<Void>> addMissingGroups(final NodeId nodeId,
-                                                                 final InstanceIdentifier<FlowCapableNode> nodeIdent,
-                                                                 final List<ItemSyncBox<Group>> groupsAddPlan,
-                                                                 final SyncCrudCounters counters) {
+                                                       final InstanceIdentifier<FlowCapableNode> nodeIdent,
+                                                       final List<ItemSyncBox<Group>> groupsAddPlan,
+                                                       final SyncCrudCounters counters) {
         if (groupsAddPlan.isEmpty()) {
             LOG.trace("no groups configured for node: {} -> SKIPPING", nodeId.getValue());
             return RpcResultBuilder.<Void>success().buildFuture();
@@ -1,12 +1,12 @@
-/**
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2016 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.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.util.Collections;
 import java.util.concurrent.Future;
index 166dd021706a22630661740d49f5100fc8c934e1..79fd17a69774be0ca6c2587ab4009fcfd2fa83b7 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.AsyncFunction;
 import com.google.common.util.concurrent.JdkFutureAdapters;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -127,14 +126,11 @@ public class ReconcileUtil {
     public static AsyncFunction<RpcResult<Void>, RpcResult<Void>> chainBarrierFlush(
             final InstanceIdentifier<Node> nodeIdent,
             final FlowCapableTransactionService flowCapableTransactionService) {
-        return new AsyncFunction<RpcResult<Void>, RpcResult<Void>>() {
-            @Override
-            public ListenableFuture<RpcResult<Void>> apply(final RpcResult<Void> input) throws Exception {
-                final SendBarrierInput barrierInput = new SendBarrierInputBuilder()
-                        .setNode(new NodeRef(nodeIdent))
-                        .build();
-                return JdkFutureAdapters.listenInPoolThread(flowCapableTransactionService.sendBarrier(barrierInput));
-            }
+        return input -> {
+            final SendBarrierInput barrierInput = new SendBarrierInputBuilder()
+                    .setNode(new NodeRef(nodeIdent))
+                    .build();
+            return JdkFutureAdapters.listenInPoolThread(flowCapableTransactionService.sendBarrier(barrierInput));
         };
     }
 
index fa4b80849a26c1fc08a30f6484dafb85bb8569ed..151724c563181515c8159ff037c02231562d621f 100644 (file)
@@ -50,14 +50,24 @@ public class SyncupEntry {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         SyncupEntry that = (SyncupEntry) o;
 
-        if (after != null ? !after.equals(that.after) : that.after != null) return false;
-        if (dsTypeAfter != that.dsTypeAfter) return false;
-        if (before != null ? !before.equals(that.before) : that.before != null) return false;
+        if (after != null ? !after.equals(that.after) : that.after != null) {
+            return false;
+        }
+        if (dsTypeAfter != that.dsTypeAfter) {
+            return false;
+        }
+        if (before != null ? !before.equals(that.before) : that.before != null) {
+            return false;
+        }
         return dsTypeBefore == that.dsTypeBefore;
     }
 
index 5a6646ca99cbaef3a8dea66d09c94d6963317dc0..3330dd44f91194c296ef431f8e30e05f2e8363a2 100644 (file)
@@ -14,6 +14,7 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.applications.frsync.SyncReactor;
 import org.opendaylight.openflowplugin.applications.frsync.impl.clustering.DeviceMastershipManager;
 import org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -34,7 +35,7 @@ public class SyncReactorClusterDecoratorTest {
     private InstanceIdentifier<FlowCapableNode> fcNodePath;
 
     @Mock
-    private SyncReactorFutureZipDecorator delegate;
+    private SyncReactor delegate;
     @Mock
     private DeviceMastershipManager deviceMastershipManager;
     @Mock
index 717744af7ab264dab935d99da08486b264fe9658..9180e62b87e06813a6a25c5d923526ae3537f463 100644 (file)
@@ -31,6 +31,7 @@ import org.mockito.invocation.InvocationOnMock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.openflowplugin.applications.frsync.SyncReactor;
 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;
@@ -56,7 +57,7 @@ public class SyncReactorFutureZipDecoratorTest {
     private final LogicalDatastoreType operationalDS = LogicalDatastoreType.OPERATIONAL;
 
     @Mock
-    private SyncReactorGuardDecorator delegate;
+    private SyncReactor delegate;
     @Mock
     private SyncupEntry syncupEntry;
 
index c91862a21f5da86eeca56d43db7fe81ebec83e5e..5b43181d65d6bdedc117abcc9713ecb2d763728e 100644 (file)
@@ -16,7 +16,7 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+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;
@@ -35,10 +35,9 @@ public class SyncReactorGuardDecoratorTest {
     private static final NodeId NODE_ID = new NodeId("test-node");
     private SyncReactorGuardDecorator reactor;
     private InstanceIdentifier<FlowCapableNode> fcNodePath;
-    private final LogicalDatastoreType dsType = LogicalDatastoreType.CONFIGURATION;
 
     @Mock
-    private SyncReactorRetryDecorator delegate;
+    private SyncReactor delegate;
     @Mock
     private FlowCapableNode fcConfigNode;
     @Mock
@@ -63,10 +62,8 @@ public class SyncReactorGuardDecoratorTest {
         Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Matchers.<SyncupEntry>any()))
                 .thenReturn(Futures.immediateFuture(Boolean.TRUE));
 
-//        reactor.syncup(fcNodePath, fcConfigNode, fcOperationalNode, dsType);
         reactor.syncup(fcNodePath, syncupEntry);
 
-//        Mockito.verify(delegate).syncup(fcNodePath, fcConfigNode, fcOperationalNode, dsType);
         Mockito.verify(delegate).syncup(fcNodePath, syncupEntry);
         Mockito.verifyNoMoreInteractions(delegate);
     }
@@ -76,10 +73,8 @@ public class SyncReactorGuardDecoratorTest {
         Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Matchers.<SyncupEntry>any()))
                 .thenReturn(Futures.immediateFailedFuture(new Exception()));
 
-//        reactor.syncup(fcNodePath, fcConfigNode, fcOperationalNode, dsType);
         reactor.syncup(fcNodePath, syncupEntry);
 
-//        Mockito.verify(delegate).syncup(fcNodePath, fcConfigNode, fcOperationalNode, dsType);
         Mockito.verify(delegate).syncup(fcNodePath, syncupEntry);
         Mockito.verifyNoMoreInteractions(delegate);
 
index 1c82ef21a41ab227ccd54333de73e949077de0b4..8151e620df889e0ebe4cb74e5e329f64d25ba88f 100644 (file)
@@ -16,6 +16,7 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.applications.frsync.SyncReactor;
 import org.opendaylight.openflowplugin.applications.frsync.util.ReconciliationRegistry;
 import org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -36,7 +37,7 @@ public class SyncReactorRetryDecoratorTest {
     private InstanceIdentifier<FlowCapableNode> fcNodePath;
 
     @Mock
-    private SyncReactorImpl delegate;
+    private SyncReactor delegate;
     @Mock
     private ReconciliationRegistry reconciliationRegistry;
     @Mock
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.openflowplugin.applications.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.math.BigInteger;
 import java.util.Collections;
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.openflowplugin.applications.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.math.BigInteger;
 import java.util.concurrent.Future;
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.openflowplugin.applications.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.math.BigInteger;
 import java.util.concurrent.Future;
index a48d7dcd6bbc8d689005b5def9b0ec2e2b2567f7..4bea89fd48c2f248841135bbdf2ca90ea001b79a 100644 (file)
@@ -25,7 +25,6 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowplugin.applications.frsync.impl.TableForwarder;
 import org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox;
 import org.opendaylight.openflowplugin.applications.frsync.util.SyncCrudCounters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchInput;
index 38721f10a8b03867f7f4769ddc5487a07470cb11..a0d84c429f229fa4ab4663141c57859ef68d9509 100644 (file)
@@ -26,15 +26,10 @@ import org.mockito.InOrder;
 import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.openflowplugin.applications.frsync.impl.DSInputFactory;
-import org.opendaylight.openflowplugin.applications.frsync.impl.FlowForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.GroupForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.MeterForwarder;
-import org.opendaylight.openflowplugin.applications.frsync.impl.TableForwarder;
 import org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox;
 import org.opendaylight.openflowplugin.applications.frsync.util.SyncCrudCounters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -226,12 +221,7 @@ public class SyncPlanPushStrategyIncrementalImplTest {
     }
 
     private <O> Answer<Future<RpcResult<O>>> createSalServiceFutureAnswer() {
-        return new Answer<Future<RpcResult<O>>>() {
-            @Override
-            public Future<RpcResult<O>> answer(final InvocationOnMock invocation) throws Throwable {
-                return RpcResultBuilder.<O>success().buildFuture();
-            }
-        };
+        return invocation -> RpcResultBuilder.<O>success().buildFuture();
     }
 
     @Test
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.openflowplugin.applications.frsync.impl;
+package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import java.math.BigInteger;
 import java.util.concurrent.Future;