incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixing broken test in blur-console and cleaning up some code.
Date Tue, 30 Dec 2014 14:32:30 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 9c7e7024d -> d52f266be


Fixing broken test in blur-console and cleaning up some code.


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

Branch: refs/heads/master
Commit: d52f266bedcce6c95424f3f604ef27b6bff157c4
Parents: 9c7e702
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Dec 30 09:32:27 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Dec 30 09:32:27 2014 -0500

----------------------------------------------------------------------
 .../org/apache/blur/thrift/CloseableTimer.java  | 37 ++++++++++++++++++++
 .../blur/thrift/ThriftBlurShardServer.java      |  8 +----
 .../test/java/org/apache/blur/MiniCluster.java  |  4 +++
 .../blur/analysis/ThriftFieldManagerTest.java   |  6 ++--
 .../org/apache/blur/thrift/BaseClusterTest.java |  2 +-
 .../blur/thrift/IntegrationTestSuite.java       |  2 +-
 .../org/apache/blur/thrift/SuiteCluster.java    | 11 ++++--
 .../java/org/apache/blur/thrift/TermsTests.java |  2 +-
 8 files changed, 56 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/main/java/org/apache/blur/thrift/CloseableTimer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/CloseableTimer.java b/blur-core/src/main/java/org/apache/blur/thrift/CloseableTimer.java
new file mode 100644
index 0000000..8400397
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/thrift/CloseableTimer.java
@@ -0,0 +1,37 @@
+/**
+ * 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.thrift;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Timer;
+
+public class CloseableTimer implements Closeable {
+
+  private final Timer _timer;
+
+  public CloseableTimer(Timer timer) {
+    _timer = timer;
+  }
+
+  @Override
+  public void close() throws IOException {
+    _timer.cancel();
+    _timer.purge();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 1f0e080..bc377e3 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -330,13 +330,7 @@ public class ThriftBlurShardServer extends ThriftServer {
   }
 
   protected static Closeable makeCloseable(final Timer timer) {
-    return new Closeable() {
-      @Override
-      public void close() throws IOException {
-        timer.cancel();
-        timer.purge();
-      }
-    };
+    return new CloseableTimer(timer);
   }
 
   @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/MiniCluster.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/MiniCluster.java b/blur-core/src/test/java/org/apache/blur/MiniCluster.java
index 114f0d9..5c30019 100644
--- a/blur-core/src/test/java/org/apache/blur/MiniCluster.java
+++ b/blur-core/src/test/java/org/apache/blur/MiniCluster.java
@@ -125,6 +125,10 @@ public class MiniCluster {
   public void startBlurCluster(String path, int controllerCount, int shardCount) {
     startBlurCluster(path, controllerCount, shardCount, false, false);
   }
+  
+  public void startBlurCluster(String path, int controllerCount, int shardCount, boolean
randomPort) {
+    startBlurCluster(path, controllerCount, shardCount, randomPort, false);
+  }
 
   public void startBlurCluster(String path, int controllerCount, int shardCount, boolean
randomPort,
       boolean externalProcesses) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
b/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
index 946b16f..3243006 100644
--- a/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
@@ -49,12 +49,12 @@ public class ThriftFieldManagerTest extends BaseFieldManagerTest {
     }
   }
 
-  public Iface getClient() {
+  public Iface getClient() throws IOException {
     return SuiteCluster.getClient();
   }
 
   @Before
-  public void setup() throws BlurException, TException {
+  public void setup() throws BlurException, TException, IOException {
     _tableDescriptor = new TableDescriptor();
     _tableDescriptor.setName("ThriftFieldManagerTest");
     _tableDescriptor.setShardCount(1);
@@ -65,7 +65,7 @@ public class ThriftFieldManagerTest extends BaseFieldManagerTest {
   }
 
   @After
-  public void teardown() throws BlurException, TException {
+  public void teardown() throws BlurException, TException, IOException {
     Iface client = getClient();
     String table = _tableDescriptor.getName();
     client.disableTable(table);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
index f32b58f..5b5dd63 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
@@ -57,7 +57,7 @@ public class BaseClusterTest {
 	    }
 	  }
 	  
-	  public Iface getClient() {
+	  public Iface getClient() throws IOException {
 	    return SuiteCluster.getClient();
 	  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java b/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
index 0c10f39..6ded4ea 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
@@ -60,7 +60,7 @@ public class IntegrationTestSuite {
   };
   
   @After
-  public void tearDown() throws BlurException, TException {
+  public void tearDown() throws BlurException, TException, IOException {
     Iface client = SuiteCluster.getClient();
     List<String> tableList = client.tableList();
     for (String table : tableList) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java b/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
index 36bc982..7768c6c 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
@@ -18,9 +18,10 @@ package org.apache.blur.thrift;
 import java.io.File;
 import java.io.IOException;
 
-
+import org.apache.blur.BlurConfiguration;
 import org.apache.blur.MiniCluster;
 import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.utils.BlurConstants;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -37,6 +38,7 @@ public class SuiteCluster {
       if (file.exists()) {
         FileUtils.deleteDirectory(file);
       }
+      cluster = null;
     }
   }
 
@@ -55,8 +57,11 @@ public class SuiteCluster {
     }
   }
 
-  public static Iface getClient() {
-    return BlurClient.getClient(cluster.getControllerConnectionStr());
+  public static Iface getClient() throws IOException {
+    String zkConnectionString = cluster.getZkConnectionString();
+    BlurConfiguration blurConfiguration = new BlurConfiguration();
+    blurConfiguration.set(BlurConstants.BLUR_ZOOKEEPER_CONNECTION, zkConnectionString);
+    return BlurClient.getClient(blurConfiguration);
   }
 
   public static boolean isClusterSetup() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d52f266b/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java b/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
index ae906fe..a17236a 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
@@ -92,7 +92,7 @@ public class TermsTests extends BaseClusterTest {
   }
   
   @Test(expected=BlurException.class)
-  public void termsShouldFailOnUnknownTable() throws BlurException, TException {
+  public void termsShouldFailOnUnknownTable() throws BlurException, TException, IOException
{
     getClient().terms("termsShouldFailOnUnknownTable", "test","col1", null, (short)10);
   }
 


Mime
View raw message