incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Adding a test suite to the console to make the units tests reuse the minicluster.
Date Thu, 19 Jun 2014 16:33:18 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/apache-blur-0.2 88a61dfd1 -> cd2673f8a


Adding a test suite to the console to make the units tests reuse the minicluster.


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

Branch: refs/heads/apache-blur-0.2
Commit: 397bc0d3bd4a375affe6a4089104b1dda7258d21
Parents: 871f526
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Jun 19 11:28:13 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Jun 19 11:28:13 2014 -0400

----------------------------------------------------------------------
 blur-console/pom.xml                            | 272 ++++++++++---------
 .../org/apache/blur/console/util/Config.java    | 239 ++++++++--------
 .../apache/blur/console/ConsoleTestBase.java    |  41 +--
 .../apache/blur/console/ConsoleTestSuite.java   |  66 +++++
 pom.xml                                         |   4 +-
 5 files changed, 355 insertions(+), 267 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/397bc0d3/blur-console/pom.xml
----------------------------------------------------------------------
diff --git a/blur-console/pom.xml b/blur-console/pom.xml
index 6d16975..7951f31 100644
--- a/blur-console/pom.xml
+++ b/blur-console/pom.xml
@@ -27,16 +27,17 @@
 	<packaging>jar</packaging>
 	<name>Blur Console</name>
 
-    <properties>
-        <!-- Grunt Execution Target. Valid values are [ development | production ] -->
-        <grunt.target>development</grunt.target>
+	<properties>
+		<!-- Grunt Execution Target. Valid values are [ development | production 
+			] -->
+		<grunt.target>development</grunt.target>
 
-        <!-- Maven Plugin Versions -->
-        <plugin.maven.exec.version>1.2.1</plugin.maven.exec.version>
-    </properties>
+		<!-- Maven Plugin Versions -->
+		<plugin.maven.exec.version>1.2.1</plugin.maven.exec.version>
+	</properties>
 
 	<dependencies>
-        <!-- Blur Dependencies -->
+		<!-- Blur Dependencies -->
 		<dependency>
 			<groupId>org.apache.blur</groupId>
 			<artifactId>blur-thrift</artifactId>
@@ -48,7 +49,7 @@
 			<version>${project.version}</version>
 		</dependency>
 
-        <!-- Development and Runtime Libraries -->
+		<!-- Development and Runtime Libraries -->
 		<dependency>
 			<groupId>org.codehaus.jackson</groupId>
 			<artifactId>jackson-mapper-asl</artifactId>
@@ -78,44 +79,49 @@
 	</dependencies>
 
 	<build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-                <includes>
-                    <include>**/blur-console-build.properties</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>false</filtering>
-                <excludes>
-                    <exclude>**/blur-console-build.properties</exclude>
-                </excludes>
-            </resource>
-        </resources>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>true</filtering>
+				<includes>
+					<include>**/blur-console-build.properties</include>
+				</includes>
+			</resource>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>false</filtering>
+				<excludes>
+					<exclude>**/blur-console-build.properties</exclude>
+				</excludes>
+			</resource>
+		</resources>
 
 		<plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-clean-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-            </plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-clean-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-source-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-resources-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<includes>
+						<include>**/ConsoleTestSuite.*</include>
+					</includes>
+				</configuration>
+			</plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
@@ -126,50 +132,50 @@
 					<target>1.6</target>
 				</configuration>
 			</plugin>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <mainClass>org.apache.blur.console.Main</mainClass>
