mirror of https://github.com/apache/jclouds.git
Swift: do not assume only 1 container in tests.
Openstack Swift ContainerApiLiveTest testListWithOptions assumes that there are no other containers and that ContainerApiLiveTest container will _always_ be the first container. The patch changes the behavior of the test to instead pull out the container from the returned list.
This commit is contained in:
parent
5383148d9e
commit
86af0753bf
|
@ -36,6 +36,7 @@ import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -98,8 +99,12 @@ public class ContainerApiLiveTest extends BaseSwiftApiLiveTest<SwiftApi> {
|
||||||
String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
|
String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
|
||||||
for (String regionId : regions) {
|
for (String regionId : regions) {
|
||||||
ListContainerOptions options = ListContainerOptions.Builder.marker(lexicographicallyBeforeName);
|
ListContainerOptions options = ListContainerOptions.Builder.marker(lexicographicallyBeforeName);
|
||||||
Container container = api.getContainerApi(regionId).list(options).get(0);
|
Container container = api.getContainerApi(regionId).list(options).firstMatch(new Predicate<Container>() {
|
||||||
assertEquals(container.getName(), name);
|
@Override
|
||||||
|
public boolean apply(Container container) {
|
||||||
|
return container.getName().equals(name);
|
||||||
|
}
|
||||||
|
}).get();
|
||||||
assertTrue(container.getObjectCount() == 0);
|
assertTrue(container.getObjectCount() == 0);
|
||||||
assertTrue(container.getBytesUsed() == 0);
|
assertTrue(container.getBytesUsed() == 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue