Merge "Updated TestIMdsalApiManager.java to support installFlow() with CheckedFuture...
[genius.git] / mdsalutil / mdsalutil-api / src / test / java / org / opendaylight / genius / mdsalutil / interfaces / testutils / TestIMdsalApiManager.java
index a26654bb3d46851c9525ef64505e6078874cd93d..50bf75f02633c7e0a6b6835f1124c7188d714018 100644 (file)
@@ -108,13 +108,15 @@ public abstract class TestIMdsalApiManager implements IMdsalApiManager {
         try {
             assertThat(flows).containsExactlyElementsIn(expectedFlowsAsNewArrayList);
         } catch (AssertionError e) {
+            // We LOG the AssertionError just for clarity why containsExactlyElementsIn() failed
+            LOG.warn("assert containsExactlyElementsIn() failed", e);
             // We LOG the expected and actual flow in case of a failed assertion
             // because, even though that is typically just a HUGE String that's
             // hard to read (the diff printed subsequently by assertEqualBeans
             // is, much, more readable), there are cases when looking more closely
             // at the full toString() output of the flows is still useful, so:
-            LOG.warn("assert fail; expected flows: {}", expectedFlowsAsNewArrayList);
-            LOG.warn("assert fail; actual flows  : {}", flows);
+            LOG.warn("assert failed [order ignored!]; expected flows: {}", expectedFlowsAsNewArrayList);
+            LOG.warn("assert failed [order ignored!]; actual flows  : {}", flows);
             // The point of this is basically just that our assertEqualBeans output,
             // in case of a comparison failure, is *A LOT* more clearly readable
             // than what G Truth (or Hamcrest) can do based on toString.
@@ -127,6 +129,13 @@ public abstract class TestIMdsalApiManager implements IMdsalApiManager {
         getOrNewFlows().add(flowEntity);
     }
 
+    @Override
+    public synchronized CheckedFuture<Void, TransactionCommitFailedException> installFlow(BigInteger dpId,
+            FlowEntity flowEntity) {
+        installFlow(flowEntity);
+        return Futures.immediateCheckedFuture(null);
+    }
+
     @Override
     public synchronized CheckedFuture<Void, TransactionCommitFailedException> removeFlow(BigInteger dpnId,
             FlowEntity flowEntity) {
@@ -135,12 +144,12 @@ public abstract class TestIMdsalApiManager implements IMdsalApiManager {
     }
 
     @Override
-    public void batchedAddFlow(BigInteger dpId, FlowEntity flowEntity) {
+    public synchronized void batchedAddFlow(BigInteger dpId, FlowEntity flowEntity) {
         getOrNewFlows().add(flowEntity);
     }
 
     @Override
-    public void batchedRemoveFlow(BigInteger dpId, FlowEntity flowEntity) {
+    public synchronized void batchedRemoveFlow(BigInteger dpId, FlowEntity flowEntity) {
         getOrNewFlows().remove(flowEntity);
     }