-                        </manifest>
-                    </archive>
-                    <descriptors>
-                        <descriptor>src/assemble/webapp.xml</descriptor>
-                    </descriptors>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-		        <groupId>org.apache.maven.plugins</groupId>
-		        <artifactId>maven-checkstyle-plugin</artifactId>
-		        <version>2.12.1</version>
-		        <configuration>
-		          <configLocation>checkstyle.xml</configLocation>
-		        </configuration>
-		      </plugin>
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<configuration>
+					<archive>
+						<manifest>
+							<mainClass>org.apache.blur.console.Main</mainClass>
+						</manifest>
+					</archive>
+					<descriptors>
+						<descriptor>src/assemble/webapp.xml</descriptor>
+					</descriptors>
+				</configuration>
+				<executions>
+					<execution>
+						<id>make-assembly</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-checkstyle-plugin</artifactId>
+				<version>2.12.1</version>
+				<configuration>
+					<configLocation>checkstyle.xml</configLocation>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 
-    <profiles>
-        <profile>
-            <id>hadoop-1x</id>
-            <activation>
-                <property>
-                    <name>hadoop1</name>
-                </property>
-            </activation>
-            <properties>
-                <projectVersion>${project.parent.version}-hadoop1</projectVersion>
-            </properties>
+	<profiles>
+		<profile>
+			<id>hadoop-1x</id>
+			<activation>
+				<property>
+					<name>hadoop1</name>
+				</property>
+			</activation>
+			<properties>
+				<projectVersion>${project.parent.version}-hadoop1</projectVersion>
+			</properties>
 			<dependencies>
 				<dependency>
 					<groupId>org.apache.hadoop</groupId>
@@ -178,17 +184,17 @@
 					<scope>test</scope>
 				</dependency>
 			</dependencies>
-        </profile>
-        <profile>
-            <id>hadoop-2.2</id>
-            <activation>
-                <property>
-                    <name>hadoop2</name>
-                </property>
-            </activation>
-            <properties>
-                <projectVersion>${project.parent.version}-hadoop2</projectVersion>
-            </properties>
+		</profile>
+		<profile>
+			<id>hadoop-2.2</id>
+			<activation>
+				<property>
+					<name>hadoop2</name>
+				</property>
+			</activation>
+			<properties>
+				<projectVersion>${project.parent.version}-hadoop2</projectVersion>
+			</properties>
 			<dependencies>
 				<dependency>
 					<groupId>org.apache.hadoop</groupId>
@@ -202,39 +208,43 @@
 					<scope>test</scope>
 				</dependency>
 			</dependencies>
