当前位置: 首页>>代码示例>>Java>>正文


Java BlockTokenSecretManager.setKeyUpdateIntervalForTesting方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager.setKeyUpdateIntervalForTesting方法的典型用法代码示例。如果您正苦于以下问题:Java BlockTokenSecretManager.setKeyUpdateIntervalForTesting方法的具体用法?Java BlockTokenSecretManager.setKeyUpdateIntervalForTesting怎么用?Java BlockTokenSecretManager.setKeyUpdateIntervalForTesting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager的用法示例。


在下文中一共展示了BlockTokenSecretManager.setKeyUpdateIntervalForTesting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lowerKeyUpdateIntervalAndClearKeys

import org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager; //导入方法依赖的package包/类
private static void lowerKeyUpdateIntervalAndClearKeys(FSNamesystem namesystem) {
  BlockTokenSecretManager btsm = namesystem.getBlockManager()
      .getBlockTokenSecretManager();
  btsm.setKeyUpdateIntervalForTesting(2 * 1000);
  btsm.setTokenLifetime(2 * 1000);
  btsm.clearAllKeysForTesting();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestFailoverWithBlockTokensEnabled.java

示例2: testLongLivedClient

import org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager; //导入方法依赖的package包/类
@Test
public void testLongLivedClient() throws IOException, InterruptedException {
  MiniDFSCluster cluster = null;
  try {
    Configuration conf = new Configuration();
    cluster = new MiniDFSCluster.Builder(conf).build();
    
    FileSystem fs = getFileSystem(conf);
    writeTestDataToFile(fs);
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    FileChecksum checksum = fs.getFileChecksum(TEST_PATH);
    fs.close();
    cluster.shutdown();
    
    setEncryptionConfigKeys(conf);
    
    cluster = new MiniDFSCluster.Builder(conf)
        .manageDataDfsDirs(false)
        .manageNameDfsDirs(false)
        .format(false)
        .startupOption(StartupOption.REGULAR)
        .build();
    
    BlockTokenSecretManager btsm = cluster.getNamesystem().getBlockManager()
        .getBlockTokenSecretManager();
    btsm.setKeyUpdateIntervalForTesting(2 * 1000);
    btsm.setTokenLifetime(2 * 1000);
    btsm.clearAllKeysForTesting();
    
    fs = getFileSystem(conf);
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    assertEquals(checksum, fs.getFileChecksum(TEST_PATH));
    
    // Sleep for 15 seconds, after which the encryption key will no longer be
    // valid. It needs to be a few multiples of the block token lifetime,
    // since several block tokens are valid at any given time (the current
    // and the last two, by default.)
    LOG.info("Sleeping so that encryption keys expire...");
    Thread.sleep(15 * 1000);
    LOG.info("Done sleeping.");
    
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    assertEquals(checksum, fs.getFileChecksum(TEST_PATH));
    
    fs.close();
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:TestEncryptedTransfer.java

示例3: testLongLivedClient

import org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager; //导入方法依赖的package包/类
@Test
public void testLongLivedClient() throws IOException, InterruptedException {
  MiniDFSCluster cluster = null;
  try {
    Configuration conf = new Configuration();
    cluster = new MiniDFSCluster.Builder(conf).build();
    
    FileSystem fs = getFileSystem(conf);
    writeTestDataToFile(fs);
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    FileChecksum checksum = fs.getFileChecksum(TEST_PATH);
    fs.close();
    cluster.shutdown();
    
    setEncryptionConfigKeys(conf);
    
    cluster = new MiniDFSCluster.Builder(conf).manageDataDfsDirs(false)
        .manageNameDfsDirs(false).format(false)
        .startupOption(StartupOption.REGULAR).build();
    
    BlockTokenSecretManager btsm = cluster.getNamesystem().getBlockManager()
        .getBlockTokenSecretManager();
    btsm.setKeyUpdateIntervalForTesting(2 * 1000);
    btsm.setTokenLifetime(2 * 1000);
    btsm.clearAllKeysForTesting();
    
    fs = getFileSystem(conf);
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    assertEquals(checksum, fs.getFileChecksum(TEST_PATH));
    
    // Sleep for 15 seconds, after which the encryption key will no longer be
    // valid. It needs to be a few multiples of the block token lifetime,
    // since several block tokens are valid at any given time (the current
    // and the last two, by default.)
    LOG.info("Sleeping so that encryption keys expire...");
    Thread.sleep(15 * 1000);
    LOG.info("Done sleeping.");
    
    assertEquals(PLAIN_TEXT, DFSTestUtil.readFile(fs, TEST_PATH));
    assertEquals(checksum, fs.getFileChecksum(TEST_PATH));
    
    fs.close();
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:49,代码来源:TestEncryptedTransfer.java


注:本文中的org.apache.hadoop.hdfs.security.token.block.BlockTokenSecretManager.setKeyUpdateIntervalForTesting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。