ForeignShardModificationContext: typo 65/52265/5
authorIsaku Yamahata <isaku.yamahata@intel.com>
Fri, 24 Feb 2017 21:55:03 +0000 (16:55 -0500)
committerRobert Varga <nite@hq.sk>
Thu, 9 Mar 2017 12:36:33 +0000 (12:36 +0000)
typo in ForeignShardModificationContext.
notReady should be false when readying it.

Change-Id: I6ecd3283f1917f9725579496142f3572549d9874
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/shard/ForeignShardModificationContext.java
dom/mdsal-dom-spi/src/test/java/org/opendaylight/mdsal/dom/spi/shard/ForeignShardModificationContextTest.java

index c3f08f5491e439d70574367b1fa4fbc0e9292e3a..4ecedf14e32b5452c6e6923191c65eb557320b2a 100644 (file)
@@ -60,7 +60,7 @@ public final class ForeignShardModificationContext implements Identifiable<DOMDa
             return;
         }
 
-        notReady = true;
+        notReady = false;
         if (cursor != null) {
             cursor.close();
             cursor = null;
index 2365a2508025f4bfd819b3e62c6d06dd84386e54..cd90dbb66a02e90aab4099f46b391e8f9ceecc27 100644 (file)
@@ -16,7 +16,6 @@ import static org.mockito.Mockito.verify;
 
 import org.junit.After;
 import org.junit.Test;
-import org.mockito.Mockito;
 
 public class ForeignShardModificationContextTest {
 
@@ -53,8 +52,17 @@ public class ForeignShardModificationContextTest {
         doReturn(null).when(TestUtils.DOM_DATA_TREE_SHARD_WRITE_TRANSACTION).commit();
         foreignShardModificationContext.submit();
         verify(TestUtils.DOM_DATA_TREE_SHARD_WRITE_TRANSACTION).commit();
+    }
 
-        Mockito.reset(TestUtils.DOM_DATA_TREE_WRITE_CURSOR);
+    @Test
+    public void basicTestClose() throws Exception {
+        final ForeignShardModificationContext foreignShardModificationContext =
+                new ForeignShardModificationContext(TestUtils.DOM_DATA_TREE_IDENTIFIER,
+                        TestUtils.DOM_DATA_TREE_SHARD_PRODUCER);
+        doReturn(TestUtils.DOM_DATA_TREE_SHARD_WRITE_TRANSACTION)
+                .when(TestUtils.DOM_DATA_TREE_SHARD_PRODUCER).createTransaction();
+        doReturn(TestUtils.DOM_DATA_TREE_WRITE_CURSOR)
+                .when(TestUtils.DOM_DATA_TREE_SHARD_WRITE_TRANSACTION).createCursor(TestUtils.DOM_DATA_TREE_IDENTIFIER);
         doNothing().when(TestUtils.DOM_DATA_TREE_SHARD_WRITE_TRANSACTION).close();
         doNothing().when(TestUtils.DOM_DATA_TREE_WRITE_CURSOR).close();
         foreignShardModificationContext.getCursor();
@@ -67,4 +75,4 @@ public class ForeignShardModificationContextTest {
     public void reset() {
         TestUtils.resetMocks();
     }
-}
\ No newline at end of file
+}