Remove BlobStore Map abstractions

These provide little end-user benefit and make evolving the core API
more difficult.  We deprecated these in 1.6.0.
This commit is contained in:
Andrew Gaul 2013-09-24 21:11:08 -07:00
parent 4304e6ab19
commit 5f8961723f
48 changed files with 8 additions and 2844 deletions

View File

@ -29,7 +29,6 @@ import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import com.google.common.cache.CacheBuilder;
@ -48,7 +47,6 @@ public class AtmosBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(AsyncBlobStore.class).to(AtmosAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);

View File

@ -1,86 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.atmos.blobstore.integration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class AtmosInputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest {
public AtmosInputStreamMapIntegrationLiveTest() {
provider = "atmos";
}
@Override
@Test(enabled = false)
public void testContainsBytesValue() throws InterruptedException, ExecutionException,
TimeoutException {
// TODO not reliable
}
@Override
@Test(enabled = false)
public void testContainsFileValue() throws InterruptedException, ExecutionException,
TimeoutException {
// TODO not reliable
}
@Override
@Test(enabled = false)
public void testContainsInputStreamValue() throws InterruptedException, ExecutionException,
TimeoutException {
// TODO not reliable
}
@Override
@Test(enabled = false)
public void testContainsStringValue() throws InterruptedException, ExecutionException,
TimeoutException {
// TODO not reliable
}
@Override
@Test(enabled = false)
public void testPut() {
// TODO not reliable NPE@BaseInputStreamMapIntegrationTest.java:258
}
@Override
@Test(enabled = false)
public void testPutBytes() {
// TODO not reliable NPE
}
@Override
@Test(enabled = false)
public void testPutFile() {
// TODO not reliable NPE
}
@Override
@Test(enabled = false)
public void testPutString() {
// TODO not reliable NPE
}
}

View File

