@Override protected Properties setupProperties() { Properties props = super.setupProperties(); props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR); return props; } }
@Test(groups = { "integration", "live" }) public void testAllLocations() throws InterruptedException { for (final Location location : view.getBlobStore().listAssignableLocations()) { final String containerName = getScratchContainerName(); try { System.err.printf(" >> creating container in location %s%n", location); view.getBlobStore().createContainerInLocation(location, containerName); System.err.printf(" << call complete.. checking%n"); assertConsistencyAware(new Runnable() { @Override public void run() { PageSet<? extends StorageMetadata> list = view.getBlobStore().list(); assert Iterables.any(list, new Predicate<StorageMetadata>() { public boolean apply(StorageMetadata md) { return containerName.equals(md.getName()) && location.equals(md.getLocation()); } }) : String.format("container %s/%s not found in list %s", location, containerName, list); assertTrue(view.getBlobStore().containerExists(containerName), containerName); } }); } finally { recycleContainer(containerName); } } }
@Test(groups = { "integration", "live" }) public void testAllLocations() throws InterruptedException { for (final Location location : view.getBlobStore().listAssignableLocations()) { final String containerName = getScratchContainerName(); try { System.err.printf(" >> creating container in location %s%n", location); view.getBlobStore().createContainerInLocation(location, containerName); System.err.printf(" << call complete.. checking%n"); assertConsistencyAware(new Runnable() { @Override public void run() { PageSet<? extends StorageMetadata> list = view.getBlobStore().list(); assert Iterables.any(list, new Predicate<StorageMetadata>() { public boolean apply(StorageMetadata md) { return containerName.equals(md.getName()) && locationEquals(location, md.getLocation()); } }) : String.format("container %s/%s not found in list %s", location, containerName, list); assertTrue(view.getBlobStore().containerExists(containerName), containerName); } }); } finally { recycleContainerAndAddToPool(containerName); } } }
void assertProvider(Location provider) { assertEquals(provider.getScope(), LocationScope.PROVIDER); assertEquals(provider.getParent(), null); assertEquals(provider.getIso3166Codes(), getIso3166Codes()); }
@Test(groups = { "integration", "live" }) public void testGetAssignableLocations() throws Exception { if (view.unwrap() instanceof Location) assertProvider(Location.class.cast(view.unwrap())); for (Location location : view.getBlobStore().listAssignableLocations()) { System.err.printf("location %s%n", location); switch (location.getScope()) { case PROVIDER: assertProvider(location); break; case REGION: assertProvider(location.getParent()); assert location.getIso3166Codes().size() == 0 || location.getParent().getIso3166Codes().containsAll(location.getIso3166Codes()) : location assertProvider(provider); assert location.getIso3166Codes().size() == 0 || location.getParent().getIso3166Codes().containsAll(location.getIso3166Codes()) : location assertProvider(provider2); break;
void assertProvider(Location provider) { assertEquals(provider.getScope(), LocationScope.PROVIDER); assertEquals(provider.getParent(), null); assertEquals(provider.getIso3166Codes(), getIso3166Codes()); }
switch (location.getScope()) { case PROVIDER: assertProvider(location); break; case REGION: assertProvider(location.getParent()); assert location.getIso3166Codes().size() == 0 || location.getParent().getIso3166Codes().containsAll(location.getIso3166Codes()) : location assertProvider(provider); assert location.getIso3166Codes().size() == 0 || location.getParent().getIso3166Codes().containsAll(location.getIso3166Codes()) : location assertProvider(provider2); break;
@Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE); return props; }
@Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE); return props; } }