// Path: src/main/java/com/knewton/mapreduce/constant/PropertyConstants.java
// public enum PropertyConstants {
// 
//     /**
//      * The Keyspace Name for a data run
//      */
//     KEYSPACE_NAME("com.knewton.inputformat.cassandra.keyspace"),
//     /**
//      * Column family type needs to be set if the column family type is Super.
//      */
//     COLUMN_FAMILY_TYPE("com.knewton.cassandra.cftype"),
//     /**
//      * Comparator class name for columns.
//      */
//     COLUMN_COMPARATOR("com.knewton.cassandra.column.comparator"),
//     /**
//      * A nonstandard comparator requires a subcomparator
//      */
//     COLUMN_SUBCOMPARATOR("com.knewton.cassandra.column.subcomparator"),
//     /**
//      * Partitioner for decorating keys.
//      */
//     PARTITIONER("com.knewton.partitioner"),
//     /**
//      * True if the columns are sparse, false if they're dense.
//      */
//     SPARSE_COLUMN("com.knewton.column.sparse"),
//     /**
//      * Boolean variable. Set true if compression enabled.
//      */
//     COMPRESSION_ENABLED("com.knewton.cassandra.backup.compression"),
//     /**
//      * Buffer size for decompression operation.
//      */
//     DECOMPRESS_BUFFER("com.knewton.cassandra.backup.compress.buffersize"),
//     /**
//      * Start and end dates for student events processing
//      */
//     START_DATE("com.knewton.studentevents.date.start"),
//     END_DATE("com.knewton.studentevents.date.end"),
//     /**
//      * The Column Family Name for a data run
//      */
//     COLUMN_FAMILY_NAME("com.knewton.inputformat.cassandra.columnfamily"),
//     /**
//      * MapReduce run environment. Should be one of the enum values in MREnvironment.java
//      */
//     MAPREDUCE_ENVIRONMENT("com.knewton.mapreduce.environment"),
//     /**
//      * Name of serialization factory class
//      */
//     SERIALIZATION_FACTORY_PARAMETER("com.knewton.thrift.serialization.protocol");
// 
//     public final String txt;
// 
//     private PropertyConstants(String propertyName) {
//         this.txt = propertyName;
//     }
// }


import com.knewton.mapreduce.constant.PropertyConstants;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.task.JobContextImpl;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
        List<FileStatus> result = testListStatus(conf, "./src/test/resources/backup_input");
        assertEquals(NUM_TABLES * NUM_COLUMN_FAMILIES, result.size());
    }

    /**
     * Tests to see if when given an input directory the {@link SSTableInputFormat} correctly
     * expands all sub directories and picks up all the data tables corresponding to a specific
     * column family when a SNAP directory exists. The SST tables should be skipped.
     */
    @Test
    public void testListStatusWithColumnFamilyNameSkipSST() throws Exception {
        Job job = Job.getInstance(new Configuration(false));
        Configuration conf = job.getConfiguration();
        SSTableInputFormat.setColumnFamilyName("col_fam", job);
        List<FileStatus> result = testListStatus(conf, "./src/test/resources/backup_input");
        assertEquals(NUM_TABLES, result.size());
    }

    @Test
    public void testIsSplittable() {
        SSTableColumnInputFormat inputFormat = new SSTableColumnInputFormat();
        assertFalse(inputFormat.isSplitable(null, null));
    }

    @Test
    public void testSetComparatorClass() throws Exception {
        Job job = Job.getInstance(new Configuration(false));
        Configuration conf = job.getConfiguration();
        String comparator = "my_comparator";
        SSTableInputFormat.setComparatorClass(comparator, job);
// Path: src/main/java/com/knewton/mapreduce/constant/PropertyConstants.java
// public enum PropertyConstants {
// 
//     /**
//      * The Keyspace Name for a data run
//      */
//     KEYSPACE_NAME("com.knewton.inputformat.cassandra.keyspace"),
//     /**
//      * Column family type needs to be set if the column family type is Super.
//      */
//     COLUMN_FAMILY_TYPE("com.knewton.cassandra.cftype"),
//     /**
//      * Comparator class name for columns.
//      */
//     COLUMN_COMPARATOR("com.knewton.cassandra.column.comparator"),
//     /**
//      * A nonstandard comparator requires a subcomparator
//      */
//     COLUMN_SUBCOMPARATOR("com.knewton.cassandra.column.subcomparator"),
//     /**
//      * Partitioner for decorating keys.
//      */
//     PARTITIONER("com.knewton.partitioner"),
//     /**
//      * True if the columns are sparse, false if they're dense.
//      */
//     SPARSE_COLUMN("com.knewton.column.sparse"),
//     /**
//      * Boolean variable. Set true if compression enabled.
//      */
//     COMPRESSION_ENABLED("com.knewton.cassandra.backup.compression"),
//     /**
//      * Buffer size for decompression operation.
//      */
//     DECOMPRESS_BUFFER("com.knewton.cassandra.backup.compress.buffersize"),
//     /**
//      * Start and end dates for student events processing
//      */
//     START_DATE("com.knewton.studentevents.date.start"),
//     END_DATE("com.knewton.studentevents.date.end"),
//     /**
//      * The Column Family Name for a data run
//      */
//     COLUMN_FAMILY_NAME("com.knewton.inputformat.cassandra.columnfamily"),
//     /**
//      * MapReduce run environment. Should be one of the enum values in MREnvironment.java
//      */
//     MAPREDUCE_ENVIRONMENT("com.knewton.mapreduce.environment"),
//     /**
//      * Name of serialization factory class
//      */
//     SERIALIZATION_FACTORY_PARAMETER("com.knewton.thrift.serialization.protocol");
// 
//     public final String txt;
// 
//     private PropertyConstants(String propertyName) {
//         this.txt = propertyName;
//     }
// }


// Path: src/test/java/com/knewton/mapreduce/io/SSTableInputFormatTest.java
import com.knewton.mapreduce.constant.PropertyConstants;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.JobID;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.task.JobContextImpl;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

        List<FileStatus> result = testListStatus(conf, "./src/test/resources/backup_input");
        assertEquals(NUM_TABLES * NUM_COLUMN_FAMILIES, result.size());
    }

    /**
     * Tests to see if when given an input directory the {@link SSTableInputFormat} correctly
     * expands all sub directories and picks up all the data tables corresponding to a specific
     * column family when a SNAP directory exists. The SST tables should be skipped.
     */
    @Test
    public void testListStatusWithColumnFamilyNameSkipSST() throws Exception {
        Job job = Job.getInstance(new Configuration(false));
        Configuration conf = job.getConfiguration();
        SSTableInputFormat.setColumnFamilyName("col_fam", job);
        List<FileStatus> result = testListStatus(conf, "./src/test/resources/backup_input");
        assertEquals(NUM_TABLES, result.size());
    }

    @Test
    public void testIsSplittable() {
        SSTableColumnInputFormat inputFormat = new SSTableColumnInputFormat();
        assertFalse(inputFormat.isSplitable(null, null));
    }

    @Test
    public void testSetComparatorClass() throws Exception {
        Job job = Job.getInstance(new Configuration(false));
        Configuration conf = job.getConfiguration();
        String comparator = "my_comparator";
        SSTableInputFormat.setComparatorClass(comparator, job);
        assertEquals(comparator, conf.get(PropertyConstants.COLUMN_COMPARATOR.txt));