@ -1,40 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.atmos.blobstore.integration;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class AtmosMapIntegrationLiveTest extends BaseBlobMapIntegrationTest {
public AtmosMapIntegrationLiveTest() {
provider = "atmos";
}
@Override
// NO support for Content-MD5, so contains cannot work
public void testContains() throws InterruptedException, ExecutionException, TimeoutException, IOException {
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.cloudfiles.blobstore.integration;
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class CloudFilesBlobMapIntegrationLiveTest extends SwiftBlobMapIntegrationLiveTest {
public CloudFilesBlobMapIntegrationLiveTest(){
provider = "cloudfiles";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.cloudfiles.blobstore.integration;
import org.jclouds.openstack.swift.blobstore.integration.SwiftInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class CloudFilesInputStreamMapIntegrationLiveTest extends SwiftInputStreamMapIntegrationLiveTest {
public CloudFilesInputStreamMapIntegrationLiveTest(){
provider = "cloudfiles";
}
}

View File

@ -25,7 +25,6 @@ import org.jclouds.blobstore.LocalAsyncBlobStore;
import org.jclouds.blobstore.LocalBlobRequestSigner;
import org.jclouds.blobstore.LocalStorageStrategy;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.blobstore.config.BlobStoreObjectModule;
import org.jclouds.blobstore.config.LocalBlobStore;
import org.jclouds.blobstore.util.BlobUtils;
@ -52,7 +51,6 @@ public class FilesystemBlobStoreContextModule extends AbstractModule {
bind(BlobStore.class).to(LocalBlobStore.class);
install(new BlobStoreObjectModule());
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(LocalStorageStrategy.class).to(FilesystemStorageStrategyImpl.class);
bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class);

View File

@ -1,44 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.filesystem.integration;
import java.util.Properties;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.filesystem.utils.TestUtils;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemBlobMapIntegrationTest")
public class FilesystemBlobMapIntegrationTestDisabled extends BaseBlobMapIntegrationTest {
public FilesystemBlobMapIntegrationTestDisabled() {
provider = "filesystem";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
return props;
}
}

View File

@ -1,43 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.filesystem.integration;
import java.util.Properties;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.filesystem.utils.TestUtils;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemInputStreamMapIntegrationTest")
public class FilesystemInputStreamMapIntegrationTestDisabled extends BaseInputStreamMapIntegrationTest {
public FilesystemInputStreamMapIntegrationTestDisabled() {
provider = "filesystem";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
return props;
}
}

View File

@ -26,7 +26,6 @@ import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.domain.Location;
import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.blobstore.S3AsyncBlobStore;
@ -53,7 +52,6 @@ public class S3BlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(AsyncBlobStore.class).to(S3AsyncBlobStore.class).in(SINGLETON);
bind(BlobStore.class).to(S3BlobStore.class).in(SINGLETON);

View File

@ -21,10 +21,8 @@ import javax.inject.Singleton;
import org.jclouds.Context;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
import org.jclouds.location.Provider;
@ -43,10 +41,10 @@ public class S3BlobStoreContextImpl extends BlobStoreContextImpl implements S3Bl
@Inject
public S3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
Utils utils, ConsistencyModel consistencyModel,
AsyncBlobStore ablobStore, BlobStore blobStore,
BlobRequestSigner blobRequestSigner) {
super(backend, backendType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
super(backend, backendType, utils, consistencyModel, ablobStore,
blobStore, blobRequestSigner);
}

View File

@ -1,33 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.s3.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "S3BlobMapIntegrationLiveTest")
public class S3BlobMapIntegrationLiveTest extends BaseBlobMapIntegrationTest {
public S3BlobMapIntegrationLiveTest() {
provider = "s3";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
}

View File

@ -1,33 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.s3.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "S3InputStreamMapIntegrationLiveTest")
public class S3InputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest {
public S3InputStreamMapIntegrationLiveTest() {
provider = "s3";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
}

View File

@ -20,7 +20,6 @@ package org.jclouds.openstack.swift.blobstore.config;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore;
import org.jclouds.openstack.swift.blobstore.SwiftBlobStore;
@ -37,7 +36,6 @@ public class SwiftBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(AsyncBlobStore.class).to(SwiftAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(SwiftBlobStore.class).in(Scopes.SINGLETON);

View File

@ -1,40 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.openstack.swift.blobstore.integration;
import java.util.Properties;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class SwiftBlobMapIntegrationLiveTest extends BaseBlobMapIntegrationTest {
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
return props;
}
public SwiftBlobMapIntegrationLiveTest() {
provider = System.getProperty("test.swift.provider", "swift");
}
}

View File

@ -1,40 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.openstack.swift.blobstore.integration;
import java.util.Properties;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class SwiftInputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest {
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
return props;
}
public SwiftInputStreamMapIntegrationLiveTest() {
provider = System.getProperty("test.swift.provider", "swift");
}
}

View File

@ -1,48 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.blobstore.internal.BlobMapImpl;
import org.jclouds.blobstore.options.ListContainerOptions;
import com.google.inject.ImplementedBy;
/**
* This allows you to access the underlying {@link Blob} so that you can manually set metadata such
* as length, content-type, or eTag hash.
*
* @author Adrian Cole
*
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
@ImplementedBy(BlobMapImpl.class)
public interface BlobMap extends ListableMap<String, Blob> {
/**
*
* @return builder for creating new {@link Blob}s
*/
BlobBuilder blobBuilder();
public static interface Factory {
BlobMap create(String containerName, ListContainerOptions options);
}
}

View File

@ -42,61 +42,6 @@ public interface BlobStoreContext extends Closeable, View {
*/
BlobRequestSigner getSigner();
/**
* Creates a <code>Map<String,InputStream></code> view of the specified container. Use this for
* simplest access to blobstore, knowing that MD5s will be calculated for every object.
*
* @param container
* existing container you wish to read or modify
* @param options
* allow you to specify a directory within the container, or whether to list
* recursively.
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
InputStreamMap createInputStreamMap(String container, ListContainerOptions options);
/**
* Creates a <code>Map<String,InputStream></code> view of the specified container. Use this for
* simplest access to blobstore, knowing that MD5s will be calculated for every object.
*
* Only root-level blobs will be visible.
*
* @param container
* existing container you wish to read or modify
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
InputStreamMap createInputStreamMap(String container);
/**
* Creates a <code>Map<String,Blob></code> view of the specified container. Use this when you wan
* to control the content type, or manually specify length or size of blobs.
*
* @param container
* existing container you wish to read or modify
* @param options
* allow you to specify a directory within the container, or whether to list
* recursively.
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
BlobMap createBlobMap(String container, ListContainerOptions options);
/**
* Creates a <code>Map<String,Blob></code> view of the specified container.
* Use this when you wan to control the content type, or manually specify
* length or size of blobs.
*
* Only root-level blobs will be visible.
*
* @param container
* existing container you wish to read or modify
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
BlobMap createBlobMap(String container);
/**
* @return a portable asynchronous interface for the BlobStore, which returns
* {@code Future}s for each call.

View File

@ -1,60 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore;
import java.io.File;
import java.io.InputStream;
import java.util.Map;
import org.jclouds.blobstore.internal.InputStreamMapImpl;
import org.jclouds.blobstore.options.ListContainerOptions;
import com.google.inject.ImplementedBy;
/**
* Map view of an {@link org.jclouds.aws.s3.domain.S3Bucket}. Provides additional methods for
* inserting common object types.
* <p/>
* <h2>Note</h2> All <code>put</code> operations will invoke
* {@link org.jclouds.aws.s3.domain.S3Object#generateETag}. By extension,
* {@link #put(Object, Object)} will result in the InputStream being converted to a byte array. For
* this reason, do not use {@link #put(Object, Object)} to store files. Use
* {@link #putFile(String, File)} or {@link S3ObjectMap} instead.
*
* @author Adrian Cole
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
@ImplementedBy(InputStreamMapImpl.class)
public interface InputStreamMap extends ListableMap<String, InputStream> {
public static interface Factory {
InputStreamMap create(String containerName, ListContainerOptions options);
}
InputStream putString(String key, String value);
InputStream putFile(String key, File value);
InputStream putBytes(String key, byte[] value);
void putAllStrings(Map<? extends String, ? extends String> map);
void putAllBytes(Map<? extends String, byte[]> map);
void putAllFiles(Map<? extends String, ? extends File> map);
}

View File

@ -1,39 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore;
import java.util.Map;
import org.jclouds.blobstore.domain.StorageMetadata;
/**
* All Map views of {@link ContainerListing}s provide means to access the underlying Blob.
*
* @author Adrian Cole
*
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
public interface ListableMap<K, V> extends Map<K, V> {
/**
*
* @return blob listing that this map represents
*/
Iterable<? extends StorageMetadata> list();
}

View File

@ -1,96 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.config;
import javax.inject.Inject;
import javax.inject.Provider;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.blobstore.internal.BlobMapImpl;
import org.jclouds.blobstore.internal.InputStreamMapImpl;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.blobstore.strategy.GetBlobsInListStrategy;
import org.jclouds.blobstore.strategy.PutBlobsStrategy;
import org.jclouds.blobstore.strategy.internal.ListContainerAndRecurseThroughFolders;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
/**
* Configures the domain object mappings needed for all Blob implementations
*
* @author Adrian Cole
*/
public class BlobStoreMapModule extends AbstractModule {
/**
* explicit factories are created here as it has been shown that Assisted Inject is extremely
* inefficient. http://code.google.com/p/google-guice/issues/detail?id=435
*/
@Override
protected void configure() {
bind(BlobMap.Factory.class).to(BlobMapFactory.class).in(Scopes.SINGLETON);
bind(InputStreamMap.Factory.class).to(InputStreamMapFactory.class).in(Scopes.SINGLETON);
}
private static class BlobMapFactory implements BlobMap.Factory {
@Inject
BlobStore connection;
@Inject
GetBlobsInListStrategy getAllBlobs;
@Inject
ContainsValueInListStrategy containsValueStrategy;
@Inject
PutBlobsStrategy putBlobsStrategy;
@Inject
ListContainerAndRecurseThroughFolders listStrategy;
@Inject
Provider<BlobBuilder> blobBuilders;
public BlobMap create(String containerName, ListContainerOptions options) {
return new BlobMapImpl(connection, getAllBlobs, containsValueStrategy, putBlobsStrategy, listStrategy,
containerName, options, blobBuilders);
}
}
private static class InputStreamMapFactory implements InputStreamMap.Factory {
@Inject
BlobStore connection;
@Inject
Provider<BlobBuilder> blobBuilders;
@Inject
GetBlobsInListStrategy getAllBlobs;
@Inject
ContainsValueInListStrategy containsValueStrategy;
@Inject
PutBlobsStrategy putBlobsStrategy;
@Inject
ListContainerAndRecurseThroughFolders listStrategy;
public InputStreamMap create(String containerName, ListContainerOptions options) {
return new InputStreamMapImpl(connection, blobBuilders, getAllBlobs, listStrategy, containsValueStrategy,
putBlobsStrategy, containerName, options);
}
}
}

View File

@ -41,7 +41,6 @@ public class TransientBlobStoreContextModule extends AbstractModule {
// forward all requests from TransientBlobStore to TransientAsyncBlobStore. needs above binding as cannot proxy a class
bindSyncToAsyncApi(binder(), LocalBlobStore.class, AsyncBlobStore.class);
install(new BlobStoreObjectModule());
install(new BlobStoreMapModule());
bind(BlobStore.class).to(LocalBlobStore.class);
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(LocalStorageStrategy.class).to(TransientStorageStrategy.class);

View File

@ -1,219 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.internal;
import static com.google.common.base.Functions.identity;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.ListableMap;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.MutableBlobMetadata;
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.options.ListContainerOptions.ImmutableListContainerOptions;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.blobstore.strategy.GetBlobsInListStrategy;
import org.jclouds.blobstore.strategy.PutBlobsStrategy;
import org.jclouds.blobstore.strategy.internal.ListContainerAndRecurseThroughFolders;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
/**
* Implements core Map functionality with a {@link BlobStore}
*
*
* @author Adrian Cole
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
public abstract class BaseBlobMap<V> implements ListableMap<String, V> {
protected final BlobStore blobstore;
protected final String containerName;
protected final Function<String, String> prefixer;
protected final Function<String, String> pathStripper;
protected final ListContainerOptions options;
protected final GetBlobsInListStrategy getAllBlobs;
protected final ContainsValueInListStrategy containsValueStrategy;
protected final ListContainerAndRecurseThroughFolders listStrategy;
protected final PutBlobsStrategy putBlobsStrategy;
static class StripPath implements Function<String, String> {
private final String prefix;
private final String delimiter;
StripPath(String prefix, String delimiter) {
this.prefix = checkNotNull(prefix, "prefix");
this.delimiter = checkNotNull(delimiter, "delimiter");
}
public String apply(String from) {
return from.replaceFirst(prefix + delimiter, "");
}
}
static class PrefixKey implements Function<String, String> {
private final String prefix;
private final String delimiter;
PrefixKey(String prefix, String delimiter) {
this.prefix = checkNotNull(prefix, "prefix");
this.delimiter = checkNotNull(delimiter, "delimiter");
}
public String apply(String from) {
return prefix + delimiter + from;
}
}
@Inject
public BaseBlobMap(BlobStore blobstore, GetBlobsInListStrategy getAllBlobs,
ContainsValueInListStrategy containsValueStrategy, PutBlobsStrategy putBlobsStrategy,
ListContainerAndRecurseThroughFolders listStrategy, String containerName, ListContainerOptions options) {
this.blobstore = checkNotNull(blobstore, "blobstore");
this.containerName = checkNotNull(containerName, "container");
checkArgument(containerName.indexOf('/') == -1,
"please specify directory path using the option: inDirectory, not encoded in the container name");
this.options = checkNotNull(options, "options") instanceof ImmutableListContainerOptions ? options
: new ImmutableListContainerOptions(options);
String dir = options.getDir();
if (dir == null) {
prefixer = identity();
pathStripper = prefixer;
} else {
prefixer = new PrefixKey(dir, "/");
pathStripper = new StripPath(dir, "/");
}
this.getAllBlobs = checkNotNull(getAllBlobs, "getAllBlobs");
this.listStrategy = checkNotNull(listStrategy, "listStrategy");
this.containsValueStrategy = checkNotNull(containsValueStrategy, "containsValueStrategy");
this.putBlobsStrategy = checkNotNull(putBlobsStrategy, "putBlobsStrategy");
checkArgument(!containerName.equals(""), "container name must not be a blank string!");
}
@Override
public Set<java.util.Map.Entry<String, V>> entrySet() {
return ImmutableSet.copyOf(transform(list(), new Function<BlobMetadata, Map.Entry<String, V>>() {
@Override
public java.util.Map.Entry<String, V> apply(BlobMetadata from) {
return new Entry(pathStripper.apply(from.getName()));
}
}));
}
public class Entry implements java.util.Map.Entry<String, V> {
private final String key;
Entry(String key) {
this.key = key;
}
@Override
public String getKey() {
return key;
}
@Override
public V getValue() {
return get(prefixer.apply(key));
}
@Override
public V setValue(V value) {
return put(prefixer.apply(key), value);
}
}
@Override
public int size() {
return (int) blobstore.countBlobs(containerName, options);
}
protected Iterable<Blob> getAllBlobs() {
Iterable<Blob> returnVal = getAllBlobs.execute(containerName, options);
if (options != null) {
for (Blob from : returnVal)
stripPrefix(from);
}
return returnVal;
}
protected Blob stripPrefix(Blob from) {
from.getMetadata().setName(pathStripper.apply(from.getMetadata().getName()));
return from;
}
@Override
public boolean containsValue(Object value) {
return containsValueStrategy.execute(containerName, value, options);
}
@Override
public void clear() {
blobstore.clearContainer(containerName, options);
}
@Override
public Set<String> keySet() {
return ImmutableSet.copyOf(transform(list(), new Function<BlobMetadata, String>() {
@Override
public String apply(BlobMetadata from) {
return from.getName();
}
}));
}
@Override
public boolean containsKey(Object key) {
String realKey = prefixer.apply(checkNotNull(key, "key").toString());
return blobstore.blobExists(containerName, realKey);
}
@Override
public boolean isEmpty() {
return size() == 0;
}
public Iterable<? extends BlobMetadata> list() {
return transform(listStrategy.execute(containerName, options), new Function<BlobMetadata, BlobMetadata>() {
public BlobMetadata apply(BlobMetadata from) {
MutableBlobMetadata md = new MutableBlobMetadataImpl(from);
if (options.getDir() != null)
md.setName(pathStripper.apply(from.getName()));
return md;
}
});
}
@Override
public String toString() {
return "[containerName=" + containerName + ", options=" + options + "]";
}
}

View File

@ -1,130 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform;
import java.util.Collection;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Provider;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.KeyNotFoundException;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.blobstore.strategy.GetBlobsInListStrategy;
import org.jclouds.blobstore.strategy.PutBlobsStrategy;
import org.jclouds.blobstore.strategy.internal.ListContainerAndRecurseThroughFolders;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
/**
* Map representation of a live connection to a Blob Service.
*
* @see BlobStore
* @see BaseBlobMap
*
* @author Adrian Cole
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
public class BlobMapImpl extends BaseBlobMap<Blob> implements BlobMap {
public static class CorrectBlobName implements Function<java.util.Map.Entry<? extends String, ? extends Blob>, Blob> {
private final Function<String, String> prefixer;
public CorrectBlobName(Function<String, String> prefixer) {
this.prefixer = checkNotNull(prefixer, "prefixer");
}
@Override
public Blob apply(java.util.Map.Entry<? extends String, ? extends Blob> arg0) {
return apply(arg0.getKey(), arg0.getValue());
}
public Blob apply(String key, Blob blob) {
blob.getMetadata().setName(prefixer.apply(key));
return blob;
}
}
private final CorrectBlobName correctBlobName;
private final Provider<BlobBuilder> blobBuilders;
@Inject
public BlobMapImpl(BlobStore blobstore, GetBlobsInListStrategy getAllBlobs,
ContainsValueInListStrategy containsValueStrategy, PutBlobsStrategy putBlobsStrategy,
ListContainerAndRecurseThroughFolders listStrategy, String containerName, ListContainerOptions options,
Provider<BlobBuilder> blobBuilders) {
super(blobstore, getAllBlobs, containsValueStrategy, putBlobsStrategy, listStrategy, containerName, options);
this.correctBlobName = new CorrectBlobName(prefixer);
this.blobBuilders = checkNotNull(blobBuilders, "blobBuilders");
}
@Override
public Blob get(Object key) {
String realKey = prefixer.apply(checkNotNull(key, "key").toString());
Blob blob = blobstore.getBlob(containerName, realKey);
return blob != null ? stripPrefix(blob) : null;
}
@Override
public Blob put(String key, Blob value) {
Blob returnVal = getLastValue(checkNotNull(key, "key"));
blobstore.putBlob(containerName, correctBlobName.apply(key, value));
return returnVal;
}
@Override
public void putAll(Map<? extends String, ? extends Blob> map) {
putBlobsStrategy.execute(containerName, transform(checkNotNull(map, "map").entrySet(), correctBlobName));
}
@Override
public Blob remove(Object key) {
Blob old = getLastValue(checkNotNull(key, "key"));
String realKey = prefixer.apply(key.toString());
blobstore.removeBlob(containerName, realKey);
return old;
}
private Blob getLastValue(Object key) {
Blob old;
try {
old = get(checkNotNull(key, "key"));
} catch (KeyNotFoundException e) {
old = null;
}
return old;
}
@Override
public Collection<Blob> values() {
return ImmutableSet.copyOf(getAllBlobs.execute(containerName, options));
}
@Override
public BlobBuilder blobBuilder() {
return blobBuilders.get();
}
}

View File

@ -23,11 +23,9 @@ import javax.inject.Singleton;
import org.jclouds.Context;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.internal.BaseView;
@ -43,8 +41,6 @@ import com.google.common.reflect.TypeToken;
*/
@Singleton
public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
private final BlobMap.Factory blobMapFactory;
private final InputStreamMap.Factory inputStreamMapFactory;
private final AsyncBlobStore ablobStore;
private final BlobStore blobStore;
private final ConsistencyModel consistencyModel;
@ -53,13 +49,11 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
@Inject
public BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
Utils utils, ConsistencyModel consistencyModel,
AsyncBlobStore ablobStore, BlobStore blobStore,
BlobRequestSigner blobRequestSigner) {
super(backend, backendType);
this.consistencyModel = checkNotNull(consistencyModel, "consistencyModel");
this.blobMapFactory = checkNotNull(blobMapFactory, "blobMapFactory");
this.inputStreamMapFactory = checkNotNull(inputStreamMapFactory, "inputStreamMapFactory");
this.ablobStore = checkNotNull(ablobStore, "ablobStore");
this.blobStore = checkNotNull(blobStore, "blobStore");
this.utils = checkNotNull(utils, "utils");
@ -71,26 +65,6 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext {
return consistencyModel;
}
@Override
public BlobMap createBlobMap(String container, ListContainerOptions options) {
return blobMapFactory.create(container, options);
}
@Override
public BlobMap createBlobMap(String container) {
return blobMapFactory.create(container, ListContainerOptions.NONE);
}
@Override
public InputStreamMap createInputStreamMap(String container, ListContainerOptions options) {
return inputStreamMapFactory.create(container, options);
}
@Override
public InputStreamMap createInputStreamMap(String container) {
return inputStreamMapFactory.create(container, ListContainerOptions.NONE);
}
@Override
public BlobStore getBlobStore() {
return blobStore;

View File

@ -1,188 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.internal;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Lists.newArrayList;
import static org.jclouds.io.Payloads.newPayload;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Provider;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobBuilder;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.blobstore.strategy.GetBlobsInListStrategy;
import org.jclouds.blobstore.strategy.PutBlobsStrategy;
import org.jclouds.blobstore.strategy.internal.ListContainerAndRecurseThroughFolders;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.jclouds.io.payloads.ByteArrayPayload;
import org.jclouds.io.payloads.FilePayload;
import org.jclouds.io.payloads.InputStreamPayload;
import org.jclouds.io.payloads.StringPayload;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
/**
* Map representation of a live connection to a BlobStore. All put operations will result in ETag
* calculation. If this is not desired, use {@link BlobMap} instead.
*
* @author Adrian Cole
*
* @see BlobStore
* @see InputStreamMap
* @see BaseBlobMap
* @deprecated will be removed in jclouds 1.7. Please use {@link BlobStore}
*/
@Deprecated
public class InputStreamMapImpl extends BaseBlobMap<InputStream> implements InputStreamMap {
@Inject
public InputStreamMapImpl(BlobStore connection, Provider<BlobBuilder> blobBuilders,
GetBlobsInListStrategy getAllBlobs, ListContainerAndRecurseThroughFolders listStrategy,
ContainsValueInListStrategy containsValueStrategy, PutBlobsStrategy putBlobsStrategy, String containerName,
ListContainerOptions options) {
super(connection, getAllBlobs, containsValueStrategy, putBlobsStrategy, listStrategy, containerName, options);
}
@Override
public InputStream get(Object o) {
String realKey = prefixer.apply(o.toString());
Blob blob = blobstore.getBlob(containerName, realKey);
return getInputStreamOrNull(blob);
}
private InputStream getInputStreamOrNull(Blob blob) {
return blob != null ? blob.getPayload() != null ? blob.getPayload().getInput() : null : null;
}
@Override
public InputStream remove(Object o) {
InputStream old = get(o);
String realKey = prefixer.apply(o.toString());
blobstore.removeBlob(containerName, realKey);
return old;
}
@Override
public Collection<InputStream> values() {
return newArrayList(transform(getAllBlobs.execute(containerName, options), new Function<Blob, InputStream>() {
public InputStream apply(Blob from) {
return getInputStreamOrNull(from);
}
}));
}
@Override
public void putAll(Map<? extends String, ? extends InputStream> map) {
putAllInternal(map);
}
@Override
public void putAllBytes(Map<? extends String, byte[]> map) {
putAllInternal(map);
}
@Override
public void putAllFiles(Map<? extends String, ? extends File> map) {
putAllInternal(map);
}
@Override
public void putAllStrings(Map<? extends String, ? extends String> map) {
putAllInternal(map);
}
/**
* submits requests to add all objects and collects the results later. All values will have eTag
* calculated first. As a side-effect of this, the content will be copied into a byte [].
*
* @see S3Client#put(String, Blob)
*/
@VisibleForTesting
void putAllInternal(Map<? extends String, ? extends Object> map) {
putBlobsStrategy.execute(containerName,
transform(map.entrySet(), new Function<Map.Entry<? extends String, ? extends Object>, Blob>() {
@Override
public Blob apply(Map.Entry<? extends String, ? extends Object> from) {
String name = from.getKey();
Object value = from.getValue();
return newBlobWithMD5(name, value);
}
}));
}
@VisibleForTesting
Blob newBlobWithMD5(String name, Object value) {
Blob blob = blobstore.blobBuilder(prefixer.apply(name)).payload(newPayload(value)).build();
try {
Payloads.calculateMD5(blob);
} catch (IOException e) {
Throwables.propagate(e);
}
return blob;
}
@Override
public InputStream putString(String key, String value) {
return putInternal(key, new StringPayload(value));
}
@Override
public InputStream putFile(String key, File value) {
return putInternal(key, new FilePayload(value));
}
@Override
public InputStream putBytes(String key, byte[] value) {
return putInternal(key, new ByteArrayPayload(value));
}
@Override
public InputStream put(String key, InputStream value) {
return putInternal(key, new InputStreamPayload(value));
}
/**
* calculates eTag before adding the object to s3. As a side-effect of this, the content will be
* copied into a byte []. *
*
* @see S3Client#put(String, Blob)
*/
@VisibleForTesting
InputStream putInternal(String name, Payload payload) {
InputStream returnVal = containsKey(name) ? get(name) : null;
Blob blob = newBlobWithMD5(name, payload);
blobstore.putBlob(containerName, blob);
return returnVal;
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = { "integration", "live" })
public class TransientBlobMapIntegrationTest extends BaseBlobMapIntegrationTest {
public TransientBlobMapIntegrationTest() {
provider = "transient";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = { "integration", "live" })
public class TransientInputStreamMapIntegrationTest extends BaseInputStreamMapIntegrationTest {
public TransientInputStreamMapIntegrationTest() {
provider = "transient";
}
}

View File

@ -1,292 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.integration.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.inDirectory;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResults;
import static org.testng.Assert.assertEquals;
import java.io.InputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.io.Payloads;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
* Tests to cover @{link LiveS3ObjectMap}
*
* @author Adrian Cole
*/
public abstract class BaseBlobMapIntegrationTest extends BaseMapIntegrationTest<Blob> {
private static class StringToBlob implements Function<String, Blob> {
private final BlobMap map;
private StringToBlob(BlobMap map) {
this.map = map;
}
@Override
public Blob apply(String arg0) {
return map.blobBuilder().name(arg0).payload(arg0).build();
}
}
@Override
@Test(groups = { "integration", "live" })
public void testValues() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
BlobMap map = createMap(view, bucketName);
putFiveStrings(map);
putFiveStringsUnderPath(map);
Collection<Blob> blobs = map.values();
assertConsistencyAwareMapSize(map, 5);
Set<String> blobsAsString = Sets.newLinkedHashSet();
for (Blob blob : blobs) {
blobsAsString.add(getContentAsStringOrNullAndClose(blob));
}
blobsAsString.removeAll(fiveStrings.values());
assert blobsAsString.size() == 0 : blobsAsString.size() + ": " + blobs + ": " + blobsAsString;
} finally {
returnContainer(bucketName);
}
}
@Test(groups = { "integration", "live" })
public void testRemove() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(view, bucketName);
putStringWithMD5(map, "one", "two");
assertConsistencyAwareContentEquals(map, "one", "two");
// TODO track how often this occurs and potentially update map implementation
assertConsistencyAwareRemoveEquals(map, "one", null);
assertConsistencyAwareGetEquals(map, "one", null);
assertConsistencyAwareKeySize(map, 0);
} finally {
returnContainer(bucketName);
}
}
private void assertConsistencyAwareContentEquals(final Map<String, Blob> map, final String key, final String blob)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
Blob old = map.remove(key);
try {
assertEquals(getContentAsStringOrNullAndClose(old), blob);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
}
@Override
@Test(groups = { "integration", "live" })
public void testEntrySet() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
final BlobMap map = createMap(view, bucketName);
putFiveStrings(map);
assertConsistencyAwareMapSize(map, 5);
Set<Entry<String, Blob>> entries = map.entrySet();
assertEquals(entries.size(), 5);
for (Entry<String, Blob> entry : entries) {
assertEquals(fiveStrings.get(entry.getKey()), getContentAsStringOrNullAndClose(entry.getValue()));
Blob blob = entry.getValue();
blob.setPayload("");
Payloads.calculateMD5(blob);
entry.setValue(blob);
}
assertConsistencyAware(new Runnable() {
public void run() {
for (Blob blob : map.values()) {
try {
assertEquals(getContentAsStringOrNullAndClose(blob), "");
} catch (IOException e) {
Throwables.propagate(e);
}
}
}
});
} finally {
returnContainer(bucketName);
}
}
@Test(groups = { "integration", "live" })
public void testContains() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(view, bucketName);
putStringWithMD5(map, "one", "apple");
Blob blob = view.getBlobStore().blobBuilder("one").payload("apple").calculateMD5().build();
assertConsistencyAwareContainsValue(map, blob);
} finally {
returnContainer(bucketName);
}
}
void getOneReturnsAppleAndOldValueIsNull(Map<String, Blob> map, Blob old) throws IOException, InterruptedException {
assert old == null;
assertEquals(getContentAsStringOrNullAndClose(map.get("one")), "apple");
assertConsistencyAwareMapSize(map, 1);
}
void getOneReturnsBearAndOldValueIsApple(Map<String, Blob> map, Blob oldValue) throws IOException,
InterruptedException {
assertEquals(getContentAsStringOrNullAndClose(checkNotNull(map.get("one"), "one")), "bear");
assertEquals(getContentAsStringOrNullAndClose(oldValue), "apple");
assertConsistencyAwareMapSize(map, 1);
}
@Test(groups = { "integration", "live" })
public void testPut() throws IOException, InterruptedException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(view, bucketName);
Blob blob = view.getBlobStore().blobBuilder("one").payload(Strings2.toInputStream("apple")).calculateMD5()
.build();
Blob old = map.put(blob.getMetadata().getName(), blob);
getOneReturnsAppleAndOldValueIsNull(map, old);
blob.setPayload(Strings2.toInputStream("bear"));
Payloads.calculateMD5(blob);
Blob apple = map.put(blob.getMetadata().getName(), blob);
getOneReturnsBearAndOldValueIsApple(map, apple);
} finally {
returnContainer(bucketName);
}
}
@Test(groups = { "integration", "live" })
public void testPutAll() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
Map<String, Blob> map = createMap(view, bucketName);
ImmutableMap.Builder<String, Blob> newMap = ImmutableMap.builder();
for (Map.Entry<String, InputStream> entry : fiveInputs.entrySet()) {
String key = entry.getKey();
newMap.put(
key,
view.getBlobStore().blobBuilder(key).payload(entry.getValue())
.contentLength((long) fiveBytes.get(key).length).build());
}
map.putAll(newMap.build());
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, ImmutableSet.copyOf(fiveInputs.keySet()));
fourLeftRemovingOne(map);
} finally {
returnContainer(bucketName);
}
}
@Test(groups = { "integration", "live" })
public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException {
if (maxResultsForTestListings() == 0)
return;
String bucketName = getContainerName();
try {
BlobMap map = createMap(view, bucketName);
Builder<String> keySet = ImmutableSet.builder();
for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
keySet.add(i + "");
}
Map<String, Blob> newMap = Maps.newLinkedHashMap();
for (String key : keySet.build()) {
newMap.put(key, map.blobBuilder().name(key).payload(key).build());
}
map.putAll(newMap);
newMap.clear();
assertConsistencyAwareMapSize(map, maxResultsForTestListings() + 1);
assertConsistencyAwareKeySetEquals(map, keySet.build());
map.clear();
assertConsistencyAwareMapSize(map, 0);
} finally {
returnContainer(bucketName);
}
}
@Override
protected void putStringWithMD5(Map<String, Blob> map, String key, String text) throws IOException {
map.put(key, view.getBlobStore().blobBuilder(key).payload(text).calculateMD5().build());
}
protected void putFiveStrings(BlobMap map) {
map.putAll(Maps.transformValues(fiveStrings, new StringToBlob(map)));
}
protected void putFiveStringsUnderPath(BlobMap map) {
map.putAll(Maps.transformValues(fiveStringsUnderPath, new StringToBlob(map)));
}
protected int maxResultsForTestListings() {
return 100;
}
@Override
protected BlobMap createMap(BlobStoreContext context, String bucket) {
return createMap(context, bucket, maxResults(maxResultsForTestListings()));
}
@Override
protected BlobMap createMap(BlobStoreContext context, String bucket, ListContainerOptions options) {
return context.createBlobMap(bucket, options);
}
@Override
protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
BlobMap blobMap = createMap(view, containerName, inDirectory(prefix));
for (int i = 0; i < 10; i++) {
blobMap.put(i + "", blobMap.blobBuilder().name(i + "").payload(i + "content").build());
}
}
@Override
protected void addTenObjectsUnderRoot(String containerName) throws InterruptedException {
BlobMap blobMap = createMap(view, containerName, ListContainerOptions.NONE);
for (int i = 0; i < 10; i++) {
blobMap.put(i + "", blobMap.blobBuilder().name(i + "").payload(i + "content").build());
}
}
}

