Java 类org.apache.hadoop.fs.azure.AzureBlobStorageTestAccount.CreateOptions 实例源码

项目:hadoop    文件:TestContainerChecks.java   
@Test
public void testContainerChecksWithSas() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // The container shouldn't be there
  assertFalse(container.exists());

  // A write should just fail
  try {
    fs.createNewFile(new Path("/foo"));
    assertFalse("Should've thrown.", true);
  } catch (AzureException ex) {
  }
  assertFalse(container.exists());
}
项目:aliyun-oss-hadoop-fs    文件:TestContainerChecks.java   
@Test
public void testContainerChecksWithSas() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // The container shouldn't be there
  assertFalse(container.exists());

  // A write should just fail
  try {
    fs.createNewFile(new Path("/foo"));
    assertFalse("Should've thrown.", true);
  } catch (AzureException ex) {
  }
  assertFalse(container.exists());
}
项目:big-c    文件:TestContainerChecks.java   
@Test
public void testContainerChecksWithSas() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // The container shouldn't be there
  assertFalse(container.exists());

  // A write should just fail
  try {
    fs.createNewFile(new Path("/foo"));
    assertFalse("Should've thrown.", true);
  } catch (AzureException ex) {
  }
  assertFalse(container.exists());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestContainerChecks.java   
@Test
public void testContainerChecksWithSas() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // The container shouldn't be there
  assertFalse(container.exists());

  // A write should just fail
  try {
    fs.createNewFile(new Path("/foo"));
    assertFalse("Should've thrown.", true);
  } catch (AzureException ex) {
  }
  assertFalse(container.exists());
}
项目:hadoop    文件:TestContainerChecks.java   
@Test
public void testContainerExistAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    fs.listStatus(new Path("/"));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();
  // Add a file to the container outside of the WASB FileSystem
  CloudBlockBlob blob = testAccount.getBlobReference("foo");
  BlobOutputStream outputStream = blob.openOutputStream();
  outputStream.write(new byte[10]);
  outputStream.close();

  // Make sure the file is visible
  assertTrue(fs.exists(new Path("/foo")));
  assertTrue(container.exists());
}
项目:hadoop    文件:TestContainerChecks.java   
@Test
public void testContainerCreateAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    assertNull(fs.listStatus(new Path("/")));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();

  // Write should succeed
  assertTrue(fs.createNewFile(new Path("/foo")));
  assertTrue(container.exists());
}
项目:hadoop    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSAS() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas, CreateOptions.CreateContainer));
  assumeNotNull(testAccount);
  // Validate input and output on the connection.
  // NOTE: As of 4/15/2013, Azure Storage has a deficiency that prevents the
  // full scenario from working (CopyFromBlob doesn't work with SAS), so
  // just do a minor check until that is corrected.
  assertFalse(testAccount.getFileSystem().exists(new Path("/IDontExist")));
  //assertTrue(validateIOStreams(new Path("/sastest.txt")));
}
项目:hadoop    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSASReadonly() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("", EnumSet.of(
      CreateOptions.UseSas, CreateOptions.CreateContainer,
      CreateOptions.Readonly));
  assumeNotNull(testAccount);

  // Create a blob in there
  final String blobKey = "blobForReadonly";
  CloudBlobContainer container = testAccount.getRealContainer();
  CloudBlockBlob blob = container.getBlockBlobReference(blobKey);
  ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { 1,
      2, 3 });
  blob.upload(inputStream, 3);
  inputStream.close();

  // Make sure we can read it from the file system
  Path filePath = new Path("/" + blobKey);
  FileSystem fs = testAccount.getFileSystem();
  assertTrue(fs.exists(filePath));
  byte[] obtained = new byte[3];
  DataInputStream obtainedInputStream = fs.open(filePath);
  obtainedInputStream.readFully(obtained);
  obtainedInputStream.close();
  assertEquals(3, obtained[2]);
}
项目:aliyun-oss-hadoop-fs    文件:TestContainerChecks.java   
@Test
public void testContainerExistAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    fs.listStatus(new Path("/"));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();
  // Add a file to the container outside of the WASB FileSystem
  CloudBlockBlob blob = testAccount.getBlobReference("foo");
  BlobOutputStream outputStream = blob.openOutputStream();
  outputStream.write(new byte[10]);
  outputStream.close();

  // Make sure the file is visible
  assertTrue(fs.exists(new Path("/foo")));
  assertTrue(container.exists());
}
项目:aliyun-oss-hadoop-fs    文件:TestContainerChecks.java   
@Test
public void testContainerCreateAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    assertNull(fs.listStatus(new Path("/")));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();

  // Write should succeed
  assertTrue(fs.createNewFile(new Path("/foo")));
  assertTrue(container.exists());
}
项目:aliyun-oss-hadoop-fs    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSAS() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas, CreateOptions.CreateContainer));
  assumeNotNull(testAccount);
  // Validate input and output on the connection.
  // NOTE: As of 4/15/2013, Azure Storage has a deficiency that prevents the
  // full scenario from working (CopyFromBlob doesn't work with SAS), so
  // just do a minor check until that is corrected.
  assertFalse(testAccount.getFileSystem().exists(new Path("/IDontExist")));
  //assertTrue(validateIOStreams(new Path("/sastest.txt")));
}
项目:aliyun-oss-hadoop-fs    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSASReadonly() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("", EnumSet.of(
      CreateOptions.UseSas, CreateOptions.CreateContainer,
      CreateOptions.Readonly));
  assumeNotNull(testAccount);

  // Create a blob in there
  final String blobKey = "blobForReadonly";
  CloudBlobContainer container = testAccount.getRealContainer();
  CloudBlockBlob blob = container.getBlockBlobReference(blobKey);
  ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { 1,
      2, 3 });
  blob.upload(inputStream, 3);
  inputStream.close();

  // Make sure we can read it from the file system
  Path filePath = new Path("/" + blobKey);
  FileSystem fs = testAccount.getFileSystem();
  assertTrue(fs.exists(filePath));
  byte[] obtained = new byte[3];
  DataInputStream obtainedInputStream = fs.open(filePath);
  obtainedInputStream.readFully(obtained);
  obtainedInputStream.close();
  assertEquals(3, obtained[2]);
}
项目:big-c    文件:TestContainerChecks.java   
@Test
public void testContainerExistAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    fs.listStatus(new Path("/"));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();
  // Add a file to the container outside of the WASB FileSystem
  CloudBlockBlob blob = testAccount.getBlobReference("foo");
  BlobOutputStream outputStream = blob.openOutputStream();
  outputStream.write(new byte[10]);
  outputStream.close();

  // Make sure the file is visible
  assertTrue(fs.exists(new Path("/foo")));
  assertTrue(container.exists());
}
项目:big-c    文件:TestContainerChecks.java   
@Test
public void testContainerCreateAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    assertNull(fs.listStatus(new Path("/")));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();

  // Write should succeed
  assertTrue(fs.createNewFile(new Path("/foo")));
  assertTrue(container.exists());
}
项目:big-c    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSAS() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas, CreateOptions.CreateContainer));
  assumeNotNull(testAccount);
  // Validate input and output on the connection.
  // NOTE: As of 4/15/2013, Azure Storage has a deficiency that prevents the
  // full scenario from working (CopyFromBlob doesn't work with SAS), so
  // just do a minor check until that is corrected.
  assertFalse(testAccount.getFileSystem().exists(new Path("/IDontExist")));
  //assertTrue(validateIOStreams(new Path("/sastest.txt")));
}
项目:big-c    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSASReadonly() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("", EnumSet.of(
      CreateOptions.UseSas, CreateOptions.CreateContainer,
      CreateOptions.Readonly));
  assumeNotNull(testAccount);

  // Create a blob in there
  final String blobKey = "blobForReadonly";
  CloudBlobContainer container = testAccount.getRealContainer();
  CloudBlockBlob blob = container.getBlockBlobReference(blobKey);
  ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { 1,
      2, 3 });
  blob.upload(inputStream, 3);
  inputStream.close();

  // Make sure we can read it from the file system
  Path filePath = new Path("/" + blobKey);
  FileSystem fs = testAccount.getFileSystem();
  assertTrue(fs.exists(filePath));
  byte[] obtained = new byte[3];
  DataInputStream obtainedInputStream = fs.open(filePath);
  obtainedInputStream.readFully(obtained);
  obtainedInputStream.close();
  assertEquals(3, obtained[2]);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestContainerChecks.java   
@Test
public void testContainerExistAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    fs.listStatus(new Path("/"));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();
  // Add a file to the container outside of the WASB FileSystem
  CloudBlockBlob blob = testAccount.getBlobReference("foo");
  BlobOutputStream outputStream = blob.openOutputStream();
  outputStream.write(new byte[10]);
  outputStream.close();

  // Make sure the file is visible
  assertTrue(fs.exists(new Path("/foo")));
  assertTrue(container.exists());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestContainerChecks.java   
@Test
public void testContainerCreateAfterDoesNotExist() throws Exception {
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.noneOf(CreateOptions.class));
  assumeNotNull(testAccount);
  CloudBlobContainer container = testAccount.getRealContainer();
  FileSystem fs = testAccount.getFileSystem();

  // Starting off with the container not there
  assertFalse(container.exists());

  // A list shouldn't create the container and will set file system store
  // state to DoesNotExist
  try {
    assertNull(fs.listStatus(new Path("/")));
    assertTrue("Should've thrown.", false);
  } catch (FileNotFoundException ex) {
    assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("does not exist."));
  }
  assertFalse(container.exists());

  // Create a container outside of the WASB FileSystem
  container.create();

  // Write should succeed
  assertTrue(fs.createNewFile(new Path("/foo")));
  assertTrue(container.exists());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSAS() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("",
      EnumSet.of(CreateOptions.UseSas, CreateOptions.CreateContainer));
  assumeNotNull(testAccount);
  // Validate input and output on the connection.
  // NOTE: As of 4/15/2013, Azure Storage has a deficiency that prevents the
  // full scenario from working (CopyFromBlob doesn't work with SAS), so
  // just do a minor check until that is corrected.
  assertFalse(testAccount.getFileSystem().exists(new Path("/IDontExist")));
  //assertTrue(validateIOStreams(new Path("/sastest.txt")));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestWasbUriAndConfiguration.java   
@Test
public void testConnectUsingSASReadonly() throws Exception {
  // Create the test account with SAS credentials.
  testAccount = AzureBlobStorageTestAccount.create("", EnumSet.of(
      CreateOptions.UseSas, CreateOptions.CreateContainer,
      CreateOptions.Readonly));
  assumeNotNull(testAccount);

  // Create a blob in there
  final String blobKey = "blobForReadonly";
  CloudBlobContainer container = testAccount.getRealContainer();
  CloudBlockBlob blob = container.getBlockBlobReference(blobKey);
  ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] { 1,
      2, 3 });
  blob.upload(inputStream, 3);
  inputStream.close();

  // Make sure we can read it from the file system
  Path filePath = new Path("/" + blobKey);
  FileSystem fs = testAccount.getFileSystem();
  assertTrue(fs.exists(filePath));
  byte[] obtained = new byte[3];
  DataInputStream obtainedInputStream = fs.open(filePath);
  obtainedInputStream.readFully(obtained);
  obtainedInputStream.close();
  assertEquals(3, obtained[2]);
}