/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 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,
private DOMStoreThreePhaseCommitCohort commitCohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
shardedDOMDataTree = new ShardedDOMDataTree();
client = mock(DataStoreClient.class);
final DistributedShardFrontend rootShard = new DistributedShardFrontend(distributedDataStore, client, ROOT);
- try (final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT))) {
+ try (DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT))) {
shardedDOMDataTree.registerDataTreeShard(ROOT, rootShard, producer);
}
final DistributedShardFrontend outerListShard = new DistributedShardFrontend(
distributedDataStore, outerListClient, OUTER_LIST_ID);
- try (final DOMDataTreeProducer producer =
+ try (DOMDataTreeProducer producer =
shardedDOMDataTree.createProducer(Collections.singletonList(OUTER_LIST_ID))) {
shardedDOMDataTree.registerDataTreeShard(OUTER_LIST_ID, outerListShard, producer);
}
final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT));
final DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
- final DOMDataTreeWriteCursor cursor = tx.createCursor(ROOT);
+ final DOMDataTreeWriteCursor txCursor = tx.createCursor(ROOT);
- assertNotNull(cursor);
- cursor.write(TestModel.TEST_PATH.getLastPathArgument(), createCrossShardContainer());
+ assertNotNull(txCursor);
+ txCursor.write(TestModel.TEST_PATH.getLastPathArgument(), createCrossShardContainer());
//check the lower shard got the correct modification
verify(outerListCursor, times(2)).write(pathArgumentCaptor.capture(), nodeCaptor.capture());
final MapNode actualInnerListNode = (MapNode) nodeCaptor.getAllValues().get(1);
assertEquals(createInnerMapNode(1), actualInnerListNode);
- cursor.close();
- tx.submit().checkedGet();
+ txCursor.close();
+ tx.commit().get();
verify(commitCohort, times(2)).canCommit();
verify(commitCohort, times(2)).preCommit();
verify(commitCohort, times(2)).commit();
-
}
private static MapNode createInnerMapNode(final int id) {
return testContainer;
}
-
-
-}
\ No newline at end of file
+}