View File

@ -1,338 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.integration.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResults;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
* Tests to cover @{link LiveS3ObjectMap}
*
* @author Adrian Cole
*/
public abstract class BaseInputStreamMapIntegrationTest extends BaseMapIntegrationTest<InputStream> {
@Override
@Test(groups = { "integration", "live" })
public void testValues() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
map.putAll(this.fiveInputs);
// this will cause us to block until the bucket updates.
assertConsistencyAwareMapSize(map, 5);
Collection<InputStream> values = map.values();
assertEquals(values.size(), 5);
Set<String> valuesAsString = Sets.newLinkedHashSet();
for (InputStream stream : values) {
valuesAsString.add(Strings2.toStringAndClose(stream));
}
valuesAsString.removeAll(fiveStrings.values());
assert valuesAsString.size() == 0 : valuesAsString.size() + ": " + values + ": " + valuesAsString;
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
InputStreamMap map = createMap(view, containerName);
Set<String> keySet = Sets.newLinkedHashSet();
for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
keySet.add(i + "");
}
Map<String, String> newMap = Maps.newHashMap();
for (String key : keySet) {
newMap.put(key, key);
}
map.putAllStrings(newMap);
newMap.clear();
assertConsistencyAwareMapSize(map, maxResultsForTestListings() + 1);
assertConsistencyAwareKeySetEquals(map, keySet);
map.clear();
assertConsistencyAwareMapSize(map, 0);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testRemove() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
putStringWithMD5(map, "one", "two");
InputStream old = map.remove("one");
assertEquals(Strings2.toStringAndClose(old), "two");
assertConsistencyAwareKeySize(map, 0);
old = map.remove("one");
assert old == null;
old = map.get("one");
assert old == null;
assertConsistencyAwareKeySize(map, 0);
} finally {
returnContainer(containerName);
}
}
@Override
@Test(groups = { "integration", "live" })
public void testEntrySet() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllStrings(this.fiveStrings);
// this will cause us to block until the bucket updates.
assertConsistencyAwareKeySize(map, 5);
Set<Entry<String, InputStream>> entries = map.entrySet();
assertEquals(entries.size(), 5);
for (Entry<String, InputStream> entry : entries) {
assertEquals(fiveStrings.get(entry.getKey()), Strings2.toStringAndClose(entry.getValue()));
entry.setValue(Strings2.toInputStream(""));
}
assertConsistencyAwareMapSize(map, 5);
for (Entry<String, InputStream> entry : map.entrySet()) {
assertEquals(Strings2.toStringAndClose(checkNotNull(entry.getValue(), entry.getKey())), "");
}
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testContainsStringValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, fiveStrings.get("one"));
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testContainsFileValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, fiveFiles.get("one"));
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testContainsInputStreamValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, this.fiveInputs.get("one"));
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testContainsBytesValue() throws InterruptedException, ExecutionException, TimeoutException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putString("one", String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareContainsValue(map, this.fiveBytes.get("one"));
} finally {
returnContainer(containerName);
}
}
@Override
@Test(groups = { "integration", "live" })
public void testPutAll() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
map.putAll(this.fiveInputs);
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(fiveInputs.keySet()));
fourLeftRemovingOne(map);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutAllBytes() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllBytes(this.fiveBytes);
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(fiveBytes.keySet()));
fourLeftRemovingOne(map);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutAllFiles() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllFiles(this.fiveFiles);
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(fiveFiles.keySet()));
fourLeftRemovingOne(map);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutAllStrings() throws InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
((InputStreamMap) map).putAllStrings(this.fiveStrings);
assertConsistencyAwareMapSize(map, 5);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(fiveStrings.keySet()));
fourLeftRemovingOne(map);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutString() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putString("one", fiveStrings.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
InputStream apple = ((InputStreamMap) map).putString("one", fiveStrings.get("two"));
getOneReturnsBearAndOldValueIsApple(map, apple);
} finally {
returnContainer(containerName);
}
}
void getOneReturnsAppleAndOldValueIsNull(Map<String, InputStream> map, InputStream old) throws IOException,
InterruptedException {
assert old == null;
assertEquals(Strings2.toStringAndClose(map.get("one")), String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareMapSize(map, 1);
}
void getOneReturnsBearAndOldValueIsApple(Map<String, InputStream> map, InputStream oldValue) throws IOException,
InterruptedException {
assertEquals(Strings2.toStringAndClose(map.get("one")), String.format(XML_STRING_FORMAT, "bear"));
assertEquals(Strings2.toStringAndClose(oldValue), String.format(XML_STRING_FORMAT, "apple"));
assertConsistencyAwareMapSize(map, 1);
}
@Test(groups = { "integration", "live" })
public void testPutFile() throws IOException, InterruptedException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putFile("one", fiveFiles.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
InputStream apple = ((InputStreamMap) map).putFile("one", fiveFiles.get("two"));
getOneReturnsBearAndOldValueIsApple(map, apple);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPutBytes() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = ((InputStreamMap) map).putBytes("one", fiveBytes.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
InputStream apple = ((InputStreamMap) map).putBytes("one", fiveBytes.get("two"));
getOneReturnsBearAndOldValueIsApple(map, apple);
} finally {
returnContainer(containerName);
}
}
@Test(groups = { "integration", "live" })
public void testPut() throws InterruptedException, IOException {
String containerName = getContainerName();
try {
Map<String, InputStream> map = createMap(view, containerName);
InputStream old = map.put("one", fiveInputs.get("one"));
getOneReturnsAppleAndOldValueIsNull(map, old);
InputStream apple = map.put("one", fiveInputs.get("two"));
getOneReturnsBearAndOldValueIsApple(map, apple);
} finally {
returnContainer(containerName);
}
}
@Override
protected void putStringWithMD5(Map<String, InputStream> map, String key, String value) throws InterruptedException {
((InputStreamMap) map).putString(key, value);
}
protected int maxResultsForTestListings() {
return 100;
}
protected InputStreamMap createMap(BlobStoreContext context, String bucket) {
return createMap(context, bucket, maxResults(maxResultsForTestListings()));
}
protected InputStreamMap createMap(BlobStoreContext context, String bucket, ListContainerOptions options) {
return context.createInputStreamMap(bucket, options);
}
}

