@Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class }) public void testNullIsBad() { fn.apply(null); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { if (Arrays.equals(toSearch, metadata.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
@Test public void testMD5String() throws IOException { assertEquals(fn.apply("foo"), md5().hashString("foo", UTF_8).asBytes()); }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { if (Arrays.equals(toSearch, metadata.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { if (Arrays.equals(toSearch, metadata.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { BlobProperties properties = client.getBlobProperties(containerName, metadata.getName()); if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { BlobProperties properties = client.getBlobProperties(containerName, metadata.getName()); if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { BlobProperties properties = client.getBlobProperties(containerName, metadata.getName()); if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
public boolean execute(String containerName, Object value, ListContainerOptions options) { try { byte[] toSearch = objectMD5.apply(value); for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) { BlobProperties properties = client.getBlobProperties(containerName, metadata.getName()); if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5())) return true; } return false; } catch (Exception e) { Throwables.propagateIfPossible(e, BlobRuntimeException.class); throw new BlobRuntimeException(String.format( "Error searching for ETAG of value: [%2$s] in container:%1$s", containerName, value), e); } }
@Override public boolean execute(final String containerName, Object value, ListContainerOptions options) { final byte[] toSearch = objectMD5.apply(value); final BlockingQueue<Boolean> queue = new SynchronousQueue<Boolean>(); Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
@Override public boolean execute(final String containerName, Object value, ListContainerOptions options) { final byte[] toSearch = objectMD5.apply(value); final BlockingQueue<Boolean> queue = new SynchronousQueue<Boolean>(); Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
@Override public boolean execute(final String containerName, Object value, ListContainerOptions options) { final byte[] toSearch = objectMD5.apply(value); final BlockingQueue<Boolean> queue = new SynchronousQueue<Boolean>(); Map<String, ListenableFuture<?>> responses = Maps.newHashMap();
@Test public void testMD5PayloadEnclosing() throws IOException { Payload payload = Payloads.newPayload("foo"); HttpMessage payloadEnclosing = HttpMessage.builder().payload(payload).build(); assertEquals(fn.apply(payloadEnclosing), md5().hashString("foo", UTF_8).asBytes()); }
@Test public void testAlreadyHasMD5() { Payload payload = Payloads.newPayload("foo"); payload.getContentMetadata().setContentMD5(new byte[] {}); HttpMessage payloadEnclosing = HttpMessage.builder().payload(payload).build(); assertEquals(fn.apply(payloadEnclosing), new byte[] {}); }