incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: This should fix the unit tests, by forcing maven to execute each test in a seperate jvm.
Date Sat, 25 May 2013 00:57:11 GMT
Updated Branches:
  refs/heads/0.1.5 7abb183c9 -> fbee0e711


This should fix the unit tests, by forcing maven to execute each test in a seperate jvm.


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

Branch: refs/heads/0.1.5
Commit: fbee0e711b84ff924545db9d1582b10398c5847e
Parents: 7abb183
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri May 24 20:56:23 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri May 24 20:56:23 2013 -0400

----------------------------------------------------------------------
 .../clusterstatus/ZookeeperClusterStatusTest.java  |    5 +-
 .../manager/writer/TransactionRecorderTest.java    |   38 +++++++++++----
 src/pom.xml                                        |    7 +++
 3 files changed, 38 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fbee0e71/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
b/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
index 27d1e6e..0416134 100644
--- a/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
@@ -31,11 +31,10 @@ import java.util.concurrent.TimeUnit;
 import org.apache.blur.MiniCluster;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.manager.clusterstatus.ZookeeperPathConstants;
 import org.apache.blur.thrift.generated.AnalyzerDefinition;
 import org.apache.blur.thrift.generated.TableDescriptor;
 import org.apache.blur.utils.BlurUtil;
+import org.apache.blur.zookeeper.ZooKeeperClient;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
@@ -80,7 +79,7 @@ public class ZookeeperClusterStatusTest {
 
   @Before
   public void setup() throws KeeperException, InterruptedException, IOException {
-    zooKeeper = new ZooKeeper(MiniCluster.getZkConnectionString(), 30000, new Watcher() {
+    zooKeeper = new ZooKeeperClient(MiniCluster.getZkConnectionString(), 30000, new Watcher()
{
       @Override
       public void process(WatchedEvent event) {
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fbee0e71/src/blur-core/src/test/java/org/apache/blur/manager/writer/TransactionRecorderTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/manager/writer/TransactionRecorderTest.java
b/src/blur-core/src/test/java/org/apache/blur/manager/writer/TransactionRecorderTest.java
index 3ded662..4cff23e 100644
--- a/src/blur-core/src/test/java/org/apache/blur/manager/writer/TransactionRecorderTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/manager/writer/TransactionRecorderTest.java
@@ -21,12 +21,17 @@ import static org.apache.blur.lucene.LuceneVersionConstant.LUCENE_VERSION;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.net.URI;
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.blur.MiniCluster;
 import org.apache.blur.index.IndexWriter;
+import org.apache.blur.log.Log;
+import org.apache.blur.log.LogFactory;
 import org.apache.blur.server.ShardContext;
 import org.apache.blur.server.TableContext;
 import org.apache.blur.thrift.generated.AnalyzerDefinition;
@@ -37,30 +42,43 @@ import org.apache.blur.thrift.generated.TableDescriptor;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.RAMDirectory;
+import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TransactionRecorderTest {
-  
+
+  private static final Log LOG = LogFactory.getLog(TransactionRecorderTest.class);
+
   @BeforeClass
   public static void setup() {
     MiniCluster.startDfs("target/transaction-recorder-test");
   }
-  
+
   @AfterClass
-  public static void teardown() {
+  public static void teardown() throws IOException {
     MiniCluster.shutdownDfs();
   }
 
+  private Collection<Closeable> closeThis = new HashSet<Closeable>();
+
+  @After
+  public void after() {
+    for (Closeable closeable : closeThis) {
+      IOUtils.cleanup(LOG, closeable);
+    }
+  }
+
   @Test
   public void testReplaySimpleTest() throws IOException, InterruptedException {
-    Configuration configuration = new Configuration();
+    Configuration configuration = new Configuration(false);
     URI fileSystemUri = MiniCluster.getFileSystemUri();
     Path path = new Path(fileSystemUri.toString() + "/transaction-recorder-test");
     FileSystem fileSystem = path.getFileSystem(configuration);
@@ -70,19 +88,23 @@ public class TransactionRecorderTest {
 
     TableDescriptor tableDescriptor = new TableDescriptor();
     tableDescriptor.setName("table");
-    tableDescriptor.setTableUri(new Path(path, "tableuri").toUri().toString());
+    String tableUri = new Path(path, "tableuri").toUri().toString();
+
+    System.out.println("tableUri=" + tableUri);
+    tableDescriptor.setTableUri(tableUri);
     tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
 
     TableContext tableContext = TableContext.create(tableDescriptor);
     ShardContext shardContext = ShardContext.create(tableContext, "shard-1");
     TransactionRecorder transactionRecorder = new TransactionRecorder(shardContext);
+    closeThis.add(transactionRecorder);
     transactionRecorder.open();
     try {
       transactionRecorder.replaceRow(true, genRow(), null);
       fail("Should NPE");
     } catch (NullPointerException e) {
     }
-    
+
     Thread.sleep(TimeUnit.NANOSECONDS.toMillis(tableContext.getTimeBetweenWALSyncsNanos())
* 2);
 
     RAMDirectory directory = new RAMDirectory();
@@ -90,12 +112,10 @@ public class TransactionRecorderTest {
     IndexWriter writer = new IndexWriter(directory, conf);
 
     TransactionRecorder replayTransactionRecorder = new TransactionRecorder(shardContext);
+    closeThis.add(replayTransactionRecorder);
     replayTransactionRecorder.replay(writer);
     IndexReader reader = DirectoryReader.open(directory);
     assertEquals(1, reader.numDocs());
-    
-    // cleanup recorder
-    transactionRecorder.close();
   }
 
   private Row genRow() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fbee0e71/src/pom.xml
----------------------------------------------------------------------
diff --git a/src/pom.xml b/src/pom.xml
index edb3127..9088605 100644
--- a/src/pom.xml
+++ b/src/pom.xml
@@ -99,6 +99,13 @@ under the License.
 
 		<pluginManagement>
 			<plugins>
+				<plugin>
+				  <groupId>org.apache.maven.plugins</groupId>
+				  <artifactId>maven-surefire-plugin</artifactId>
+				  <configuration>
+				    <reuseForks>false</reuseForks>
+				  </configuration>
+				</plugin>
 				<!-- Ignore/Execute plugin execution -->
 		        <plugin>
 		          <artifactId>maven-assembly-plugin</artifactId>


Mime
View raw message