mirror of https://github.com/apache/jclouds.git
Merge pull request #106 from andrewgaul/issue-629
Issue 629: Fix createContainerInLocation return value.
This commit is contained in:
commit
dbc84d82ed
|
@ -360,11 +360,12 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String name) {
|
public ListenableFuture<Boolean> createContainerInLocation(final Location location, final String name) {
|
||||||
if (!getContainerToBlobs().containsKey(name)) {
|
if (getContainerToBlobs().containsKey(name)) {
|
||||||
getContainerToBlobs().put(name, new ConcurrentHashMap<String, Blob>());
|
return immediateFuture(Boolean.FALSE);
|
||||||
getContainerToLocation().put(name, location != null ? location : defaultLocation.get());
|
|
||||||
}
|
}
|
||||||
return immediateFuture(getContainerToBlobs().containsKey(name));
|
getContainerToBlobs().put(name, new ConcurrentHashMap<String, Blob>());
|
||||||
|
getContainerToLocation().put(name, location != null ? location : defaultLocation.get());
|
||||||
|
return immediateFuture(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,14 +21,18 @@ package org.jclouds.blobstore.integration;
|
||||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||||
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResults;
|
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResults;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.blobstore.BlobStore;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||||
import org.jclouds.blobstore.domain.PageSet;
|
import org.jclouds.blobstore.domain.PageSet;
|
||||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
|
import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -65,4 +69,18 @@ public class TransientContainerIntegrationTest extends BaseContainerIntegrationT
|
||||||
returnContainer(containerName);
|
returnContainer(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Test(groups = { "integration", "live" })
|
||||||
|
public void testDuplicateCreateContainer() {
|
||||||
|
BlobStore blobStore = context.getBlobStore();
|
||||||
|
Location location = null;
|
||||||
|
String container = "container";
|
||||||
|
boolean created;
|
||||||
|
|
||||||
|
created = blobStore.createContainerInLocation(location, container);
|
||||||
|
assertTrue(created);
|
||||||
|
|
||||||
|
created = blobStore.createContainerInLocation(location, container);
|
||||||
|
assertFalse(created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue