@Override public Object valueFromString(String param) { if (param == null) return null; return Protocol.valueOf(param.toUpperCase()); }
/** * Single endpoint constructor (disables smart-client). */ public ObjectConfig(URI endpoint) { this(Protocol.valueOf(endpoint.getScheme().toUpperCase()), endpoint.getPort(), endpoint.getHost()); setRootContext(endpoint.getPath()); setSmartClient(false); }
@Before public void setup() throws Exception { Properties syncProperties = TestConfig.getProperties(); String endpoint = syncProperties.getProperty(TestConfig.PROP_S3_ENDPOINT); final String accessKey = syncProperties.getProperty(TestConfig.PROP_S3_ACCESS_KEY_ID); final String secretKey = syncProperties.getProperty(TestConfig.PROP_S3_SECRET_KEY); final boolean useVHost = Boolean.valueOf(syncProperties.getProperty(TestConfig.PROP_S3_VHOST)); Assume.assumeNotNull(endpoint, accessKey, secretKey); final URI endpointUri = new URI(endpoint); S3Config s3Config; if (useVHost) s3Config = new S3Config(endpointUri); else s3Config = new S3Config(Protocol.valueOf(endpointUri.getScheme().toUpperCase()), endpointUri.getHost()); s3Config.withPort(endpointUri.getPort()).withUseVHost(useVHost).withIdentity(accessKey).withSecretKey(secretKey); s3 = new S3JerseyClient(s3Config); try { s3.createBucket(bucketName); } catch (S3Exception e) { if (!e.getErrorCode().equals("BucketAlreadyExists")) throw e; } targetConfig = new EcsS3Config(); targetConfig.setProtocol(com.emc.ecs.sync.config.Protocol.valueOf(endpointUri.getScheme().toLowerCase())); targetConfig.setHost(endpointUri.getHost()); targetConfig.setPort(endpointUri.getPort()); targetConfig.setEnableVHosts(useVHost); targetConfig.setAccessKey(accessKey); targetConfig.setSecretKey(secretKey); targetConfig.setBucketName(bucketName); }
s3Config = new S3Config(endpointUri); } else { s3Config = new S3Config(com.emc.object.Protocol.valueOf(endpointUri.getScheme().toUpperCase()), endpointUri.getHost());
else s3Config = new S3Config(Protocol.valueOf(endpointUri.getScheme().toUpperCase()), endpointUri.getHost()); s3Config.withPort(endpointUri.getPort()).withUseVHost(useVHost).withIdentity(accessKey).withSecretKey(secretKey);
vdcs.add(new Vdc(config.getHost())); s3Config = new S3Config(Protocol.valueOf(config.getProtocol().toString().toUpperCase()), vdcs.toArray(new Vdc[vdcs.size()])); if (config.getPort() > 0) s3Config.setPort(config.getPort()); s3Config.setSmartClient(config.isSmartClientEnabled());