Package eu.stratosphere.nephele.util

Examples of eu.stratosphere.nephele.util.FileLineWriter


   */
  @Test
  public void testReadWrite() throws Exception {

    this.file.createNewFile();
    FileLineWriter writer = new FileLineWriter();
    Whitebox.setInternalState(writer, "environment", this.environment);
    Whitebox.setInternalState(writer, "input", this.recordReader);
    when(this.environment.getTaskConfiguration()).thenReturn(this.conf);

    when(this.conf.getString("outputPath", null)).thenReturn(this.file.toURI().toString());
    when(this.recordReader.hasNext()).thenReturn(true, true, true, false);
    StringRecord in = new StringRecord("abc");
    try {
      when(this.recordReader.next()).thenReturn(in);
    } catch (IOException e) {
      fail();
      e.printStackTrace();
    } catch (InterruptedException e) {
      fail();
      e.printStackTrace();
    }
    writer.invoke();

    final FileInputSplit split = new FileInputSplit(0, new Path(this.file.toURI().toString()), 0,
      this.file.length(), null);
    when(this.environment.getInputSplitProvider()).thenReturn(this.inputSplitProvider);
    when(this.inputSplitProvider.getNextInputSplit()).thenReturn(split, (FileInputSplit) null);
View Full Code Here

TOP

Related Classes of eu.stratosphere.nephele.util.FileLineWriter

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.