import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
+import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.junit.Test;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class WriteTransactionTest extends AbstractDataBrokerTest {
-
private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
private static final TopLevelListKey TOP_LIST_KEY = new TopLevelListKey("foo");
private static final InstanceIdentifier<TopLevelList> NODE_PATH = TOP_PATH.child(TopLevelList.class, TOP_LIST_KEY);
- private static final TopLevelList NODE = new TopLevelListBuilder().setKey(TOP_LIST_KEY).build();
+ private static final TopLevelList NODE = new TopLevelListBuilder().withKey(TOP_LIST_KEY).build();
@Test
public void test() throws InterruptedException, ExecutionException {
@Test
public void testPutCreateParentsSuccess() throws InterruptedException, ExecutionException {
-
final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
- writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
+ writeTx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
writeTx.commit().get();
final ReadTransaction readTx = getDataBroker().newReadOnlyTransaction();
@Test
public void testMergeCreateParentsSuccess() throws InterruptedException, ExecutionException {
-
final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
- writeTx.merge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
+ writeTx.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
writeTx.commit().get();
final ReadTransaction readTx = getDataBroker().newReadOnlyTransaction();
final Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
assertTrue("List node must exists after commit",listNode.isPresent());
}
-
}