Search in sources :

Example 61 with CreateFilePOptions

use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.

the class CheckConsistencyIntegrationTest method before.

@Before
public final void before() throws Exception {
    mFileSystemMaster = mLocalAlluxioClusterResource.get().getLocalAlluxioMaster().getMasterProcess().getMaster(FileSystemMaster.class);
    mFileSystem = FileSystem.Factory.create(ServerConfiguration.global());
    CreateDirectoryPOptions dirOptions = CreateDirectoryPOptions.newBuilder().setWriteType(WritePType.CACHE_THROUGH).build();
    CreateFilePOptions fileOptions = CreateFilePOptions.newBuilder().setWriteType(WritePType.CACHE_THROUGH).build();
    mFileSystem.createDirectory(DIRECTORY, dirOptions);
    mFileSystem.createFile(FILE, fileOptions).close();
}
Also used : CreateDirectoryPOptions(alluxio.grpc.CreateDirectoryPOptions) FileSystemMaster(alluxio.master.file.FileSystemMaster) CreateFilePOptions(alluxio.grpc.CreateFilePOptions) Before(org.junit.Before)

Example 62 with CreateFilePOptions

use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method setAcl.

@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.SECURITY_AUTHENTICATION_TYPE, "SIMPLE", PropertyKey.Name.SECURITY_AUTHORIZATION_PERMISSION_ENABLED, "true", PropertyKey.Name.SECURITY_GROUP_MAPPING_CLASS, FakeUserGroupsMapping.FULL_CLASS_NAME })
public void setAcl() throws Exception {
    AlluxioURI filePath = new AlluxioURI("/file");
    String user = "alluxio";
    ServerConfiguration.set(PropertyKey.SECURITY_LOGIN_USERNAME, user);
    CreateFilePOptions op = CreateFilePOptions.newBuilder().setBlockSizeBytes(64).build();
    mFileSystem.createFile(filePath, op).close();
    // TODO(chaomin): also setOwner and setGroup once there's a way to fake the owner/group in UFS.
    mFileSystem.setAttribute(filePath, SetAttributePOptions.newBuilder().setMode(new Mode((short) 0400).toProto()).setRecursive(false).build());
    URIStatus status = mFileSystem.getStatus(filePath);
    mLocalAlluxioCluster.stopFS();
    aclTestUtil(status, user);
    deleteFsMasterJournalLogs();
    aclTestUtil(status, user);
}
Also used : Mode(alluxio.security.authorization.Mode) CreateFilePOptions(alluxio.grpc.CreateFilePOptions) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 63 with CreateFilePOptions

use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method file.

/**
 * Tests file creation.
 */
@Test
public void file() throws Exception {
    CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes(64).build();
    AlluxioURI filePath = new AlluxioURI("/xyz");
    mFileSystem.createFile(filePath, option).close();
    URIStatus status = mFileSystem.getStatus(filePath);
    mLocalAlluxioCluster.stopFS();
    fileTestUtil(status);
    deleteFsMasterJournalLogs();
    fileTestUtil(status);
}
Also used : CreateFilePOptions(alluxio.grpc.CreateFilePOptions) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 64 with CreateFilePOptions

use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method rename.

/**
 * Tests file and directory creation, and rename.
 */
@Test
public void rename() throws Exception {
    for (int i = 0; i < 10; i++) {
        mFileSystem.createDirectory(new AlluxioURI("/i" + i));
        for (int j = 0; j < 10; j++) {
            CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes((i + j + 1) * 64).build();
            AlluxioURI path = new AlluxioURI("/i" + i + "/j" + j);
            mFileSystem.createFile(path, option).close();
            mFileSystem.rename(path, new AlluxioURI("/i" + i + "/jj" + j));
        }
        mFileSystem.rename(new AlluxioURI("/i" + i), new AlluxioURI("/ii" + i));
    }
    mLocalAlluxioCluster.stopFS();
    renameTestUtil();
    deleteFsMasterJournalLogs();
    renameTestUtil();
}
Also used : CreateFilePOptions(alluxio.grpc.CreateFilePOptions) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 65 with CreateFilePOptions

use of alluxio.grpc.CreateFilePOptions in project alluxio by Alluxio.

the class UfsJournalIntegrationTest method fileDirectory.

/**
 * Tests file and directory creation.
 */
@Test
public void fileDirectory() throws Exception {
    for (int i = 0; i < 10; i++) {
        mFileSystem.createDirectory(new AlluxioURI("/i" + i));
        for (int j = 0; j < 10; j++) {
            CreateFilePOptions option = CreateFilePOptions.newBuilder().setBlockSizeBytes((i + j + 1) * 64).build();
            mFileSystem.createFile(new AlluxioURI("/i" + i + "/j" + j), option).close();
        }
    }
    mLocalAlluxioCluster.stopFS();
    fileDirectoryTestUtil();
    deleteFsMasterJournalLogs();
    fileDirectoryTestUtil();
}
Also used : CreateFilePOptions(alluxio.grpc.CreateFilePOptions) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

CreateFilePOptions (alluxio.grpc.CreateFilePOptions)68 AlluxioURI (alluxio.AlluxioURI)61 Test (org.junit.Test)49 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)36 FileInStream (alluxio.client.file.FileInStream)27 FileOutStream (alluxio.client.file.FileOutStream)16 URIStatus (alluxio.client.file.URIStatus)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 FileSystem (alluxio.client.file.FileSystem)4 AlluxioException (alluxio.exception.AlluxioException)4 FileAlreadyExistsException (alluxio.exception.FileAlreadyExistsException)4 CreateDirectoryPOptions (alluxio.grpc.CreateDirectoryPOptions)4 IOException (java.io.IOException)4 DirectoryNotEmptyException (alluxio.exception.DirectoryNotEmptyException)3 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)3 ArrayList (java.util.ArrayList)3 ConfigurationRule (alluxio.ConfigurationRule)2 BlockMaster (alluxio.master.block.BlockMaster)2 Mode (alluxio.security.authorization.Mode)2 UnderFileSystem (alluxio.underfs.UnderFileSystem)2