@Test public void testDelete() throws Exception { WriteTransaction transaction = mock(WriteTransaction.class); doReturn(CommitInfo.emptyFluentFuture()).when(transaction).commit(); InstanceIdentifier identifier = mock(InstanceIdentifier.class); when(transactionChain.newWriteOnlyTransaction()).thenReturn(transaction); assertNotNull(access.delete(identifier, LogicalDatastoreType.OPERATIONAL)); verify(transaction).delete(LogicalDatastoreType.OPERATIONAL, identifier); when(transactionChain.newWriteOnlyTransaction()).thenReturn(null); exception.expect(NullPointerException.class); access.delete(identifier, LogicalDatastoreType.OPERATIONAL); }
public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> delete( final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Delete {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } synchronized (dataBroker) { final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.delete(logicalDatastoreType, path); return transaction.commit(); } }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> delete( final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Delete {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } synchronized (dataBroker) { final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.delete(logicalDatastoreType, path); return transaction.commit(); } } }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> delete( final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Delete {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } synchronized (dataBroker) { final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.delete(logicalDatastoreType, path); return transaction.commit(); } } private  DatastoreAccess(final DataBroker dataBroker); }
DatastoreAccess implements AutoCloseable { public synchronized <T extends DataObject> FluentFuture<? extends CommitInfo> delete( final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Delete {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } synchronized (dataBroker) { final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.delete(logicalDatastoreType, path); 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> delete( final InstanceIdentifier<T> path, final LogicalDatastoreType logicalDatastoreType) { LOG.debug("Delete {} {}", logicalDatastoreType, path.getTargetType()); if (!checkParams(path, logicalDatastoreType)) { return FluentFutures.immediateCancelledFluentFuture(); } synchronized (dataBroker) { final WriteTransaction transaction = bindingTransactionChain.newWriteOnlyTransaction(); transaction.delete(logicalDatastoreType, path); 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();  }