Search in sources :

Example 1 with LocalFirstPolicy

use of alluxio.client.block.policy.LocalFirstPolicy in project alluxio by Alluxio.

the class OutStreamOptionsTest method defaults.

/**
 * Tests that building an {@link OutStreamOptions} with the defaults works.
 */
@Test
public void defaults() throws IOException {
    AlluxioStorageType alluxioType = AlluxioStorageType.STORE;
    UnderStorageType ufsType = UnderStorageType.SYNC_PERSIST;
    mConf.set(PropertyKey.USER_BLOCK_SIZE_BYTES_DEFAULT, "64MB");
    mConf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.CACHE_THROUGH.toString());
    mConf.set(PropertyKey.USER_FILE_WRITE_TIER_DEFAULT, Constants.LAST_TIER);
    mConf.set(PropertyKey.SECURITY_GROUP_MAPPING_CLASS, FakeUserGroupsMapping.class.getName());
    Subject subject = new Subject();
    subject.getPrincipals().add(new User("test_user"));
    ClientContext clientContext = ClientContext.create(subject, mConf);
    OutStreamOptions options = OutStreamOptions.defaults(clientContext);
    assertEquals(alluxioType, options.getAlluxioStorageType());
    assertEquals(64 * Constants.MB, options.getBlockSizeBytes());
    assertTrue(options.getLocationPolicy() instanceof LocalFirstPolicy);
    assertEquals("test_user", options.getOwner());
    assertEquals("test_group", options.getGroup());
    assertEquals(ModeUtils.applyFileUMask(Mode.defaults(), mConf.getString(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK)), options.getMode());
    assertEquals(Constants.NO_TTL, options.getCommonOptions().getTtl());
    assertEquals(TtlAction.DELETE, options.getCommonOptions().getTtlAction());
    assertEquals(ufsType, options.getUnderStorageType());
    assertEquals(WriteType.CACHE_THROUGH, options.getWriteType());
    assertEquals(Constants.LAST_TIER, options.getWriteTier());
}
Also used : UnderStorageType(alluxio.client.UnderStorageType) User(alluxio.security.User) ClientContext(alluxio.ClientContext) LocalFirstPolicy(alluxio.client.block.policy.LocalFirstPolicy) AlluxioStorageType(alluxio.client.AlluxioStorageType) Subject(javax.security.auth.Subject) Test(org.junit.Test)

Aggregations

ClientContext (alluxio.ClientContext)1 AlluxioStorageType (alluxio.client.AlluxioStorageType)1 UnderStorageType (alluxio.client.UnderStorageType)1 LocalFirstPolicy (alluxio.client.block.policy.LocalFirstPolicy)1 User (alluxio.security.User)1 Subject (javax.security.auth.Subject)1 Test (org.junit.Test)1