View File

@ -1,360 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.integration.internal;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.inDirectory;
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursive;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.ListableMap;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.util.Strings2;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
public abstract class BaseMapIntegrationTest<V> extends BaseBlobStoreIntegrationTest {
public abstract void testPutAll() throws InterruptedException, ExecutionException, TimeoutException;
public abstract void testEntrySet() throws IOException, InterruptedException, ExecutionException, TimeoutException;
public abstract void testValues() throws IOException, InterruptedException, ExecutionException, TimeoutException;
protected Map<String, byte[]> fiveBytes = Maps.transformValues(fiveStrings, new Function<String, byte[]>() {
public byte[] apply(String from) {
return from.getBytes();
}
});
protected Map<String, InputStream> fiveInputs;
protected Map<String, File> fiveFiles;
String tmpDirectory;
@BeforeMethod(groups = { "integration", "live" })
protected void setUpInputStreams() {
fiveInputs = Maps.transformValues(fiveStrings, new Function<String, InputStream>() {
public InputStream apply(String from) {
return Strings2.toInputStream(from);
}
});
}
@BeforeClass(groups = { "integration", "live" })
@Parameters({ "basedir" })
protected void setUpTempDir(@Optional String basedir) throws InterruptedException, ExecutionException,
FileNotFoundException, IOException, TimeoutException {
if (basedir == null) {
basedir = System.getProperty("java.io.tmpdir");
}
tmpDirectory = basedir + File.separator + "target" + File.separator + "testFiles" + File.separator
+ getClass().getSimpleName();
new File(tmpDirectory).mkdirs();
fiveFiles = Maps.newHashMap();
for (Entry<String, String> entry : fiveStrings.entrySet()) {
File file = new File(tmpDirectory, entry.getKey());
Files.write(entry.getValue().getBytes(Charsets.UTF_8), file);
fiveFiles.put(entry.getKey(), file);
}
}
protected abstract Map<String, V> createMap(BlobStoreContext context, String containerName);
protected abstract Map<String, V> createMap(BlobStoreContext context, String containerName,
ListContainerOptions options);
@Test(groups = { "integration", "live" })
public void testClear() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareMapSize(map, 0);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareMapSize(map, 1);
map.clear();
assertConsistencyAwareMapSize(map, 0);
} finally {
returnContainer(containerNameName);
}
}
@Test(groups = { "integration", "live" })
public abstract void testRemove() throws IOException, InterruptedException, ExecutionException, TimeoutException;
@Test(groups = { "integration", "live" })
public void testKeySet() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareKeySize(map, 0);
putStringWithMD5(map, "one", "two");
assertConsistencyAwareKeySize(map, 1);
assertConsistencyAwareKeySetEquals(map, ImmutableSet.of("one"));
} finally {
returnContainer(containerNameName);
}
}
protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
for (int i = 0; i < 10; i++) {
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(prefix + "/" + i).payload(i + "content").build());
}
}
protected void addTenObjectsUnderRoot(String containerName) throws InterruptedException {
for (int i = 0; i < 10; i++) {
view.getBlobStore().putBlob(containerName,
view.getBlobStore().blobBuilder(i + "").payload(i + "content").build());
}
}
@Test(groups = { "integration", "live" })
public void testDirectory() throws InterruptedException {
String containerName = getContainerName();
String directory = "apps";
Map<String, V> rootMap = createMap(view, containerName);
Map<String, V> rootRecursiveMap = createMap(view, containerName, recursive());
Map<String, V> inDirectoryMap = createMap(view, containerName, inDirectory(directory));
Map<String, V> inDirectoryRecursiveMap = createMap(view, containerName, inDirectory(directory).recursive());
try {
view.getBlobStore().createDirectory(containerName, directory);
addTenObjectsUnderRoot(containerName);
assertEquals(rootMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(rootMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
assertEquals(rootRecursiveMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(rootRecursiveMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
assertEquals(inDirectoryMap.size(), 0);
assertEquals(inDirectoryRecursiveMap.size(), 0);
addTenObjectsUnderPrefix(containerName, directory);
assertEquals(rootMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(rootMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
assertEquals(rootRecursiveMap.size(), 20);
assertEquals(ImmutableSortedSet.copyOf(rootRecursiveMap.keySet()), ImmutableSet.of("0", "1", "2", "3", "4",
"5", "6", "7", "8", "9", "apps/0", "apps/1", "apps/2", "apps/3", "apps/4", "apps/5", "apps/6", "apps/7",
"apps/8", "apps/9"));
assertEquals(inDirectoryMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(inDirectoryMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
assertEquals(inDirectoryRecursiveMap.size(), 10);
assertEquals(ImmutableSortedSet.copyOf(inDirectoryRecursiveMap.keySet()),
ImmutableSortedSet.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
view.getBlobStore().createDirectory(containerName, directory + "/" + directory);
assertEquals(rootMap.size(), 10);
assertEquals(rootRecursiveMap.size(), 20);
assertEquals(inDirectoryMap.size(), 10);
assertEquals(inDirectoryRecursiveMap.size(), 10);
rootMap.clear();
assertEquals(rootMap.size(), 0);
assertEquals(rootRecursiveMap.size(), 10);
assertEquals(inDirectoryMap.size(), 10);
assertEquals(inDirectoryRecursiveMap.size(), 10);
inDirectoryMap.clear();
assertEquals(rootMap.size(), 0);
assertEquals(rootRecursiveMap.size(), 0);
assertEquals(inDirectoryMap.size(), 0);
assertEquals(inDirectoryRecursiveMap.size(), 0);
} finally {
returnContainer(containerName);
}
}
protected void assertConsistencyAwareKeySetEquals(final Map<String, V> map, final Set<String> expected)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
Set<String> toMatch = map.keySet();
Set<String> shouldBeEmpty = Sets.difference(expected, toMatch);
assert shouldBeEmpty.size() == 0 : "toMatch has less keys than expected. missing: " + shouldBeEmpty;
shouldBeEmpty = Sets.difference(toMatch, expected);
assert shouldBeEmpty.size() == 0 : "toMatch has more keys than expected. extras: " + shouldBeEmpty;
assertEquals(Sets.newTreeSet(toMatch), Sets.newTreeSet(expected));
}
});
}
protected void assertConsistencyAwareRemoveEquals(final Map<String, V> map, final String key, final Object equals)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assertEquals(map.remove(key), equals);
}
});
}
protected void assertConsistencyAwareGetEquals(final Map<String, V> map, final String key, final Object equals)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assertEquals(map.get(key), equals);
}
});
}
protected void assertConsistencyAwareKeySize(final Map<String, V> map, final int size) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assertEquals(map.keySet().size(), size);
}
});
}
@Test(groups = { "integration", "live" })
public void testContainsKey() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareDoesntContainKey(map);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareContainsKey(map);
} finally {
returnContainer(containerNameName);
}
}
/**
* containsValue() uses eTag comparison to containerName contents, so this can be subject to
* eventual consistency problems.
*/
protected void assertConsistencyAwareContainsValue(final Map<String, V> map, final Object value)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assert map.containsValue(value);
}
});
}
protected void assertConsistencyAwareContainsKey(final Map<String, V> map) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assert map.containsKey("one");
}
});
}
protected void assertConsistencyAwareDoesntContainKey(final Map<String, V> map) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assert !map.containsKey("one");
}
});
}
@Test(groups = { "integration", "live" })
public void testIsEmpty() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String containerNameName = getContainerName();
try {
Map<String, V> map = createMap(view, containerNameName);
assertConsistencyAwareEmpty(map);
putStringWithMD5(map, "one", "apple");
assertConsistencyAwareNotEmpty(map);
} finally {
returnContainer(containerNameName);
}
}
protected void assertConsistencyAwareNotEmpty(final Map<String, V> map) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assert !map.isEmpty();
}
});
}
protected void assertConsistencyAwareEmpty(final Map<String, V> map) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assert map.isEmpty();
}
});
}
abstract protected void putStringWithMD5(Map<String, V> map, String key, String value) throws InterruptedException,
ExecutionException, TimeoutException, IOException;
protected void fourLeftRemovingOne(Map<String, V> map) throws InterruptedException {
map.remove("one");
assertConsistencyAwareMapSize(map, 4);
assertConsistencyAwareKeySetEquals(map, new TreeSet<String>(ImmutableSet.of("two", "three", "four", "five")));
}
protected void assertConsistencyAwareMapSize(final Map<String, V> map, final int size) throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assertEquals(map.size(), size);
}
});
}
@Test(groups = { "integration", "live" })
public abstract void testPut() throws IOException, InterruptedException, ExecutionException, TimeoutException;
@Test(groups = { "integration", "live" })
public void testListContainer() throws InterruptedException, ExecutionException, TimeoutException {
String containerNameName = getContainerName();
try {
ListableMap<?, ?> map = (ListableMap<?, ?>) createMap(view, containerNameName);
assertConsistencyAwareListContainer(map, containerNameName);
} finally {
returnContainer(containerNameName);
}
}
protected void assertConsistencyAwareListContainer(final ListableMap<?, ?> map, final String containerNameName)
throws InterruptedException {
assertConsistencyAware(new Runnable() {
public void run() {
assertTrue(Iterables.size(map.list()) >= 0);
}
});
}
}

