Search in sources :

Example 1 with BlobOutputStream

use of com.microsoft.azure.storage.blob.BlobOutputStream in project hadoop by apache.

the class TestOutOfBandAzureBlobOperationsLive method outOfBandFolder_firstLevelFolderDelete.

@Test
public void outOfBandFolder_firstLevelFolderDelete() throws Exception {
    CloudBlockBlob blob = testAccount.getBlobReference("folderW/file");
    BlobOutputStream s = blob.openOutputStream();
    s.close();
    assertTrue(fs.exists(new Path("/folderW")));
    assertTrue(fs.exists(new Path("/folderW/file")));
    assertTrue(fs.delete(new Path("/folderW"), true));
}
Also used : Path(org.apache.hadoop.fs.Path) BlobOutputStream(com.microsoft.azure.storage.blob.BlobOutputStream) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) Test(org.junit.Test)

Example 2 with BlobOutputStream

use of com.microsoft.azure.storage.blob.BlobOutputStream in project hadoop by apache.

the class TestOutOfBandAzureBlobOperationsLive method outOfBandFolder_rename.

// scenario for this particular test described at MONARCH-HADOOP-764
@Test
public void outOfBandFolder_rename() throws Exception {
    // NOTE: manual use of CloubBlockBlob targets working directory explicitly.
    // WASB driver methods prepend working directory implicitly.
    String workingDir = "user/" + UserGroupInformation.getCurrentUser().getShortUserName() + "/";
    CloudBlockBlob blob = testAccount.getBlobReference(workingDir + "testFolder4/a/input/file");
    BlobOutputStream s = blob.openOutputStream();
    s.close();
    Path srcFilePath = new Path("testFolder4/a/input/file");
    assertTrue(fs.exists(srcFilePath));
    Path destFilePath = new Path("testFolder4/a/input/file2");
    fs.rename(srcFilePath, destFilePath);
}
Also used : Path(org.apache.hadoop.fs.Path) BlobOutputStream(com.microsoft.azure.storage.blob.BlobOutputStream) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) Test(org.junit.Test)

Example 3 with BlobOutputStream

use of com.microsoft.azure.storage.blob.BlobOutputStream in project hadoop by apache.

the class TestOutOfBandAzureBlobOperationsLive method outOfBandFolder_siblingCreate.

// scenario for this particular test described at MONARCH-HADOOP-764
@Test
public void outOfBandFolder_siblingCreate() throws Exception {
    // NOTE: manual use of CloubBlockBlob targets working directory explicitly.
    // WASB driver methods prepend working directory implicitly.
    String workingDir = "user/" + UserGroupInformation.getCurrentUser().getShortUserName() + "/";
    CloudBlockBlob blob = testAccount.getBlobReference(workingDir + "testFolder3/a/input/file");
    BlobOutputStream s = blob.openOutputStream();
    s.close();
    assertTrue(fs.exists(new Path("testFolder3/a/input/file")));
    Path targetFile = new Path("testFolder3/a/input/file2");
    FSDataOutputStream s2 = fs.create(targetFile);
    s2.close();
}
Also used : Path(org.apache.hadoop.fs.Path) BlobOutputStream(com.microsoft.azure.storage.blob.BlobOutputStream) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) Test(org.junit.Test)

Example 4 with BlobOutputStream

use of com.microsoft.azure.storage.blob.BlobOutputStream in project hadoop by apache.

the class TestOutOfBandAzureBlobOperationsLive method outOfBandFolder_rootFileDelete.

@Test
public void outOfBandFolder_rootFileDelete() throws Exception {
    CloudBlockBlob blob = testAccount.getBlobReference("fileY");
    BlobOutputStream s = blob.openOutputStream();
    s.close();
    assertTrue(fs.exists(new Path("/fileY")));
    assertTrue(fs.delete(new Path("/fileY"), true));
}
Also used : Path(org.apache.hadoop.fs.Path) BlobOutputStream(com.microsoft.azure.storage.blob.BlobOutputStream) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) Test(org.junit.Test)

Example 5 with BlobOutputStream

use of com.microsoft.azure.storage.blob.BlobOutputStream in project hadoop by apache.

the class TestOutOfBandAzureBlobOperationsLive method outOfBandFolder_parentDelete.

// scenario for this particular test described at MONARCH-HADOOP-764
@Test
public void outOfBandFolder_parentDelete() throws Exception {
    // NOTE: manual use of CloubBlockBlob targets working directory explicitly.
    // WASB driver methods prepend working directory implicitly.
    String workingDir = "user/" + UserGroupInformation.getCurrentUser().getShortUserName() + "/";
    CloudBlockBlob blob = testAccount.getBlobReference(workingDir + "testFolder2/a/input/file");
    BlobOutputStream s = blob.openOutputStream();
    s.close();
    assertTrue(fs.exists(new Path("testFolder2/a/input/file")));
    Path targetFolder = new Path("testFolder2/a/input");
    assertTrue(fs.delete(targetFolder, true));
}
Also used : Path(org.apache.hadoop.fs.Path) BlobOutputStream(com.microsoft.azure.storage.blob.BlobOutputStream) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) Test(org.junit.Test)

Aggregations

BlobOutputStream (com.microsoft.azure.storage.blob.BlobOutputStream)9 CloudBlockBlob (com.microsoft.azure.storage.blob.CloudBlockBlob)9 Path (org.apache.hadoop.fs.Path)9 Test (org.junit.Test)9 CloudBlobContainer (com.microsoft.azure.storage.blob.CloudBlobContainer)1 FileNotFoundException (java.io.FileNotFoundException)1 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)1 FileSystem (org.apache.hadoop.fs.FileSystem)1