Search in sources :

Example 6 with WriteType

use of alluxio.client.WriteType 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)

Example 7 with WriteType

use of alluxio.client.WriteType in project alluxio by Alluxio.

the class TestRunner method runTests.

/**
   * Runs combinations of tests of operation, read and write type.
   *
   * @return the number of failed tests
   */
private int runTests() {
    int failed = 0;
    List<ReadType> readTypes = mReadType == null ? READ_TYPES : Lists.newArrayList(ReadType.valueOf(mReadType));
    List<WriteType> writeTypes = mWriteType == null ? WRITE_TYPES : Lists.newArrayList(WriteType.valueOf(mWriteType));
    List<OperationType> operations = mOperation == null ? Lists.newArrayList(OperationType.values()) : Lists.newArrayList(OperationType.valueOf(mOperation));
    for (ReadType readType : readTypes) {
        for (WriteType writeType : writeTypes) {
            for (OperationType opType : operations) {
                System.out.println(String.format("runTest %s %s %s", opType, readType, writeType));
                failed += runTest(opType, readType, writeType);
            }
        }
    }
    if (failed > 0) {
        System.out.println("Number of failed tests: " + failed);
    }
    return failed;
}
Also used : ReadType(alluxio.client.ReadType) WriteType(alluxio.client.WriteType)

Aggregations

WriteType (alluxio.client.WriteType)7 Test (org.junit.Test)6 Mode (alluxio.security.authorization.Mode)5 Random (java.util.Random)5 FileWriteLocationPolicy (alluxio.client.file.policy.FileWriteLocationPolicy)3 RoundRobinPolicy (alluxio.client.file.policy.RoundRobinPolicy)3 ReadType (alluxio.client.ReadType)1 OutStreamOptions (alluxio.client.file.options.OutStreamOptions)1 CreateDirectoryTOptions (alluxio.thrift.CreateDirectoryTOptions)1 CreateFileTOptions (alluxio.thrift.CreateFileTOptions)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1