Java 类org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.TestHookOperationContext 实例源码

项目:hadoop    文件:TestBlobDataValidation.java   
private void testCheckBlockMd5(final boolean expectMd5Checked)
    throws Exception {
  assumeNotNull(testAccount);
  Path testFilePath = new Path("/testFile");

  // Add a hook to check that for GET/PUT requests we set/don't set
  // the block-level MD5 field as configured. I tried to do clever
  // testing by also messing with the raw data to see if we actually
  // validate the data as expected, but the HttpURLConnection wasn't
  // pluggable enough for me to do that.
  testAccount.getFileSystem().getStore()
  .addTestHookToOperationContext(new TestHookOperationContext() {
  @Override
        public OperationContext modifyOperationContext(
            OperationContext original) {
    original.getResponseReceivedEventHandler().addListener(
        new ContentMD5Checker(expectMd5Checked));
    return original;
        }
      });

  OutputStream outStream = testAccount.getFileSystem().create(testFilePath);
  outStream.write(new byte[] { 5, 15 });
  outStream.close();

  InputStream inStream = testAccount.getFileSystem().open(testFilePath);
  byte[] inBuf = new byte[100];
  while (inStream.read(inBuf) > 0){
    //nothing;
  }
  inStream.close();
}
项目:hadoop    文件:TestAzureFileSystemErrorConditions.java   
private void injectTransientError(NativeAzureFileSystem fs,
    final ConnectionRecognizer connectionRecognizer) {
  fs.getStore().addTestHookToOperationContext(new TestHookOperationContext() {
    @Override
    public OperationContext modifyOperationContext(OperationContext original) {
      original.getSendingRequestEventHandler().addListener(
          new TransientErrorInjector(connectionRecognizer));
      return original;
    }
  });
}
项目:aliyun-oss-hadoop-fs    文件:TestBlobDataValidation.java   
private void testCheckBlockMd5(final boolean expectMd5Checked)
    throws Exception {
  assumeNotNull(testAccount);
  Path testFilePath = new Path("/testFile");

  // Add a hook to check that for GET/PUT requests we set/don't set
  // the block-level MD5 field as configured. I tried to do clever
  // testing by also messing with the raw data to see if we actually
  // validate the data as expected, but the HttpURLConnection wasn't
  // pluggable enough for me to do that.
  testAccount.getFileSystem().getStore()
  .addTestHookToOperationContext(new TestHookOperationContext() {
  @Override
        public OperationContext modifyOperationContext(
            OperationContext original) {
    original.getResponseReceivedEventHandler().addListener(
        new ContentMD5Checker(expectMd5Checked));
    return original;
        }
      });

  OutputStream outStream = testAccount.getFileSystem().create(testFilePath);
  outStream.write(new byte[] { 5, 15 });
  outStream.close();

  InputStream inStream = testAccount.getFileSystem().open(testFilePath);
  byte[] inBuf = new byte[100];
  while (inStream.read(inBuf) > 0){
    //nothing;
  }
  inStream.close();
}
项目:aliyun-oss-hadoop-fs    文件:TestAzureFileSystemErrorConditions.java   
private void injectTransientError(NativeAzureFileSystem fs,
    final ConnectionRecognizer connectionRecognizer) {
  fs.getStore().addTestHookToOperationContext(new TestHookOperationContext() {
    @Override
    public OperationContext modifyOperationContext(OperationContext original) {
      original.getSendingRequestEventHandler().addListener(
          new TransientErrorInjector(connectionRecognizer));
      return original;
    }
  });
}
项目:big-c    文件:TestBlobDataValidation.java   
private void testCheckBlockMd5(final boolean expectMd5Checked)
    throws Exception {
  assumeNotNull(testAccount);
  Path testFilePath = new Path("/testFile");

  // Add a hook to check that for GET/PUT requests we set/don't set
  // the block-level MD5 field as configured. I tried to do clever
  // testing by also messing with the raw data to see if we actually
  // validate the data as expected, but the HttpURLConnection wasn't
  // pluggable enough for me to do that.
  testAccount.getFileSystem().getStore()
  .addTestHookToOperationContext(new TestHookOperationContext() {
  @Override
        public OperationContext modifyOperationContext(
            OperationContext original) {
    original.getResponseReceivedEventHandler().addListener(
        new ContentMD5Checker(expectMd5Checked));
    return original;
        }
      });

  OutputStream outStream = testAccount.getFileSystem().create(testFilePath);
  outStream.write(new byte[] { 5, 15 });
  outStream.close();

  InputStream inStream = testAccount.getFileSystem().open(testFilePath);
  byte[] inBuf = new byte[100];
  while (inStream.read(inBuf) > 0){
    //nothing;
  }
  inStream.close();
}
项目:big-c    文件:TestAzureFileSystemErrorConditions.java   
private void injectTransientError(NativeAzureFileSystem fs,
    final ConnectionRecognizer connectionRecognizer) {
  fs.getStore().addTestHookToOperationContext(new TestHookOperationContext() {
    @Override
    public OperationContext modifyOperationContext(OperationContext original) {
      original.getSendingRequestEventHandler().addListener(
          new TransientErrorInjector(connectionRecognizer));
      return original;
    }
  });
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestBlobDataValidation.java   
private void testCheckBlockMd5(final boolean expectMd5Checked)
    throws Exception {
  assumeNotNull(testAccount);
  Path testFilePath = new Path("/testFile");

  // Add a hook to check that for GET/PUT requests we set/don't set
  // the block-level MD5 field as configured. I tried to do clever
  // testing by also messing with the raw data to see if we actually
  // validate the data as expected, but the HttpURLConnection wasn't
  // pluggable enough for me to do that.
  testAccount.getFileSystem().getStore()
  .addTestHookToOperationContext(new TestHookOperationContext() {
  @Override
        public OperationContext modifyOperationContext(
            OperationContext original) {
    original.getResponseReceivedEventHandler().addListener(
        new ContentMD5Checker(expectMd5Checked));
    return original;
        }
      });

  OutputStream outStream = testAccount.getFileSystem().create(testFilePath);
  outStream.write(new byte[] { 5, 15 });
  outStream.close();

  InputStream inStream = testAccount.getFileSystem().open(testFilePath);
  byte[] inBuf = new byte[100];
  while (inStream.read(inBuf) > 0){
    //nothing;
  }
  inStream.close();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAzureFileSystemErrorConditions.java   
private void injectTransientError(NativeAzureFileSystem fs,
    final ConnectionRecognizer connectionRecognizer) {
  fs.getStore().addTestHookToOperationContext(new TestHookOperationContext() {
    @Override
    public OperationContext modifyOperationContext(OperationContext original) {
      original.getSendingRequestEventHandler().addListener(
          new TransientErrorInjector(connectionRecognizer));
      return original;
    }
  });
}