-        </profile>
-        <profile>
-            <id>web-war</id>
-            <properties>
-                <grunt.target>production</grunt.target>
-            </properties>
-        </profile>
-        <profile>
-            <id>grunt</id>
-            <activation><property><name>env.BLUR_CONSOLE_DEV</name></property></activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>${plugin.maven.exec.version}</version>
-                        <executions>
-                            <!-- Install all webapp dependencies -->
-                            <execution>
-                                <id>WebApp Dependencies and Minification</id>
-                                <phase>generate-resources</phase>
-                                <goals>
-                                    <goal>exec</goal>
-                                </goals>
-                                <configuration>
-                                    <executable>${basedir}/src/main/scripts/grunt.sh</executable>
-                                    <commandlineArgs>${grunt.target}</commandlineArgs>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
+		</profile>
+		<profile>
+			<id>web-war</id>
+			<properties>
+				<grunt.target>production</grunt.target>
+			</properties>
+		</profile>
+		<profile>
+			<id>grunt</id>
+			<activation>
+				<property>
+					<name>env.BLUR_CONSOLE_DEV</name>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>exec-maven-plugin</artifactId>
+						<version>${plugin.maven.exec.version}</version>
+						<executions>
+							<!-- Install all webapp dependencies -->
+							<execution>
+								<id>WebApp Dependencies and Minification</id>
+								<phase>generate-resources</phase>
+								<goals>
+									<goal>exec</goal>
+								</goals>
+								<configuration>
+									<executable>${basedir}/src/main/scripts/grunt.sh</executable>
+									<commandlineArgs>${grunt.target}</commandlineArgs>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/397bc0d3/blur-console/src/main/java/org/apache/blur/console/util/Config.java
----------------------------------------------------------------------
diff --git a/blur-console/src/main/java/org/apache/blur/console/util/Config.java b/blur-console/src/main/java/org/apache/blur/console/util/Config.java
index 784440b..59cc0f6 100644
--- a/blur-console/src/main/java/org/apache/blur/console/util/Config.java
+++ b/blur-console/src/main/java/org/apache/blur/console/util/Config.java
@@ -39,121 +39,126 @@ import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.type.TypeReference;
 
 public class Config {
-	private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/mini-cluster"));
-	private static final Log log = LogFactory.getLog(Config.class);
-	
-	private static int port;
-	private static BlurConfiguration blurConfig;
-	private static ZookeeperClusterStatus zk;
-	private static String blurConnection;
-	private static Object cluster;
-	private static Map<String, String> globalUserProperties;
-
-	public static int getConsolePort() {
-		return port;
-	}
-	public static BlurConfiguration getBlurConfig() {
-		return blurConfig;
-	}
-	
-	public static void setupConfig() throws IOException {
-		if (cluster == null) {
-			blurConfig = new BlurConfiguration();
-		} else {
-			blurConfig = new BlurConfiguration(false);
-			
-			String zkConnection = "";
-			try {
-				Method zkMethod = cluster.getClass().getMethod("getZkConnectionString");
-				zkConnection = (String) zkMethod.invoke(cluster);
-			} catch (Exception e) {
-				log.fatal("Unable get zookeeper connection string", e);
-			}
-			
-			blurConfig.set("blur.zookeeper.connection", zkConnection);
-		}
-		zk = new ZookeeperClusterStatus(blurConfig.get("blur.zookeeper.connection"), blurConfig);
-		blurConnection = buildConnectionString();
-		port = blurConfig.getInt("blur.console.port", 8080);
-		parseSecurity();
-	}
-	
-	private static void parseSecurity() {
-		String securityFile = blurConfig.get("blur.console.security.file");
-		
-		if (securityFile != null) {
-			JsonFactory factory = new JsonFactory(); 
-		    ObjectMapper mapper = new ObjectMapper(factory); 
-		    File from = new File(securityFile); 
-		    TypeReference<Map<String,String>> typeRef 
-		            = new TypeReference<Map<String,String>>() {};
-
-		    try {
-				globalUserProperties = mapper.readValue(from, typeRef);
-			} catch (Exception e) {
-				log.error("Unable to parse security file.  Search may not work right.", e);
-				globalUserProperties = null;
-			} 
-		}
-	}
-	
-	public static String getConnectionString() throws IOException {
-		return blurConnection;
-	}
-	
-	public static ZookeeperClusterStatus getZookeeper() {
-		return zk;
-	}
-	
-	private static String buildConnectionString() {
-		List<String> allControllers = new ArrayList<String>();
-		allControllers = zk.getControllerServerList();
-		return StringUtils.join(allControllers, ",");
-	}
-	
-	public static void shutdownMiniCluster() throws IOException {
-		if (cluster != null) {
-			try {
-				Method method = cluster.getClass().getMethod("shutdownBlurCluster");
-				method.invoke(cluster);
-			} catch (Exception e) {
-				log.fatal("Unable to stop mini cluster through reflection.", e);
-			}
-			File file = new File(TMPDIR, "blur-cluster-test");
-			if (file.exists()) {
-				FileUtils.deleteDirectory(file);
-			}
-		}
-	}
-	
-	
-	@SuppressWarnings({ "unchecked", "rawtypes" })
-	public static void setupMiniCluster() throws IOException {
-	    File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
-	    testDirectory.mkdirs();
-
-	    testDirectory.delete();
-	    try {
-	    	Class clusterClass = Class.forName("org.apache.blur.MiniCluster", false, Config.class.getClassLoader());
-	    
-		    if (clusterClass != null) {
-		    	cluster = clusterClass.newInstance();
-		    	Method startBlurCluster = clusterClass.getDeclaredMethod("startBlurCluster", String.class,
int.class, int.class, boolean.class);
-		    	startBlurCluster.invoke(cluster, new File(testDirectory, "cluster").getAbsolutePath(),
2, 3, true);
-		    }
-	    } catch (Exception e) {
-	    	log.fatal("Unable to start in dev mode because MiniCluster isn't in classpath", e);
-	    	cluster = null;
-	    }
-	}
-	
-	public static Iface getClient(String username) throws IOException {
-		Iface client = BlurClient.getClient(getConnectionString());
-		
-		if (globalUserProperties != null) {
-			UserContext.setUser(new User(username, globalUserProperties));
-		}
-		
-		return client;
-	}
+  private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/mini-cluster"));
+  private static final Log log = LogFactory.getLog(Config.class);
+
+  private static int port;
+  private static BlurConfiguration blurConfig;
+  private static ZookeeperClusterStatus zk;
+  private static String blurConnection;
+  private static Object cluster;
+  private static Map<String, String> globalUserProperties;
+
+  public static int getConsolePort() {
+    return port;
+  }
+
+  public static BlurConfiguration getBlurConfig() {
+    return blurConfig;
+  }
+
+  public static void setupConfig() throws IOException {
+    if (cluster == null) {
+      blurConfig = new BlurConfiguration();
+    } else {
+      blurConfig = new BlurConfiguration(false);
+
+      String zkConnection = "";
+      try {
+        Method zkMethod = cluster.getClass().getMethod("getZkConnectionString");
+        zkConnection = (String) zkMethod.invoke(cluster);
+      } catch (Exception e) {
+        log.fatal("Unable get zookeeper connection string", e);
+      }
+
+      blurConfig.set("blur.zookeeper.connection", zkConnection);
+    }
+    zk = new ZookeeperClusterStatus(blurConfig.get("blur.zookeeper.connection"), blurConfig);
+    blurConnection = buildConnectionString();
+    port = blurConfig.getInt("blur.console.port", 8080);
+    parseSecurity();
+  }
+
+  private static void parseSecurity() {
+    String securityFile = blurConfig.get("blur.console.security.file");
+
+    if (securityFile != null) {
+      JsonFactory factory = new JsonFactory();
+      ObjectMapper mapper = new ObjectMapper(factory);
+      File from = new File(securityFile);
+      TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String,
String>>() {
+      };
+
+      try {
+        globalUserProperties = mapper.readValue(from, typeRef);
+      } catch (Exception e) {
+        log.error("Unable to parse security file.  Search may not work right.", e);
+        globalUserProperties = null;
+      }
+    }
+  }
+
+  public static String getConnectionString() throws IOException {
+    return blurConnection;
+  }
+
+  public static ZookeeperClusterStatus getZookeeper() {
+    return zk;
+  }
+
+  private static String buildConnectionString() {
+    List<String> allControllers = new ArrayList<String>();
+    allControllers = zk.getControllerServerList();
+    return StringUtils.join(allControllers, ",");
+  }
+
+  public static void shutdownMiniCluster() throws IOException {
+    if (cluster != null) {
+      try {
+        Method method = cluster.getClass().getMethod("shutdownBlurCluster");
+        method.invoke(cluster);
+      } catch (Exception e) {
+        log.fatal("Unable to stop mini cluster through reflection.", e);
+      }
+      File file = new File(TMPDIR, "blur-cluster-test");
+      if (file.exists()) {
+        FileUtils.deleteDirectory(file);
+      }
+    }
+  }
+
+  public static boolean isClusterSetup() {
+    return cluster != null;
+  }
+
+  @SuppressWarnings({ "unchecked", "rawtypes" })
+  public static void setupMiniCluster() throws IOException {
+    File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
+    testDirectory.mkdirs();
+
+    testDirectory.delete();
+    try {
+      Class clusterClass = Class.forName("org.apache.blur.MiniCluster", false, Config.class.getClassLoader());
+
+      if (clusterClass != null) {
+        cluster = clusterClass.newInstance();
+        Method startBlurCluster = clusterClass.getDeclaredMethod("startBlurCluster", String.class,
int.class,
+            int.class, boolean.class);
+        startBlurCluster.invoke(cluster, new File(testDirectory, "cluster").getAbsolutePath(),
2, 3, true);
+      }
+    } catch (Exception e) {
+      log.fatal("Unable to start in dev mode because MiniCluster isn't in classpath", e);
+      cluster = null;
+    }
+  }
+
+  public static Iface getClient(String username) throws IOException {
+    Iface client = BlurClient.getClient(getConnectionString());
+
+    if (globalUserProperties != null) {
+      UserContext.setUser(new User(username, globalUserProperties));
+    }
+
+    return client;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/397bc0d3/blur-console/src/test/java/org/apache/blur/console/ConsoleTestBase.java
----------------------------------------------------------------------
diff --git a/blur-console/src/test/java/org/apache/blur/console/ConsoleTestBase.java b/blur-console/src/test/java/org/apache/blur/console/ConsoleTestBase.java
index 0aeebaf..aabe047 100644
--- a/blur-console/src/test/java/org/apache/blur/console/ConsoleTestBase.java
+++ b/blur-console/src/test/java/org/apache/blur/console/ConsoleTestBase.java
@@ -25,21 +25,28 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
 public class ConsoleTestBase {
-	protected static String TABLE_PATH = new File("./test-data/test-tables").getAbsolutePath();
-
-	@BeforeClass
-	public static void startup() throws IOException {
-		Config.setupMiniCluster();
-	}
-
-	@AfterClass
-	public static void shutdown() throws IOException {
-		Config.shutdownMiniCluster();
-	}
-
-	protected void setupConfigIfNeeded() throws IOException {
-		if (Config.getBlurConfig() == null) {
-			Config.setupConfig();
-		}
-	}
+  protected static String TABLE_PATH = new File("./target/tmp/test-data/test-tables").getAbsolutePath();
+  private static boolean _managing;
+
+  @BeforeClass
+  public static void startup() throws IOException {
+    if (!Config.isClusterSetup()) {
+      Config.setupMiniCluster();
+      _managing = true;
+    }
+
+  }
+
+  @AfterClass
+  public static void shutdown() throws IOException {
+    if (_managing) {
+      Config.shutdownMiniCluster();
+    }
+  }
+
+  protected void setupConfigIfNeeded() throws IOException {
+    if (Config.getBlurConfig() == null) {
+      Config.setupConfig();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/397bc0d3/blur-console/src/test/java/org/apache/blur/console/ConsoleTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-console/src/test/java/org/apache/blur/console/ConsoleTestSuite.java b/blur-console/src/test/java/org/apache/blur/console/ConsoleTestSuite.java
new file mode 100644
index 0000000..095673b
--- /dev/null
+++ b/blur-console/src/test/java/org/apache/blur/console/ConsoleTestSuite.java
@@ -0,0 +1,66 @@
+package org.apache.blur.console;
+
+import java.io.IOException;
+
+import org.apache.blur.console.util.Config;
+import org.apache.blur.console.util.ConfigTest;
+import org.apache.blur.console.util.NodeUtilTest;
+import org.apache.blur.console.util.QueryUtilTest;
+import org.apache.blur.console.util.TableUtilTest;
+import org.junit.*;
+import org.junit.rules.ExternalResource;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * 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.
+ */
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ ConfigTest.class, NodeUtilTest.class, QueryUtilTest.class, TableUtilTest.class
})
+public class ConsoleTestSuite {
+
+  @ClassRule
+  public static ExternalResource testCluster = new ExternalResource() {
+
+    private boolean _managing;
+
+    @Override
+    protected void after() {
+      if (_managing) {
+        try {
+          Config.shutdownMiniCluster();
+        } catch (IOException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
+
+    @Override
+    protected void before() throws Throwable {
+      if (!Config.isClusterSetup()) {
+        _managing = true;
+        try {
+          Config.setupMiniCluster();
+        } catch (IOException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
+
+  };
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/397bc0d3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 75e9fe5..77c3375 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,7 +178,7 @@ under the License.
 		<log4j.version>1.2.15</log4j.version>
 		<jersey.version>1.14</jersey.version>
 		<lucene.version>4.3.0</lucene.version>
-		<junit.version>4.7</junit.version>
+		<junit.version>4.9</junit.version>
 		<slf4j.version>1.6.1</slf4j.version>
 		<commons-cli.version>1.2</commons-cli.version>
 		<concurrentlinkedhashmap-lru.version>1.3.2</concurrentlinkedhashmap-lru.version>
@@ -198,7 +198,7 @@ under the License.
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>4.7</version>
+			<version>${junit.version}</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>


Mime
View raw message