public void testCreateWithLocation() throws URISyntaxException {
Assert.assertFalse("Sanity check", provider.exists(NAMESPACE, NAME));
String auth = getDFS().getUri().getAuthority();
URI requestedLocation = new URI("hdfs://" + auth + "/tmp/data/my_data_set");
DatasetDescriptor requested = new DatasetDescriptor.Builder(testDescriptor)
.location(requestedLocation)
.build();
final DatasetDescriptor created;
try {
created = provider.create(NAMESPACE, NAME, requested);
} catch (UnsupportedOperationException ex) {
// this is expected if the provider doesn't support requested locations
return;
}
// if supported, the location should be unchanged.
Assert.assertNotNull("Descriptor should be returned", created);
Assert.assertTrue("Descriptor should exist", provider.exists(NAMESPACE, NAME));
Assert.assertEquals("Requested locations should match",
requestedLocation, created.getLocation());
}