test_class.declarator: TEST_DATA = "target/test-data/TestFetcher"
test_class.modifier: private
test_class.original_string: private String TEST_DATA = "target/test-data/TestFetcher";
test_class.type: String
test_class.var_name: TEST_DATA
test_class.declarator: INPUT_DIR = TEST_DATA+"/in/"
test_class.modifier: private
test_class.original_string: private String INPUT_DIR = TEST_DATA+"/in/";
test_class.type: String
test_class.var_name: INPUT_DIR
test_class.declarator: OUTPUT_DIR = TEST_DATA+"/out/"
test_class.modifier: private
test_class.original_string: private String OUTPUT_DIR = TEST_DATA+"/out/";
test_class.type: String
test_class.var_name: OUTPUT_DIR
test_class.file: tajo-core/src/test/java/org/apache/tajo/worker/TestFetcher.java
test_class.identifier: TestFetcher
test_case.body: @Test
    public void testGet() throws IOException {
      Random rnd = new Random();
      FileWriter writer = new FileWriter(INPUT_DIR + "data");
      String data;
      for (int i = 0; i < 100; i++) {
        data = ""+rnd.nextInt();
        writer.write(data);
      }
      writer.flush();
      writer.close();
  
      DataRetriever ret = new DirectoryRetriever(INPUT_DIR);
      HttpDataServer server = new HttpDataServer(
          NetUtils.createSocketAddr("127.0.0.1:0"), ret);
      server.start();
      InetSocketAddress addr = server.getBindAddress();
      
      URI uri = URI.create("http://127.0.0.1:"+addr.getPort() + "/data");
      ClientSocketChannelFactory channelFactory = RpcChannelFactory.createClientChannelFactory("Fetcher", 1);
      Fetcher fetcher = new Fetcher(uri, new File(OUTPUT_DIR + "data"), channelFactory);
      fetcher.get();
      server.stop();
      
      FileSystem fs = FileSystem.getLocal(new TajoConf());
      FileStatus inStatus = fs.getFileStatus(new Path(INPUT_DIR, "data"));
      FileStatus outStatus = fs.getFileStatus(new Path(OUTPUT_DIR, "data"));
      assertEquals(inStatus.getLen(), outStatus.getLen());
    }
test_case.class_method_signature: TestFetcher.testGet()
test_case.full_signature: @Test public void testGet()
test_case.identifier: testGet
test_case.invocations: nextInt write flush close createSocketAddr start getBindAddress create getPort createClientChannelFactory get stop getLocal getFileStatus getFileStatus assertEquals getLen getLen
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGet()
focal_class.declarator: LOG = LogFactory.getLog(Fetcher.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Log LOG = LogFactory.getLog(Fetcher.class);
focal_class.type: Log
focal_class.var_name: LOG
focal_class.declarator: uri
focal_class.modifier: private final
focal_class.original_string: private final URI uri;
focal_class.type: URI
focal_class.var_name: uri
focal_class.declarator: file
focal_class.modifier: private final
focal_class.original_string: private final File file;
focal_class.type: File
focal_class.var_name: file
focal_class.declarator: host
focal_class.modifier: private final
focal_class.original_string: private final String host;
focal_class.type: String
focal_class.var_name: host
focal_class.declarator: port
focal_class.modifier: private
focal_class.original_string: private int port;
focal_class.type: int
focal_class.var_name: port
focal_class.declarator: startTime
focal_class.modifier: private
focal_class.original_string: private long startTime;
focal_class.type: long
focal_class.var_name: startTime
focal_class.declarator: finishTime
focal_class.modifier: private
focal_class.original_string: private long finishTime;
focal_class.type: long
focal_class.var_name: finishTime
focal_class.declarator: fileLen
focal_class.modifier: private
focal_class.original_string: private long fileLen;
focal_class.type: long
focal_class.var_name: fileLen
focal_class.declarator: messageReceiveCount
focal_class.modifier: private
focal_class.original_string: private int messageReceiveCount;
focal_class.type: int
focal_class.var_name: messageReceiveCount
focal_class.declarator: bootstrap
focal_class.modifier: private
focal_class.original_string: private ClientBootstrap bootstrap;
focal_class.type: ClientBootstrap
focal_class.var_name: bootstrap
focal_class.file: tajo-core/src/main/java/org/apache/tajo/worker/Fetcher.java
focal_class.identifier: Fetcher
focal_class.class_method_signature: Fetcher.Fetcher(URI uri, File file, ClientSocketChannelFactory factory)
focal_class.full_signature: public  Fetcher(URI uri, File file, ClientSocketChannelFactory factory)
focal_class.identifier: Fetcher
focal_class.modifiers: public
focal_class.parameters: (URI uri, File file, ClientSocketChannelFactory factory)
focal_class.signature:  Fetcher(URI uri, File file, ClientSocketChannelFactory factory)
focal_class.class_method_signature: Fetcher.getStartTime()
focal_class.full_signature: public long getStartTime()
focal_class.identifier: getStartTime
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getStartTime()
focal_class.class_method_signature: Fetcher.getFinishTime()
focal_class.full_signature: public long getFinishTime()
focal_class.identifier: getFinishTime
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getFinishTime()
focal_class.class_method_signature: Fetcher.getFileLen()
focal_class.full_signature: public long getFileLen()
focal_class.identifier: getFileLen
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getFileLen()
focal_class.class_method_signature: Fetcher.getMessageReceiveCount()
focal_class.full_signature: public int getMessageReceiveCount()
focal_class.identifier: getMessageReceiveCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getMessageReceiveCount()
focal_class.class_method_signature: Fetcher.getStatus()
focal_class.full_signature: public String getStatus()
focal_class.identifier: getStatus
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getStatus()
focal_class.class_method_signature: Fetcher.get()
focal_class.full_signature: public File get()
focal_class.identifier: get
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: File
focal_class.signature: File get()
focal_class.class_method_signature: Fetcher.getURI()
focal_class.full_signature: public URI getURI()
focal_class.identifier: getURI
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: URI
focal_class.signature: URI getURI()
focal_method.body: public File get() throws IOException {
      startTime = System.currentTimeMillis();
  
      ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));
  
      // Wait until the connection attempt succeeds or fails.
      Channel channel = future.awaitUninterruptibly().getChannel();
      if (!future.isSuccess()) {
        future.getChannel().close();
        throw new IOException(future.getCause());
      }
  
      String query = uri.getPath()
          + (uri.getRawQuery() != null ? "?" + uri.getRawQuery() : "");
      // Prepare the HTTP request.
      HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, query);
      request.setHeader(HttpHeaders.Names.HOST, host);
      LOG.info("Fetch: " + uri);
      request.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.CLOSE);
      request.setHeader(HttpHeaders.Names.ACCEPT_ENCODING, HttpHeaders.Values.GZIP);
  
  
      // Send the HTTP request.
      ChannelFuture channelFuture = channel.write(request);
  
      // Wait for the server to close the connection.
      channel.getCloseFuture().awaitUninterruptibly();
  
      channelFuture.addListener(ChannelFutureListener.CLOSE);
  
      // Close the channel to exit.
      future.getChannel().close();
      finishTime = System.currentTimeMillis();
      return file;
    }
focal_method.class_method_signature: Fetcher.get()
focal_method.full_signature: public File get()
focal_method.identifier: get
focal_method.invocations: currentTimeMillis connect getChannel awaitUninterruptibly isSuccess close getChannel getCause getPath getRawQuery getRawQuery setHeader info setHeader setHeader write awaitUninterruptibly getCloseFuture addListener close getChannel currentTimeMillis
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: File
focal_method.signature: File get()