// Path: src/main/java/com/knewton/mapreduce/io/SSTableInputFormat.java
// public static class DataTablePathFilter implements PathFilter {
// 
//     @Nullable
//     private String operatingCF;
// 
//     @Nullable
//     private String operatingKeyspace;
// 
//     public DataTablePathFilter(@Nullable String operatingCF,
//             @Nullable String operatingKeyspace) {
//         this.operatingCF = operatingCF;
//         this.operatingKeyspace = operatingKeyspace;
//     }
// 
//     public DataTablePathFilter() {
//         this(null, null);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public boolean accept(Path path) {
//         if (path == null) {
//             return false;
//         }
// 
//         // Try and get the component and the descriptor from the filename
//         Descriptor desc;
//         Component component;
//         try {
//             File parentFile = new File(path.getParent().toString());
//             Pair<Descriptor, Component> descCompPair = Component.fromFilename(parentFile,
//                                                                               path.getName());
//             desc = descCompPair.left;
//             component = descCompPair.right;
// 
//         } catch (RuntimeException e) {
//             return false;
//         }
// 
//         if (component != Component.DATA || desc.type.isTemporary) {
//             return false;
//         } else {
//             // these parameters are allowed to be null, but if set, we must match
//             return (operatingCF == null || desc.cfname.equals(operatingCF)) &&
//                     (operatingKeyspace == null || desc.ksname.equals(operatingKeyspace));
//         }
//     }
// }


import com.knewton.mapreduce.io.SSTableInputFormat.DataTablePathFilter;
import org.apache.hadoop.fs.Path;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
 * Copyright 2013, 2014, 2015 Knewton
 *
 * Licensed 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.knewton.mapreduce.io;




public class DataTablePathFilterTest {

    /**
     * Tests to see if the table path filter can correctly filter through the sstables and only get
     * the data tables.
     */
    @Test
    public void testDataTablePathFilter() {
// Path: src/main/java/com/knewton/mapreduce/io/SSTableInputFormat.java
// public static class DataTablePathFilter implements PathFilter {
// 
//     @Nullable
//     private String operatingCF;
// 
//     @Nullable
//     private String operatingKeyspace;
// 
//     public DataTablePathFilter(@Nullable String operatingCF,
//             @Nullable String operatingKeyspace) {
//         this.operatingCF = operatingCF;
//         this.operatingKeyspace = operatingKeyspace;
//     }
// 
//     public DataTablePathFilter() {
//         this(null, null);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public boolean accept(Path path) {
//         if (path == null) {
//             return false;
//         }
// 
//         // Try and get the component and the descriptor from the filename
//         Descriptor desc;
//         Component component;
//         try {
//             File parentFile = new File(path.getParent().toString());
//             Pair<Descriptor, Component> descCompPair = Component.fromFilename(parentFile,
//                                                                               path.getName());
//             desc = descCompPair.left;
//             component = descCompPair.right;
// 
//         } catch (RuntimeException e) {
//             return false;
//         }
// 
//         if (component != Component.DATA || desc.type.isTemporary) {
//             return false;
//         } else {
//             // these parameters are allowed to be null, but if set, we must match
//             return (operatingCF == null || desc.cfname.equals(operatingCF)) &&
//                     (operatingKeyspace == null || desc.ksname.equals(operatingKeyspace));
//         }
//     }
// }


// Path: src/test/java/com/knewton/mapreduce/io/DataTablePathFilterTest.java
import com.knewton.mapreduce.io.SSTableInputFormat.DataTablePathFilter;
import org.apache.hadoop.fs.Path;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * Copyright 2013, 2014, 2015 Knewton
 *
 * Licensed 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.knewton.mapreduce.io;




public class DataTablePathFilterTest {

    /**
     * Tests to see if the table path filter can correctly filter through the sstables and only get
     * the data tables.
     */
    @Test
    public void testDataTablePathFilter() {
        DataTablePathFilter pathFilter = new DataTablePathFilter();