use of alluxio.thrift.CreateDirectoryTOptions in project alluxio by Alluxio.
the class CreateDirectoryOptions method toThrift.
/**
* @return Thrift representation of the options
*/
public CreateDirectoryTOptions toThrift() {
CreateDirectoryTOptions options = new CreateDirectoryTOptions();
options.setAllowExists(mAllowExists);
options.setRecursive(mRecursive);
options.setTtl(mTtl);
options.setTtlAction(ThriftUtils.toThrift(mTtlAction));
options.setPersisted(mWriteType.isThrough());
if (mMode != null) {
options.setMode(mMode.toShort());
}
return options;
}
use of alluxio.thrift.CreateDirectoryTOptions in project alluxio by Alluxio.
the class CreateDirectoryOptionsTest method toThrift.
/**
* Tests conversion to thrift representation.
*/
@Test
public void toThrift() {
Random random = new Random();
boolean allowExists = random.nextBoolean();
boolean recursive = random.nextBoolean();
Mode mode = new Mode((short) random.nextInt());
long ttl = random.nextLong();
WriteType writeType = WriteType.NONE;
CreateDirectoryOptions options = CreateDirectoryOptions.defaults();
options.setAllowExists(allowExists);
options.setMode(mode);
options.setTtl(ttl);
options.setTtlAction(TtlAction.FREE);
options.setRecursive(recursive);
options.setWriteType(writeType);
CreateDirectoryTOptions thriftOptions = options.toThrift();
Assert.assertEquals(allowExists, thriftOptions.isAllowExists());
Assert.assertEquals(recursive, thriftOptions.isRecursive());
Assert.assertEquals(writeType.isThrough(), thriftOptions.isPersisted());
Assert.assertEquals(ttl, thriftOptions.getTtl());
Assert.assertEquals(alluxio.thrift.TTtlAction.Free, thriftOptions.getTtlAction());
Assert.assertEquals(mode.toShort(), thriftOptions.getMode());
}
Aggregations