incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Renamed the alias blur filter cache test
Date Fri, 01 Nov 2013 19:33:36 GMT
Updated Branches:
  refs/heads/master f95fc703b -> 292de850b


Renamed the alias blur filter cache test


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/292de850
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/292de850
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/292de850

Branch: refs/heads/master
Commit: 292de850b92eb5d201bce39fa9eefcdf2c78f4b6
Parents: f95fc70
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Nov 1 15:30:46 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Nov 1 15:33:31 2013 -0400

----------------------------------------------------------------------
 .../blur/manager/AliasBlurFilterCacheTest.java  | 123 +++++++++++++++++++
 .../manager/DefaultBlurFilterCacheTest.java     | 123 -------------------
 .../apache/blur/zookeeper/WatchChildren.java    |   1 -
 3 files changed, 123 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/292de850/blur-core/src/test/java/org/apache/blur/manager/AliasBlurFilterCacheTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/AliasBlurFilterCacheTest.java
b/blur-core/src/test/java/org/apache/blur/manager/AliasBlurFilterCacheTest.java
new file mode 100644
index 0000000..3eddb0f
--- /dev/null
+++ b/blur-core/src/test/java/org/apache/blur/manager/AliasBlurFilterCacheTest.java
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.manager;
+
+import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.blur.BlurConfiguration;
+import org.apache.blur.analysis.BaseFieldManager;
+import org.apache.blur.analysis.FieldTypeDefinition;
+import org.apache.blur.lucene.search.SuperParser;
+import org.apache.blur.manager.BlurFilterCache.FilterParser;
+import org.apache.blur.server.TableContext;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.ScoreType;
+import org.apache.blur.thrift.generated.TableDescriptor;
+import org.apache.blur.utils.BlurConstants;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.Query;
+import org.junit.Test;
+
+public class AliasBlurFilterCacheTest {
+
+  private static final String TABLE = "test";
+  private static final String TEST_FILTER = "(abc1 abc2 abc3)";
+
+  @Test
+  public void testFetchPreFilterEmpty() throws IOException {
+    BlurConfiguration configuration = new BlurConfiguration();
+    AliasBlurFilterCache defaultBlurFilterCache = new AliasBlurFilterCache(configuration);
+    Filter fetchPreFilter = defaultBlurFilterCache.fetchPreFilter(TABLE, TEST_FILTER);
+    assertNull(fetchPreFilter);
+  }
+
+  @Test
+  public void testFetchPreFilterNotEmpty() throws IOException, BlurException, ParseException
{
+    BlurConfiguration configuration = new BlurConfiguration();
+    configuration.set("blur.filter.alias.test.super:abc1", "(fam1.f1:abc1 fam2.f1:abc1)");
+    configuration.set("blur.filter.alias.test.super:abc2", "(fam1.f1:abc2 fam2.f1:abc2)");
+    configuration.set("blur.filter.alias.test.super:abc3", "(fam1.f1:abc3 fam2.f1:abc3)");
+    AliasBlurFilterCache defaultBlurFilterCache = new AliasBlurFilterCache(configuration);
+
+    TableDescriptor tableDescriptor = new TableDescriptor();
+    tableDescriptor.setName(TABLE);
+    tableDescriptor.setTableUri("file:///");
+    final TableContext tableContext = TableContext.create(tableDescriptor);
+
+    final BaseFieldManager fieldManager = getFieldManager(new WhitespaceAnalyzer(LUCENE_VERSION));
+
+    Filter filter = QueryParserUtil.parseFilter(TABLE, TEST_FILTER, false, fieldManager,
defaultBlurFilterCache,
+        tableContext);
+    Filter filterToRun = defaultBlurFilterCache.storePreFilter(TABLE, TEST_FILTER, filter,
new FilterParser() {
+      @Override
+      public Query parse(String query) throws ParseException {
+        return new SuperParser(LUCENE_VERSION, fieldManager, false, null, ScoreType.CONSTANT,
tableContext
+            .getDefaultPrimeDocTerm()).parse(query);
+      }
+    });
+    assertNotNull(filterToRun);
+    assertEquals("BooleanFilter(" + "FilterCache(super-abc1,QueryWrapperFilter(fam1.f1:abc1
fam2.f1:abc1)) "
+        + "FilterCache(super-abc2,QueryWrapperFilter(fam1.f1:abc2 fam2.f1:abc2)) "
+        + "FilterCache(super-abc3,QueryWrapperFilter(fam1.f1:abc3 fam2.f1:abc3))" + ")",
filterToRun.toString());
+
+    Filter fetchPreFilter = defaultBlurFilterCache.fetchPreFilter(TABLE, TEST_FILTER);
+    assertNotNull(fetchPreFilter);
+
+    assertTrue(filterToRun == fetchPreFilter);
+
+  }
+
+  private BaseFieldManager getFieldManager(Analyzer a) throws IOException {
+    BaseFieldManager fieldManager = new BaseFieldManager(BlurConstants.SUPER, a, new Configuration())
{
+      @Override
+      protected boolean tryToStore(FieldTypeDefinition fieldTypeDefinition, String fieldName)
{
+        return true;
+      }
+
+      @Override
+      protected void tryToLoad(String fieldName) {
+
+      }
+
+      @Override
+      protected List<String> getFieldNamesToLoad() throws IOException {
+        return new ArrayList<String>();
+      }
+    };
+
+    fieldManager.addColumnDefinition(null, "bin", null, false, "string", null);
+    fieldManager.addColumnDefinitionInt("a", "id_i");
+    fieldManager.addColumnDefinitionDouble("a", "id_d");
+    fieldManager.addColumnDefinitionFloat("a", "id_f");
+    fieldManager.addColumnDefinitionLong("a", "id_l");
+    fieldManager.addColumnDefinitionDate("a", "id_date", "yyyy-MM-dd");
+    fieldManager.addColumnDefinitionGisRecursivePrefixTree("a", "id_gis");
+    return fieldManager;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/292de850/blur-core/src/test/java/org/apache/blur/manager/DefaultBlurFilterCacheTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/manager/DefaultBlurFilterCacheTest.java
b/blur-core/src/test/java/org/apache/blur/manager/DefaultBlurFilterCacheTest.java
deleted file mode 100644
index 267356f..0000000
--- a/blur-core/src/test/java/org/apache/blur/manager/DefaultBlurFilterCacheTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.blur.manager;
-
-import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.blur.BlurConfiguration;
-import org.apache.blur.analysis.BaseFieldManager;
-import org.apache.blur.analysis.FieldTypeDefinition;
-import org.apache.blur.lucene.search.SuperParser;
-import org.apache.blur.manager.BlurFilterCache.FilterParser;
-import org.apache.blur.server.TableContext;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.ScoreType;
-import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.utils.BlurConstants;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
-import org.apache.lucene.queryparser.classic.ParseException;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.Query;
-import org.junit.Test;
-
-public class DefaultBlurFilterCacheTest {
-
-  private static final String TABLE = "test";
-  private static final String TEST_FILTER = "(abc1 abc2 abc3)";
-
-  @Test
-  public void testFetchPreFilterEmpty() throws IOException {
-    BlurConfiguration configuration = new BlurConfiguration();
-    DefaultBlurFilterCache defaultBlurFilterCache = new DefaultBlurFilterCache(configuration);
-    Filter fetchPreFilter = defaultBlurFilterCache.fetchPreFilter(TABLE, TEST_FILTER);
-    assertNull(fetchPreFilter);
-  }
-
-  @Test
-  public void testFetchPreFilterNotEmpty() throws IOException, BlurException, ParseException
{
-    BlurConfiguration configuration = new BlurConfiguration();
-    configuration.set("blur.filter.alias.test.super:abc1", "(fam1.f1:abc1 fam2.f1:abc1)");
-    configuration.set("blur.filter.alias.test.super:abc2", "(fam1.f1:abc2 fam2.f1:abc2)");
-    configuration.set("blur.filter.alias.test.super:abc3", "(fam1.f1:abc3 fam2.f1:abc3)");
-    DefaultBlurFilterCache defaultBlurFilterCache = new DefaultBlurFilterCache(configuration);
-
-    TableDescriptor tableDescriptor = new TableDescriptor();
-    tableDescriptor.setName(TABLE);
-    tableDescriptor.setTableUri("file:///");
-    final TableContext tableContext = TableContext.create(tableDescriptor);
-
-    final BaseFieldManager fieldManager = getFieldManager(new WhitespaceAnalyzer(LUCENE_VERSION));
-
-    Filter filter = QueryParserUtil.parseFilter(TABLE, TEST_FILTER, false, fieldManager,
defaultBlurFilterCache,
-        tableContext);
-    Filter filterToRun = defaultBlurFilterCache.storePreFilter(TABLE, TEST_FILTER, filter,
new FilterParser() {
-      @Override
-      public Query parse(String query) throws ParseException {
-        return new SuperParser(LUCENE_VERSION, fieldManager, false, null, ScoreType.CONSTANT,
tableContext
-            .getDefaultPrimeDocTerm()).parse(query);
-      }
-    });
-    assertNotNull(filterToRun);
-    assertEquals("BooleanFilter(" + "FilterCache(super-abc1,QueryWrapperFilter(fam1.f1:abc1
fam2.f1:abc1)) "
-        + "FilterCache(super-abc2,QueryWrapperFilter(fam1.f1:abc2 fam2.f1:abc2)) "
-        + "FilterCache(super-abc3,QueryWrapperFilter(fam1.f1:abc3 fam2.f1:abc3))" + ")",
filterToRun.toString());
-
-    Filter fetchPreFilter = defaultBlurFilterCache.fetchPreFilter(TABLE, TEST_FILTER);
-    assertNotNull(fetchPreFilter);
-
-    assertTrue(filterToRun == fetchPreFilter);
-
-  }
-
-  private BaseFieldManager getFieldManager(Analyzer a) throws IOException {
-    BaseFieldManager fieldManager = new BaseFieldManager(BlurConstants.SUPER, a, new Configuration())
{
-      @Override
-      protected boolean tryToStore(FieldTypeDefinition fieldTypeDefinition, String fieldName)
{
-        return true;
-      }
-
-      @Override
-      protected void tryToLoad(String fieldName) {
-
-      }
-
-      @Override
-      protected List<String> getFieldNamesToLoad() throws IOException {
-        return new ArrayList<String>();
-      }
-    };
-
-    fieldManager.addColumnDefinition(null, "bin", null, false, "string", null);
-    fieldManager.addColumnDefinitionInt("a", "id_i");
-    fieldManager.addColumnDefinitionDouble("a", "id_d");
-    fieldManager.addColumnDefinitionFloat("a", "id_f");
-    fieldManager.addColumnDefinitionLong("a", "id_l");
-    fieldManager.addColumnDefinitionDate("a", "id_date", "yyyy-MM-dd");
-    fieldManager.addColumnDefinitionGisRecursivePrefixTree("a", "id_gis");
-    return fieldManager;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/292de850/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
index 5352ba3..2d64511 100644
--- a/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
+++ b/blur-util/src/main/java/org/apache/blur/zookeeper/WatchChildren.java
@@ -89,7 +89,6 @@ public class WatchChildren implements Closeable {
               }
               _lock.wait();
             } catch (KeeperException e) {
-              LOG.error("Error in instance [{0}]", e, instance);
               if (!_running.get()) {
                 LOG.info("Error [{0}]", e.getMessage());
                 return;


Mime
View raw message