Search in sources :

Example 1 with CreateUfsFileTOptions

use of alluxio.thrift.CreateUfsFileTOptions in project alluxio by Alluxio.

the class CreateUfsFileOptionsTest method toThrift.

/**
   * Tests conversion to thrift representation.
   */
@Test
public void toThrift() throws IOException {
    Random random = new Random();
    String owner = CommonUtils.randomAlphaNumString(10);
    String group = CommonUtils.randomAlphaNumString(10);
    Mode mode = new Mode((short) random.nextInt());
    CreateUfsFileOptions options = CreateUfsFileOptions.defaults();
    options.setOwner(owner);
    options.setGroup(group);
    options.setMode(mode);
    CreateUfsFileTOptions thriftOptions = options.toThrift();
    Assert.assertEquals(owner, thriftOptions.getOwner());
    Assert.assertEquals(group, thriftOptions.getGroup());
    Assert.assertEquals(mode.toShort(), thriftOptions.getMode());
}
Also used : Random(java.util.Random) Mode(alluxio.security.authorization.Mode) CreateUfsFileTOptions(alluxio.thrift.CreateUfsFileTOptions) Test(org.junit.Test)

Aggregations

Mode (alluxio.security.authorization.Mode)1 CreateUfsFileTOptions (alluxio.thrift.CreateUfsFileTOptions)1 Random (java.util.Random)1 Test (org.junit.Test)1