// Path: core/src/main/java/com/caseystella/analytics/DataPoint.java
// public class DataPoint {
//     private long timestamp;
//     private double value;
//     private Map<String, String> metadata;
//     private String source;
// 
//     public DataPoint() {
// 
//     }
// 
//     public DataPoint(long timestamp, double value, Map<String, String> metadata, String source) {
//         this.timestamp = timestamp;
//         this.value = value;
//         this.metadata = metadata;
//         this.source = source;
//     }
// 
//     public String getSource() {
//         return source;
//     }
// 
//     public void setSource(String source) {
//         this.source = source;
//     }
// 
// 
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(long timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     public double getValue() {
//         return value;
//     }
// 
//     public void setValue(double value) {
//         this.value = value;
//     }
// 
//     public Map<String, String> getMetadata() {
//         return metadata;
//     }
// 
//     public void setMetadata(Map<String, String> metadata) {
//         this.metadata = metadata;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         DataPoint dataPoint = (DataPoint) o;
// 
//         if (getTimestamp() != dataPoint.getTimestamp()) return false;
//         if (Double.compare(dataPoint.getValue(), getValue()) != 0) return false;
//         if (getMetadata() != null ? !getMetadata().equals(dataPoint.getMetadata()) : dataPoint.getMetadata() != null)
//             return false;
//         return source != null ? source.equals(dataPoint.source) : dataPoint.source == null;
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result;
//         long temp;
//         result = (int) (getTimestamp() ^ (getTimestamp() >>> 32));
//         temp = Double.doubleToLongBits(getValue());
//         result = 31 * result + (int) (temp ^ (temp >>> 32));
//         result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0);
//         result = 31 * result + (source != null ? source.hashCode() : 0);
//         return result;
//     }
//     @Override
//     public String toString() {
//         return "(" +
//                 "timestamp=" + timestamp +
//                 ", value=" + value +
//                 ", metadata=" + metadata +
//                 ", source=" + source+
//                 ')';
//     }
// 
// }


import com.caseystella.analytics.DataPoint;
import com.google.common.collect.Iterables;
import junit.framework.Assert;
import org.adrianwalker.multilinestring.Multiline;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
import java.text.SimpleDateFormat;
package com.caseystella.analytics.extractor;



public class ExtractorsTest {

    /**
     {
         "keyConverter" : "NOOP"
       , "valueConverter" : "CSVConverter"
       , "valueConverterConfig" : {
                                    "columnMap" : {
                                                  "sensor1_ts" : 0
                                                 ,"sensor1_value" : 1
                                                 ,"sensor2_ts" : 4
                                                 ,"sensor2_value" : 5
                                                 ,"plant_id" : 7
                                                  }
                                  }
       , "measurements" : [
            {
             "source" : "sensor_1"
            ,"timestampField" : "sensor1_ts"
            ,"measurementField" : "sensor1_value"
            ,"metadataFields" : [ "plant_id"]
            }
           ,{
             "source" : "sensor_2"
            ,"timestampField" : "sensor2_ts"
            ,"measurementField" : "sensor2_value"
            ,"metadataFields" : [ "plant_id"]
            }
                          ]
     }
     */
    @Multiline
    public static String extractorConfig;

    @Test
    public void testExtractor() throws Exception {
        Assert.assertNotNull(extractorConfig);
        DataPointExtractorConfig config = DataPointExtractorConfig.load(extractorConfig);
        DataPointExtractor extractor = new DataPointExtractor().withConfig(config);
        {
// Path: core/src/main/java/com/caseystella/analytics/DataPoint.java
// public class DataPoint {
//     private long timestamp;
//     private double value;
//     private Map<String, String> metadata;
//     private String source;
// 
//     public DataPoint() {
// 
//     }
// 
//     public DataPoint(long timestamp, double value, Map<String, String> metadata, String source) {
//         this.timestamp = timestamp;
//         this.value = value;
//         this.metadata = metadata;
//         this.source = source;
//     }
// 
//     public String getSource() {
//         return source;
//     }
// 
//     public void setSource(String source) {
//         this.source = source;
//     }
// 
// 
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(long timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     public double getValue() {
//         return value;
//     }
// 
//     public void setValue(double value) {
//         this.value = value;
//     }
// 
//     public Map<String, String> getMetadata() {
//         return metadata;
//     }
// 
//     public void setMetadata(Map<String, String> metadata) {
//         this.metadata = metadata;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         DataPoint dataPoint = (DataPoint) o;
// 
//         if (getTimestamp() != dataPoint.getTimestamp()) return false;
//         if (Double.compare(dataPoint.getValue(), getValue()) != 0) return false;
//         if (getMetadata() != null ? !getMetadata().equals(dataPoint.getMetadata()) : dataPoint.getMetadata() != null)
//             return false;
//         return source != null ? source.equals(dataPoint.source) : dataPoint.source == null;
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result;
//         long temp;
//         result = (int) (getTimestamp() ^ (getTimestamp() >>> 32));
//         temp = Double.doubleToLongBits(getValue());
//         result = 31 * result + (int) (temp ^ (temp >>> 32));
//         result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0);
//         result = 31 * result + (source != null ? source.hashCode() : 0);
//         return result;
//     }
//     @Override
//     public String toString() {
//         return "(" +
//                 "timestamp=" + timestamp +
//                 ", value=" + value +
//                 ", metadata=" + metadata +
//                 ", source=" + source+
//                 ')';
//     }
// 
// }


// Path: core/src/test/java/com/caseystella/analytics/extractor/ExtractorsTest.java
import com.caseystella.analytics.DataPoint;
import com.google.common.collect.Iterables;
import junit.framework.Assert;
import org.adrianwalker.multilinestring.Multiline;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
import java.text.SimpleDateFormat;

package com.caseystella.analytics.extractor;



public class ExtractorsTest {

    /**
     {
         "keyConverter" : "NOOP"
       , "valueConverter" : "CSVConverter"
       , "valueConverterConfig" : {
                                    "columnMap" : {
                                                  "sensor1_ts" : 0
                                                 ,"sensor1_value" : 1
                                                 ,"sensor2_ts" : 4
                                                 ,"sensor2_value" : 5
                                                 ,"plant_id" : 7
                                                  }
                                  }
       , "measurements" : [
            {
             "source" : "sensor_1"
            ,"timestampField" : "sensor1_ts"
            ,"measurementField" : "sensor1_value"
            ,"metadataFields" : [ "plant_id"]
            }
           ,{
             "source" : "sensor_2"
            ,"timestampField" : "sensor2_ts"
            ,"measurementField" : "sensor2_value"
            ,"metadataFields" : [ "plant_id"]
            }
                          ]
     }
     */
    @Multiline
    public static String extractorConfig;

    @Test
    public void testExtractor() throws Exception {
        Assert.assertNotNull(extractorConfig);
        DataPointExtractorConfig config = DataPointExtractorConfig.load(extractorConfig);
        DataPointExtractor extractor = new DataPointExtractor().withConfig(config);
        {
            Iterable<DataPoint> dataPoints = extractor.extract(Bytes.toBytes(0L), Bytes.toBytes("   #0,100,foo,bar,50,7,grok,plant_1,baz"), true);