org.apache.hadoop.fs.swift.util.DurationStats Java Examples

The following examples show how to use org.apache.hadoop.fs.swift.util.DurationStats. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSwiftRestClient.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testPutAndDelete() throws Throwable {
  assumeEnabled();
  SwiftRestClient client = createClient();
  client.authenticate();
  Path path = new Path("restTestPutAndDelete");
  SwiftObjectPath sobject = SwiftObjectPath.fromPath(serviceURI, path);
  byte[] stuff = new byte[1];
  stuff[0] = 'a';
  client.upload(sobject, new ByteArrayInputStream(stuff), stuff.length);
  //check file exists
  Duration head = new Duration();
  Header[] responseHeaders = client.headRequest("expect success",
                                                sobject,
                                                SwiftRestClient.NEWEST);
  head.finished();
  LOG.info("head request duration " + head);
  for (Header header: responseHeaders) {
    LOG.info(header.toString());
  }
  //delete the file
  client.delete(sobject);
  //check file is gone
  try {
    Header[] headers = client.headRequest("expect fail",
                                          sobject,
                                          SwiftRestClient.NEWEST);
    Assert.fail("Expected deleted file, but object is still present: "
                + sobject);
  } catch (FileNotFoundException e) {
    //expected
  }
  for (DurationStats stats: client.getOperationStatistics()) {
    LOG.info(stats);
  }
}
 
Example #2
Source File: SwiftFileSystemBaseTest.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void classTearDown() throws Exception {
  if (lastFs  != null) {
    List<DurationStats> statistics = lastFs.getOperationStatistics();
    for (DurationStats stat : statistics) {
      LOG.info(stat.toString());
    }
  }
}
 
Example #3
Source File: TestSwiftRestClient.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testPutAndDelete() throws Throwable {
  assumeEnabled();
  SwiftRestClient client = createClient();
  client.authenticate();
  Path path = new Path("restTestPutAndDelete");
  SwiftObjectPath sobject = SwiftObjectPath.fromPath(serviceURI, path);
  byte[] stuff = new byte[1];
  stuff[0] = 'a';
  client.upload(sobject, new ByteArrayInputStream(stuff), stuff.length);
  //check file exists
  Duration head = new Duration();
  Header[] responseHeaders = client.headRequest("expect success",
                                                sobject,
                                                SwiftRestClient.NEWEST);
  head.finished();
  LOG.info("head request duration " + head);
  for (Header header: responseHeaders) {
    LOG.info(header.toString());
  }
  //delete the file
  client.delete(sobject);
  //check file is gone
  try {
    Header[] headers = client.headRequest("expect fail",
                                          sobject,
                                          SwiftRestClient.NEWEST);
    Assert.fail("Expected deleted file, but object is still present: "
                + sobject);
  } catch (FileNotFoundException e) {
    //expected
  }
  for (DurationStats stats: client.getOperationStatistics()) {
    LOG.info(stats);
  }
}
 
Example #4
Source File: SwiftFileSystemBaseTest.java    From big-c with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void classTearDown() throws Exception {
  if (lastFs  != null) {
    List<DurationStats> statistics = lastFs.getOperationStatistics();
    for (DurationStats stat : statistics) {
      LOG.info(stat.toString());
    }
  }
}
 
Example #5
Source File: TestSwiftRestClient.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testPutAndDelete() throws Throwable {
  assumeEnabled();
  SwiftRestClient client = createClient();
  client.authenticate();
  Path path = new Path("restTestPutAndDelete");
  SwiftObjectPath sobject = SwiftObjectPath.fromPath(serviceURI, path);
  byte[] stuff = new byte[1];
  stuff[0] = 'a';
  client.upload(sobject, new ByteArrayInputStream(stuff), stuff.length);
  //check file exists
  Duration head = new Duration();
  Header[] responseHeaders = client.headRequest("expect success",
                                                sobject,
                                                SwiftRestClient.NEWEST);
  head.finished();
  LOG.info("head request duration " + head);
  for (Header header: responseHeaders) {
    LOG.info(header.toString());
  }
  //delete the file
  client.delete(sobject);
  //check file is gone
  try {
    Header[] headers = client.headRequest("expect fail",
                                          sobject,
                                          SwiftRestClient.NEWEST);
    Assert.fail("Expected deleted file, but object is still present: "
                + sobject);
  } catch (FileNotFoundException e) {
    //expected
  }
  for (DurationStats stats: client.getOperationStatistics()) {
    LOG.info(stats);
  }
}
 
Example #6
Source File: SwiftFileSystemBaseTest.java    From sahara-extra with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void classTearDown() throws Exception {
  if (lastFs  != null) {
    List<DurationStats> statistics = lastFs.getOperationStatistics();
    for (DurationStats stat : statistics) {
      LOG.info(stat.toString());
    }
  }
}
 
Example #7
Source File: SwiftRestClient.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */

public List<DurationStats> getOperationStatistics() {
  return durationStats.getDurationStatistics();
}
 
Example #8
Source File: SwiftRestClient.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */

public List<DurationStats> getOperationStatistics() {
  return durationStats.getDurationStatistics();
}
 
Example #9
Source File: SwiftRestClient.java    From sahara-extra with Apache License 2.0 4 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */

public List<DurationStats> getOperationStatistics() {
  return durationStats.getDurationStatistics();
}
 
Example #10
Source File: SwiftNativeFileSystem.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return store.getOperationStatistics();
}
 
Example #11
Source File: SwiftNativeFileSystemStore.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return swiftRestClient.getOperationStatistics();
}
 
Example #12
Source File: SwiftNativeFileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return store.getOperationStatistics();
}
 
Example #13
Source File: SwiftNativeFileSystemStore.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return swiftRestClient.getOperationStatistics();
}
 
Example #14
Source File: SwiftNativeFileSystem.java    From sahara-extra with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return store.getOperationStatistics();
}
 
Example #15
Source File: SwiftNativeFileSystemStore.java    From sahara-extra with Apache License 2.0 2 votes vote down vote up
/**
 * Get the current operation statistics
 * @return a snapshot of the statistics
 */
public List<DurationStats> getOperationStatistics() {
  return swiftRestClient.getOperationStatistics();
}