gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [23/37] gora git commit: Refactored the code
Date Wed, 23 Aug 2017 20:55:21 GMT
http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/avro/gora-cassandra-mapping.xml
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/avro/gora-cassandra-mapping.xml b/gora-cassandra-cql/src/test/conf/avro/gora-cassandra-mapping.xml
index 74e4b1c..105adc1 100644
--- a/gora-cassandra-cql/src/test/conf/avro/gora-cassandra-mapping.xml
+++ b/gora-cassandra-cql/src/test/conf/avro/gora-cassandra-mapping.xml
@@ -19,26 +19,32 @@
 
 <gora-otd>
 
-  <keyspace name="avroKeySpace" durableWrite="false">
-    <placementStrategy name="SimpleStrategy" replication_factor="1"/>
-  </keyspace>
-  
-  <class name="org.apache.gora.examples.generated.WebPage" keyClass="java.lang.String"
table="WebPage" keyspace="avroKeySpace">
-    <field name="url" column="url" type="ascii" />
-    <field name="content" column="content" type="blob"/>
-    <field name="parsedContent" column="parsedContent" type="list(ascii)"/>
-    <field name="outlinks" column="outlinks" type="map(text,text)"/>
-    <field name="headers" column="headers" type="map(text,text)"/>
-    <field name="byteData" column="byteData" type="map(text,blob)"/>
-    <field name="stringData" column="stringData" type="map(text,ascii)"/>
-  </class>
-
-  <class name="org.apache.gora.examples.generated.Employee" keyClass="java.lang.String"
keyspace="avroKeySpace"
-         table="Employee" compactStorage="true" >
-    <field name="name" column="name" type="text"/>
-    <field name="dateOfBirth" column="dob" type="bigint" />
-    <field name="ssn" column="ssn" type="text" />
-    <field name="salary" column="salary" type="int" />
-   </class>
+    <keyspace name="avroKeySpace" durableWrite="false">
+        <placementStrategy name="SimpleStrategy" replication_factor="1"/>
+    </keyspace>
+
+    <class name="org.apache.gora.examples.generated.WebPage" keyClass="java.lang.String"
table="WebPage"
+           allowFiltering="true"
+           keyspace="avroKeySpace">
+        <field name="url" column="url" type="ascii"/>
+        <field name="content" column="content" type="blob"/>
+        <field name="parsedContent" column="parsedContent" type="list(ascii)"/>
+        <field name="outlinks" column="outlinks" type="map(text,text)"/>
+        <field name="headers" column="headers" type="map(text,text)"/>
+        <field name="byteData" column="byteData" type="map(text,blob)"/>
+        <field name="metadata" column="metadata" type="blob"/>
+        <field name="stringData" column="stringData" type="map(text,ascii)"/>
+    </class>
+
+    <class name="org.apache.gora.examples.generated.Employee" keyClass="java.lang.String"
keyspace="avroKeySpace"
+           allowFiltering="true"
+           table="Employee" compactStorage="true">
+        <field name="name" column="name" type="text"/>
+        <field name="dateOfBirth" column="dob" type="bigint"/>
+        <field name="ssn" column="ssn" type="text"/>
+        <field name="salary" column="salary" type="int"/>
+        <field name="boss" column="boss" type="blob"/>
+        <field name="webpage" column="webpage" type="blob"/>
+    </class>
 
 </gora-otd>

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/compositeKey/gora-cassandra-mapping.xml
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/compositeKey/gora-cassandra-mapping.xml b/gora-cassandra-cql/src/test/conf/compositeKey/gora-cassandra-mapping.xml
index 42c6343..17b4a4a 100644
--- a/gora-cassandra-cql/src/test/conf/compositeKey/gora-cassandra-mapping.xml
+++ b/gora-cassandra-cql/src/test/conf/compositeKey/gora-cassandra-mapping.xml
@@ -19,11 +19,13 @@
 
 <gora-otd>
     <keyspace name="EmployeeSpace" durableWrite="false">
-        <placementStrategy name="SimpleStrategy" />
+        <placementStrategy name="SimpleStrategy"/>
     </keyspace>
 
-    <class name="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord"
keyClass="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey" keyspace="EmployeeSpace"
-           table="CassandraRecord" allowFiltering="true"  id="5a1c395e-b41f-11e5-9f22-ba0be0483c18">
+    <class name="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord"
+           keyClass="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey"
+           keyspace="EmployeeSpace"
+           table="CassandraRecord" allowFiltering="true" id="5a1c395e-b41f-11e5-9f22-ba0be0483c18">
         <field name="dataString" column="name" type="text"/>
         <field name="dataInt" column="age" type="int"/>
         <field name="dataLong" column="salary" type="bigint"/>
