+ @Test
+ public void bPutSomethingIntoDataStore() throws Exception {
+ writeInitialState();
+ assertThat(isTopInDataStore()).isTrue();
+ }
+
+ @Test
+ public void cEnsureDataStoreIsEmptyAgainInNewTest() throws ReadFailedException {
+ assertThat(isTopInDataStore()).isFalse();
+ }
+
+ // copy/pasted from Bug1125RegressionTest.writeInitialState()
+ private void writeInitialState() throws TransactionCommitFailedException {
+ WriteTransaction initialTx = getDataBroker().newWriteOnlyTransaction();
+ initialTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
+ TreeComplexUsesAugment fooAugment = new TreeComplexUsesAugmentBuilder()
+ .setContainerWithUses(new ContainerWithUsesBuilder().setLeafFromGrouping("foo").build()).build();
+ initialTx.put(LogicalDatastoreType.OPERATIONAL, path(TOP_FOO_KEY), topLevelList(TOP_FOO_KEY, fooAugment));
+ initialTx.submit().checkedGet();
+ }
+
+ private boolean isTopInDataStore() throws ReadFailedException {
+ ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
+ try {
+ return readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).checkedGet().isPresent();
+ } finally {
+ readTx.close();
+ }
+ }
+