Package com.dp.nebula.wormhole.common

Examples of com.dp.nebula.wormhole.common.BufferedLineExchanger


        IParam param = new DefaultParam(params);
       
        SftpDirSplitter splitter = new SftpDirSplitter();
        splitter.init(param);
        List<IParam> list = splitter.split();
        BufferedLineExchanger exchanger=BufferedLineExchangerTest.getLineExchanger();
        List<String> result = new ArrayList<String>();

        for(IParam paramItem:list) {
//          System.out.println(paramItem.getValue(ParamKey.dir));
           
          reader.setParam(paramItem);
            reader.init();
            reader.connection();
            reader.read(exchanger);
            reader.finish();
            ILine line = null;
            try{
              int i = 0;
              while((line = exchanger.receive()) != null) {
                result.add(line.getField(0)+"\t"+line.getField(1)+"\n");
                i++;
              }
            }catch(Exception e) {
              //Do nothing
View Full Code Here


        IParam param = new DefaultParam(params);
        periphery.prepare(param, null);
        splitter.init(param);
        List<IParam> paramList = splitter.split();
      BufferedLineExchanger exchanger=BufferedLineExchangerTest.getLineExchanger();
      for(ILine line:datas) {
        exchanger.send(line);
        exchanger.flush();
      }

        for(IParam oneParam:paramList) {
          writer.setParam(oneParam);
          writer.init();
View Full Code Here

      storageConf.setWaitTime(
          engineConf.getIntValue(EngineConfParamKey.STORAGE_WAIT_TIME));
      result.add(storageConf);
    }
    StorageManager manager = new StorageManager(result);
    BufferedLineExchanger exchanger = new BufferedLineExchanger(manager.getStorageForWriter("1"), manager.getStorageForReader());
    return exchanger;
  }
View Full Code Here

    params.put(ParamKey.path, "jdbc:hsqldb:mem:" + DB_NAME);
    params.put(ParamKey.username, "sa");
    params.put(ParamKey.sql, "SELECT str_col, num_col FROM sample_table WHERE num_col < 250");
    IParam iParam = new DefaultParam(params);
    hiveReader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = HiveReaderTest.getBufferedLineExchangerInstance();
   
    IPluginMonitor pluginMonitor = mock(IPluginMonitor.class);
    hiveReader.setMonitor(pluginMonitor);
   
    hiveReader.init();
    hiveReader.connection();
    hiveReader.read(bufLineExchanger);
    ILine line = bufLineExchanger.receive();
   
    assertEquals(2, line.getFieldNum());
    assertEquals("Ford", line.getField(0));
    assertEquals("100", line.getField(1));
   
View Full Code Here

    periphery.prepare(iParam, null);
    splitter.init(iParam);
    splitter.split();

    reader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = BufferedLineExchangerTest.getLineExchanger();
   
    IPluginMonitor pluginMonitor = mock(IPluginMonitor.class);
    reader.setMonitor(pluginMonitor);
   
    reader.init();
    reader.connection();
    reader.read(bufLineExchanger);
    ILine line = bufLineExchanger.receive();
   
    assertEquals(2, line.getFieldNum());
    assertEquals("Ford", line.getField(0));
    assertEquals("100", line.getField(1));
   
View Full Code Here

         
      );
      result.add(storageConf);
    }
    StorageManager manager = new StorageManager(result);
    return new BufferedLineExchanger(manager.getStorageForWriter("0"), manager.getStorageForReader());
  }
View Full Code Here

    params.put(ParamKey.sql, "copy (select * from dpmid.mid_dp_shop_info_his where cal_dt = '2012-01-01' limit 20) to stdout WITH DELIMITER E'\t' ");
    IParam iParam = new DefaultParam(params);
   
    gpPeriphery.prepare(iParam,null);
    gpReader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = getLineExchanger();
   
    IPluginMonitor pluginMonitor = mock(IPluginMonitor.class);
    gpReader.setMonitor(pluginMonitor);
   
    gpReader.init();
    gpReader.connection();
    ReadRunnable t = new ReadRunnable();
    t.init(gpReader,bufLineExchanger);
    new Thread(t).start();
    ILine line = null;
    System.out.println("start");
    int num = 0;
    try{
      while((line = bufLineExchanger.receive())!=null) {
        num++;
        if(line.getFieldNum() != 14){
          for(int i=0; i <line.getFieldNum(); i++){
            System.out.print(line.getField(i)+"\t");
          }
View Full Code Here

    Map<String, String> params = new HashMap<String, String>();
    params.put(ParamKey.inputUri, "mongodb://localhost:" + MONGODB_PORT + "/embedded.testCollection");
    params.put(ParamKey.inputFields, "{ msg : 1 }");
    IParam iParam = new DefaultParam(params);
    mongoReader.setParam(iParam);
    BufferedLineExchanger bufLineExchanger = HiveReaderTest.getBufferedLineExchangerInstance();
   
    IPluginMonitor pluginMonitor = mock(IPluginMonitor.class);
    mongoReader.setMonitor(pluginMonitor);
   
    mongoReader.init();
    mongoReader.connection();
    mongoReader.read(bufLineExchanger);
    ILine line = bufLineExchanger.receive();
   
    System.out.println(line.getField(0));
    assertEquals("hello world mongoDB in Java", line.getField(0));
   
    mongoReader.finish();
View Full Code Here

TOP

Related Classes of com.dp.nebula.wormhole.common.BufferedLineExchanger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.