Search in sources :

Example 56 with AlluxioURI

use of alluxio.AlluxioURI in project alluxio by Alluxio.

the class FileSystemClientRestApiTest method unmount.

@Test
public void unmount() throws Exception {
    AlluxioURI uri = new AlluxioURI("/mount");
    mFileSystemMaster.mount(uri, new AlluxioURI(mFolder.newFolder().getAbsolutePath()), alluxio.master.file.options.MountOptions.defaults());
    new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.UNMOUNT, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(UnmountOptions.defaults())).run();
}
Also used : TestCase(alluxio.rest.TestCase) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 57 with AlluxioURI

use of alluxio.AlluxioURI in project alluxio by Alluxio.

the class FileSystemClientRestApiTest method free.

@Test
public void free() throws Exception {
    AlluxioURI uri = new AlluxioURI("/file");
    writeFile(uri, null);
    new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.FREE, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(FreeOptions.defaults())).run();
}
Also used : TestCase(alluxio.rest.TestCase) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 58 with AlluxioURI

use of alluxio.AlluxioURI in project alluxio by Alluxio.

the class FileSystemClientRestApiTest method upload.

@Test
public void upload() throws Exception {
    AlluxioURI uri = new AlluxioURI("/file");
    String message = "Greetings traveller!";
    writeFile(uri, message.getBytes());
    String result = new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.GET_STATUS, NO_PARAMS, HttpMethod.POST, null).call();
    FileInfo fileInfo = new ObjectMapper().readValue(result, FileInfo.class);
    Assert.assertEquals(message.length(), fileInfo.getLength());
}
Also used : FileInfo(alluxio.wire.FileInfo) TestCase(alluxio.rest.TestCase) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 59 with AlluxioURI

use of alluxio.AlluxioURI in project alluxio by Alluxio.

the class FileSystemClientRestApiTest method rename.

@Test
public void rename() throws Exception {
    AlluxioURI uri1 = new AlluxioURI("/file1");
    AlluxioURI uri2 = new AlluxioURI("/file2");
    writeFile(uri1, null);
    Map<String, String> params = new HashMap<>();
    params.put("dst", uri2.toString());
    new TestCase(mHostname, mPort, PATHS_PREFIX + uri1.toString() + "/" + PathsRestServiceHandler.RENAME, params, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(RenameOptions.defaults())).run();
    try {
        mFileSystemMaster.getFileInfo(uri1);
        Assert.fail("file should have been removed");
    } catch (FileDoesNotExistException e) {
    // Expected
    }
    mFileSystemMaster.getFileInfo(uri2);
}
Also used : FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 60 with AlluxioURI

use of alluxio.AlluxioURI in project alluxio by Alluxio.

the class ClusterInitializationTest method startCluster.

/**
   * When a user starts a new cluster, an empty root dir is created and owned by the user.
   */
@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.SECURITY_LOGIN_USERNAME, SUPER_USER })
public void startCluster() throws Exception {
    FileSystem fs = mLocalAlluxioClusterResource.get().getClient();
    URIStatus status = fs.getStatus(ROOT);
    Assert.assertEquals(SUPER_USER, status.getOwner());
    Assert.assertEquals(0755, status.getMode());
    Assert.assertEquals(0, fs.listStatus(new AlluxioURI("/")).size());
}
Also used : FileSystem(alluxio.client.file.FileSystem) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Aggregations

AlluxioURI (alluxio.AlluxioURI)1552 Test (org.junit.Test)1094 URIStatus (alluxio.client.file.URIStatus)356 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)303 IOException (java.io.IOException)154 FileInStream (alluxio.client.file.FileInStream)152 FileInfo (alluxio.wire.FileInfo)130 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)124 ArrayList (java.util.ArrayList)120 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)119 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)114 File (java.io.File)107 FileSystem (alluxio.client.file.FileSystem)99 FileOutStream (alluxio.client.file.FileOutStream)97 AlluxioException (alluxio.exception.AlluxioException)92 CreateFilePOptions (alluxio.grpc.CreateFilePOptions)76 InvalidPathException (alluxio.exception.InvalidPathException)68 AbstractAlluxioShellTest (alluxio.shell.AbstractAlluxioShellTest)63 UnderFileSystem (alluxio.underfs.UnderFileSystem)63 FileAlreadyExistsException (alluxio.exception.FileAlreadyExistsException)62