Examples of SwiftObjectPath


Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testParseAuthenticatedUrl() throws Exception {
    final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
    final URI uri = new URI(pathString);
    final Path path = new Path(pathString);
    final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
    final SwiftObjectPath actual = new SwiftObjectPath(
            RestClientBindings.extractContainerName(uri),
            "/home/tom/documents/finance.docx");

    assertEquals(expected, actual);
  }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testConvertToPath() throws Throwable {
    String initialpath = "/dir/file1";
    Path ipath = new Path(initialpath);
    SwiftObjectPath objectPath = SwiftObjectPath.fromPath(new URI(initialpath),
            ipath);
    URI endpoint = new URI(ENDPOINT);
    URI uri = SwiftRestClient.pathToURI(objectPath, endpoint);
    LOG.info("Inital Hadoop Path =" + initialpath);
    LOG.info("Merged URI=" + uri);
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

    LOG.info("Merged URI=" + uri);
  }

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testRootDirProbeEmptyPath() throws Throwable {
    SwiftObjectPath object=new SwiftObjectPath("container","");
    assertTrue(SwiftUtils.isRootDir(object));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

    assertTrue(SwiftUtils.isRootDir(object));
  }

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testRootDirProbeRootPath() throws Throwable {
    SwiftObjectPath object=new SwiftObjectPath("container","/");
    assertTrue(SwiftUtils.isRootDir(object));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

      p2));
  }

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testChildOfProbe() throws Throwable {
    SwiftObjectPath parent = new SwiftObjectPath("container",
                                                 "/parent");
    SwiftObjectPath parent2 = new SwiftObjectPath("container",
                                                 "/parent2");
    SwiftObjectPath child = new SwiftObjectPath("container",
                                                 "/parent/child");
    SwiftObjectPath sibling = new SwiftObjectPath("container",
                                                 "/parent/sibling");
    SwiftObjectPath grandchild = new SwiftObjectPath("container",
                                                     "/parent/child/grandchild");
    assertParentOf(parent, child);
    assertParentOf(parent, grandchild);
    assertParentOf(child, grandchild);
    assertParentOf(parent, parent);
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

    assertNotParentOf(grandchild, parent);
  }

  @Test(timeout = SWIFT_TEST_TIMEOUT)
  public void testChildOfRoot() throws Throwable {
    SwiftObjectPath root = new SwiftObjectPath("container", "/");
    SwiftObjectPath child = new SwiftObjectPath("container", "child");
    SwiftObjectPath grandchild = new SwiftObjectPath("container",
                                                     "/child/grandchild");
    assertParentOf(root, child);
    assertParentOf(root, grandchild);
    assertParentOf(child, grandchild);
    assertParentOf(root, root);
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

    } else {
      stringPath = stringPath.concat("/").concat(partitionFilename);
    }

    swiftRestClient.upload(
      new SwiftObjectPath(toDirPath(path).getContainer(), stringPath),
            inputStream,
            length);
  }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

   * @throws IOException IO problem
   * @throws FileNotFoundException if there is nothing at the end
   */
  public Header[] getObjectHeaders(Path path, boolean newest)
    throws IOException, FileNotFoundException {
    SwiftObjectPath objectPath = toObjectPath(path);
    return stat(objectPath, newest);
  }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

   * @throws FileNotFoundException if there is nothing at the end
   */
  public SwiftFileStatus getObjectMetadata(Path path, boolean newest)
    throws IOException, FileNotFoundException {

    SwiftObjectPath objectPath = toObjectPath(path);
    final Header[] headers = stat(objectPath, newest);
    //no headers is treated as a missing file
    if (headers.length == 0) {
      throw new FileNotFoundException("Not Found " + path.toUri());
    }
View Full Code Here

Examples of org.apache.hadoop.fs.swift.util.SwiftObjectPath

   * @param path path to delete
   * @return true if the path was deleted by this specific operation.
   * @throws IOException on a failure
   */
  public boolean deleteObject(Path path) throws IOException {
    SwiftObjectPath swiftObjectPath = toObjectPath(path);
    if (!SwiftUtils.isRootDir(swiftObjectPath)) {
      return swiftRestClient.delete(swiftObjectPath);
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Not deleting root directory entry");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.