Search in sources :

Example 6 with RoundRobinPolicy

use of alluxio.client.file.policy.RoundRobinPolicy in project alluxio by Alluxio.

the class OutStreamOptionsTest method fields.

/**
   * Tests getting and setting fields.
   */
@Test
public void fields() {
    Random random = new Random();
    long blockSize = random.nextLong();
    FileWriteLocationPolicy locationPolicy = new RoundRobinPolicy();
    String owner = CommonUtils.randomAlphaNumString(10);
    String group = CommonUtils.randomAlphaNumString(10);
    Mode mode = new Mode((short) random.nextInt());
    long ttl = random.nextLong();
    int writeTier = random.nextInt();
    WriteType writeType = WriteType.NONE;
    OutStreamOptions options = OutStreamOptions.defaults();
    options.setBlockSizeBytes(blockSize);
    options.setLocationPolicy(locationPolicy);
    options.setOwner(owner);
    options.setGroup(group);
    options.setMode(mode);
    options.setTtl(ttl);
    options.setTtlAction(TtlAction.FREE);
    options.setWriteTier(writeTier);
    options.setWriteType(writeType);
    Assert.assertEquals(blockSize, options.getBlockSizeBytes());
    Assert.assertEquals(locationPolicy, options.getLocationPolicy());
    Assert.assertEquals(owner, options.getOwner());
    Assert.assertEquals(group, options.getGroup());
    Assert.assertEquals(mode, options.getMode());
    Assert.assertEquals(ttl, options.getTtl());
    Assert.assertEquals(TtlAction.FREE, options.getTtlAction());
    Assert.assertEquals(writeTier, options.getWriteTier());
    Assert.assertEquals(writeType.getAlluxioStorageType(), options.getAlluxioStorageType());
    Assert.assertEquals(writeType.getUnderStorageType(), options.getUnderStorageType());
}
Also used : FileWriteLocationPolicy(alluxio.client.file.policy.FileWriteLocationPolicy) Random(java.util.Random) WriteType(alluxio.client.WriteType) Mode(alluxio.security.authorization.Mode) RoundRobinPolicy(alluxio.client.file.policy.RoundRobinPolicy) Test(org.junit.Test)

Aggregations

RoundRobinPolicy (alluxio.client.file.policy.RoundRobinPolicy)6 Test (org.junit.Test)6 FileWriteLocationPolicy (alluxio.client.file.policy.FileWriteLocationPolicy)5 WriteType (alluxio.client.WriteType)3 Mode (alluxio.security.authorization.Mode)3 Random (java.util.Random)3 ReadType (alluxio.client.ReadType)2 AlluxioURI (alluxio.AlluxioURI)1 BlockLocationPolicy (alluxio.client.block.policy.BlockLocationPolicy)1 DeterministicHashPolicy (alluxio.client.block.policy.DeterministicHashPolicy)1 FileInStream (alluxio.client.file.FileInStream)1 FileSystem (alluxio.client.file.FileSystem)1 URIStatus (alluxio.client.file.URIStatus)1 CreateFileTOptions (alluxio.thrift.CreateFileTOptions)1