@Test void testRollbackTransaction() { String blobId = "MyBlobId"; BlobMetadata blobMetadata = mock(BlobMetadata.class); when(blobMetadata.getId()).thenReturn(blobId); ReadableByteChannel readableByteChannel = mock(ReadableByteChannel.class); when(blobStore.store(readableByteChannel)).thenReturn(blobMetadata); transactionalBlobStoreDecorator.store(readableByteChannel); transactionalBlobStoreDecorator.rollbackTransaction(TRANSACTION_ID); verify(blobStore).delete(blobId); }
@Override public void rollbackTransaction(String transactionId) { List<String> blobIds = new ArrayList<>(transactionBlobMap.get(transactionId)); blobIds.forEach(this::delete); }
TransactionalBlobStoreDecorator extends BlobStoreDecorator implements TransactionListener { @Override public void rollbackTransaction(String transactionId) { List<String> blobIds = new ArrayList<>(transactionBlobMap.get(transactionId)); blobIds.forEach(this::delete); } }
TransactionalBlobStoreDecorator extends BlobStoreDecorator implements TransactionListener { @Override public void rollbackTransaction(String transactionId) { List<String> blobIds = new ArrayList<>(transactionBlobMap.get(transactionId)); blobIds.forEach(this::delete); } TransactionalBlobStoreDecorator(BlobStore delegateBlobStore); }
TransactionalBlobStoreDecorator extends BlobStoreDecorator implements TransactionListener { @Override public void rollbackTransaction(String transactionId) { List<String> blobIds = new ArrayList<>(transactionBlobMap.get(transactionId)); blobIds.forEach(this::delete); } TransactionalBlobStoreDecorator(BlobStore delegateBlobStore); @Override BlobMetadata store(ReadableByteChannel fromChannel); @Override void delete(String blobId); @Override void rollbackTransaction(String transactionId); @Override void doCleanupAfterCompletion(String transactionId); }
TransactionalBlobStoreDecorator extends BlobStoreDecorator implements TransactionListener { @Override public void rollbackTransaction(String transactionId) { List<String> blobIds = new ArrayList<>(transactionBlobMap.get(transactionId)); blobIds.forEach(this::delete); } TransactionalBlobStoreDecorator(BlobStore delegateBlobStore); @Override BlobMetadata store(ReadableByteChannel fromChannel); @Override void delete(String blobId); @Override void rollbackTransaction(String transactionId); @Override void doCleanupAfterCompletion(String transactionId);  }