You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2015/09/04 16:40:36 UTC

gora git commit: GORA-314 Implement TestDriver for AccumuloStoreTest e.g. TODO in class

Repository: gora
Updated Branches:
  refs/heads/master 97d584510 -> d4797dc28


GORA-314 Implement TestDriver for AccumuloStoreTest e.g. TODO in class


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

Branch: refs/heads/master
Commit: d4797dc28ec09a8aa34053826a3cf76f2eb7fe6c
Parents: 97d5845
Author: Lewis John McGibbney <le...@jpl.nasa.gov>
Authored: Fri Sep 4 07:38:40 2015 -0700
Committer: Lewis John McGibbney <le...@jpl.nasa.gov>
Committed: Fri Sep 4 07:38:40 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../gora/accumulo/GoraAccumuloTestDriver.java   | 69 ++++++++++++++++++++
 .../org/apache/gora/accumulo/package-info.java  | 21 ++++++
 .../gora/accumulo/store/AccumuloStoreTest.java  | 28 ++++++--
 4 files changed, 115 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/d4797dc2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 31cafc5..8b79248 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,8 @@
 
 Current Development
 
+* GORA-314 Implement TestDriver for AccumuloStoreTest e.g. TODO in class (lewismc)
+
 * GORA-417 Deploy Hadoop-1 compatible binaries for Apache Gora (lewismc)
 
 * GORA-432 Simplify if Statements (Furkan KAMACI via lewismc)

http://git-wip-us.apache.org/repos/asf/gora/blob/d4797dc2/gora-accumulo/src/test/java/org/apache/gora/accumulo/GoraAccumuloTestDriver.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/test/java/org/apache/gora/accumulo/GoraAccumuloTestDriver.java b/gora-accumulo/src/test/java/org/apache/gora/accumulo/GoraAccumuloTestDriver.java
new file mode 100644
index 0000000..0d33444
--- /dev/null
+++ b/gora-accumulo/src/test/java/org/apache/gora/accumulo/GoraAccumuloTestDriver.java
@@ -0,0 +1,69 @@
+/**
+ * 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.gora.accumulo;
+
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.gora.GoraTestDriver;
+import org.apache.gora.accumulo.store.AccumuloStore;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author lmcgibbn
+ *
+ */
+public class GoraAccumuloTestDriver extends GoraTestDriver {
+
+  private static final Logger LOG = LoggerFactory.getLogger(GoraAccumuloTestDriver.class);
+  private static MiniAccumuloCluster cluster = null;
+  private static final String PASSWORD = "password";
+
+  @Rule
+  public TemporaryFolder tmpDir = new TemporaryFolder();
+
+  public GoraAccumuloTestDriver() throws Exception {
+    super(AccumuloStore.class);
+  }
+
+  @Override
+  public void setUpClass() throws Exception {
+    super.setUpClass();
+    log.info("Starting Accumulo MiniAccumuloCluster...");
+    try {
+      tmpDir.create();
+      cluster = new MiniAccumuloCluster(tmpDir.getRoot(), PASSWORD);
+      cluster.start();
+    } catch (Exception e) {
+      LOG.error("Error starting Accumulo MiniAccumuloCluster: {}", e.getMessage());
+      // cleanup
+      tearDownClass();
+    }
+  }
+
+  @Override
+  public void tearDownClass() throws Exception {
+    super.tearDownClass();
+    log.info("Shutting down Accumulo MiniAccumuloCluster...");
+    if (cluster != null) {
+      cluster.stop();
+    }
+    tmpDir.delete();
+  }
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/d4797dc2/gora-accumulo/src/test/java/org/apache/gora/accumulo/package-info.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/test/java/org/apache/gora/accumulo/package-info.java b/gora-accumulo/src/test/java/org/apache/gora/accumulo/package-info.java
new file mode 100644
index 0000000..7a5b8f2
--- /dev/null
+++ b/gora-accumulo/src/test/java/org/apache/gora/accumulo/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+/**
+ * Tests for <code>gora-accumulo</code> including
+ * the test driver for {@link org.apache.gora.accumulo.store.AccumuloStoreTest}
+ */
+package org.apache.gora.accumulo;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/d4797dc2/gora-accumulo/src/test/java/org/apache/gora/accumulo/store/AccumuloStoreTest.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/test/java/org/apache/gora/accumulo/store/AccumuloStoreTest.java b/gora-accumulo/src/test/java/org/apache/gora/accumulo/store/AccumuloStoreTest.java
index 95d2fae..285f439 100644
--- a/gora-accumulo/src/test/java/org/apache/gora/accumulo/store/AccumuloStoreTest.java
+++ b/gora-accumulo/src/test/java/org/apache/gora/accumulo/store/AccumuloStoreTest.java
@@ -18,32 +18,50 @@ package org.apache.gora.accumulo.store;
 
 import java.io.IOException;
 
+import org.apache.gora.accumulo.GoraAccumuloTestDriver;
 import org.apache.gora.examples.generated.Employee;
 import org.apache.gora.examples.generated.WebPage;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestBase;
 import org.apache.hadoop.conf.Configuration;
+import org.junit.Before;
 import org.junit.Ignore;
 
 /**
- * 
+ * Tests extending {@link org.apache.gora.store.DataStoreTestBase}
+ * which run the base JUnit test suite for Gora.
  */
 public class AccumuloStoreTest extends DataStoreTestBase {
-  
-  // TODO implement test driver
+
+  static {
+    try {
+    setTestDriver(new GoraAccumuloTestDriver());
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+  }
+
+  public GoraAccumuloTestDriver getTestDriver() {
+    return (GoraAccumuloTestDriver) testDriver;
+  }
 
   @Override
   protected DataStore<String,Employee> createEmployeeDataStore() throws IOException {
     return DataStoreFactory.getDataStore(String.class, Employee.class, new Configuration());
   }
-  
+
   @Override
   protected DataStore<String,WebPage> createWebPageDataStore() throws IOException {
     return DataStoreFactory.getDataStore(String.class, WebPage.class, new Configuration());
   }
 
-  
+
   //Until GORA-66 is resolved this test will always fail, so 
   //do not run it
   @Ignore("skipped until GORA-66 is resolved")