View File

@ -1,60 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.blobstore.internal;
import static org.testng.Assert.assertEquals;
import java.util.Map;
import org.jclouds.ContextBuilder;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.inject.TypeLiteral;
import com.google.inject.util.Types;
/**
*
* Tests retry logic.
*
* @author Adrian Cole
*/
@Test(groups = { "unit" })
public class BaseBlobMapTest {
BlobStoreContext context;
InputStreamMapImpl map;
@BeforeClass
void addDefaultObjectsSoThatTestsWillPass() {
context = ContextBuilder.newBuilder("transient").build(BlobStoreContext.class);
map = (InputStreamMapImpl) context.createInputStreamMap("test");
}
public void testTypes() {
TypeLiteral<Map<String, Map<String, Blob>>> type0 = new TypeLiteral<Map<String, Map<String, Blob>>>() {
};
TypeLiteral<?> type1 = TypeLiteral.get(Types.newParameterizedType(Map.class, String.class,
Types.newParameterizedType(Map.class, String.class, Blob.class)));
assertEquals(type0, type1);
}
}

View File

@ -24,10 +24,8 @@ import org.jclouds.aws.s3.blobstore.AWSS3AsyncBlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStore;
import org.jclouds.aws.s3.blobstore.AWSS3BlobStoreContext;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobMap;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.InputStreamMap;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.location.Provider;
import org.jclouds.rest.Utils;
@ -43,10 +41,10 @@ public class AWSS3BlobStoreContextImpl extends S3BlobStoreContextImpl implements
@Inject
public AWSS3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
Utils utils, ConsistencyModel consistencyModel,
AsyncBlobStore ablobStore, BlobStore blobStore,
BlobRequestSigner blobRequestSigner) {
super(backend, backendType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
super(backend, backendType, utils, consistencyModel, ablobStore,
blobStore, blobRequestSigner);
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.aws.s3.blobstore.integration;
import org.jclouds.s3.blobstore.integration.S3BlobMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "AWSS3BlobMapIntegrationLiveTest")
public class AWSS3BlobMapIntegrationLiveTest extends S3BlobMapIntegrationLiveTest {
public AWSS3BlobMapIntegrationLiveTest() {
provider = "aws-s3";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.aws.s3.blobstore.integration;
import org.jclouds.s3.blobstore.integration.S3InputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "AWSS3InputStreamMapIntegrationLiveTest")
public class AWSS3InputStreamMapIntegrationLiveTest extends S3InputStreamMapIntegrationLiveTest {
public AWSS3InputStreamMapIntegrationLiveTest() {
provider = "aws-s3";
}
}

View File

@ -30,7 +30,6 @@ import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import com.google.common.cache.CacheBuilder;
@ -49,7 +48,6 @@ public class AzureBlobStoreContextModule extends AbstractModule {
@Override
protected void configure() {
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(AsyncBlobStore.class).to(AzureAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AzureBlobStore.class).in(Scopes.SINGLETON);

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azureblob.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseInputStreamMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class AzureBlobInputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest {
public AzureBlobInputStreamMapIntegrationLiveTest() {
provider = "azureblob";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.azureblob.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseBlobMapIntegrationTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
public class AzureBlobMapIntegrationLiveTest extends BaseBlobMapIntegrationTest {
public AzureBlobMapIntegrationLiveTest() {
provider = "azureblob";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
import org.jclouds.cloudfiles.blobstore.integration.CloudFilesBlobMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudFilesUKBlobMapIntegrationLiveTest")
public class CloudFilesUKBlobMapIntegrationLiveTest extends CloudFilesBlobMapIntegrationLiveTest {
public CloudFilesUKBlobMapIntegrationLiveTest() {
provider = "cloudfiles-uk";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
import org.jclouds.cloudfiles.blobstore.integration.CloudFilesInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudFilesUKInputStreamMapIntegrationLiveTest")
public class CloudFilesUKInputStreamMapIntegrationLiveTest extends CloudFilesInputStreamMapIntegrationLiveTest {
public CloudFilesUKInputStreamMapIntegrationLiveTest() {
provider = "cloudfiles-uk";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
import org.jclouds.cloudfiles.blobstore.integration.CloudFilesBlobMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudFilesUSBlobMapIntegrationLiveTest")
public class CloudFilesUSBlobMapIntegrationLiveTest extends CloudFilesBlobMapIntegrationLiveTest {
public CloudFilesUSBlobMapIntegrationLiveTest() {
provider = "cloudfiles-us";
}
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.rackspace.cloudfiles.blobstore.integration;
import org.jclouds.cloudfiles.blobstore.integration.CloudFilesInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudFilesUSInputStreamMapIntegrationLiveTest")
public class CloudFilesUSInputStreamMapIntegrationLiveTest extends CloudFilesInputStreamMapIntegrationLiveTest {
public CloudFilesUSInputStreamMapIntegrationLiveTest() {
provider = "cloudfiles-us";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.cloudonestorage.blobstore.integration;
import org.jclouds.atmos.blobstore.integration.AtmosMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudOneStorageBlobMapIntegrationLiveTest")
public class CloudOneStorageBlobMapIntegrationLiveTest extends AtmosMapIntegrationLiveTest {
public CloudOneStorageBlobMapIntegrationLiveTest() {
provider = "cloudonestorage";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.cloudonestorage.blobstore.integration;
import org.jclouds.atmos.blobstore.integration.AtmosInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudOneStorageInputStreamMapIntegrationLiveTest")
public class CloudOneStorageInputStreamMapIntegrationLiveTest extends AtmosInputStreamMapIntegrationLiveTest {
public CloudOneStorageInputStreamMapIntegrationLiveTest() {
provider = "cloudonestorage";
}
}

View File

@ -29,7 +29,6 @@ import javax.inject.Singleton;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi;
import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageAsyncBlobStore;
import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageBlobStore;
@ -98,7 +97,6 @@ public class HPCloudObjectStorageBlobStoreContextModule extends SwiftBlobStoreCo
@Override
protected void configure() {
install(new BlobStoreMapModule());
bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT);
bind(AsyncBlobStore.class).to(HPCloudObjectStorageAsyncBlobStore.class);
bind(BlobStore.class).to(HPCloudObjectStorageBlobStore.class);

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.hpcloud.objectstorage.blobstore.integration;
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Jeremy Daggett
*/
@Test(groups = "live")
public class HPCloudObjectStorageBlobMapIntegrationLiveTest extends SwiftBlobMapIntegrationLiveTest {
public HPCloudObjectStorageBlobMapIntegrationLiveTest() {
provider = "hpcloud-objectstorage";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.hpcloud.objectstorage.blobstore.integration;
import org.jclouds.openstack.swift.blobstore.integration.SwiftInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Jeremy Daggett
*/
@Test(groups = "live")
public class HPCloudObjectStorageInputStreamMapIntegrationLiveTest extends SwiftInputStreamMapIntegrationLiveTest {
public HPCloudObjectStorageInputStreamMapIntegrationLiveTest() {
provider = "hpcloud-objectstorage";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.ninefold.storage.blobstore.integration;
import org.jclouds.atmos.blobstore.integration.AtmosMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "NinefoldStorageBlobMapIntegrationLiveTest")
public class NinefoldStorageBlobMapIntegrationLiveTest extends AtmosMapIntegrationLiveTest {
public NinefoldStorageBlobMapIntegrationLiveTest() {
provider = "ninefold-storage";
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.ninefold.storage.blobstore.integration;
import org.jclouds.atmos.blobstore.integration.AtmosInputStreamMapIntegrationLiveTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", testName = "NinefoldStorageInputStreamMapIntegrationLiveTest")
public class NinefoldStorageInputStreamMapIntegrationLiveTest extends AtmosInputStreamMapIntegrationLiveTest {
public NinefoldStorageInputStreamMapIntegrationLiveTest() {
provider = "ninefold-storage";
}
}