コード例 #1
0
 @BeforeClass
 public static final void beforeClass() throws Exception {
   sFileSystem = sLocalTachyonClusterResource.get().getClient();
   sTachyonConf = sLocalTachyonClusterResource.get().getMasterTachyonConf();
   sWriteBoth = StreamOptionUtils.getCreateFileOptionsCacheThrough(sTachyonConf);
   sWriteTachyon = StreamOptionUtils.getCreateFileOptionsMustCache(sTachyonConf);
   sWriteUnderStore = StreamOptionUtils.getCreateFileOptionsThrough(sTachyonConf);
 }
コード例 #2
0
  @BeforeClass
  public static void beforeClass() throws Exception {
    Configuration conf = new Configuration();
    conf.set("fs.tachyon.impl", TFS.class.getName());

    TachyonFileSystem tachyonFS = sLocalTachyonClusterResource.get().getClient();
    TachyonFSTestUtils.createByteFile(
        tachyonFS, "/testFile1", TachyonStorageType.STORE, UnderStorageType.SYNC_PERSIST, FILE_LEN);

    URI uri = URI.create(sLocalTachyonClusterResource.get().getMasterUri());
    sTFS = FileSystem.get(uri, conf);
  }
コード例 #3
0
  @Test
  @LocalTachyonClusterResource.Config(
      tachyonConfParams = {
        Constants.SECURITY_AUTHENTICATION_TYPE,
        "CUSTOM",
        Constants.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER,
        NameMatchAuthenticationProvider.FULL_CLASS_NAME,
        Constants.SECURITY_LOGIN_USERNAME,
        "tachyon"
      })
  public void customAuthenticationDenyConnectTest() throws Exception {
    mThrown.expect(ConnectionFailedException.class);

    FileSystemMasterClient masterClient =
        new FileSystemMasterClient(
            mLocalTachyonClusterResource.get().getMaster().getAddress(), ClientContext.getConf());
    try {
      Assert.assertFalse(masterClient.isConnected());
      // Using no-tachyon as loginUser to connect to Master, the IOException will be thrown
      LoginUserTestUtils.resetLoginUser(ClientContext.getConf(), "no-tachyon");
      masterClient.connect();
    } finally {
      masterClient.close();
    }
  }
 @Test
 @LocalTachyonClusterResource.Config(
     tachyonConfParams = {
       Constants.SECURITY_AUTHENTICATION_TYPE,
       "CUSTOM",
       Constants.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER,
       NameMatchAuthenticationProvider.FULL_CLASS_NAME
     },
     startCluster = false)
 public void customAuthenticationDenyConnectTest() throws Exception {
   /**
    * Using tachyon as loginUser for unit testing, only tachyon user is allowed to connect to
    * Tachyon Master.
    */
   System.setProperty(Constants.SECURITY_LOGIN_USERNAME, "tachyon");
   mLocalTachyonClusterResource.start();
   // Using no-tachyon as loginUser to connect to Master, the IOException will be thrown
   clearLoginUser();
   mThrown.expect(ConnectionFailedException.class);
   System.setProperty(Constants.SECURITY_LOGIN_USERNAME, "no-tachyon");
   FileSystemMasterClient masterClient =
       new FileSystemMasterClient(
           mLocalTachyonClusterResource.get().getMaster().getAddress(),
           mLocalTachyonClusterResource.get().getMasterTachyonConf());
   try {
     Assert.assertFalse(masterClient.isConnected());
     masterClient.connect();
   } finally {
     masterClient.close();
   }
 }
コード例 #5
0
  @BeforeClass
  public static final void beforeClass() throws Exception {
    sFileSystem = sLocalTachyonClusterResource.get().getClient();
    sTachyonConf = sLocalTachyonClusterResource.get().getMasterTachyonConf();
    sWriteBoth = StreamOptionUtils.getCreateFileOptionsCacheThrough(sTachyonConf);
    sWriteTachyon = StreamOptionUtils.getCreateFileOptionsMustCache(sTachyonConf);
    sWriteUnderStore = StreamOptionUtils.getCreateFileOptionsThrough(sTachyonConf);
    sTestPath = PathUtils.uniqPath();

    // Create files of varying size and write type to later read from
    for (int k = MIN_LEN; k <= MAX_LEN; k += DELTA) {
      for (CreateFileOptions op : getOptionSet()) {
        TachyonURI path = new TachyonURI(sTestPath + "/file_" + k + "_" + op.hashCode());
        FileSystemTestUtils.createByteFile(sFileSystem, path, op, k);
      }
    }
  }
コード例 #6
0
  @BeforeClass
  public static void beforeClass() throws Exception {
    Configuration conf = new Configuration();
    conf.set("fs.tachyon.impl", TFS.class.getName());

    URI uri = URI.create(sLocalTachyonClusterResource.get().getMasterUri());

    sTFS = FileSystem.get(uri, conf);
  }
コード例 #7
0
 /**
  * Test Tachyon client connects or disconnects to the Master. When the client connects
  * successfully to the Master, it can successfully create file or not.
  *
  * @param filename
  * @throws Exception
  */
 private void authenticationOperationTest(String filename) throws Exception {
   FileSystemMasterClient masterClient =
       new FileSystemMasterClient(
           mLocalTachyonClusterResource.get().getMaster().getAddress(),
           mLocalTachyonClusterResource.get().getMasterTachyonConf());
   Assert.assertFalse(masterClient.isConnected());
   masterClient.connect();
   Assert.assertTrue(masterClient.isConnected());
   masterClient.createFile(new TachyonURI(filename), CreateFileOptions.defaults());
   Assert.assertNotNull(masterClient.getStatus(new TachyonURI(filename)));
   masterClient.disconnect();
   masterClient.close();
 }