@@ -41,8 +43,8 @@
 
     <cassandraKey name="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey">
         <partitionKey>
-                <field name="url" column="urlData" type="text"/>
-                <field name="timestamp" column="timestampData" type="bigint"/>
+            <field name="url" column="urlData" type="text"/>
+            <field name="timestamp" column="timestampData" type="bigint"/>
         </partitionKey>
         <clusterKey>
             <key column="timestampData" order="desc"/>

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/gora-cassandra-mapping.xml
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/gora-cassandra-mapping.xml b/gora-cassandra-cql/src/test/conf/gora-cassandra-mapping.xml
index 90f5267..b36d8cd 100644
--- a/gora-cassandra-cql/src/test/conf/gora-cassandra-mapping.xml
+++ b/gora-cassandra-cql/src/test/conf/gora-cassandra-mapping.xml
@@ -71,7 +71,8 @@
         <field name="id" column="srilankan" type="uuid" ttl="10"/>
     </class>
 
-    <class name="org.apache.gora.examples.generated.Employee" keyClass="org.apache.gora.examples.generated.WebPage"
keyspace="WebPage"
+    <class name="org.apache.gora.examples.generated.Employee" keyClass="org.apache.gora.examples.generated.WebPage"
+           keyspace="WebPage"
            compactStorage="true" id="31323131">
         <field name="lname" column="name" type="text" ttl="10" primarykey="true"/>
         <field name="fname" column="name" type="text" ttl="10"/>

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/gora.properties
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/gora.properties b/gora-cassandra-cql/src/test/conf/gora.properties
index 012ac08..a109759 100644
--- a/gora-cassandra-cql/src/test/conf/gora.properties
+++ b/gora-cassandra-cql/src/test/conf/gora.properties
@@ -14,7 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-
 gora.datastore.default=org.apache.gora.cassandra.CassandraStore
 gora.cassandrastore.cluster=Gora Cassandra Test Cluster
 gora.cassandrastore.host=localhost:9160

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/log4j-server.properties
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/log4j-server.properties b/gora-cassandra-cql/src/test/conf/log4j-server.properties
index 142071a..b32aec0 100644
--- a/gora-cassandra-cql/src/test/conf/log4j-server.properties
+++ b/gora-cassandra-cql/src/test/conf/log4j-server.properties
@@ -14,18 +14,14 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-
-# for production, you should probably set pattern to %c instead of %l.  
+# for production, you should probably set pattern to %c instead of %l.
 # (%l is slower.)
-
 # output messages into a rolling log file as well as stdout
 log4j.rootLogger=INFO,stdout,R
-
 # stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
-
 # rolling log file
 log4j.appender.R=org.apache.log4j.RollingFileAppender
 log4j.appender.R.maxFileSize=20MB
@@ -34,15 +30,12 @@ log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
 # Edit the next line to point to your logs directory
 log4j.appender.R.File=target/log/var/log/cassandra/system.log
-
 # Application logging options
 #log4j.logger.org.apache.cassandra=DEBUG
 #log4j.logger.org.apache.cassandra.db=DEBUG
 #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
-
 # Adding this to avoid thrift logging disconnect errors.
 log4j.logger.org.apache.thrift.server.TNonblockingServer=ERROR
-
 # Add for gora-cassandra specific logging duing tests
 log4j.logger.org.apache.gora.cassandra=DEBUG
 

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora-cassandra-mapping.xml
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora-cassandra-mapping.xml
b/gora-cassandra-cql/src/test/conf/nativeSerialization/gora-cassandra-mapping.xml
index b301071..00ffb19 100644
--- a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora-cassandra-mapping.xml
+++ b/gora-cassandra-cql/src/test/conf/nativeSerialization/gora-cassandra-mapping.xml
@@ -17,54 +17,29 @@
   ~  limitations under the License.
   -->
 
-<!--
-   The values of 'replication_factor' and 'placementStrategy' attribute of keyspace tag
-   only apply if gora create the kyespace. they have no effect if this is being used against

