@Test public void createOperation() throws Exception { final WriteableSubshardBoundaryNode writeableSubshardBoundaryNode = WriteableSubshardBoundaryNode.from(FOREIGN_SHARD_MODIFICATION_CONTEXT); doNothing().when(TestUtils.DOM_DATA_TREE_WRITE_CURSOR).exit(); 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_WRITE_CURSOR) .enter(TestUtils.DOM_DATA_TREE_IDENTIFIER.getRootIdentifier().getLastPathArgument()); doNothing().when(TestUtils.DOM_DATA_TREE_WRITE_CURSOR).exit(); writeableSubshardBoundaryNode.createOperation(TestUtils.DOM_DATA_TREE_WRITE_CURSOR).exit(); verify(TestUtils.DOM_DATA_TREE_WRITE_CURSOR).exit(); WriteCursorStrategy writeCursorStrategy = writeableSubshardBoundaryNode.createOperation(TestUtils.DOM_DATA_TREE_WRITE_CURSOR); assertNotNull(writeCursorStrategy); WriteCursorStrategy childWriteCursorStrategy = writeCursorStrategy.enter(TestUtils.DOM_DATA_TREE_IDENTIFIER.getRootIdentifier().getLastPathArgument()); childWriteCursorStrategy.exit(); verify(TestUtils.DOM_DATA_TREE_WRITE_CURSOR, times(2)).exit(); }
@Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new DelegatingWriteCursorStrategy() { @Override public void exit() { parentCursor.exit(); } @Override protected DelegatingWriteCursorStrategy childStrategy() { return new DelegatingWriteCursorStrategy() { @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; }
WriteableSubshardBoundaryNode extends WriteableModificationNode { @Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new DelegatingWriteCursorStrategy() { @Override public void exit() { parentCursor.exit(); } @Override protected DelegatingWriteCursorStrategy childStrategy() { return new DelegatingWriteCursorStrategy() { @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } }
WriteableSubshardBoundaryNode extends WriteableModificationNode { @Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new DelegatingWriteCursorStrategy() { @Override public void exit() { parentCursor.exit(); } @Override protected DelegatingWriteCursorStrategy childStrategy() { return new DelegatingWriteCursorStrategy() { @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } WriteableSubshardBoundaryNode(final ForeignShardModificationContext boundary); }
WriteableSubshardBoundaryNode extends WriteableModificationNode { @Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new DelegatingWriteCursorStrategy() { @Override public void exit() { parentCursor.exit(); } @Override protected DelegatingWriteCursorStrategy childStrategy() { return new DelegatingWriteCursorStrategy() { @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } WriteableSubshardBoundaryNode(final ForeignShardModificationContext boundary); static WriteableSubshardBoundaryNode from(final ForeignShardModificationContext value); @Override PathArgument getIdentifier(); @Override WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor); @Override WriteableModificationNode getChild(final PathArgument node); @Override void markDeleted(); @Override Map<PathArgument, WriteableModificationNode> getChildrenWithSubshards(); }
WriteableSubshardBoundaryNode extends WriteableModificationNode { @Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new DelegatingWriteCursorStrategy() { @Override public void exit() { parentCursor.exit(); } @Override protected DelegatingWriteCursorStrategy childStrategy() { return new DelegatingWriteCursorStrategy() { @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } @Override protected DOMDataTreeWriteCursor delegate() { return boundary.getCursor(); } }; } WriteableSubshardBoundaryNode(final ForeignShardModificationContext boundary); static WriteableSubshardBoundaryNode from(final ForeignShardModificationContext value); @Override PathArgument getIdentifier(); @Override WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor); @Override WriteableModificationNode getChild(final PathArgument node); @Override void markDeleted(); @Override Map<PathArgument, WriteableModificationNode> getChildrenWithSubshards();  }