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


Java PutOpParam.Op方法代码示例

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


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

示例1: testCaseInsensitive

import org.apache.hadoop.hdfs.web.resources.PutOpParam; //导入方法依赖的package包/类
public void testCaseInsensitive() throws IOException {
  final Path p = new Path("/test/testCaseInsensitive");
  final WebHdfsFileSystem webhdfs = (WebHdfsFileSystem)fs;
  final PutOpParam.Op op = PutOpParam.Op.MKDIRS;

  //replace query with mix case letters
  final URL url = webhdfs.toUrl(op, p);
  WebHdfsFileSystem.LOG.info("url      = " + url);
  final URL replaced = new URL(url.toString().replace(op.toQueryString(),
      "Op=mkDIrs"));
  WebHdfsFileSystem.LOG.info("replaced = " + replaced);

  //connect with the replaced URL.
  final HttpURLConnection conn = (HttpURLConnection)replaced.openConnection();
  conn.setRequestMethod(op.getType().toString());
  conn.connect();
  final BufferedReader in = new BufferedReader(new InputStreamReader(
      conn.getInputStream()));
  for(String line; (line = in.readLine()) != null; ) {
    WebHdfsFileSystem.LOG.info("> " + line);
  }

  //check if the command successes.
  assertTrue(fs.getFileStatus(p).isDirectory());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:TestWebHdfsFileSystemContract.java

示例2: testCaseInsensitive

import org.apache.hadoop.hdfs.web.resources.PutOpParam; //导入方法依赖的package包/类
public void testCaseInsensitive() throws IOException {
  final Path p = new Path("/test/testCaseInsensitive");
  final WebHdfsFileSystem webhdfs = (WebHdfsFileSystem) fs;
  final PutOpParam.Op op = PutOpParam.Op.MKDIRS;

  //replace query with mix case letters
  final URL url = webhdfs.toUrl(op, p);
  WebHdfsFileSystem.LOG.info("url      = " + url);
  final URL replaced =
      new URL(url.toString().replace(op.toQueryString(), "Op=mkDIrs"));
  WebHdfsFileSystem.LOG.info("replaced = " + replaced);

  //connect with the replaced URL.
  final HttpURLConnection conn =
      (HttpURLConnection) replaced.openConnection();
  conn.setRequestMethod(op.getType().toString());
  conn.connect();
  final BufferedReader in =
      new BufferedReader(new InputStreamReader(conn.getInputStream()));
  for (String line; (line = in.readLine()) != null; ) {
    WebHdfsFileSystem.LOG.info("> " + line);
  }

  //check if the command successes.
  assertTrue(fs.getFileStatus(p).isDirectory());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestWebHdfsFileSystemContract.java

示例3: testCaseInsensitive

import org.apache.hadoop.hdfs.web.resources.PutOpParam; //导入方法依赖的package包/类
public void testCaseInsensitive() throws IOException {
  final Path p = new Path("/test/testCaseInsensitive");
  final WebHdfsFileSystem webhdfs = (WebHdfsFileSystem)fs;
  final PutOpParam.Op op = PutOpParam.Op.MKDIRS;

  //replace query with mix case letters
  final URL url = webhdfs.toUrl(op, p);
  WebHdfsFileSystem.LOG.info("url      = " + url);
  final URL replaced = new URL(url.toString().replace(op.toQueryString(),
      "Op=mkDIrs"));
  WebHdfsFileSystem.LOG.info("replaced = " + replaced);

  //connect with the replaced URL.
  final HttpURLConnection conn = (HttpURLConnection)replaced.openConnection();
  conn.setRequestMethod(op.getType().toString());
  conn.connect();
  final BufferedReader in = new BufferedReader(new InputStreamReader(
      conn.getInputStream()));
  for(String line; (line = in.readLine()) != null; ) {
    WebHdfsFileSystem.LOG.info("> " + line);
  }

  //check if the command successes.
  assertTrue(fs.getFileStatus(p).isDir());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:26,代码来源:TestWebHdfsFileSystemContract.java


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