-   an existing keyspace. the default value for 'replication_factor' is '1'
-   
-   The value of 'placement_strategy' should be a fully qualifed class name that is known
to
-   the cassansra cluster, not the application or gora. As of this writing, the classes that
ship
-   with cassandra are:
-   'org.apache.cassandra.locator.SimpleStrategy'
-   'org.apache.cassandra.locator.NetworkTopologyStrategy'
-   gora cassandra would use SimpleStrategy by default if no value for this attribute is specified
-   
-   The default value of 'gc_grace_seconds' is '0' which is ONLY VIABLE FOR SINGLE NODE
-   CLUSTER. you should update this value according to your cluster configuration. 
-   https://wiki.apache.org/cassandra/StorageConfiguration
-
-   The value of 'ttl' (time to live) attribute of field tag should most likely always
-   be zero unless you want Cassandra to create Tombstones and delete portions of your
-   data once this period expires. Any positive value is read and bound to the number
-   of seconds after which the value for that field will disappear. The default value of ttl
-   is '0'
-
-   More information on gora-cassandra configuration and mapping's can be found
-   at http://gora.apache.org/current/gora-cassandra.html
--->
-
-
 <gora-otd>
     <keyspace name="nativeTestKeySpace" durableWrite="false">
         <placementStrategy name="SimpleStrategy" replication_factor="1"/>
     </keyspace>
 
-    <class name="org.apache.gora.cassandra.example.generated.nativeSerialization.User"
keyClass="java.util.UUID" keyspace="nativeTestKeySpace"
-           table="users" >
+    <class name="org.apache.gora.cassandra.example.generated.nativeSerialization.User"
keyClass="java.util.UUID"
+           keyspace="nativeTestKeySpace"
+           table="users">
         <field name="userId" column="user_id" type="uuid" primarykey="true"/>
-        <field name="name" column="name" type="text" />
-        <field name="dateOfBirth" column="dob" type="timestamp" />
+        <field name="name" column="name" type="text"/>
+        <field name="dateOfBirth" column="dob" type="timestamp"/>
     </class>
 
-    <class name="org.apache.gora.cassandra.example.generated.nativeSerialization.ComplexTypes"
keyClass="java.lang.String" keyspace="nativeTestKeySpace"
-           table="documents" >
+    <class name="org.apache.gora.cassandra.example.generated.nativeSerialization.ComplexTypes"
+           keyClass="java.lang.String" keyspace="nativeTestKeySpace"
+           table="documents">
         <field name="id" column="id" type="text" primarykey="true"/>
         <field name="listDataType" column="listDataType" type="list(text)"/>
         <field name="listUUIDDataType" column="listUUIDDataType" type="list(uuid)"/>
-        <field name="mapDataType" column="mapDataType" type="map(text,text)" />
-        <field name="stringArrayDataType" column="stringArrayDataType" type="list(text)"
/>
-        <field name="intArrayDataType" column="intArrayDataType" type="list(int)" />
-        <field name="setDataType" column="setDataType" type="set(text)" />
+        <field name="mapDataType" column="mapDataType" type="map(text,text)"/>
+        <field name="stringArrayDataType" column="stringArrayDataType" type="list(text)"/>
+        <field name="intArrayDataType" column="intArrayDataType" type="list(int)"/>
+        <field name="setDataType" column="setDataType" type="set(text)"/>
     </class>
 
 </gora-otd>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora.properties
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora.properties b/gora-cassandra-cql/src/test/conf/nativeSerialization/gora.properties
index febd442..3dcb007 100644
--- a/gora-cassandra-cql/src/test/conf/nativeSerialization/gora.properties
+++ b/gora-cassandra-cql/src/test/conf/nativeSerialization/gora.properties
@@ -14,7 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-
 gora.datastore.default=org.apache.gora.cassandra.CassandraStore
 gora.cassandrastore.cluster=Gora Test Cluster
 gora.cassandrastore.host=localhost:9160

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
index d384ff4..a091721 100644
--- a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
@@ -17,12 +17,10 @@
 
 /**
  * @author lewismc
- *
  */
 
 package org.apache.gora.cassandra;
 
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.service.CassandraDaemon;
 import org.apache.gora.GoraTestDriver;
