// Path: src/main/java/com/cloudera/knittingboar/io/InputRecordsSplit.java
// public class InputRecordsSplit {
//   
//   TextInputFormat input_format = null;
//   InputSplit split = null;
//   JobConf jobConf = null;
//   
//   RecordReader<LongWritable,Text> reader = null;
//   LongWritable key = null;
//   
//   final Reporter voidReporter = Reporter.NULL;
//   
//   public InputRecordsSplit(JobConf jobConf, InputSplit split)
//       throws IOException {
//     
//     this.jobConf = jobConf;
//     this.split = split;
//     this.input_format = new TextInputFormat();
//     
//     // RecordReader<LongWritable, Text> reader =
//     // format.getRecordReader(splits[x], job, reporter);
//     this.reader = input_format.getRecordReader(this.split, this.jobConf,
//         voidReporter);
//     this.key = reader.createKey();
//     // Text value = reader.createValue();
//     
//   }
//   
//   /**
//    * 
//    * just a dead simple way to do this
//    * 
//    * - functionality from TestTextInputFormat::readSplit()
//    * 
//    * If returns true, then csv_line contains the next line If returns false,
//    * then there is no next record
//    * 
//    * Will terminate when it hits the end of the split based on the information
//    * provided in the split class to the constructor and the TextInputFormat
//    * 
//    * @param csv_line
//    * @throws IOException
//    */
//   public boolean next(Text csv_line) throws IOException {
//     
//     return reader.next(key, csv_line);
//     
//   }
//   
//   public void ResetToStartOfSplit() throws IOException {
//     
//     // I'mma cheatin here. sue me.
//     this.reader = input_format.getRecordReader(this.split, this.jobConf,
//         voidReporter);
//     
//   }
//   
// }
// 
// Path: src/test/java/com/cloudera/knittingboar/utils/TestingUtils.java
// public class TestingUtils {
// 
//   public static void copyDecompressed(String resource, File output)
//       throws IOException {
//     URL input = Resources.getResource(resource);
//     ByteStreams.copy(new GZIPInputStream(input.openStream()),
//         new FileOutputStream(output));
//   }
// 
// }


import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.mahout.classifier.sgd.L1;
import org.apache.mahout.classifier.sgd.OnlineLogisticRegression;
import org.apache.mahout.math.DenseVector;
import org.apache.mahout.math.RandomAccessSparseVector;
import org.apache.mahout.math.Vector;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.cloudera.knittingboar.io.InputRecordsSplit;
import com.cloudera.knittingboar.utils.TestingUtils;
import com.google.common.io.Files;
/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cloudera.knittingboar.records;




public class TestTwentyNewsgroupsCustomRecordParseOLRRun {
  private static final Log LOG = LogFactory
      .getLog(TestTwentyNewsgroupsCustomRecordParseOLRRun.class.getName());

  private static final int FEATURES = 10000;

  private JobConf defaultConf;
  private FileSystem localFs;

  private File baseDir;
  private Path workDir;
  private String inputFileName;

  @Before
  public void setup() throws Exception {
    defaultConf = new JobConf();
    defaultConf.set("fs.defaultFS", "file:///");
    localFs = FileSystem.getLocal(defaultConf);
    inputFileName = "kboar-shard-0.txt";
    baseDir = Files.createTempDir();
    File inputFile = new File(baseDir, inputFileName);
// Path: src/main/java/com/cloudera/knittingboar/io/InputRecordsSplit.java
// public class InputRecordsSplit {
//   
//   TextInputFormat input_format = null;
//   InputSplit split = null;
//   JobConf jobConf = null;
//   
//   RecordReader<LongWritable,Text> reader = null;
//   LongWritable key = null;
//   
//   final Reporter voidReporter = Reporter.NULL;
//   
//   public InputRecordsSplit(JobConf jobConf, InputSplit split)
//       throws IOException {
//     
//     this.jobConf = jobConf;
//     this.split = split;
//     this.input_format = new TextInputFormat();
//     
//     // RecordReader<LongWritable, Text> reader =
//     // format.getRecordReader(splits[x], job, reporter);
//     this.reader = input_format.getRecordReader(this.split, this.jobConf,
//         voidReporter);
//     this.key = reader.createKey();
//     // Text value = reader.createValue();
//     
//   }
//   
//   /**
//    * 
//    * just a dead simple way to do this
//    * 
//    * - functionality from TestTextInputFormat::readSplit()
//    * 
//    * If returns true, then csv_line contains the next line If returns false,
//    * then there is no next record
//    * 
//    * Will terminate when it hits the end of the split based on the information
//    * provided in the split class to the constructor and the TextInputFormat
//    * 
//    * @param csv_line
//    * @throws IOException
//    */
//   public boolean next(Text csv_line) throws IOException {
//     
//     return reader.next(key, csv_line);
//     
//   }
//   
//   public void ResetToStartOfSplit() throws IOException {
//     
//     // I'mma cheatin here. sue me.
//     this.reader = input_format.getRecordReader(this.split, this.jobConf,
//         voidReporter);
//     
//   }
//   
// }
// 
// Path: src/test/java/com/cloudera/knittingboar/utils/TestingUtils.java
// public class TestingUtils {
// 
//   public static void copyDecompressed(String resource, File output)
//       throws IOException {
//     URL input = Resources.getResource(resource);
//     ByteStreams.copy(new GZIPInputStream(input.openStream()),
//         new FileOutputStream(output));
//   }
// 
// }


// Path: src/test/java/com/cloudera/knittingboar/records/TestTwentyNewsgroupsCustomRecordParseOLRRun.java
import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.mahout.classifier.sgd.L1;
import org.apache.mahout.classifier.sgd.OnlineLogisticRegression;
import org.apache.mahout.math.DenseVector;
import org.apache.mahout.math.RandomAccessSparseVector;
import org.apache.mahout.math.Vector;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.cloudera.knittingboar.io.InputRecordsSplit;
import com.cloudera.knittingboar.utils.TestingUtils;
import com.google.common.io.Files;

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cloudera.knittingboar.records;




public class TestTwentyNewsgroupsCustomRecordParseOLRRun {
  private static final Log LOG = LogFactory
      .getLog(TestTwentyNewsgroupsCustomRecordParseOLRRun.class.getName());

  private static final int FEATURES = 10000;

  private JobConf defaultConf;
  private FileSystem localFs;

  private File baseDir;
  private Path workDir;
  private String inputFileName;

  @Before
  public void setup() throws Exception {
    defaultConf = new JobConf();
    defaultConf.set("fs.defaultFS", "file:///");
    localFs = FileSystem.getLocal(defaultConf);
    inputFileName = "kboar-shard-0.txt";
    baseDir = Files.createTempDir();
    File inputFile = new File(baseDir, inputFileName);
    TestingUtils.copyDecompressed(inputFileName + ".gz", inputFile);