Search in sources :

Example 26 with TestCase

use of alluxio.rest.TestCase in project alluxio by Alluxio.

the class BlockWorkerClientRestApiTest method cancelBlock.

@Test
public void cancelBlock() throws Exception {
    mBlockWorker.createBlock(SESSION_ID, BLOCK_ID, TIER_ALIAS, INITIAL_BYTES);
    Map<String, String> params = new HashMap<>();
    params.put("blockId", Long.toString(BLOCK_ID));
    params.put("sessionId", Long.toString(SESSION_ID));
    new TestCase(mHostname, mPort, getEndpoint(BlockWorkerClientRestServiceHandler.CANCEL_BLOCK), params, HttpMethod.POST, null).run();
}
Also used : HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 27 with TestCase

use of alluxio.rest.TestCase in project alluxio by Alluxio.

the class BlockWorkerClientRestApiTest method promoteBlock.

@Test
public void promoteBlock() throws Exception {
    mBlockWorker.createBlock(SESSION_ID, BLOCK_ID, TIER_ALIAS, INITIAL_BYTES);
    mBlockWorker.commitBlock(SESSION_ID, BLOCK_ID);
    Map<String, String> params = new HashMap<>();
    params.put("blockId", Long.toString(BLOCK_ID));
    new TestCase(mHostname, mPort, getEndpoint(BlockWorkerClientRestServiceHandler.PROMOTE_BLOCK), params, HttpMethod.POST, null).run();
}
Also used : HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 28 with TestCase

use of alluxio.rest.TestCase in project alluxio by Alluxio.

the class FileSystemMasterClientRestApiTest method remove.

@Test
public void remove() throws Exception {
    AlluxioURI uri = new AlluxioURI("/file");
    mFileSystemMaster.createFile(uri, CreateFileOptions.defaults());
    mFileSystemMaster.completeFile(uri, CompleteFileOptions.defaults());
    Map<String, String> params = new HashMap<>();
    params.put("path", uri.toString());
    params.put("recursive", "false");
    new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.REMOVE), params, "POST", null).run();
    try {
        mFileSystemMaster.getFileInfo(uri);
        Assert.fail("file should have been removed");
    } catch (FileDoesNotExistException e) {
    // Expected
    }
}
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 29 with TestCase

use of alluxio.rest.TestCase in project alluxio by Alluxio.

the class FileSystemMasterClientRestApiTest method mount.

@Test
public void mount() throws Exception {
    AlluxioURI uri = new AlluxioURI("/file");
    Map<String, String> params = new HashMap<>();
    params.put("path", uri.toString());
    params.put("ufsPath", mFolder.newFolder().getAbsolutePath());
    new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.MOUNT), params, HttpMethod.POST, null).run();
}
Also used : HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Example 30 with TestCase

use of alluxio.rest.TestCase in project alluxio by Alluxio.

the class FileSystemMasterClientRestApiTest method createFile.

@Test
public void createFile() throws Exception {
    AlluxioURI uri = new AlluxioURI("/file");
    Map<String, String> params = new HashMap<>();
    params.put("path", uri.toString());
    params.put("persisted", "false");
    params.put("recursive", "false");
    params.put("blockSizeBytes", "1");
    params.put("blockSizeBytes", "1");
    new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.CREATE_FILE), params, HttpMethod.POST, null).run();
    Assert.assertFalse(mFileSystemMaster.getFileInfo(uri).isCompleted());
}
Also used : HashMap(java.util.HashMap) TestCase(alluxio.rest.TestCase) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) RestApiTest(alluxio.rest.RestApiTest)

Aggregations

TestCase (alluxio.rest.TestCase)44 RestApiTest (alluxio.rest.RestApiTest)40 Test (org.junit.Test)40 HashMap (java.util.HashMap)30 AlluxioURI (alluxio.AlluxioURI)29 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)12 FileInfo (alluxio.wire.FileInfo)7 Config (alluxio.LocalAlluxioClusterResource.Config)5 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)4 List (java.util.List)3 CommandLineJob (alluxio.job.CommandLineJob)2 JobConf (alluxio.job.JobConf)2 BlockWriter (alluxio.worker.block.io.BlockWriter)2 HttpURLConnection (java.net.HttpURLConnection)2 TestCaseOptions (alluxio.rest.TestCaseOptions)1 AlluxioMasterInfo (alluxio.wire.AlluxioMasterInfo)1 AlluxioWorkerInfo (alluxio.wire.AlluxioWorkerInfo)1 BlockInfo (alluxio.wire.BlockInfo)1 LineageInfo (alluxio.wire.LineageInfo)1 LockBlockResult (alluxio.wire.LockBlockResult)1