incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [16/51] [partial] Initial repackage to org.apache.
Date Mon, 03 Sep 2012 03:17:11 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/search/RandomSuperQueryTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/search/RandomSuperQueryTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/search/RandomSuperQueryTest.java
deleted file mode 100644
index c716e68..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/search/RandomSuperQueryTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.nearinfinity.blur.search;
-
-/**
- * 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.
- */
-
-import static com.nearinfinity.blur.lucene.LuceneConstant.LUCENE_VERSION;
-import static junit.framework.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Random;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWrapperFilter;
-import org.apache.lucene.search.TopDocs;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.store.RAMDirectory;
-import org.junit.Test;
-
-import com.nearinfinity.blur.analysis.BlurAnalyzer;
-import com.nearinfinity.blur.index.IndexWriter;
-import com.nearinfinity.blur.lucene.search.SuperParser;
-import com.nearinfinity.blur.thrift.generated.Column;
-import com.nearinfinity.blur.thrift.generated.Record;
-import com.nearinfinity.blur.thrift.generated.Row;
-import com.nearinfinity.blur.thrift.generated.ScoreType;
-import com.nearinfinity.blur.utils.RowIndexWriter;
-
-public class RandomSuperQueryTest {
-
-  private static final int MOD_COLS_USED_FOR_SKIPPING = 3;
-  private static final int MAX_NUM_OF_DOCS = 10000;// 10000
-  private static final int MIN_NUM_COL_FAM = 3;// 3
-  private static final int MAX_NUM_COL_FAM = 20;// 20
-  private static final int MAX_NUM_DOCS_PER_COL_FAM = 25;// 25
-  private static final int MAX_NUM_COLS = 21;// 21
-  private static final int MIN_NUM_COLS = 3;// 3
-  private static final int MAX_NUM_OF_WORDS = 1000;
-  private static final int MOD_USED_FOR_SAMPLING = 1;//
-
-  private Random seedGen = new Random(1);
-
-  @Test
-  public void testRandomSuperQuery() throws CorruptIndexException, IOException, InterruptedException, ParseException {
-    long seed = seedGen.nextLong();
-
-    Filter filter = new QueryWrapperFilter(new MatchAllDocsQuery());
-
-    Random random = new Random(seed);
-    Collection<String> sampler = new HashSet<String>();
-    System.out.print("Creating index... ");
-    System.out.flush();
-    Directory directory = createIndex(random, sampler);
-    IndexReader reader = IndexReader.open(directory);
-    System.out.print("Running searches [" + sampler.size() + "]... ");
-    System.out.flush();
-    assertTrue(!sampler.isEmpty());
-    IndexSearcher searcher = new IndexSearcher(reader);
-    long s = System.currentTimeMillis();
-    for (String str : sampler) {
-      Query query = new SuperParser(LUCENE_VERSION, new StandardAnalyzer(LUCENE_VERSION), true, filter, ScoreType.AGGREGATE).parse(str);
-      TopDocs topDocs = searcher.search(query, 10);
-      assertTrue("seed [" + seed + "] {" + query + "} {" + s + "}", topDocs.totalHits > 0);
-    }
-    long e = System.currentTimeMillis();
-    System.out.println("Finished in [" + (e - s) + "] ms");
-  }
-
-  private Directory createIndex(Random random, Collection<String> sampler) throws CorruptIndexException, LockObtainFailedException, IOException {
-    Directory directory = new RAMDirectory();
-    String[] columnFamilies = genWords(random, MIN_NUM_COL_FAM, MAX_NUM_COL_FAM, "colfam");
-    Map<String, String[]> columns = new HashMap<String, String[]>();
-    for (int i = 0; i < columnFamilies.length; i++) {
-      columns.put(columnFamilies[i], genWords(random, MIN_NUM_COLS, MAX_NUM_COLS, "col"));
-    }
-    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(LUCENE_VERSION, new StandardAnalyzer(LUCENE_VERSION)));
-    RowIndexWriter indexWriter = new RowIndexWriter(writer, new BlurAnalyzer(new StandardAnalyzer(LUCENE_VERSION)));
-    int numberOfDocs = random.nextInt(MAX_NUM_OF_DOCS) + 1;
-    for (int i = 0; i < numberOfDocs; i++) {
-      indexWriter.replace(false, generatSuperDoc(random, columns, sampler));
-    }
-    writer.close();
-    return directory;
-  }
-
-  private String[] genWords(Random random, int min, int max, String prefix) {
-    int numberOfColFam = random.nextInt(max - min) + min;
-    String[] str = new String[numberOfColFam];
-    for (int i = 0; i < numberOfColFam; i++) {
-      str[i] = genWord(random, prefix);
-    }
-    return str;
-  }
-
-  private Row generatSuperDoc(Random random, Map<String, String[]> columns, Collection<String> sampler) {
-    Row row = new Row().setId(Long.toString(random.nextLong()));
-    StringBuilder builder = new StringBuilder();
-    for (String colFam : columns.keySet()) {
-      String[] cols = columns.get(colFam);
-      for (int i = 0; i < random.nextInt(MAX_NUM_DOCS_PER_COL_FAM); i++) {
-        Record record = new Record();
-        record.setFamily(colFam);
-        record.setRecordId(Long.toString(random.nextLong()));
-        int staringLength = builder.length();
-        for (String column : cols) {
-          if (random.nextInt() % MOD_COLS_USED_FOR_SKIPPING == 0) {
-            String word = genWord(random, "word");
-            record.addToColumns(new Column(column, word));
-            if (random.nextInt() % MOD_USED_FOR_SAMPLING == 0) {
-              builder.append(" +" + colFam + "." + column + ":" + word);
-            }
-          }
-        }
-        if (builder.length() != staringLength) {
-          builder.append(" nojoin.nojoin ");
-        }
-        row.addToRecords(record);
-      }
-    }
-    String string = builder.toString().trim();
-    if (!string.isEmpty()) {
-      sampler.add(string);
-    }
-    return row;
-  }
-
-  private String genWord(Random random, String prefix) {
-    return prefix + random.nextInt(MAX_NUM_OF_WORDS);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/search/SuperQueryTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/search/SuperQueryTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/search/SuperQueryTest.java
deleted file mode 100644
index 0dbaf84..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/search/SuperQueryTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package com.nearinfinity.blur.search;
-
-/**
- * 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.
- */
-
-import static com.nearinfinity.blur.lucene.LuceneConstant.LUCENE_VERSION;
-import static com.nearinfinity.blur.utils.BlurConstants.PRIME_DOC;
-import static com.nearinfinity.blur.utils.BlurConstants.PRIME_DOC_VALUE;
-import static com.nearinfinity.blur.utils.BlurConstants.ROW_ID;
-import static com.nearinfinity.blur.utils.BlurUtil.newColumn;
-import static com.nearinfinity.blur.utils.BlurUtil.newRecord;
-import static com.nearinfinity.blur.utils.BlurUtil.newRow;
-import static junit.framework.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLongArray;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.TopDocs;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.store.RAMDirectory;
-import org.junit.Test;
-
-import com.nearinfinity.blur.analysis.BlurAnalyzer;
-import com.nearinfinity.blur.index.IndexWriter;
-import com.nearinfinity.blur.lucene.search.FacetQuery;
-import com.nearinfinity.blur.lucene.search.SuperQuery;
-import com.nearinfinity.blur.thrift.generated.ScoreType;
-import com.nearinfinity.blur.utils.RowIndexWriter;
-
-public class SuperQueryTest {
-
-  private static final String PERSON_NAME = "person.name";
-  private static final String ADDRESS_STREET = "address.street";
-
-  private static final String STREET = "street";
-  private static final String ADDRESS = "address";
-  private static final String PERSON = "person";
-  private static final String NAME = "name";
-
-  private static final String NAME1 = "jon";
-  private static final String NAME2 = "jane";
-  private static final String STREET2 = "main st";
-  private static final String STREET1 = "main";
-
-  @Test
-  public void testSimpleSuperQuery() throws CorruptIndexException, IOException, InterruptedException {
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(new TermQuery(new Term(PERSON_NAME, NAME1))), Occur.MUST);
-    booleanQuery.add(wrapSuper(new TermQuery(new Term(ADDRESS_STREET, STREET1))), Occur.MUST);
-
-    Directory directory = createIndex();
-    IndexReader reader = IndexReader.open(directory);
-    printAll(new Term(PERSON_NAME, NAME1), reader);
-    printAll(new Term(ADDRESS_STREET, STREET1), reader);
-    printAll(new Term(PRIME_DOC, PRIME_DOC_VALUE), reader);
-    IndexSearcher searcher = new IndexSearcher(reader);
-    TopDocs topDocs = searcher.search(booleanQuery, 10);
-    assertEquals(2, topDocs.totalHits);
-    assertEquals("1", searcher.doc(topDocs.scoreDocs[0].doc).get(ROW_ID));
-    assertEquals("3", searcher.doc(topDocs.scoreDocs[1].doc).get(ROW_ID));
-  }
-
-  @Test
-  public void testAggregateScoreTypes() throws Exception {
-    IndexSearcher searcher = createSearcher();
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(PERSON_NAME, NAME1, ScoreType.AGGREGATE), Occur.SHOULD);
-    booleanQuery.add(wrapSuper(ADDRESS_STREET, STREET1, ScoreType.AGGREGATE), Occur.MUST);
-    TopDocs topDocs = searcher.search(booleanQuery, 10);
-    printTopDocs(topDocs);
-    assertEquals(3, topDocs.totalHits);
-    assertEquals(3.30, topDocs.scoreDocs[0].score, 0.01);
-    assertEquals(2.20, topDocs.scoreDocs[1].score, 0.01);
-    assertEquals(0.55, topDocs.scoreDocs[2].score, 0.01);
-  }
-
-  @Test
-  public void testBestScoreTypes() throws Exception {
-    IndexSearcher searcher = createSearcher();
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(PERSON_NAME, NAME1, ScoreType.BEST), Occur.SHOULD);
-    booleanQuery.add(wrapSuper(ADDRESS_STREET, STREET1, ScoreType.BEST), Occur.MUST);
-    TopDocs topDocs = searcher.search(booleanQuery, 10);
-    assertEquals(3, topDocs.totalHits);
-    printTopDocs(topDocs);
-    assertEquals(2.20, topDocs.scoreDocs[0].score, 0.01);
-    assertEquals(2.20, topDocs.scoreDocs[1].score, 0.01);
-    assertEquals(0.55, topDocs.scoreDocs[2].score, 0.01);
-  }
-
-  private void printTopDocs(TopDocs topDocs) {
-    for (int i = 0; i < topDocs.totalHits; i++) {
-      System.out.println("doc " + i + " score " + topDocs.scoreDocs[i].score);
-    }
-
-  }
-
-  @Test
-  public void testConstantScoreTypes() throws Exception {
-    IndexSearcher searcher = createSearcher();
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(PERSON_NAME, NAME1, ScoreType.CONSTANT), Occur.SHOULD);
-    booleanQuery.add(wrapSuper(ADDRESS_STREET, STREET1, ScoreType.CONSTANT), Occur.MUST);
-    TopDocs topDocs = searcher.search(booleanQuery, 10);
-    assertEquals(3, topDocs.totalHits);
-    printTopDocs(topDocs);
-    assertEquals(2.0, topDocs.scoreDocs[0].score, 0.01);
-    assertEquals(2.0, topDocs.scoreDocs[1].score, 0.01);
-    assertEquals(0.5, topDocs.scoreDocs[2].score, 0.01);
-  }
-
-  @Test
-  public void testSuperScoreTypes() throws Exception {
-    IndexSearcher searcher = createSearcher();
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(PERSON_NAME, NAME1, ScoreType.SUPER), Occur.SHOULD);
-    booleanQuery.add(wrapSuper(ADDRESS_STREET, STREET1, ScoreType.SUPER), Occur.MUST);
-    TopDocs topDocs = searcher.search(booleanQuery, 10);
-    assertEquals(3, topDocs.totalHits);
-    printTopDocs(topDocs);
-    assertEquals(3.10, topDocs.scoreDocs[0].score, 0.01);
-    assertEquals(3.00, topDocs.scoreDocs[1].score, 0.01);
-    assertEquals(0.75, topDocs.scoreDocs[2].score, 0.01);
-  }
-
-  @Test
-  public void testSuperScoreTypesWithFacet() throws Exception {
-    IndexSearcher searcher = createSearcher();
-    BooleanQuery booleanQuery = new BooleanQuery();
-    booleanQuery.add(wrapSuper(PERSON_NAME, NAME1, ScoreType.SUPER), Occur.SHOULD);
-    booleanQuery.add(wrapSuper(ADDRESS_STREET, STREET1, ScoreType.SUPER), Occur.MUST);
-
-    BooleanQuery f1 = new BooleanQuery();
-    f1.add(new TermQuery(new Term(PERSON_NAME, NAME1)), Occur.MUST);
-    f1.add(new TermQuery(new Term(PERSON_NAME, NAME2)), Occur.MUST);
-
-    Query[] facets = new Query[] { new SuperQuery(f1, ScoreType.CONSTANT) };
-    AtomicLongArray counts = new AtomicLongArray(facets.length);
-    FacetQuery query = new FacetQuery(booleanQuery, facets, counts);
-
-    TopDocs topDocs = searcher.search(query, 10);
-    assertEquals(3, topDocs.totalHits);
-    printTopDocs(topDocs);
-    assertEquals(3.10, topDocs.scoreDocs[0].score, 0.01);
-    assertEquals(3.00, topDocs.scoreDocs[1].score, 0.01);
-    assertEquals(0.75, topDocs.scoreDocs[2].score, 0.01);
-  }
-
-  private void printAll(Term term, IndexReader reader) throws IOException {
-    TermDocs termDocs = reader.termDocs(term);
-    while (termDocs.next()) {
-      System.out.println(term + "=>" + termDocs.doc());
-    }
-  }
-
-  private static IndexSearcher createSearcher() throws Exception {
-    Directory directory = createIndex();
-    IndexReader reader = IndexReader.open(directory);
-    return new IndexSearcher(reader);
-  }
-
-  public static Directory createIndex() throws CorruptIndexException, LockObtainFailedException, IOException {
-    Directory directory = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(LUCENE_VERSION, new StandardAnalyzer(LUCENE_VERSION)));
-    BlurAnalyzer analyzer = new BlurAnalyzer(new StandardAnalyzer(LUCENE_VERSION));
-    RowIndexWriter indexWriter = new RowIndexWriter(writer, analyzer);
-    indexWriter.replace(
-        false,
-        newRow("1", newRecord(PERSON, UUID.randomUUID().toString(), newColumn(NAME, NAME1)), newRecord(PERSON, UUID.randomUUID().toString(), newColumn(NAME, NAME1)),
-            newRecord(ADDRESS, UUID.randomUUID().toString(), newColumn(STREET, STREET1))));
-    indexWriter.replace(false,
-        newRow("2", newRecord(PERSON, UUID.randomUUID().toString(), newColumn(NAME, NAME2)), newRecord(ADDRESS, UUID.randomUUID().toString(), newColumn(STREET, STREET1))));
-    indexWriter.replace(false,
-        newRow("3", newRecord(PERSON, UUID.randomUUID().toString(), newColumn(NAME, NAME1)), newRecord(ADDRESS, UUID.randomUUID().toString(), newColumn(STREET, STREET2))));
-    ;
-    writer.close();
-    return directory;
-  }
-
-  private Query wrapSuper(Query query) {
-    return new SuperQuery(query, ScoreType.AGGREGATE);
-  }
-
-  private Query wrapSuper(String field, String value, ScoreType scoreType) {
-    return new SuperQuery(new TermQuery(new Term(field, value)), scoreType);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/search/TestingPagingCollector.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/search/TestingPagingCollector.java b/src/blur-core/src/test/java/com/nearinfinity/blur/search/TestingPagingCollector.java
deleted file mode 100644
index 3497397..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/search/TestingPagingCollector.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.nearinfinity.blur.search;
-
-/**
- * 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.
- */
-
-import static com.nearinfinity.blur.lucene.LuceneConstant.LUCENE_VERSION;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.lucene.analysis.KeywordAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.store.RAMDirectory;
-import org.junit.Test;
-
-import com.nearinfinity.blur.lucene.search.IterablePaging;
-import com.nearinfinity.blur.lucene.search.IterablePaging.ProgressRef;
-import com.nearinfinity.blur.lucene.search.IterablePaging.TotalHitsRef;
-
-/**
- * Testing the paging collector.
- * 
- * @author Aaron McCurry
- */
-public class TestingPagingCollector {
-
-  @Test
-  public void testNothingYet() {
-
-  }
-
-  public static void main(String[] args) throws Exception {
-    IndexReader reader = getReaderFlatScore(13245);
-    IndexSearcher searcher = new IndexSearcher(reader);
-
-    TotalHitsRef totalHitsRef = new TotalHitsRef();
-    ProgressRef progressRef = new ProgressRef();
-
-    TermQuery query = new TermQuery(new Term("f1", "value"));
-    IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100);
-
-    for (ScoreDoc sd : paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef)) {
-
-      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] " + "searches [" + progressRef.searchesPerformed() + "] "
-          + "position [" + progressRef.currentHitPosition() + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
-    }
-  }
-
-  private static IndexReader getReaderFlatScore(int length) throws Exception {
-    RAMDirectory directory = new RAMDirectory();
-    IndexWriter indexWriter = new IndexWriter(directory, new IndexWriterConfig(LUCENE_VERSION, new KeywordAnalyzer()));
-    for (int i = 0; i < length; i++) {
-      Document document = new Document();
-      document.add(new Field("f1", "value", Store.NO, Index.ANALYZED_NO_NORMS));
-      indexWriter.addDocument(document);
-    }
-    indexWriter.close();
-    return IndexReader.open(directory);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
deleted file mode 100644
index 2ae8b37..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurClusterTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.nearinfinity.blur.thrift;
-
-/**
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.thrift.TException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.nearinfinity.blur.MiniCluster;
-import com.nearinfinity.blur.thrift.generated.Blur;
-import com.nearinfinity.blur.thrift.generated.Blur.Iface;
-import com.nearinfinity.blur.thrift.generated.BlurException;
-import com.nearinfinity.blur.thrift.generated.BlurQuery;
-import com.nearinfinity.blur.thrift.generated.BlurResults;
-import com.nearinfinity.blur.thrift.generated.RecordMutation;
-import com.nearinfinity.blur.thrift.generated.RowMutation;
-import com.nearinfinity.blur.thrift.generated.SimpleQuery;
-import com.nearinfinity.blur.thrift.generated.TableDescriptor;
-import com.nearinfinity.blur.utils.BlurUtil;
-
-public class BlurClusterTest {
-
-  @BeforeClass
-  public static void startCluster() {
-    MiniCluster.startBlurCluster("./tmp/cluster", 2, 3);
-  }
-
-  @AfterClass
-  public static void shutdownCluster() {
-    MiniCluster.shutdownBlurCluster();
-  }
-
-  @Test
-  public void testCreateTable() throws BlurException, TException, IOException {
-    Blur.Iface client = getClient();
-    TableDescriptor tableDescriptor = new TableDescriptor();
-    tableDescriptor.setName("test");
-    tableDescriptor.setShardCount(5);
-    tableDescriptor.setTableUri(MiniCluster.getFileSystemUri().toString() + "/blur/test");
-    client.createTable(tableDescriptor);
-    List<String> tableList = client.tableList();
-    assertEquals(Arrays.asList("test"), tableList);
-  }
-
-  private Iface getClient() {
-    return BlurClient.getClient(MiniCluster.getControllerConnectionStr());
-  }
-
-  @Test
-  public void testLoadTable() throws BlurException, TException, InterruptedException {
-    Iface client = getClient();
-    int length = 100;
-    List<RowMutation> mutations = new ArrayList<RowMutation>();
-    for (int i = 0; i < length; i++) {
-      String rowId = UUID.randomUUID().toString();
-      RecordMutation mutation = BlurUtil.newRecordMutation("test", rowId, BlurUtil.newColumn("test", "value"));
-      RowMutation rowMutation = BlurUtil.newRowMutation("test", rowId, mutation);
-      rowMutation.setWaitToBeVisible(true);
-      mutations.add(rowMutation);
-    }
-    client.mutateBatch(mutations);
-    BlurQuery blurQuery = new BlurQuery();
-    SimpleQuery simpleQuery = new SimpleQuery();
-    simpleQuery.setQueryStr("test.test:value");
-    blurQuery.setSimpleQuery(simpleQuery);
-    BlurResults results = client.query("test", blurQuery);
-    assertEquals(length, results.getTotalResults());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurControllerServerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurControllerServerTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurControllerServerTest.java
deleted file mode 100644
index 87c1fd6..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurControllerServerTest.java
+++ /dev/null
@@ -1,334 +0,0 @@
-package com.nearinfinity.blur.thrift;
-
-/**
- * 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.
- */
-
-import org.junit.Test;
-
-public class BlurControllerServerTest {
-
-  @Test
-  public void testNothing() {
-    // do nothing
-  }
-
-  // private static final String TABLE = "test";
-  // private static Map<String, Iface> shardServers = new HashMap<String,
-  // Iface>();
-  // private static BlurControllerServer server;
-  // private static Thread daemonService;
-  //
-  // @BeforeClass
-  // public static void zkServerStartup() throws InterruptedException,
-  // KeeperException, IOException, BlurException, TException {
-  // rm(new File("../zk-tmp"));
-  // daemonService = new Thread(new Runnable() {
-  // @Override
-  // public void run() {
-  // QuorumPeerMain.main(new
-  // String[]{"./src/test/resources/com/nearinfinity/blur/thrift/zoo.cfg"});
-  // }
-  // });
-  // daemonService.start();
-  // Thread.sleep(1000);
-  //
-  // ZooKeeper zookeeper = new ZooKeeper("127.0.0.1:10101", 30000, new Watcher()
-  // {
-  // @Override
-  // public void process(WatchedEvent event) {
-  //
-  // }
-  // });
-  //
-  // addShardServer("shard-00000000");
-  // addShardServer("shard-00000001");
-  // addShardServer("shard-00000002");
-  // BlurQueryChecker queryChecker = new BlurQueryChecker(new
-  // BlurConfiguration());
-  // server = new BlurControllerServer();
-  // server.setClient(getClient());
-  // server.setClusterStatus(new ZookeeperClusterStatus(zookeeper));
-  // server.setQueryChecker(queryChecker);
-  // server.setZookeeper(zookeeper);
-  // server.init();
-  //
-  // File file = new File("./tmp-data/test");
-  // rm(file);
-  //
-  // TableDescriptor tableDescriptor = new TableDescriptor();
-  // tableDescriptor.name = "test";
-  // tableDescriptor.shardCount = 3;
-  // tableDescriptor.tableUri = file.toURI().toString();
-  // tableDescriptor.analyzerDefinition = new AnalyzerDefinition();
-  // server.createTable(tableDescriptor);
-  // }
-  //
-  // @AfterClass
-  // public static void zkServerShutdown() {
-  // daemonService.interrupt();
-  // server.close();
-  // }
-  //
-  // private static void rm(File file) {
-  // if (file.isDirectory()) {
-  // for (File f : file.listFiles()) {
-  // rm(f);
-  // }
-  // }
-  // file.delete();
-  // }
-  //
-  // @Test
-  // public void testQuery() throws BlurException, TException {
-  // BlurQuery blurQuery = new BlurQuery();
-  // blurQuery.maxQueryTime = TimeUnit.SECONDS.toMillis(5);
-  // blurQuery.minimumNumberOfResults = Long.MAX_VALUE;
-  // BlurResults results = server.query(TABLE, blurQuery);
-  // assertNotNull(results);
-  // }
-  //
-  // @Test
-  // public void testQueryWithFacets() throws BlurException, TException {
-  // BlurQuery blurQuery = new BlurQuery();
-  // blurQuery.maxQueryTime = TimeUnit.SECONDS.toMillis(5);
-  // blurQuery.minimumNumberOfResults = Long.MAX_VALUE;
-  // blurQuery.facets = new ArrayList<Facet>();
-  // blurQuery.facets.add(new Facet());
-  // blurQuery.facets.add(new Facet());
-  // BlurResults results = server.query(TABLE, blurQuery);
-  // assertNotNull(results);
-  // assertNotNull(results.facetCounts);
-  // for (int i = 0; i < results.facetCounts.size(); i++) {
-  // long count = results.facetCounts.get(i);
-  // assertEquals(shardServers.size() * (i + 1), count);
-  // }
-  // }
-  //
-  // @Test
-  // public void testRecordFrequency() throws BlurException, TException {
-  // long recordFrequency = server.recordFrequency(TABLE, "cf", "cn", "value");
-  // assertEquals(shardServers.size(), recordFrequency);
-  // }
-  //
-  // @Test
-  // public void testMutate() throws BlurException, TException {
-  // RowMutation mutation = new RowMutation();
-  // mutation.setRowId("1234");
-  // RecordMutation recMut = new RecordMutation();
-  // Record record = new Record();
-  // record.setFamily("test");
-  // record.setRecordId("5678");
-  // record.addToColumns(new Column("name", "value"));
-  // mutation.addToRecordMutations(recMut);
-  // mutation.table = TABLE;
-  // server.mutate(mutation);
-  //
-  // Selector selector = new Selector();
-  // selector.rowId = "1234";
-  //
-  // FetchResult fetchRow = server.fetchRow(TABLE, selector);
-  // assertNotNull(fetchRow.rowResult);
-  // }
-  //
-  // private static BlurClient getClient() {
-  // BlurClientEmbedded blurClientEmbedded = new BlurClientEmbedded();
-  // for (String node : shardServers.keySet()) {
-  // blurClientEmbedded.putNode(node, shardServers.get(node));
-  // }
-  // return blurClientEmbedded;
-  // }
-  //
-  // private static Iface getShardServer(final String node) {
-  // return new Iface() {
-  //
-  // private Map<String, Map<String, Row>> rows = new HashMap<String,
-  // Map<String, Row>>();
-  //
-  // @Override
-  // public List<String> terms(String arg0, String arg1, String arg2, String
-  // arg3, short arg4) throws BlurException, TException {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // @Override
-  // public List<String> tableList() throws BlurException, TException {
-  // List<String> table = new ArrayList<String>();
-  // table.add(TABLE);
-  // return table;
-  // }
-  //
-  // @Override
-  // public List<String> shardServerList(String cluster) throws BlurException,
-  // TException {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // @Override
-  // public Map<String, String> shardServerLayout(String table) throws
-  // BlurException, TException {
-  // Map<String, String> layout = new HashMap<String, String>();
-  // layout.put(node, node);
-  // return layout;
-  // }
-  //
-  // @Override
-  // public BlurResults query(String table, BlurQuery query) throws
-  // BlurException, TException {
-  // BlurResults results = new BlurResults();
-  // results.putToShardInfo(node, 0);
-  // results.setFacetCounts(getFacetCounts(query));
-  // return results;
-  // }
-  //
-  // private List<Long> getFacetCounts(BlurQuery query) {
-  // if (query.facets != null) {
-  // int size = query.facets.size();
-  // List<Long> results = new ArrayList<Long>();
-  // for (int i = 0; i < size; i++) {
-  // results.add(i + 1L);
-  // }
-  // return results;
-  // }
-  // return null;
-  // }
-  //
-  // @Override
-  // public Schema schema(String arg0) throws BlurException, TException {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // @Override
-  // public long recordFrequency(String arg0, String arg1, String arg2, String
-  // arg3) throws BlurException, TException {
-  // return 1l;
-  // }
-  //
-  // @Override
-  // public FetchResult fetchRow(String table, Selector selector) throws
-  // BlurException, TException {
-  // Map<String, Row> map = rows.get(table);
-  // Row row = map.get(selector.rowId);
-  // FetchResult fetchResult = new FetchResult();
-  // fetchResult.setRowResult(new FetchRowResult(row));
-  // return fetchResult;
-  // }
-  //
-  // @Override
-  // public TableDescriptor describe(String arg0) throws BlurException,
-  // TException {
-  // TableDescriptor descriptor = new TableDescriptor();
-  // descriptor.isEnabled = true;
-  // descriptor.shardCount = 3;
-  // return descriptor;
-  // }
-  //
-  // @Override
-  // public List<BlurQueryStatus> currentQueries(String arg0) throws
-  // BlurException, TException {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // @Override
-  // public List<String> controllerServerList() throws BlurException, TException
-  // {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // @Override
-  // public void cancelQuery(String table, long arg0) throws BlurException,
-  // TException {
-  // throw new RuntimeException("no impl");
-  // }
-  //
-  // private Row toRow(RowMutation mutation) {
-  // Row row = new Row();
-  // row.id = mutation.rowId;
-  // row.records = toRecords(mutation.recordMutations);
-  // return row;
-  // }
-  //
-  // private List<Record> toRecords(List<RecordMutation> recordMutations) {
-  // List<Record> records = new ArrayList<Record>();
-  // for (RecordMutation mutation : recordMutations) {
-  // records.add(mutation.record);
-  // }
-  // return records;
-  // }
-  //
-  // @Override
-  // public void createTable(TableDescriptor tableDescriptor) throws
-  // BlurException, TException {
-  // throw new RuntimeException("not impl");
-  // }
-  //
-  // @Override
-  // public void disableTable(String table) throws BlurException, TException {
-  // throw new RuntimeException("not impl");
-  // }
-  //
-  // @Override
-  // public void enableTable(String table) throws BlurException, TException {
-  // throw new RuntimeException("not impl");
-  // }
-  //
-  // @Override
-  // public void removeTable(String table, boolean deleteIndexFiles) throws
-  // BlurException, TException {
-  // throw new RuntimeException("not impl");
-  // }
-  //
-  // @Override
-  // public TableStats getTableStats(String table) throws BlurException,
-  // TException {
-  // return new TableStats();
-  // }
-  //
-  // @Override
-  // public void mutate(RowMutation mutation) throws BlurException, TException {
-  // String table = mutation.table;
-  // Map<String, Row> map = rows.get(table);
-  // if (map == null) {
-  // map = new HashMap<String, Row>();
-  // rows.put(table, map);
-  // }
-  // Row row = toRow(mutation);
-  // map.put(row.id, row);
-  // }
-  //
-  // @Override
-  // public void mutateBatch(List<RowMutation> mutations) throws BlurException,
-  // TException {
-  // for (RowMutation mutation : mutations) {
-  // MutationHelper.validateMutation(mutation);
-  // }
-  // for (RowMutation mutation : mutations) {
-  // mutate(mutation);
-  // }
-  // }
-  //
-  // @Override
-  // public List<String> shardClusterList() throws BlurException, TException {
-  // throw new RuntimeException("no impl");
-  // }
-  // };
-  // }
-  //
-  // private static void addShardServer(String node) {
-  // shardServers.put(node, getShardServer(node));
-  // }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurShardServerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurShardServerTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurShardServerTest.java
deleted file mode 100644
index 004f043..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/BlurShardServerTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.nearinfinity.blur.thrift;
-
-/**
- * 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.
- */
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-
-import org.apache.hadoop.io.compress.CompressionCodec;
-import org.apache.lucene.search.Similarity;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.nearinfinity.blur.analysis.BlurAnalyzer;
-import com.nearinfinity.blur.manager.IndexManager;
-import com.nearinfinity.blur.manager.IndexServer;
-import com.nearinfinity.blur.manager.writer.BlurIndex;
-
-public class BlurShardServerTest {
-
-  private BlurShardServer blurShardServer;
-
-  @Before
-  public void setUp() {
-    IndexServer indexServer = getIndexServer();
-    IndexManager indexManager = getIndexManager();
-    indexManager.setIndexServer(indexServer);
-    indexManager.setThreadCount(1);
-    indexManager.init();
-    blurShardServer = new BlurShardServer();
-    blurShardServer.setIndexManager(indexManager);
-    blurShardServer.setIndexServer(indexServer);
-    blurShardServer.init();
-  }
-
-  @After
-  public void tearDown() throws InterruptedException {
-    blurShardServer.close();
-  }
-
-  @Test
-  public void testNothingYet() {
-
-  }
-
-  private IndexServer getIndexServer() {
-    return new IndexServer() {
-
-      @Override
-      public void close() {
-
-      }
-
-      @Override
-      public BlurAnalyzer getAnalyzer(String table) {
-        throw new RuntimeException("not impl");
-      }
-
-      @Override
-      public Map<String, BlurIndex> getIndexes(String table) throws IOException {
-        throw new RuntimeException("not impl");
-      }
-
-      @Override
-      public List<String> getShardList(String table) {
-        throw new RuntimeException("not impl");
-      }
-
-      @Override
-      public Similarity getSimilarity(String table) {
-        throw new RuntimeException("not impl");
-      }
-
-      @Override
-      public TABLE_STATUS getTableStatus(String table) {
-        throw new RuntimeException("not impl");
-      }
-
-      @Override
-      public String getNodeName() {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public String getTableUri(String table) {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public int getShardCount(String table) {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public int getCompressionBlockSize(String table) {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public CompressionCodec getCompressionCodec(String table) {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public long getRecordCount(String table) throws IOException {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public long getRowCount(String table) throws IOException {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public long getTableSize(String table) throws IOException {
-        throw new RuntimeException("no impl");
-      }
-
-      @Override
-      public SortedSet<String> getShardListCurrentServerOnly(String table) throws IOException {
-        throw new RuntimeException("no impl");
-      }
-    };
-  }
-
-  private IndexManager getIndexManager() {
-    return new IndexManager() {
-
-    };
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/DoNothingServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/DoNothingServer.java b/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/DoNothingServer.java
deleted file mode 100644
index 163fe7d..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/thrift/DoNothingServer.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package com.nearinfinity.blur.thrift;
-
-/**
- * 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.
- */
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.thrift.TException;
-
-import com.nearinfinity.blur.thrift.generated.BlurException;
-import com.nearinfinity.blur.thrift.generated.BlurQuery;
-import com.nearinfinity.blur.thrift.generated.BlurQueryStatus;
-import com.nearinfinity.blur.thrift.generated.BlurResults;
-import com.nearinfinity.blur.thrift.generated.FetchResult;
-import com.nearinfinity.blur.thrift.generated.RowMutation;
-import com.nearinfinity.blur.thrift.generated.Schema;
-import com.nearinfinity.blur.thrift.generated.Selector;
-import com.nearinfinity.blur.thrift.generated.TableDescriptor;
-import com.nearinfinity.blur.thrift.generated.TableStats;
-import com.nearinfinity.blur.thrift.generated.Blur.Iface;
-
-public class DoNothingServer implements Iface {
-
-  @Override
-  public TableDescriptor describe(String table) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<String> tableList() throws BlurException, TException {
-    return Arrays.asList("donothing");
-  }
-
-  @Override
-  public List<String> controllerServerList() throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<String> shardServerList(String cluster) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public Map<String, String> shardServerLayout(String table) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public BlurResults query(String table, BlurQuery blurQuery) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public void cancelQuery(String table, long providedUuid) throws BlurException, TException {
-
-  }
-
-  @Override
-  public FetchResult fetchRow(String table, Selector selector) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<BlurQueryStatus> currentQueries(String arg0) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public long recordFrequency(String arg0, String arg1, String arg2, String arg3) throws BlurException, TException {
-    return 0;
-  }
-
-  @Override
-  public Schema schema(String arg0) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<String> terms(String arg0, String arg1, String arg2, String arg3, short arg4) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public void createTable(TableDescriptor tableDescriptor) throws BlurException, TException {
-
-  }
-
-  @Override
-  public void disableTable(String table) throws BlurException, TException {
-
-  }
-
-  @Override
-  public void enableTable(String table) throws BlurException, TException {
-
-  }
-
-  @Override
-  public void removeTable(String table, boolean deleteIndexFiles) throws BlurException, TException {
-
-  }
-
-  @Override
-  public TableStats getTableStats(String table) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public void mutate(RowMutation mutation) throws BlurException, TException {
-
-  }
-
-  @Override
-  public void mutateBatch(List<RowMutation> mutations) throws BlurException, TException {
-
-  }
-
-  @Override
-  public List<String> shardClusterList() throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<String> tableListByCluster(String cluster) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public BlurQueryStatus queryStatusById(String table, long uuid) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public List<Long> queryStatusIdList(String table) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public void optimize(String table, int numberOfSegmentsPerShard) throws BlurException, TException {
-
-  }
-
-  @Override
-  public boolean isInSafeMode(String cluster) throws BlurException, TException {
-    return false;
-  }
-
-  @Override
-  public TableStats tableStats(String table) throws BlurException, TException {
-    return null;
-  }
-
-  @Override
-  public Map<String, String> configuration() throws BlurException, TException {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/utils/BlurUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/utils/BlurUtilsTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/utils/BlurUtilsTest.java
deleted file mode 100644
index d6d6ff0..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/utils/BlurUtilsTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package com.nearinfinity.blur.utils;
-
-/**
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.lucene.analysis.KeywordAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.store.RAMDirectory;
-import org.junit.Test;
-
-import com.nearinfinity.blur.lucene.LuceneConstant;
-import com.nearinfinity.blur.thrift.generated.Record;
-import com.nearinfinity.blur.thrift.generated.RecordMutation;
-import com.nearinfinity.blur.thrift.generated.RowMutation;
-
-public class BlurUtilsTest {
-
-  @Test
-  public void testHumanizeTime1() {
-    long time = TimeUnit.HOURS.toMillis(2) + TimeUnit.MINUTES.toMillis(42) + TimeUnit.SECONDS.toMillis(37) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("2 hours 42 minutes 37 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testHumanizeTime2() {
-    long time = TimeUnit.HOURS.toMillis(0) + TimeUnit.MINUTES.toMillis(42) + TimeUnit.SECONDS.toMillis(37) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("42 minutes 37 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testHumanizeTime3() {
-    long time = TimeUnit.HOURS.toMillis(2) + TimeUnit.MINUTES.toMillis(0) + TimeUnit.SECONDS.toMillis(37) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("2 hours 0 minutes 37 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testHumanizeTime4() {
-    long time = TimeUnit.HOURS.toMillis(2) + TimeUnit.MINUTES.toMillis(0) + TimeUnit.SECONDS.toMillis(0) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("2 hours 0 minutes 0 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testHumanizeTime5() {
-    long time = TimeUnit.HOURS.toMillis(0) + TimeUnit.MINUTES.toMillis(0) + TimeUnit.SECONDS.toMillis(37) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("37 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testHumanizeTime6() {
-    long time = TimeUnit.HOURS.toMillis(0) + TimeUnit.MINUTES.toMillis(0) + TimeUnit.SECONDS.toMillis(0) + TimeUnit.MILLISECONDS.toMillis(124);
-    String humanizeTime = BlurUtil.humanizeTime(time, TimeUnit.MILLISECONDS);
-    assertEquals("0 seconds", humanizeTime);
-  }
-
-  @Test
-  public void testMemoryUsage() throws CorruptIndexException, LockObtainFailedException, IOException {
-    IndexReader reader = getReader();
-    long memoryUsage = BlurUtil.getMemoryUsage(reader);
-    assertTrue(memoryUsage > 0);
-  }
-
-  @Test
-  public void testRecordMatch() {
-    Record r1 = BlurUtil.newRecord("test-family", "record-1", BlurUtil.newColumn("a", "b"));
-    Record r2 = BlurUtil.newRecord("test-family", "record-1", BlurUtil.newColumn("c", "d"));
-    Record r3 = BlurUtil.newRecord("test-family", "record-2", BlurUtil.newColumn("e", "f"));
-    Record r4 = BlurUtil.newRecord("test-family-2", "record-1", BlurUtil.newColumn("g", "h"));
-
-    assertTrue("should match with same family and record-id", BlurUtil.match(r1, r2));
-    assertFalse("should not match with different record-id", BlurUtil.match(r1, r3));
-    assertFalse("should not match with different family", BlurUtil.match(r1, r4));
-  }
-
-  @Test
-  public void testRecordMutationMatch() {
-    RecordMutation rm1 = BlurUtil.newRecordMutation("test-family", "record-1", BlurUtil.newColumn("a", "b"));
-    RecordMutation rm2 = BlurUtil.newRecordMutation("test-family", "record-2", BlurUtil.newColumn("c", "d"));
-    RecordMutation rm3 = BlurUtil.newRecordMutation("test-family-2", "record-1", BlurUtil.newColumn("e", "f"));
-    Record r = BlurUtil.newRecord("test-family", "record-1", BlurUtil.newColumn("g", "h"));
-
-    assertTrue("should match with same family and record-id", BlurUtil.match(rm1, r));
-    assertFalse("should not match with different record-id", BlurUtil.match(rm2, r));
-    assertFalse("should not match with different family", BlurUtil.match(rm3, r));
-  }
-
-  @Test
-  public void testFindRecordMutation() {
-    RecordMutation rm1 = BlurUtil.newRecordMutation("test-family", "record-1", BlurUtil.newColumn("a", "b"));
-    RecordMutation rm2 = BlurUtil.newRecordMutation("test-family", "record-2", BlurUtil.newColumn("c", "d"));
-    RecordMutation rm3 = BlurUtil.newRecordMutation("test-family-2", "record-1", BlurUtil.newColumn("e", "f"));
-    RowMutation row = BlurUtil.newRowMutation("test-table", "row-123", rm1, rm2, rm3);
-    Record r = BlurUtil.newRecord("test-family", "record-2", BlurUtil.newColumn("g", "h"));
-    Record r2 = BlurUtil.newRecord("test-family", "record-99", BlurUtil.newColumn("g", "h"));
-
-    assertEquals("should find record-2", rm2, BlurUtil.findRecordMutation(row, r));
-    assertNull("should not find record-99", BlurUtil.findRecordMutation(row, r2));
-  }
-
-  private IndexReader getReader() throws CorruptIndexException, LockObtainFailedException, IOException {
-    RAMDirectory directory = new RAMDirectory();
-    IndexWriterConfig conf = new IndexWriterConfig(LuceneConstant.LUCENE_VERSION, new KeywordAnalyzer());
-    IndexWriter writer = new IndexWriter(directory, conf);
-    Document doc = new Document();
-    doc.add(new Field("a", "b", Store.YES, Index.NOT_ANALYZED_NO_NORMS));
-    writer.addDocument(doc);
-    writer.close();
-    return IndexReader.open(directory);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/com/nearinfinity/blur/utils/TermDocIterableTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/com/nearinfinity/blur/utils/TermDocIterableTest.java b/src/blur-core/src/test/java/com/nearinfinity/blur/utils/TermDocIterableTest.java
deleted file mode 100644
index 1599627..0000000
--- a/src/blur-core/src/test/java/com/nearinfinity/blur/utils/TermDocIterableTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.nearinfinity.blur.utils;
-
-/**
- * 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.
- */
-
-import static com.nearinfinity.blur.lucene.LuceneConstant.LUCENE_VERSION;
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldSelector;
-import org.apache.lucene.document.FieldSelectorResult;
-import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.store.FSDirectory;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TermDocIterableTest {
-
-  private static final int BLOCKS = 10;
-  private static final int COUNT_PER_BLOCK = 100;
-  private IndexReader reader;
-
-  @Before
-  public void setup() throws IOException {
-    reader = createIndexReader();
-  }
-
-  @SuppressWarnings("serial")
-  @Test
-  public void testTermDocIterable() throws IOException {
-    for (int pass = 0; pass < 1; pass++) {
-      for (int id = 0; id < BLOCKS; id++) {
-        TermDocs termDocs = reader.termDocs(new Term("id", Integer.toString(id)));
-        TermDocIterable iterable = new TermDocIterable(termDocs, reader, new FieldSelector() {
-          @Override
-          public FieldSelectorResult accept(String fieldName) {
-            return FieldSelectorResult.LOAD;
-          }
-        });
-        int count = 0;
-        int i = 0;
-        long s = System.nanoTime();
-        for (Document document : iterable) {
-          count++;
-          assertEquals(i, Integer.parseInt(document.get("field")));
-          i++;
-        }
-        long time = System.nanoTime() - s;
-        System.out.println(time / 1000000.0 + " " + id + " " + pass);
-        assertEquals(COUNT_PER_BLOCK, count);
-      }
-    }
-  }
-
-  private IndexReader createIndexReader() throws IOException {
-    FSDirectory directory = FSDirectory.open(new File("./tmp/termdociterable"));
-    if (!IndexReader.indexExists(directory)) {
-      rm(new File("./tmp/termdociterable"));
-      IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(LUCENE_VERSION, new StandardAnalyzer(LUCENE_VERSION)));
-      for (int i = 0; i < BLOCKS; i++) {
-        addDocumentBlock(i, COUNT_PER_BLOCK, writer);
-      }
-      writer.close();
-    }
-    return IndexReader.open(directory);
-  }
-
-  private File rm(File file) {
-    if (file.isDirectory()) {
-      for (File f : file.listFiles()) {
-        rm(f);
-      }
-    }
-    file.delete();
-    return file;
-  }
-
-  private void addDocumentBlock(int id, int count, IndexWriter writer) throws IOException {
-    for (int i = 0; i < count; i++) {
-      Document document = new Document();
-      document.add(new Field("id", Integer.toString(id), Store.YES, Index.NOT_ANALYZED_NO_NORMS));
-      document.add(new Field("field", Integer.toString(i), Store.YES, Index.NOT_ANALYZED_NO_NORMS));
-      for (int j = 0; j < 100; j++) {
-        document.add(new Field("field" + j, "testing here testing here testing here testing here testing here testing here testing here", Store.YES, Index.NO));
-      }
-      writer.addDocument(document);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/org/apache/blur/MiniCluster.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/MiniCluster.java b/src/blur-core/src/test/java/org/apache/blur/MiniCluster.java
new file mode 100644
index 0000000..2cc79d5
--- /dev/null
+++ b/src/blur-core/src/test/java/org/apache/blur/MiniCluster.java
@@ -0,0 +1,464 @@
+package org.apache.blur;
+
+/**
+ * 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.
+ */
+
+import static org.apache.blur.utils.BlurConstants.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.blur.BlurConfiguration;
+import org.apache.blur.log.Log;
+import org.apache.blur.log.LogFactory;
+import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.BlurClientManager;
+import org.apache.blur.thrift.Connection;
+import org.apache.blur.thrift.ThriftBlurControllerServer;
+import org.apache.blur.thrift.ThriftBlurShardServer;
+import org.apache.blur.thrift.ThriftServer;
+import org.apache.blur.thrift.generated.AnalyzerDefinition;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.BlurQuery;
+import org.apache.blur.thrift.generated.BlurResults;
+import org.apache.blur.thrift.generated.Column;
+import org.apache.blur.thrift.generated.Record;
+import org.apache.blur.thrift.generated.Row;
+import org.apache.blur.thrift.generated.RowMutation;
+import org.apache.blur.thrift.generated.TableDescriptor;
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.utils.BlurUtil;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransportException;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
+
+
+public abstract class MiniCluster {
+
+  private static Log LOG = LogFactory.getLog(MiniCluster.class);
+  private static MiniDFSCluster cluster;
+  private static Thread serverThread;
+  private static String zkConnectionString = "localhost:21810";
+  private static ZooKeeperServerMainEmbedded zooKeeperServerMain;
+  private static List<ThriftServer> controllers = new ArrayList<ThriftServer>();
+  private static List<ThriftServer> shards = new ArrayList<ThriftServer>();
+  private static String controllerConnectionStr;
+
+  public static void main(String[] args) throws IOException, InterruptedException, KeeperException, BlurException, TException {
+    startDfs("./tmp");
+    startZooKeeper("./tmp");
+    startControllers(1);
+    startShards(1);
+
+    try {
+      Iface client = BlurClient.getClient(getControllerConnectionStr());
+      createTable("test", client);
+      long start = System.nanoTime();
+      for (int i = 0; i < 1000; i++) {
+        long now = System.nanoTime();
+        if (start + 5000000000L < now) {
+          System.out.println("Total [" + i + "]");
+          start = now;
+        }
+        addRow("test", i, client);
+      }
+
+      // This waits for all the data to become visible.
+      Thread.sleep(2000);
+
+      for (int i = 0; i < 1000; i++) {
+        searchRow("test", i, client);
+      }
+
+    } finally {
+      stopShards();
+      stopControllers();
+      shutdownZooKeeper();
+      shutdownDfs();
+    }
+  }
+
+  public static void startBlurCluster(String path, int controllerCount, int shardCount) {
+    startDfs(path);
+    startZooKeeper(path);
+    startControllers(controllerCount);
+    startShards(shardCount);
+  }
+
+  public static void shutdownBlurCluster() {
+    stopShards();
+    stopControllers();
+    shutdownZooKeeper();
+    shutdownDfs();
+  }
+
+  private static void createTable(String test, Iface client) throws BlurException, TException, IOException {
+    final TableDescriptor descriptor = new TableDescriptor();
+    descriptor.setName(test);
+    descriptor.setShardCount(7);
+    descriptor.setAnalyzerDefinition(new AnalyzerDefinition());
+    descriptor.setTableUri(getFileSystemUri() + "/blur/" + test);
+    client.createTable(descriptor);
+  }
+
+  public static String getControllerConnectionStr() {
+    return controllerConnectionStr;
+  }
+
+  private static void addRow(String table, int i, Iface client) throws BlurException, TException {
+    Row row = new Row();
+    row.setId(Integer.toString(i));
+    Record record = new Record();
+    record.setRecordId(Integer.toString(i));
+    record.setFamily("test");
+    record.addToColumns(new Column("test", Integer.toString(i)));
+    row.addToRecords(record);
+    RowMutation rowMutation = BlurUtil.toRowMutation(table, row);
+    rowMutation.setWal(false);
+    client.mutate(rowMutation);
+  }
+
+  private static void searchRow(String table, int i, Iface client) throws BlurException, TException {
+    BlurQuery blurQuery = BlurUtil.newSimpleQuery("test.test:" + i);
+    System.out.println("Running [" + blurQuery + "]");
+    BlurResults results = client.query(table, blurQuery);
+    if (results.getTotalResults() != 1L) {
+      throw new RuntimeException("we got a problem here.");
+    }
+  }
+
+  public static void stopControllers() {
+    for (ThriftServer s : controllers) {
+      s.close();
+    }
+  }
+
+  public static void stopShards() {
+    for (ThriftServer s : shards) {
+      s.close();
+    }
+  }
+
+  public static void startControllers(int num) {
+    BlurConfiguration configuration = getBlurConfiguration();
+    startControllers(configuration, num);
+  }
+
+  private static BlurConfiguration getBlurConfiguration() {
+    BlurConfiguration configuration;
+    try {
+      configuration = new BlurConfiguration();
+    } catch (IOException e) {
+      LOG.error(e);
+      throw new RuntimeException(e);
+    }
+    configuration.set(BLUR_ZOOKEEPER_CONNECTION, getZkConnectionString());
+    configuration.set(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, "false");
+    configuration.set(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT, "0");
+    configuration.setLong(BLUR_SHARD_SAFEMODEDELAY, 5000);
+    configuration.setInt(BLUR_GUI_CONTROLLER_PORT, -1);
+    configuration.setInt(BLUR_GUI_SHARD_PORT, -1);
+    return configuration;
+  }
+
+  public static void startControllers(BlurConfiguration configuration, int num) {
+    StringBuilder builder = new StringBuilder();
+    for (int i = 0; i < num; i++) {
+      try {
+        ThriftServer server = ThriftBlurControllerServer.createServer(i, configuration);
+        controllers.add(server);
+        Connection connection = new Connection("localhost", 40010 + i);
+        if (builder.length() != 0) {
+          builder.append(',');
+        }
+        builder.append(connection.getConnectionStr());
+        startServer(server, connection);
+      } catch (Exception e) {
+        LOG.error(e);
+        throw new RuntimeException(e);
+      }
+    }
+    controllerConnectionStr = builder.toString();
+  }
+
+  public static void startShards(int num) {
+    BlurConfiguration configuration = getBlurConfiguration();
+    startShards(configuration, num);
+  }
+
+  public static void startShards(final BlurConfiguration configuration, int num) {
+    ExecutorService executorService = Executors.newFixedThreadPool(num);
+    List<Future<ThriftServer>> futures = new ArrayList<Future<ThriftServer>>();
+    for (int i = 0; i < num; i++) {
+      final int index = i;
+      futures.add(executorService.submit(new Callable<ThriftServer>() {
+        @Override
+        public ThriftServer call() throws Exception {
+          return ThriftBlurShardServer.createServer(index, configuration);
+        }
+      }));
+    }
+
+    for (int i = 0; i < num; i++) {
+      try {
+        ThriftServer server = futures.get(i).get();
+        shards.add(server);
+        Connection connection = new Connection("localhost", 40020 + i);
+        startServer(server, connection);
+      } catch (Exception e) {
+        LOG.error(e);
+        throw new RuntimeException(e);
+      }
+    }
+  }
+
+  private static void startServer(final ThriftServer server, Connection connection) {
+    new Thread(new Runnable() {
+      @Override
+      public void run() {
+        try {
+          server.start();
+        } catch (TTransportException e) {
+          LOG.error(e);
+          throw new RuntimeException(e);
+        }
+      }
+    }).start();
+    while (true) {
+      try {
+        Thread.sleep(50);
+      } catch (InterruptedException e) {
+        return;
+      }
+      try {
+        Client client = BlurClientManager.newClient(connection);
+        BlurClientManager.close(client);
+        break;
+      } catch (TException e) {
+        throw new RuntimeException(e);
+      } catch (IOException e) {
+        LOG.info("Can not connection to [" + connection + "]");
+      }
+    }
+  }
+
+  public static String getZkConnectionString() {
+    return zkConnectionString;
+  }
+
+  public static void startZooKeeper(String path) {
+    startZooKeeper(true, path);
+  }
+
+  public static void startZooKeeper(boolean format, String path) {
+    Properties properties = new Properties();
+    properties.setProperty("tickTime", "2000");
+    properties.setProperty("initLimit", "10");
+    properties.setProperty("syncLimit", "5");
+
+    properties.setProperty("clientPort", "21810");
+
+    startZooKeeper(properties, format, path);
+  }
+
+  public static void startZooKeeper(Properties properties, String path) {
+    startZooKeeper(properties, true, path);
+  }
+
+  private static class ZooKeeperServerMainEmbedded extends ZooKeeperServerMain {
+    @Override
+    public void shutdown() {
+      super.shutdown();
+    }
+  }
+
+  public static void startZooKeeper(final Properties properties, boolean format, String path) {
+    String realPath = path + "/zk_test";
+    properties.setProperty("dataDir", realPath);
+    final ServerConfig serverConfig = new ServerConfig();
+    QuorumPeerConfig config = new QuorumPeerConfig();
+    try {
+      config.parseProperties(properties);
+    } catch (IOException e) {
+      LOG.error(e);
+      throw new RuntimeException(e);
+    } catch (ConfigException e) {
+      LOG.error(e);
+      throw new RuntimeException(e);
+    }
+    serverConfig.readFrom(config);
+    rm(new File(realPath));
+    serverThread = new Thread(new Runnable() {
+
+      @Override
+      public void run() {
+        try {
+          zooKeeperServerMain = new ZooKeeperServerMainEmbedded();
+          zooKeeperServerMain.runFromConfig(serverConfig);
+        } catch (IOException e) {
+          LOG.error(e);
+        }
+      }
+    });
+    serverThread.start();
+    long s = System.nanoTime();
+    while (s + 10000000000L > System.nanoTime()) {
+      try {
+        Thread.sleep(50);
+      } catch (InterruptedException e) {
+        LOG.error(e);
+        throw new RuntimeException(e);
+      }
+      try {
+        ZooKeeper zk = new ZooKeeper(zkConnectionString, 30000, new Watcher() {
+          @Override
+          public void process(WatchedEvent event) {
+
+          }
+        });
+        zk.close();
+        break;
+      } catch (IOException e) {
+        LOG.error(e);
+        throw new RuntimeException(e);
+      } catch (InterruptedException e) {
+        LOG.error(e);
+        throw new RuntimeException(e);
+      }
+    }
+  }
+
+  public static URI getFileSystemUri() throws IOException {
+    return cluster.getFileSystem().getUri();
+  }
+
+  public static void startDfs(String path) {
+    startDfs(true, path);
+  }
+
+  public static void startDfs(boolean format, String path) {
+    startDfs(new Configuration(), format, path);
+  }
+
+  public static void startDfs(Configuration conf, String path) {
+    startDfs(conf, true, path);
+  }
+
+  public static void startDfs(Configuration conf, boolean format, String path) {
+    System.setProperty("test.build.data", path);
+    try {
+      cluster = new MiniDFSCluster(conf, 1, true, (String[]) null);
+      cluster.waitActive();
+    } catch (Exception e) {
+      LOG.error("error opening file system", e);
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static void shutdownZooKeeper() {
+    zooKeeperServerMain.shutdown();
+  }
+
+  public static void shutdownDfs() {
+    if (cluster != null) {
+      LOG.info("Shutting down Mini DFS ");
+      try {
+        cluster.shutdown();
+      } catch (Exception e) {
+        // / Can get a java.lang.reflect.UndeclaredThrowableException thrown
+        // here because of an InterruptedException. Don't let exceptions in
+        // here be cause of test failure.
+      }
+      try {
+        FileSystem fs = cluster.getFileSystem();
+        if (fs != null) {
+          LOG.info("Shutting down FileSystem");
+          fs.close();
+        }
+        FileSystem.closeAll();
+      } catch (IOException e) {
+        LOG.error("error closing file system", e);
+      }
+
+      // This has got to be one of the worst hacks I have ever had to do.
+      // This is needed to shutdown 2 thread pools that are not shutdown by
+      // themselves.
+      ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+      Thread[] threads = new Thread[100];
+      int enumerate = threadGroup.enumerate(threads);
+      for (int i = 0; i < enumerate; i++) {
+        Thread thread = threads[i];
+        if (thread.getName().startsWith("pool")) {
+          while (thread.isAlive()) {
+            LOG.info("Stopping ThreadPoolExecutor [" + thread.getName() + "]");
+            Object target = getField(thread, "target");
+            if (target != null) {
+              ThreadPoolExecutor e = (ThreadPoolExecutor) getField(target, "this$0");
+              if (e != null) {
+                e.shutdownNow();
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  private static Object getField(Object o, String fieldName) {
+    try {
+      Field field = o.getClass().getDeclaredField(fieldName);
+      field.setAccessible(true);
+      return field.get(o);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private static void rm(File file) {
+    if (!file.exists()) {
+      return;
+    }
+    if (file.isDirectory()) {
+      for (File f : file.listFiles()) {
+        rm(f);
+      }
+    }
+    file.delete();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/org/apache/blur/analysis/BlurAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/BlurAnalyzerTest.java b/src/blur-core/src/test/java/org/apache/blur/analysis/BlurAnalyzerTest.java
new file mode 100644
index 0000000..9d0bb1f
--- /dev/null
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/BlurAnalyzerTest.java
@@ -0,0 +1,102 @@
+package org.apache.blur.analysis;
+
+/**
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.blur.thrift.generated.AlternateColumnDefinition;
+import org.apache.blur.thrift.generated.AnalyzerDefinition;
+import org.apache.blur.thrift.generated.ColumnDefinition;
+import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
+import org.apache.lucene.document.Field.Store;
+import org.junit.Test;
+
+
+public class BlurAnalyzerTest {
+
+  private static final String STANDARD = "org.apache.lucene.analysis.standard.StandardAnalyzer";
+  private AnalyzerDefinition analyzerDefinition = getDef();
+
+  @Test
+  public void testToAndFromJSON() throws IOException {
+    BlurAnalyzer analyzer = new BlurAnalyzer(analyzerDefinition);
+    String json = analyzer.toJSON();
+    BlurAnalyzer analyzer2 = BlurAnalyzer.create(json);
+    assertEquals(analyzer.getAnalyzerDefinition(), analyzer2.getAnalyzerDefinition());
+  }
+
+  @Test
+  public void testStoringOfField() throws IOException {
+    BlurAnalyzer analyzer = new BlurAnalyzer(analyzerDefinition);
+    assertEquals(Store.NO, analyzer.getStore("b.c.sub1"));
+    assertEquals(Store.YES, analyzer.getStore("b.c"));
+  }
+
+  @Test
+  public void testGetSubFields() throws IOException {
+    BlurAnalyzer analyzer = new BlurAnalyzer(analyzerDefinition);
+    assertNull(analyzer.getSubIndexNames("b.d"));
+    Set<String> subIndexNames = analyzer.getSubIndexNames("b.c");
+    TreeSet<String> set = new TreeSet<String>();
+    set.add("b.c.sub1");
+    set.add("b.c.sub2");
+    assertEquals(set, subIndexNames);
+  }
+
+  @Test
+  public void testFullTextFields() throws IOException {
+    BlurAnalyzer analyzer = new BlurAnalyzer(analyzerDefinition);
+    assertTrue(analyzer.isFullTextField("a.b"));
+    assertFalse(analyzer.isFullTextField("a.d"));
+  }
+
+  private AnalyzerDefinition getDef() {
+
+    AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition().setDefaultDefinition(new ColumnDefinition(STANDARD, false, null)).setFullTextAnalyzerClassName(STANDARD);
+    Map<String, ColumnFamilyDefinition> columnFamilyDefinitions = new HashMap<String, ColumnFamilyDefinition>();
+
+    ColumnFamilyDefinition aColumnFamilyDefinition = new ColumnFamilyDefinition();
+
+    Map<String, ColumnDefinition> aColumnDefinitions = new HashMap<String, ColumnDefinition>();
+    aColumnDefinitions.put("b", new ColumnDefinition(STANDARD, true, null));
+    aColumnFamilyDefinition.setColumnDefinitions(aColumnDefinitions);
+    columnFamilyDefinitions.put("a", aColumnFamilyDefinition);
+
+    Map<String, ColumnDefinition> bColumnDefinitions = new HashMap<String, ColumnDefinition>();
+    Map<String, AlternateColumnDefinition> alternates = new HashMap<String, AlternateColumnDefinition>();
+    alternates.put("sub1", new AlternateColumnDefinition(STANDARD));
+    alternates.put("sub2", new AlternateColumnDefinition(STANDARD));
+    bColumnDefinitions.put("c", new ColumnDefinition(STANDARD, true, alternates));
+    ColumnFamilyDefinition bColumnFamilyDefinition = new ColumnFamilyDefinition();
+    bColumnFamilyDefinition.setColumnDefinitions(bColumnDefinitions);
+    columnFamilyDefinitions.put("b", bColumnFamilyDefinition);
+
+    analyzerDefinition.setColumnFamilyDefinitions(columnFamilyDefinitions);
+    return analyzerDefinition;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java b/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
new file mode 100644
index 0000000..0cab7ce
--- /dev/null
+++ b/src/blur-core/src/test/java/org/apache/blur/analysis/LongAnalyzerTest.java
@@ -0,0 +1,79 @@
+package org.apache.blur.analysis;
+
+/**
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.blur.index.IndexWriter;
+import org.apache.blur.thrift.generated.AnalyzerDefinition;
+import org.apache.blur.thrift.generated.ColumnDefinition;
+import org.apache.blur.thrift.generated.ColumnFamilyDefinition;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.NumericRangeQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.Version;
+import org.junit.Test;
+
+
+public class LongAnalyzerTest {
+
+  @Test
+  public void testLongAnalyzer() throws IOException {
+    AnalyzerDefinition analyzerDefinition = new AnalyzerDefinition();
+    ColumnFamilyDefinition cfDef = new ColumnFamilyDefinition();
+    cfDef.putToColumnDefinitions("test", new ColumnDefinition("long", true, null));
+    analyzerDefinition.putToColumnFamilyDefinitions("test", cfDef);
+    BlurAnalyzer analyzer = new BlurAnalyzer(analyzerDefinition);
+
+    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, analyzer);
+    Directory dir = new RAMDirectory();
+    IndexWriter indexWriter = new IndexWriter(dir, conf);
+    for (int i = 0; i < 1000; i++) {
+      Document document = new Document();
+      String value = Long.toString(i);
+      document.add(new Field("test.test", value, Store.YES, Index.ANALYZED_NO_NORMS));
+      FieldConverterUtil.convert(document, analyzer);
+      indexWriter.addDocument(document);
+    }
+    indexWriter.close();
+
+    IndexSearcher searcher = new IndexSearcher(IndexReader.open(dir));
+    NumericRangeQuery<Long> query = NumericRangeQuery.newLongRange("test.test", 0L, 2L, true, true);
+    Query rewrite = searcher.rewrite(query);
+    TopDocs docs = searcher.search(rewrite, 100);
+    ScoreDoc[] scoreDocs = docs.scoreDocs;
+    assertEquals(3, docs.totalHits);
+    for (int i = 0; i < docs.totalHits; i++) {
+      Document document = searcher.doc(scoreDocs[i].doc);
+      assertTrue(Integer.parseInt(document.get("test.test")) < 3);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-core/src/test/java/org/apache/blur/lucene/search/FacetQueryTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/lucene/search/FacetQueryTest.java b/src/blur-core/src/test/java/org/apache/blur/lucene/search/FacetQueryTest.java
new file mode 100644
index 0000000..9657b7c
--- /dev/null
+++ b/src/blur-core/src/test/java/org/apache/blur/lucene/search/FacetQueryTest.java
@@ -0,0 +1,101 @@
+package org.apache.blur.lucene.search;
+
+/**
+ * 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.
+ */
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicLongArray;
+
+import org.apache.blur.lucene.search.FacetQuery;
+import org.apache.lucene.analysis.KeywordAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanClause.Occur;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.Version;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class FacetQueryTest {
+
+  private IndexReader reader;
+
+  @Before
+  public void setup() throws CorruptIndexException, LockObtainFailedException, IOException {
+    reader = createIndex();
+  }
+
+  @After
+  public void tearDown() {
+
+  }
+
+  @Test
+  public void testFacetQueryNoSuper() throws IOException {
+    BooleanQuery bq = new BooleanQuery();
+    bq.add(new TermQuery(new Term("f1", "value")), Occur.SHOULD);
+    bq.add(new TermQuery(new Term("f2", "v3")), Occur.SHOULD);
+
+    Query f1 = new TermQuery(new Term("f2", "v4"));
+
+    BooleanQuery f2 = new BooleanQuery();
+    f2.add(new TermQuery(new Term("f1", "value")), Occur.MUST);
+    f2.add(new TermQuery(new Term("f2", "v3")), Occur.MUST);
+
+    Query[] facets = new Query[] { f1, f2 };
+
+    AtomicLongArray counts = new AtomicLongArray(facets.length);
+    FacetQuery facetQuery = new FacetQuery(bq, facets, counts);
+
+    IndexSearcher indexSearcher = new IndexSearcher(reader);
+    TopDocs topDocs = indexSearcher.search(facetQuery, 10);
+
+    for (int i = 0; i < counts.length(); i++) {
+      System.out.println(counts.get(i));
+    }
+  }
+
+  private IndexReader createIndex() throws CorruptIndexException, LockObtainFailedException, IOException {
+    RAMDirectory directory = new RAMDirectory();
+    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, new KeywordAnalyzer());
+    IndexWriter writer = new IndexWriter(directory, conf);
+    for (int i = 0; i < 10; i++) {
+      Document document = new Document();
+      document.add(new Field("f1", "value", Store.YES, Index.NOT_ANALYZED_NO_NORMS));
+      document.add(new Field("f2", "v" + i, Store.YES, Index.NOT_ANALYZED_NO_NORMS));
+      writer.addDocument(document);
+    }
+    writer.close();
+    return IndexReader.open(directory);
+  }
+
+}


Mime
View raw message