@Test public void testMerge() throws Exception { WriteTransaction transaction = mock(WriteTransaction.class); InstanceIdentifier identifier = mock(InstanceIdentifier.class); DataObject dataObject = mock(DataObject.class); when(transactionChain.newWriteOnlyTransaction()).thenReturn(transaction); access.merge(identifier, dataObject, LogicalDatastoreType.OPERATIONAL); verify(transaction).merge(LogicalDatastoreType.OPERATIONAL, identifier, dataObject); when(transactionChain.newWriteOnlyTransaction()).thenReturn(null); exception.expect(NullPointerException.class); access.merge(identifier, dataObject, LogicalDatastoreType.OPERATIONAL); }
public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> merge( final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Merge {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } Preconditions.checkNotNull(data); final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.merge(logicalDatastoreType, path, data); return transaction.commit(); }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> merge( final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Merge {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } Preconditions.checkNotNull(data); final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.merge(logicalDatastoreType, path, data); return transaction.commit(); } }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> merge( final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Merge {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } Preconditions.checkNotNull(data); final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.merge(logicalDatastoreType, path, data); return transaction.commit(); } private  DatastoreAccess(final DataBroker dataBroker); }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> merge( final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Merge {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } Preconditions.checkNotNull(data); final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.merge(logicalDatastoreType, path, data); return transaction.commit(); } private  DatastoreAccess(final DataBroker dataBroker); static DatastoreAccess getInstance(final DataBroker dataBroker); static DatastoreAccess getInstance(final DatastoreAccess datastoreAccess); synchronized FluentFuture<? extends CommitInfo> delete(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<? extends CommitInfo> merge(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<? extends CommitInfo> put(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<java.util.Optional<T>> read(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized boolean mergeSynchronous(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized boolean putSynchronous(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized boolean deleteSynchronous(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized T readSynchronous(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized boolean checkAndPut(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType,
            final boolean isUpdating); synchronized boolean checkAndMerge(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType,
            final boolean isUpdating); synchronized boolean checkAndDelete(
            final InstanceIdentifier<T> identifier, final LogicalDatastoreType datastoreType); synchronized boolean putIfNotExists(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType); synchronized void reinitializeChain(); @Override synchronized void close(); }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> merge( final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Merge {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } Preconditions.checkNotNull(data); final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.merge(logicalDatastoreType, path, data); return transaction.commit(); } private  DatastoreAccess(final DataBroker dataBroker); static DatastoreAccess getInstance(final DataBroker dataBroker); static DatastoreAccess getInstance(final DatastoreAccess datastoreAccess); synchronized FluentFuture<? extends CommitInfo> delete(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<? extends CommitInfo> merge(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<? extends CommitInfo> put(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized FluentFuture<java.util.Optional<T>> read(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized boolean mergeSynchronous(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized boolean putSynchronous(
            final InstanceIdentifier<T> path, final T data, final LogicalDatastoreType logicalDatastoreType); synchronized boolean deleteSynchronous(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized T readSynchronous(
            final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType); synchronized boolean checkAndPut(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType,
            final boolean isUpdating); synchronized boolean checkAndMerge(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType,
            final boolean isUpdating); synchronized boolean checkAndDelete(
            final InstanceIdentifier<T> identifier, final LogicalDatastoreType datastoreType); synchronized boolean putIfNotExists(
            final InstanceIdentifier<T> identifier, final T data, final LogicalDatastoreType datastoreType); synchronized void reinitializeChain(); @Override synchronized void close();  }