@@ -36,26 +34,21 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 
 // Logging imports
 
 /**
- * Helper class for third party tests using gora-cassandra backend. 
+ * Helper class for third party tests using gora-cassandra backend.
+ *
  * @see GoraTestDriver for test specifics.
  * This driver is the base for all test cases that require an embedded Cassandra
  * server. In this case we draw on Hector's @see EmbeddedServerHelper.
  * It starts (setUp) and stops (tearDown) embedded Cassandra server.
- *
  */
 
 public class GoraCassandraTestDriver extends GoraTestDriver {
   private static Logger log = LoggerFactory.getLogger(GoraCassandraTestDriver.class);
-  
+
   private static String baseDirectory = "target/test";
 
   private CassandraDaemon cassandraDaemon;
@@ -64,13 +57,51 @@ public class GoraCassandraTestDriver extends GoraTestDriver {
 
   private Properties properties;
 
+  public GoraCassandraTestDriver() {
+    super(CassandraStore.class);
+  }
+
+  /**
+   * Cleans up cassandra's temporary base directory.
+   * <p>
+   * In case o failure waits for 250 msecs and then tries it again, 3 times totally.
+   */
+  private static void cleanupDirectoriesFailover() {
+    int tries = 3;
+    while (tries-- > 0) {
+      try {
+        cleanupDirectories();
+        break;
+      } catch (Exception e) {
+        // ignore exception
+        try {
+          Thread.sleep(2500);
+        } catch (InterruptedException e1) {
+          // ignore exception
+        }
+      }
+    }
+  }
+
+  /**
+   * Cleans up cassandra's temporary base directory.
+   *
+   * @throws Exception if an error occurs
+   */
+  private static void cleanupDirectories() throws Exception {
+    File dirFile = new File(baseDirectory);
+    if (dirFile.exists()) {
+      FileUtils.deleteRecursive(dirFile);
+    }
+  }
+
   public void setParameters(Properties parameters) {
     this.properties = parameters;
   }
 
   @Override
   public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K>
keyClass, Class<T> persistentClass) throws GoraException {
-    return DataStoreFactory.createDataStore(CassandraStore.class, keyClass, persistentClass
, conf, properties, null);
+    return DataStoreFactory.createDataStore(CassandraStore.class, keyClass, persistentClass,
conf, properties, null);
   }
 
   /**
@@ -80,25 +111,20 @@ public class GoraCassandraTestDriver extends GoraTestDriver {
     return baseDirectory;
   }
 
-  public GoraCassandraTestDriver() {
-    super(CassandraStore.class);
-  }
-	
   /**
    * Starts embedded Cassandra server.
    *
-   * @throws Exception
-   * 	if an error occurs
+   * @throws Exception if an error occurs
    */
   @Override
-  public void setUpClass(){
-    log.info("Starting embedded Cassandra Server...");
+  public void setUpClass() {
+/*    log.info("Starting embedded Cassandra Server...");
     try {
       cleanupDirectoriesFailover();
       FileUtils.createDirectory(baseDirectory);
       System.setProperty("log4j.configuration", "log4j-server.properties");
       System.setProperty("cassandra.config", "cassandra.yaml");
-      
+
       cassandraDaemon = new CassandraDaemon();
       cassandraDaemon.completeSetup();
       cassandraDaemon.applyConfig();
@@ -113,7 +139,7 @@ public class GoraCassandraTestDriver extends GoraTestDriver {
           }
         }
       });
-	
+
       cassandraThread.setDaemon(true);
       cassandraThread.start();
     } catch (Exception e) {
@@ -121,70 +147,20 @@ public class GoraCassandraTestDriver extends GoraTestDriver {
 
       // cleanup
       tearDownClass();
-    }
+    }*/
   }
 
-
   /**
    * Stops embedded Cassandra server.
    *
-   * @throws Exception
-   * 	if an error occurs
+   * @throws Exception if an error occurs
    */
   @Override
-  public void tearDownClass(){
+  public void tearDownClass() {
     log.info("Shutting down Embedded Cassandra server...");
-    if (cassandraThread != null) {
+ /*   if (cassandraThread != null) {
       cassandraDaemon.stop();
       cassandraDaemon.destroy();
-//      cassandraThread.interrupt();
-//      cassandraThread = null;
-    }
-/*    Thread cleanupThread = new Thread(() -> {
-      try {
-        Thread.sleep(5000);
-        cleanupDirectoriesFailover();
-      } catch (Exception e) {
-        log.error("Embedded casandra server run failed!", e);
-      }
-    });
-    cleanupThread.setDaemon(true);
-    cleanupThread.start();*/
-
-  }  
-
-  /**
-   * Cleans up cassandra's temporary base directory.
-   *
-   * In case o failure waits for 250 msecs and then tries it again, 3 times totally.
-   */
-  public static void cleanupDirectoriesFailover() {
-    int tries = 3;
-    while (tries-- > 0) {
-      try {
-        cleanupDirectories();
-        break;
-      } catch (Exception e) {
-        // ignore exception
-        try {
-          Thread.sleep(2500);
-        } catch (InterruptedException e1) {
-          // ignore exception
-        }
-      }
-    }
-  }
-
-  /**
-   * Cleans up cassandra's temporary base directory.
-   *
-   * @throws Exception
-   * 	if an error occurs
-   */
-  private static void cleanupDirectories() throws Exception {
-    File dirFile = new File(baseDirectory);
-    if (dirFile.exists()) {
-      FileUtils.deleteRecursive(dirFile);
-    }
+    }*/
   }
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStore.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStore.java
b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStore.java
new file mode 100644
index 0000000..30a9b9e
--- /dev/null
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStore.java
@@ -0,0 +1,133 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ * <p>
+ * Testing class for all standard gora-cassandra functionality.
+ * We extend DataStoreTestBase enabling us to run the entire base test
+ * suite for Gora.
+ * <p>
+ * Testing class for all standard gora-cassandra functionality.
+ * We extend DataStoreTestBase enabling us to run the entire base test
+ * suite for Gora.
+ */
+
+/**
+ * Testing class for all standard gora-cassandra functionality.
+ * We extend DataStoreTestBase enabling us to run the entire base test
+ * suite for Gora. 
+ */
+package org.apache.gora.cassandra.store;
+
+import org.apache.gora.cassandra.GoraCassandraTestDriver;
+import org.apache.gora.store.DataStoreTestBase;
+import org.apache.gora.store.DataStoreTestUtil;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Test for CassandraStore.
+ */
+public class TestCassandraStore extends DataStoreTestBase {
+  private static Properties properties;
+
+  static {
+    GoraCassandraTestDriver testDriver = new GoraCassandraTestDriver();
+    setProperties();
+    testDriver.setParameters(properties);
+    setTestDriver(testDriver);
+  }
+
+  private static void setProperties() {
+    properties = new Properties();
+    properties.setProperty(CassandraStoreParameters.CASSANDRA_SERVERS, "localhost");
+    properties.setProperty(CassandraStoreParameters.PORT, "9042");
+    properties.setProperty(CassandraStoreParameters.CASSANDRA_SERIALIZATION_TYPE, "avro");
+    properties.setProperty(CassandraStoreParameters.PROTOCOL_VERSION, "3");
+    properties.setProperty(CassandraStoreParameters.CLUSTER_NAME, "Test Cluster");
+    properties.setProperty("gora.cassandrastore.mapping.file", "avro/gora-cassandra-mapping.xml");
+  }
+
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+  }
+
+  @Ignore("GORA-298 Implement CassandraStore#getPartitions")
+  @Override
+  public void testGetPartitions() throws IOException {
+  }
+
+  @Test
+  public void testQuery() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testQuery");
+    DataStoreTestUtil.testQueryWebPages(webPageStore);
+  }
+
+  @Test
+  public void testQueryStartKey() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testQueryStartKey");
+    DataStoreTestUtil.testQueryWebPageStartKey(webPageStore);
+  }
+
+  @Test
+  public void testQueryEndKey() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testQueryEndKey");
+    DataStoreTestUtil.testQueryWebPageEndKey(webPageStore);
+  }
+
+  @Test
+  public void testQueryKeyRange() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testQueryKetRange");
+    DataStoreTestUtil.testQueryWebPageKeyRange(webPageStore);
+  }
+
+  @Test
+  public void testDelete() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testDelete");
+    DataStoreTestUtil.testDelete(webPageStore);
+  }
+
+  //TODO need to fix the test
+  @Ignore
+  @Test
+  public void testDeleteByQuery() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testDeleteByQuery");
+    DataStoreTestUtil.testDeleteByQuery(webPageStore);
+  }
+
+  //TODO need to fix the test
+  @Ignore
+  @Test
+  public void testDeleteByQueryFields() throws Exception {
+    webPageStore.truncateSchema();
+    log.info("test method: testQueryByQueryFields");
+    DataStoreTestUtil.testDeleteByQueryFields(webPageStore);
+  }
+
+  @Ignore
+  public void testGet3UnionField() {
+  }
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithCassandraKey.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithCassandraKey.java
b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithCassandraKey.java
index 5273481..7f74227 100644
--- a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithCassandraKey.java
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithCassandraKey.java
@@ -47,7 +47,7 @@ public class TestCassandraStoreWithCassandraKey {
     setProperties();
     testDriver.setParameters(parameter);
     testDriver.setUpClass();
-    cassandraRecordDataStore =(CassandraStore<CassandraKey, CassandraRecord> )testDriver.createDataStore(CassandraKey.class,
CassandraRecord.class);
+    cassandraRecordDataStore = (CassandraStore<CassandraKey, CassandraRecord>) testDriver.createDataStore(CassandraKey.class,
CassandraRecord.class);
   }
 
   private static void setProperties() {
@@ -60,16 +60,15 @@ public class TestCassandraStoreWithCassandraKey {
     parameter.setProperty("gora.cassandrastore.mapping.file", "compositeKey/gora-cassandra-mapping.xml");
   }
 
-  @After
-  public void tearDown() throws Exception {
-    testDriver.tearDown();
-  }
-
   @AfterClass
   public static void tearDownClass() throws Exception {
     testDriver.tearDownClass();
   }
 
+  @After
+  public void tearDown() throws Exception {
+    testDriver.tearDown();
+  }
 
   /**
    * In this test case, schema exists method behavior of the data store is testing.
@@ -112,6 +111,7 @@ public class TestCassandraStoreWithCassandraKey {
 
   /**
    * In this test case, execute and deleteByQuery methods behaviour of the data store is
testing.
+   *
    * @throws Exception
    */
   @Test
@@ -193,10 +193,10 @@ public class TestCassandraStoreWithCassandraKey {
     CassandraKey key4 = new CassandraKey();
     key4.setTimestamp(215L);
     key4.setUrl("www.apache.org");
-    cassandraRecordDataStore.put(key1,record1);
-    cassandraRecordDataStore.put(key2,record2);
-    cassandraRecordDataStore.put(key3,record3);
-    cassandraRecordDataStore.put(key4,record4);
+    cassandraRecordDataStore.put(key1, record1);
+    cassandraRecordDataStore.put(key2, record2);
+    cassandraRecordDataStore.put(key3, record3);
+    cassandraRecordDataStore.put(key4, record4);
     Query<CassandraKey, CassandraRecord> rangeQuery = cassandraRecordDataStore.newQuery();
     rangeQuery.setStartKey(key2);
     rangeQuery.setEndKey(key2);
@@ -205,7 +205,7 @@ public class TestCassandraStoreWithCassandraKey {
     while (result.next()) {
       i++;
     }
-    Assert.assertEquals(1,i);
+    Assert.assertEquals(1, i);
 
     rangeQuery.setStartKey(key2);
     rangeQuery.setEndKey(key3);
@@ -214,7 +214,7 @@ public class TestCassandraStoreWithCassandraKey {
     while (result.next()) {
       i++;
     }
-    Assert.assertEquals(2,i);
+    Assert.assertEquals(2, i);
   }
 
   @Test
@@ -249,15 +249,15 @@ public class TestCassandraStoreWithCassandraKey {
     CassandraKey key4 = new CassandraKey();
     key4.setTimestamp(215L);
     key4.setUrl("www.apache.org");
-    cassandraRecordDataStore.put(key1,record1);
-    cassandraRecordDataStore.put(key2,record2);
-    cassandraRecordDataStore.put(key3,record3);
-    cassandraRecordDataStore.put(key4,record4);
+    cassandraRecordDataStore.put(key1, record1);
+    cassandraRecordDataStore.put(key2, record2);
+    cassandraRecordDataStore.put(key3, record3);
+    cassandraRecordDataStore.put(key4, record4);
     CassandraQuery<CassandraKey, CassandraRecord> query = new CassandraQuery<>(cassandraRecordDataStore);
     query.setKey(key1);
     query.addUpdateField("dataString", new Utf8("test123"));
     cassandraRecordDataStore.updateByQuery(query);
-   CassandraRecord result = cassandraRecordDataStore.get(key1);
+    CassandraRecord result = cassandraRecordDataStore.get(key1);
     Assert.assertEquals(new Utf8("test123"), result.getDataString());
   }
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/962d7a6a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
index f90862a..489732c 100644
--- a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
@@ -67,16 +67,16 @@ public class TestCassandraStoreWithNativeSerialization {
     parameter.setProperty("gora.cassandrastore.mapping.file", "nativeSerialization/gora-cassandra-mapping.xml");
   }
 
-  @After
-  public void tearDown() throws Exception {
-    testDriver.tearDown();
-  }
-
   @AfterClass
   public static void tearDownClass() throws Exception {
     testDriver.tearDownClass();
   }
 
+  @After
+  public void tearDown() throws Exception {
+    testDriver.tearDown();
+  }
+
   /**
    * In this test case, put and get behavior of the data store are testing.
    */


Mime
View raw message