Skip to content

Commit

Permalink
fix s3 spport for s3 api (apache#3845)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiazhai authored and merlimat committed Mar 29, 2019
1 parent 709d49b commit eb96f93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
import org.jclouds.io.Payloads;
import org.jclouds.osgi.ProviderRegistry;
import org.jclouds.s3.reference.S3Constants;
import org.jclouds.osgi.ApiRegistry;
import org.jclouds.s3.S3ApiMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -120,6 +122,7 @@ private static Pair<BlobStoreLocation, BlobStore> createBlobStore(String driver,
overrides.setProperty(Constants.PROPERTY_SO_TIMEOUT, "25000");
overrides.setProperty(Constants.PROPERTY_MAX_RETRIES, Integer.toString(100));

ApiRegistry.registerApi(new S3ApiMetadata());
ProviderRegistry.registerProvider(new AWSS3ProviderMetadata());
ProviderRegistry.registerProvider(new GoogleCloudStorageProviderMetadata());

Expand Down Expand Up @@ -186,9 +189,6 @@ public static BlobStoreManagedLedgerOffloader create(TieredStorageConfigurationD
OrderedScheduler scheduler)
throws IOException {
String driver = conf.getManagedLedgerOffloadDriver();
if ("s3".equals(driver.toLowerCase())) {
driver = "aws-s3";
}
if (!driverSupported(driver)) {
throw new IOException(
"Not support this kind of driver as offload backend: " + driver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,17 @@ public void testGcsSmallBlockSizeConfigured() throws Exception {
}
}

@Test
public void testS3DriverConfiguredWell() throws Exception {
TieredStorageConfigurationData conf = new TieredStorageConfigurationData();
conf.setManagedLedgerOffloadDriver("s3");
conf.setS3ManagedLedgerOffloadBucket(BUCKET);
conf.setS3ManagedLedgerOffloadServiceEndpoint("http://fake.s3.end.point");

// should success and no exception thrown.
BlobStoreManagedLedgerOffloader.create(conf, scheduler);
}

@Test
public void testOffloadAndRead() throws Exception {
ReadHandle toWrite = buildReadHandle(DEFAULT_BLOCK_SIZE, 3);
Expand Down

0 comments on commit eb96f93

Please sign in to comment.