kopia lustrzana https://github.com/gaul/s3proxy
Add test for encrypted conditional get
rodzic
9c587c7f38
commit
6e5fbf5a5f
|
@ -47,10 +47,12 @@ import org.jclouds.blobstore.options.CopyOptions;
|
|||
import org.jclouds.blobstore.options.GetOptions;
|
||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||
import org.jclouds.blobstore.options.PutOptions;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -829,4 +831,23 @@ public final class EncryptedBlobStoreTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadConditional() {
|
||||
String blobName = TestUtils.createRandomBlobName();
|
||||
String content = "Hello world.";
|
||||
InputStream is = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
Blob blob = makeBlob(encryptedBlobStore, blobName, is, content.length());
|
||||
encryptedBlobStore.putBlob(containerName, blob);
|
||||
|
||||
GetOptions options = new GetOptions();
|
||||
blob = encryptedBlobStore.getBlob(containerName, blobName, options);
|
||||
String etag = blob.getMetadata().getETag();
|
||||
|
||||
GetOptions conditionalOptions = GetOptions.Builder.ifETagDoesntMatch(etag);
|
||||
var e = Assert.assertThrows(HttpResponseException.class,
|
||||
() -> encryptedBlobStore.getBlob(containerName, blobName, conditionalOptions));
|
||||
assertThat(e.getResponse().getStatusCode()).isEqualTo(304);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue