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

项目:hadoop    文件:TestAzureFileSystemInstrumentation.java   
@Test
public void testClientErrorMetrics() throws Exception {
  String directoryName = "metricsTestDirectory_ClientError";
  Path directoryPath = new Path("/" + directoryName);
  assertTrue(fs.mkdirs(directoryPath));
  String leaseID = testAccount.acquireShortLease(directoryName);
  try {
    try {
      fs.delete(directoryPath, true);
      assertTrue("Should've thrown.", false);
    } catch (AzureException ex) {
      assertTrue("Unexpected exception: " + ex,
          ex.getMessage().contains("lease"));
    }
    assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_CLIENT_ERRORS));
    assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_SERVER_ERRORS));
  } finally {
    testAccount.releaseLease(leaseID, directoryName);
  }
}
项目:big-c    文件:TestAzureFileSystemInstrumentation.java   
@Test
public void testClientErrorMetrics() throws Exception {
  String directoryName = "metricsTestDirectory_ClientError";
  Path directoryPath = new Path("/" + directoryName);
  assertTrue(fs.mkdirs(directoryPath));
  String leaseID = testAccount.acquireShortLease(directoryName);
  try {
    try {
      fs.delete(directoryPath, true);
      assertTrue("Should've thrown.", false);
    } catch (AzureException ex) {
      assertTrue("Unexpected exception: " + ex,
          ex.getMessage().contains("lease"));
    }
    assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_CLIENT_ERRORS));
    assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_SERVER_ERRORS));
  } finally {
    testAccount.releaseLease(leaseID, directoryName);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAzureFileSystemInstrumentation.java   
@Test
public void testClientErrorMetrics() throws Exception {
  String directoryName = "metricsTestDirectory_ClientError";
  Path directoryPath = new Path("/" + directoryName);
  assertTrue(fs.mkdirs(directoryPath));
  String leaseID = testAccount.acquireShortLease(directoryName);
  try {
    try {
      fs.delete(directoryPath, true);
      assertTrue("Should've thrown.", false);
    } catch (AzureException ex) {
      assertTrue("Unexpected exception: " + ex,
          ex.getMessage().contains("lease"));
    }
    assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_CLIENT_ERRORS));
    assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_SERVER_ERRORS));
  } finally {
    testAccount.releaseLease(leaseID, directoryName);
  }
}
项目:hadoop    文件:TestReadAndSeekPageBlobAfterWrite.java   
/**
 * Read "size" bytes of data and verify that what was read and what was written
 * are the same.
 */
private void readRandomDataAndVerify(int size) throws AzureException, IOException {
  byte[] b = new byte[size];
  FSDataInputStream stream = fs.open(PATH);
  int bytesRead = stream.read(b);
  stream.close();
  assertEquals(bytesRead, size);

  // compare the data read to the data written
  assertTrue(comparePrefix(randomData, b, size));
}
项目:aliyun-oss-hadoop-fs    文件:TestAzureFileSystemInstrumentation.java   
@Test
public void testClientErrorMetrics() throws Exception {
  String fileName = "metricsTestFile_ClientError";
  Path filePath = new Path("/"+fileName);
  final int FILE_SIZE = 100;
  OutputStream outputStream = null;
  String leaseID = null;
  try {
    // Create a file
    outputStream = fs.create(filePath);
    leaseID = testAccount.acquireShortLease(fileName);
    try {
      outputStream.write(new byte[FILE_SIZE]);
      outputStream.close();
      assertTrue("Should've thrown", false);
    } catch (AzureException ex) {
      assertTrue("Unexpected exception: " + ex,
        ex.getMessage().contains("lease"));
    }
    assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_CLIENT_ERRORS));
    assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_SERVER_ERRORS));
  } finally {
    if(leaseID != null){
      testAccount.releaseLease(leaseID, fileName);
    }
    IOUtils.closeStream(outputStream);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReadAndSeekPageBlobAfterWrite.java   
/**
 * Read "size" bytes of data and verify that what was read and what was written
 * are the same.
 */
private void readRandomDataAndVerify(int size) throws AzureException, IOException {
  byte[] b = new byte[size];
  FSDataInputStream stream = fs.open(PATH);
  int bytesRead = stream.read(b);
  stream.close();
  assertEquals(bytesRead, size);

  // compare the data read to the data written
  assertTrue(comparePrefix(randomData, b, size));
}
项目:big-c    文件:TestReadAndSeekPageBlobAfterWrite.java   
/**
 * Read "size" bytes of data and verify that what was read and what was written
 * are the same.
 */
private void readRandomDataAndVerify(int size) throws AzureException, IOException {
  byte[] b = new byte[size];
  FSDataInputStream stream = fs.open(PATH);
  int bytesRead = stream.read(b);
  stream.close();
  assertEquals(bytesRead, size);

  // compare the data read to the data written
  assertTrue(comparePrefix(randomData, b, size));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReadAndSeekPageBlobAfterWrite.java   
/**
 * Read "size" bytes of data and verify that what was read and what was written
 * are the same.
 */
private void readRandomDataAndVerify(int size) throws AzureException, IOException {
  byte[] b = new byte[size];
  FSDataInputStream stream = fs.open(PATH);
  int bytesRead = stream.read(b);
  stream.close();
  assertEquals(bytesRead, size);

  // compare the data read to the data written
  assertTrue(comparePrefix(randomData, b, size));
}
项目:hadoop    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing lease on the specified file.
 */
public SelfRenewingLease acquireLease(Path path) throws AzureException {
  String fullKey = pathToKey(makeAbsolute(path));
  return getStore().acquireLease(fullKey);
}
项目:hadoop    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing Azure blob lease on the source folder zero-byte file.
 */
private SelfRenewingLease leaseSourceFolder(String srcKey)
    throws AzureException {
  return store.acquireLease(srcKey);
}
项目:aliyun-oss-hadoop-fs    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing lease on the specified file.
 */
public SelfRenewingLease acquireLease(Path path) throws AzureException {
  String fullKey = pathToKey(makeAbsolute(path));
  return getStore().acquireLease(fullKey);
}
项目:aliyun-oss-hadoop-fs    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing Azure blob lease on the source folder zero-byte file.
 */
private SelfRenewingLease leaseSourceFolder(String srcKey)
    throws AzureException {
  return store.acquireLease(srcKey);
}
项目:big-c    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing lease on the specified file.
 */
public SelfRenewingLease acquireLease(Path path) throws AzureException {
  String fullKey = pathToKey(makeAbsolute(path));
  return getStore().acquireLease(fullKey);
}
项目:big-c    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing Azure blob lease on the source folder zero-byte file.
 */
private SelfRenewingLease leaseSourceFolder(String srcKey)
    throws AzureException {
  return store.acquireLease(srcKey);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing lease on the specified file.
 */
public SelfRenewingLease acquireLease(Path path) throws AzureException {
  String fullKey = pathToKey(makeAbsolute(path));
  return getStore().acquireLease(fullKey);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NativeAzureFileSystem.java   
/**
 * Get a self-renewing Azure blob lease on the source folder zero-byte file.
 */
private SelfRenewingLease leaseSourceFolder(String srcKey)
    throws AzureException {
  return store.acquireLease(srcKey);
}