gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [05/37] gora git commit: Add doc comments to Cassandra Store Parameters
Date Wed, 23 Aug 2017 20:55:03 GMT
Add doc comments to Cassandra Store Parameters


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

Branch: refs/heads/master
Commit: 516f366cc27fa2654cf4017fa151cc07ad902a6d
Parents: 6617b0b
Author: madhawa <madhawa30@gmail.com>
Authored: Fri Jun 23 18:18:46 2017 +0530
Committer: madhawa <madhawa30@gmail.com>
Committed: Fri Jun 23 18:18:46 2017 +0530

----------------------------------------------------------------------
 .../gora/cassandra/store/CassandraStore.java    | 173 ++++++---------
 .../store/CassandraStoreParameters.java         | 222 +++++++++++++++++++
 .../apache/gora/cassandra/store/Constants.java  | 101 ---------
 .../mappingManager/gora-cassandra-mapping.xml   |  97 ++++++++
 .../test/conf/mappingManager/gora.properties    |  30 +++
 .../gora/cassandra/GoraCassandraTestDriver.java |  27 ++-
 .../cassandra/store/TestCassandraStore.java     |  89 --------
 ...stCassandraStoreWithNativeSerialization.java |  57 +++++
 .../test/nativeSerialization/User.java          | 122 ++++++++++
 pom.xml                                         |   2 +-
 10 files changed, 620 insertions(+), 300 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
index 09123da..7031444 100644
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
@@ -23,13 +23,12 @@ import com.datastax.driver.core.*;
 import com.datastax.driver.core.policies.*;
 import org.apache.gora.cassandra.bean.*;
 import org.apache.gora.persistency.BeanFactory;
-import org.apache.gora.persistency.impl.PersistentBase;
+import org.apache.gora.persistency.Persistent;
 import org.apache.gora.query.PartitionQuery;
 import org.apache.gora.query.Query;
 import org.apache.gora.query.Result;
+import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
-import org.apache.gora.store.impl.DataStoreBase;
-import org.apache.hadoop.conf.Configuration;
 import org.jdom.Attribute;
 import org.jdom.Document;
 import org.jdom.Element;
@@ -37,10 +36,9 @@ import org.jdom.input.SAXBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.DataInput;
-import java.io.DataOutput;
 import java.io.IOException;
 import java.util.List;
+import java.util.Locale;
 import java.util.Properties;
 
 /**
@@ -49,14 +47,20 @@ import java.util.Properties;
  * @param <K> key class
  * @param <T> persistent class
  */
-public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K, T> {
+public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> {
 
   private static final String DEFAULT_MAPPING_FILE = "gora-cassandra-mapping.xml";
 
   public static final Logger LOG = LoggerFactory.getLogger(CassandraStore.class);
 
+  private BeanFactory<K, T> beanFactory;
+
   private Cluster cluster;
 
+  private Class keyClass;
+
+  private Class persistentClass;
+
   private CassandraMapping mapping;
 
   private boolean isUseCassandraMappingManager;
@@ -70,7 +74,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   /**
-   * {@inheritDoc}
+   *
    * In initializing the cassandra datastore, read the mapping file, creates the basic connection to cassandra cluster,
    * according to the gora properties
    *
@@ -78,15 +82,15 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
    * @param persistentClass persistent class
    * @param properties      properties
    */
-  @Override
   public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) {
     LOG.debug("Initializing Cassandra store");
-    super.initialize(keyClass, persistentClass, properties);
     try {
+      this.keyClass = keyClass;
+      this.persistentClass = persistentClass;
       String mappingFile = DataStoreFactory.getMappingFile(properties, this,
               DEFAULT_MAPPING_FILE);
       mapping = readMapping(mappingFile);
-      isUseCassandraMappingManager = Boolean.parseBoolean(properties.getProperty(Constants.USE_CASSANDRA_MAPPING_MANAGER));
+      isUseCassandraMappingManager = Boolean.parseBoolean(properties.getProperty(CassandraStoreParameters.USE_CASSANDRA_NATIVE_SERIALIZATION));
       Cluster.Builder builder = Cluster.builder();
       populateSettings(builder, properties);
       this.cluster = builder.build();
@@ -128,8 +132,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
                 persistentClass.getCanonicalName())) {
 
           classMatched = true;
-          String tableName = getSchemaName(
-                  classElement.getAttributeValue("table"), persistentClass);
+          String tableName = classElement.getAttributeValue("table");
           map.setCoreName(tableName);
 
           List classAttributes = classElement.getAttributes();
@@ -298,7 +301,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
                   keyField.setColumnName(attributeValue);
                   break;
                 case "order":
-                  keyField.setOrder(ClusterKeyField.Order.valueOf(attributeValue.toUpperCase()));
+                  keyField.setOrder(ClusterKeyField.Order.valueOf(attributeValue.toUpperCase(Locale.ENGLISH)));
                   break;
                 default:
                   keyField.addProperty(attributeName, attributeValue);
@@ -317,39 +320,39 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private void populateSettings(Cluster.Builder builder, Properties properties) {
-    String serversParam = properties.getProperty(Constants.CASSANDRA_SERVERS);
+    String serversParam = properties.getProperty(CassandraStoreParameters.CASSANDRA_SERVERS);
     String[] servers = serversParam.split(",");
     for (String server : servers) {
       builder = builder.addContactPoint(server);
     }
-    String portProp = properties.getProperty(Constants.PORT);
+    String portProp = properties.getProperty(CassandraStoreParameters.PORT);
     if (portProp != null) {
       builder = builder.withPort(Integer.parseInt(portProp));
     }
-    String clusterNameProp = properties.getProperty(Constants.CLUSTER_NAME);
+    String clusterNameProp = properties.getProperty(CassandraStoreParameters.CLUSTER_NAME);
     if (clusterNameProp != null) {
       builder = builder.withClusterName(clusterNameProp);
     }
-    String compressionProp = properties.getProperty(Constants.COMPRESSION);
+    String compressionProp = properties.getProperty(CassandraStoreParameters.COMPRESSION);
     if (compressionProp != null) {
       builder = builder.withCompression(ProtocolOptions.Compression.valueOf(compressionProp));
     }
     builder = this.populateCredentials(properties, builder);
     builder = this.populateLoadBalancingProp(properties, builder);
-    String enableJMXProp = properties.getProperty(Constants.ENABLE_JMX_REPORTING);
+    String enableJMXProp = properties.getProperty(CassandraStoreParameters.ENABLE_JMX_REPORTING);
     if (enableJMXProp != null) {
       if (!Boolean.parseBoolean(enableJMXProp)) {
         builder = builder.withoutJMXReporting();
       }
     }
-    String enableMetricsProp = properties.getProperty(Constants.ENABLE_METRICS);
+    String enableMetricsProp = properties.getProperty(CassandraStoreParameters.ENABLE_METRICS);
     if (enableMetricsProp != null) {
       if (!Boolean.parseBoolean(enableMetricsProp)) {
         builder = builder.withoutMetrics();
       }
     }
     builder = this.populatePoolingSettings(properties, builder);
-    String versionProp = properties.getProperty(Constants.PROTOCOL_VERSION);
+    String versionProp = properties.getProperty(CassandraStoreParameters.PROTOCOL_VERSION);
     if (versionProp != null) {
       builder = builder.withProtocolVersion(ProtocolVersion.fromInt(Integer.parseInt(versionProp)));
     }
@@ -357,7 +360,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     builder = this.populateReconnectPolicy(properties, builder);
     builder = this.populateRetrytPolicy(properties, builder);
     builder = this.populateSocketOptions(properties, builder);
-    String enableSSLProp = properties.getProperty(Constants.ENABLE_SSL);
+    String enableSSLProp = properties.getProperty(CassandraStoreParameters.ENABLE_SSL);
     if (enableSSLProp != null) {
       if (Boolean.parseBoolean(enableSSLProp)) {
         builder = builder.withSSL();
@@ -367,7 +370,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
 
 
   private Cluster.Builder populateLoadBalancingProp(Properties properties, Cluster.Builder builder) {
-    String loadBalancingProp = properties.getProperty(Constants.LOAD_BALANCING_POLICY);
+    String loadBalancingProp = properties.getProperty(CassandraStoreParameters.LOAD_BALANCING_POLICY);
     if (loadBalancingProp != null) {
       switch (loadBalancingProp) {
         case "LatencyAwareRoundRobinPolicy":
@@ -377,9 +380,9 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
           builder = builder.withLoadBalancingPolicy(new RoundRobinPolicy());
           break;
         case "DCAwareRoundRobinPolicy": {
-          String dataCenter = properties.getProperty(Constants.DATA_CENTER);
+          String dataCenter = properties.getProperty(CassandraStoreParameters.DATA_CENTER);
           boolean allowRemoteDCsForLocalConsistencyLevel = Boolean.parseBoolean(
-                  properties.getProperty(Constants.ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL));
+                  properties.getProperty(CassandraStoreParameters.ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL));
           if (dataCenter != null && !dataCenter.isEmpty()) {
             if (allowRemoteDCsForLocalConsistencyLevel) {
               builder = builder.withLoadBalancingPolicy(
@@ -403,9 +406,9 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
           builder = builder.withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
           break;
         case "TokenAwareDCAwareRoundRobinPolicy": {
-          String dataCenter = properties.getProperty(Constants.DATA_CENTER);
+          String dataCenter = properties.getProperty(CassandraStoreParameters.DATA_CENTER);
           boolean allowRemoteDCsForLocalConsistencyLevel = Boolean.parseBoolean(
-                  properties.getProperty(Constants.ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL));
+                  properties.getProperty(CassandraStoreParameters.ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL));
           if (dataCenter != null && !dataCenter.isEmpty()) {
             if (allowRemoteDCsForLocalConsistencyLevel) {
               builder = builder.withLoadBalancingPolicy(new TokenAwarePolicy(
@@ -435,8 +438,8 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populateCredentials(Properties properties, Cluster.Builder builder) {
-    String usernameProp = properties.getProperty(Constants.USERNAME);
-    String passwordProp = properties.getProperty(Constants.PASSWORD);
+    String usernameProp = properties.getProperty(CassandraStoreParameters.USERNAME);
+    String passwordProp = properties.getProperty(CassandraStoreParameters.PASSWORD);
     if (usernameProp != null) {
       builder = builder.withCredentials(usernameProp, passwordProp);
     }
@@ -444,14 +447,14 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populatePoolingSettings(Properties properties, Cluster.Builder builder) {
-    String localCoreConnectionsPerHost = properties.getProperty(Constants.LOCAL_CORE_CONNECTIONS_PER_HOST);
-    String remoteCoreConnectionsPerHost = properties.getProperty(Constants.REMOTE_CORE_CONNECTIONS_PER_HOST);
-    String localMaxConnectionsPerHost = properties.getProperty(Constants.LOCAL_MAX_CONNECTIONS_PER_HOST);
-    String remoteMaxConnectionsPerHost = properties.getProperty(Constants.REMOTE_MAX_CONNECTIONS_PER_HOST);
-    String localNewConnectionThreshold = properties.getProperty(Constants.LOCAL_NEW_CONNECTION_THRESHOLD);
-    String remoteNewConnectionThreshold = properties.getProperty(Constants.REMOTE_NEW_CONNECTION_THRESHOLD);
-    String localMaxRequestsPerConnection = properties.getProperty(Constants.LOCAL_MAX_REQUESTS_PER_CONNECTION);
-    String remoteMaxRequestsPerConnection = properties.getProperty(Constants.REMOTE_MAX_REQUESTS_PER_CONNECTION);
+    String localCoreConnectionsPerHost = properties.getProperty(CassandraStoreParameters.LOCAL_CORE_CONNECTIONS_PER_HOST);
+    String remoteCoreConnectionsPerHost = properties.getProperty(CassandraStoreParameters.REMOTE_CORE_CONNECTIONS_PER_HOST);
+    String localMaxConnectionsPerHost = properties.getProperty(CassandraStoreParameters.LOCAL_MAX_CONNECTIONS_PER_HOST);
+    String remoteMaxConnectionsPerHost = properties.getProperty(CassandraStoreParameters.REMOTE_MAX_CONNECTIONS_PER_HOST);
+    String localNewConnectionThreshold = properties.getProperty(CassandraStoreParameters.LOCAL_NEW_CONNECTION_THRESHOLD);
+    String remoteNewConnectionThreshold = properties.getProperty(CassandraStoreParameters.REMOTE_NEW_CONNECTION_THRESHOLD);
+    String localMaxRequestsPerConnection = properties.getProperty(CassandraStoreParameters.LOCAL_MAX_REQUESTS_PER_CONNECTION);
+    String remoteMaxRequestsPerConnection = properties.getProperty(CassandraStoreParameters.REMOTE_MAX_REQUESTS_PER_CONNECTION);
     PoolingOptions options = new PoolingOptions();
     if (localCoreConnectionsPerHost != null) {
       options.setCoreConnectionsPerHost(HostDistance.LOCAL, Integer.parseInt(localCoreConnectionsPerHost));
@@ -482,9 +485,9 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populateQueryOptions(Properties properties, Cluster.Builder builder) {
-    String consistencyLevelProp = properties.getProperty(Constants.CONSISTENCY_LEVEL);
-    String serialConsistencyLevelProp = properties.getProperty(Constants.SERIAL_CONSISTENCY_LEVEL);
-    String fetchSize = properties.getProperty(Constants.FETCH_SIZE);
+    String consistencyLevelProp = properties.getProperty(CassandraStoreParameters.CONSISTENCY_LEVEL);
+    String serialConsistencyLevelProp = properties.getProperty(CassandraStoreParameters.SERIAL_CONSISTENCY_LEVEL);
+    String fetchSize = properties.getProperty(CassandraStoreParameters.FETCH_SIZE);
     QueryOptions options = new QueryOptions();
     if (consistencyLevelProp != null) {
       options.setConsistencyLevel(ConsistencyLevel.valueOf(consistencyLevelProp));
@@ -499,19 +502,18 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populateReconnectPolicy(Properties properties, Cluster.Builder builder) {
-    String reconnectionPolicy = properties.getProperty(Constants.RECONNECTION_POLICY);
+    String reconnectionPolicy = properties.getProperty(CassandraStoreParameters.RECONNECTION_POLICY);
     if (reconnectionPolicy != null) {
       switch (reconnectionPolicy) {
         case "ConstantReconnectionPolicy": {
-          String constantReconnectionPolicyDelay = properties.getProperty(Constants.CONSTANT_RECONNECTION_POLICY_DELAY);
-
+          String constantReconnectionPolicyDelay = properties.getProperty(CassandraStoreParameters.CONSTANT_RECONNECTION_POLICY_DELAY);
           ConstantReconnectionPolicy policy = new ConstantReconnectionPolicy(Long.parseLong(constantReconnectionPolicyDelay));
           builder = builder.withReconnectionPolicy(policy);
           break;
         }
         case "ExponentialReconnectionPolicy": {
-          String exponentialReconnectionPolicyBaseDelay = properties.getProperty(Constants.EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY);
-          String exponentialReconnectionPolicyMaxDelay = properties.getProperty(Constants.EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY);
+          String exponentialReconnectionPolicyBaseDelay = properties.getProperty(CassandraStoreParameters.EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY);
+          String exponentialReconnectionPolicyMaxDelay = properties.getProperty(CassandraStoreParameters.EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY);
 
           ExponentialReconnectionPolicy policy = new ExponentialReconnectionPolicy(Long.parseLong(exponentialReconnectionPolicyBaseDelay),
                   Long.parseLong(exponentialReconnectionPolicyMaxDelay));
@@ -526,7 +528,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populateRetrytPolicy(Properties properties, Cluster.Builder builder) {
-    String retryPolicy = properties.getProperty(Constants.RETRY_POLICY);
+    String retryPolicy = properties.getProperty(CassandraStoreParameters.RETRY_POLICY);
     if (retryPolicy != null) {
       switch (retryPolicy) {
         case "DefaultRetryPolicy":
@@ -556,14 +558,14 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   private Cluster.Builder populateSocketOptions(Properties properties, Cluster.Builder builder) {
-    String connectionTimeoutMillisProp = properties.getProperty(Constants.CONNECTION_TIMEOUT_MILLIS);
-    String keepAliveProp = properties.getProperty(Constants.KEEP_ALIVE);
-    String readTimeoutMillisProp = properties.getProperty(Constants.READ_TIMEOUT_MILLIS);
-    String receiveBufferSizeProp = properties.getProperty(Constants.RECEIVER_BUFFER_SIZE);
-    String reuseAddress = properties.getProperty(Constants.REUSE_ADDRESS);
-    String sendBufferSize = properties.getProperty(Constants.SEND_BUFFER_SIZE);
-    String soLinger = properties.getProperty(Constants.SO_LINGER);
-    String tcpNoDelay = properties.getProperty(Constants.TCP_NODELAY);
+    String connectionTimeoutMillisProp = properties.getProperty(CassandraStoreParameters.CONNECTION_TIMEOUT_MILLIS);
+    String keepAliveProp = properties.getProperty(CassandraStoreParameters.KEEP_ALIVE);
+    String readTimeoutMillisProp = properties.getProperty(CassandraStoreParameters.READ_TIMEOUT_MILLIS);
+    String receiveBufferSizeProp = properties.getProperty(CassandraStoreParameters.RECEIVER_BUFFER_SIZE);
+    String reuseAddress = properties.getProperty(CassandraStoreParameters.REUSE_ADDRESS);
+    String sendBufferSize = properties.getProperty(CassandraStoreParameters.SEND_BUFFER_SIZE);
+    String soLinger = properties.getProperty(CassandraStoreParameters.SO_LINGER);
+    String tcpNoDelay = properties.getProperty(CassandraStoreParameters.TCP_NODELAY);
     SocketOptions options = new SocketOptions();
     if (connectionTimeoutMillisProp != null) {
       options.setConnectTimeoutMillis(Integer.parseInt(connectionTimeoutMillisProp));
@@ -594,12 +596,12 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
 
   @Override
   public void setPersistentClass(Class<T> persistentClass) {
-    super.setPersistentClass(persistentClass);
+    this.persistentClass = persistentClass;
   }
 
   @Override
   public Class<T> getPersistentClass() {
-    return super.getPersistentClass();
+    return this.persistentClass;
   }
 
   @Override
@@ -619,32 +621,37 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
 
   @Override
   public Class<K> getKeyClass() {
-    return super.getKeyClass();
+    return this.keyClass;
   }
 
   @Override
   public void setKeyClass(Class<K> keyClass) {
-    super.setKeyClass(keyClass);
+    this.keyClass = keyClass;
   }
 
   @Override
   public K newKey() {
-    return super.newKey();
+    try {
+      return beanFactory.newKey();
+    } catch (Exception ex) {
+      LOG.error(ex.getMessage(), ex);
+      return null;
+    }
   }
 
   @Override
   public T newPersistent() {
-    return super.newPersistent();
+    return this.beanFactory.newPersistent();
   }
 
   @Override
   public void setBeanFactory(BeanFactory<K, T> beanFactory) {
-    super.setBeanFactory(beanFactory);
+    this.beanFactory = beanFactory;
   }
 
   @Override
   public BeanFactory<K, T> getBeanFactory() {
-    return super.getBeanFactory();
+    return this.beanFactory;
   }
 
   @Override
@@ -657,7 +664,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     if (isUseCassandraMappingManager) {
       return mapper.get(key);
     } else {
-      return super.get(key);
+      return null;
     }
   }
 
@@ -671,7 +678,7 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     if (isUseCassandraMappingManager) {
       mapper.save(obj);
     } else {
-      super.get(key);
+
     }
   }
 
@@ -711,48 +718,12 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
   }
 
   @Override
-  protected String[] getFieldsToQuery(String[] fields) {
-    return super.getFieldsToQuery(fields);
-  }
-
-  @Override
-  protected String[] getFields() {
-    return super.getFields();
-  }
-
-  @Override
-  public Configuration getConf() {
-    return super.getConf();
-  }
-
-  @Override
-  public void setConf(Configuration conf) {
-    super.setConf(conf);
-  }
-
-  @Override
-  protected Configuration getOrCreateConf() {
-    return super.getOrCreateConf();
-  }
-
-  @Override
-  public void readFields(DataInput in) {
-    super.readFields(in);
-  }
-
-  @Override
-  public void write(DataOutput out) {
-    super.write(out);
-  }
-
-  @Override
   public boolean equals(Object obj) {
     return super.equals(obj);
   }
 
   @Override
   public void truncateSchema() {
-    super.truncateSchema();
   }
 
   @Override
@@ -760,8 +731,4 @@ public class CassandraStore<K, T extends PersistentBase> extends DataStoreBase<K
     return false;
   }
 
-  @Override
-  protected String getSchemaName(String mappingSchemaName, Class<?> persistentClass) {
-    return super.getSchemaName(mappingSchemaName, persistentClass);
-  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java
new file mode 100644
index 0000000..bd60a15
--- /dev/null
+++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java
@@ -0,0 +1,222 @@
+/*
+ *  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.cassandra.store;
+
+/**
+ * Configuration Properties.
+ */
+public class CassandraStoreParameters {
+
+  /**
+   * Property pointing to cassandra db contact points.
+   * string (multiple values with comma separated)
+   */
+  public static final String CASSANDRA_SERVERS = "gora.cassandra.store.cassandraServers";
+  /**
+   *Property pointing to the Cassandra keyspace.
+   * string
+   */
+  public static final String KEYSPACE = "gora.cassandra.store.keyspace";
+  /**
+   *  Property pointing to the port to use to connect to the Cassandra hosts.
+   *  integer
+   */
+  public static final String PORT = "gora.cassandra.store.port";
+
+  /**
+   * Property pointing to the Cassandra cluster name.
+   * string
+   */
+  public static final String CLUSTER_NAME = "gora.cassandra.store.clusterName";
+  /**
+   * Property pointing to set compression to use for the transport.
+   * "LZ4", "SNAPPY", "NONE"
+   */
+  public static final String COMPRESSION = "gora.cassandra.store.compression";
+  /**
+   * Property pointing to the username to connect to the server.
+   * string
+   */
+  public static final String USERNAME = "gora.cassandra.store.username";
+  /**
+   * Property pointing to the password to connect to the server.
+   * string
+   */
+  public static final String PASSWORD = "gora.cassandra.store.password";
+  /**
+   * Property pointing to set load balancing policy.
+   * "RoundRobinPolicy", "LatencyAwareRoundRobinPolicy", "TokenAwareRoundRobinPolicy"
+   */
+  public static final String LOAD_BALANCING_POLICY = "gora.cassandra.store.loadBalancingPolicy";
+  /**
+   * Property pointing to enable/disable JMX reporting.
+   * boolean
+   */
+  public static final String ENABLE_JMX_REPORTING = "gora.cassandra.store.enableJMXReporting";
+  /**
+   * Property pointing to enable/disable metrics.
+   * boolean
+   */
+  public static final String ENABLE_METRICS = "gora.cassandra.store.enableMetrics";
+  /**
+   * Property pointing to set local host core connections size.
+   * integer
+   */
+  public static final String LOCAL_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.localCoreConnectionsPerHost";
+  /**
+   * Property pointing to set remote host core connections size.
+   * integer
+   */
+  public static final String REMOTE_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteCoreConnectionsPerHost";
+  /**
+   * Property pointing to set local host max connections size.
+   * integer
+   */
+  public static final String LOCAL_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.localMaxConnectionsPerHost";
+  /**
+   * Property pointing to set remote host max connections size.
+   * integer
+   */
+  public static final String REMOTE_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteMaxConnectionsPerHost";
+  /**
+   * Property pointing to set local host new connection threshold.
+   * integer
+   */
+  public static final String LOCAL_NEW_CONNECTION_THRESHOLD= "gora.cassandra.store.localNewConnectionThreshold";
+  /**
+   * Property pointing to set remote host new connection threshold.
+   * integer
+   */
+  public static final String REMOTE_NEW_CONNECTION_THRESHOLD = "gora.cassandra.store.remoteNewConnectionThreshold";
+  /**
+   * Property pointing to set local host max requests per connection.
+   * integer
+   */
+  public static final String LOCAL_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.localMaxRequestsPerConnection";
+  /**
+   * Property pointing to set remote host max requests per connection.
+   * integer
+   */
+  public static final String REMOTE_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.remoteMaxRequestsPerConnection";
+  /**
+   * Property pointing to set CQL Protocol version.
+   * integer
+   */
+  public static final String PROTOCOL_VERSION = "gora.cassandra.store.protocolVersion";
+  /**
+   * Property pointing to set consistency level in Cassandra Query Options.
+   * "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO"
+   */
+  public static final String CONSISTENCY_LEVEL = "gora.cassandra.store.consistencyLevel";
+  /**
+   * Property pointing to set fetchsize in Cassandra Query Options.
+   * integer
+   */
+  public static final String FETCH_SIZE = "fetchSize";
+  /**
+   * Property pointing to set serial consistency level in Cassandra Query Options.
+   * "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO"
+   */
+  public static final String SERIAL_CONSISTENCY_LEVEL = "gora.cassandra.store.serialConsistencyLevel";
+  /**
+   * Property pointing to set reconnection policy
+   * "ConstantReconnectionPolicy", "ExponentialReconnectionPolicy",
+   */
+  public static final String RECONNECTION_POLICY = "gora.cassandra.store.reconnectionPolicy";
+  /**
+   * Property pointing to set the delay in constant reconnection policy.
+   * long
+   */
+  public static final String CONSTANT_RECONNECTION_POLICY_DELAY = "gora.cassandra.store.constantReconnectionPolicyDelay";
+  /**
+   * Property pointing to set the delay in exponential reconnection policy.
+   * long
+   */
+  public static final String EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyBaseDelay";
+  /**
+   * Property pointing to set the max delay in exponential reconnection policy.
+   * long
+   */
+  public static final String EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyMaxDelay";
+  /**
+   * Property pointing to set the retry policy.
+   * "DefaultRetryPolicy", "DowngradingConsistencyRetryPolicy", "FallthroughRetryPolicy",
+   * "LoggingDefaultRetryPolicy", "LoggingDowngradingConsistencyRetryPolicy", "LoggingFallthroughRetryPolicy"
+   */
+  public static final String RETRY_POLICY = "gora.cassandra.store.retryPolicy";
+  /**
+   * Property pointing to set the connection time out in Cassandra Socket Options.
+   * integer
+   */
+  public static final String CONNECTION_TIMEOUT_MILLIS = "gora.cassandra.store.connectionTimeoutMillis";
+  /**
+   * Property pointing to set the keep alive in Cassandra Socket Options.
+   * boolean
+   */
+  public static final String KEEP_ALIVE = "gora.cassandra.store.keepAlive";
+  /**
+   * Property pointing to set the read time out in Cassandra Socket Options.
+   * integer
+   */
+  public static final String READ_TIMEOUT_MILLIS = "gora.cassandra.store.readTimeoutMillis";
+  /**
+   * Property pointing to set the receiver buffer size in Cassandra Socket Options.
+   * integer
+   */
+  public static final String RECEIVER_BUFFER_SIZE = "gora.cassandra.store.receiverBufferSize";
+  /**
+   * Property pointing to set the reuse address in Cassandra Socket Options.
+   * boolean
+   */
+  public static final String REUSE_ADDRESS = "gora.cassandra.store.reuseAddress";
+  /**
+   * Property pointing to set the sender buffer size in Cassandra Socket Options.
+   * integer
+   */
+  public static final String SEND_BUFFER_SIZE = "gora.cassandra.store.sendBufferSize";
+  /**
+   * Property pointing to set the soLinger in Cassandra Socket Options.
+   * integer
+   */
+  public static final String SO_LINGER = "gora.cassandra.store.soLinger";
+  /**
+   * Property pointing to set the no tcp delay in Cassandra Socket Options.
+   * boolean
+   */
+  public static final String TCP_NODELAY = "gora.cassandra.store.tcpNoDelay";
+  /**
+   * Property pointing to enable SSL.
+   * boolean
+   */
+  public static final String ENABLE_SSL = "gora.cassandra.store.enableSSL";
+  /**
+   * Property pointing to set aware local data center.
+   * string
+   */
+  public static final String DATA_CENTER = "gora.cassandra.store.dataCenter";
+  /**
+   * Property pointing to enable/disable remote data centers for local consistency level.
+   * string
+   */
+  public static final String ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL = "gora.cassandra.store.allowRemoteDCsForLocalConsistencyLevel";
+  /**
+   * Property pointing to use Native Cassandra Native Serialization.
+   * boolean
+   */
+  public static final String USE_CASSANDRA_NATIVE_SERIALIZATION = "gora.cassandra.store.useCassandraNativeSerialization";
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/Constants.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/Constants.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/Constants.java
deleted file mode 100644
index c79301a..0000000
--- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/Constants.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  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.cassandra.store;
-
-public class Constants {
-
-  /* string (multiple values with comma separated) */
-  public static final String CASSANDRA_SERVERS = "gora.cassandra.store.cassandraServers";
-  /* string */
-  public static final String KEYSPACE = "gora.cassandra.store.keyspace";
-  /* integer */
-  public static final String PORT = "gora.cassandra.store.port";
-  /* string */
-  public static final String CLUSTER_NAME = "gora.cassandra.store.clusterName";
-  /* "LZ4", "SNAPPY", "NONE" */
-  public static final String COMPRESSION = "gora.cassandra.store.compression";
-  /* string */
-  public static final String USERNAME = "gora.cassandra.store.username";
-  /* string */
-  public static final String PASSWORD = "gora.cassandra.store.password";
-  /* "RoundRobinPolicy", "LatencyAwareRoundRobinPolicy", "TokenAwareRoundRobinPolicy" */
-  public static final String LOAD_BALANCING_POLICY = "gora.cassandra.store.loadBalancingPolicy";
-  /* boolean */
-  public static final String ENABLE_JMX_REPORTING = "gora.cassandra.store.enableJMXReporting";
-  /* boolean */
-  public static final String ENABLE_METRICS = "gora.cassandra.store.enableMetrics";
-  /* inter */
-  public static final String LOCAL_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.localCoreConnectionsPerHost";
-  /* integer */
-  public static final String REMOTE_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteCoreConnectionsPerHost";
-  /* integer */
-  public static final String LOCAL_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.localMaxConnectionsPerHost";
-  /* integer */
-  public static final String REMOTE_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteMaxConnectionsPerHost";
-  /* integer */
-  public static final String LOCAL_NEW_CONNECTION_THRESHOLD= "gora.cassandra.store.localNewConnectionThreshold";
-  /* integer */
-  public static final String REMOTE_NEW_CONNECTION_THRESHOLD = "gora.cassandra.store.remoteNewConnectionThreshold";
-  /* integer */
-  public static final String LOCAL_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.localMaxRequestsPerConnection";
-  /* integer */
-  public static final String REMOTE_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.remoteMaxRequestsPerConnection";
-  /* integer */
-  public static final String PROTOCOL_VERSION = "gora.cassandra.store.protocolVersion";
-  /* "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO" */
-  public static final String CONSISTENCY_LEVEL = "gora.cassandra.store.consistencyLevel";
-  /* integer */
-  public static final String FETCH_SIZE = "fetchSize";
-  /* "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO" */
-  public static final String SERIAL_CONSISTENCY_LEVEL = "gora.cassandra.store.serialConsistencyLevel";
-  /* "ConstantReconnectionPolicy", "ExponentialReconnectionPolicy",  */
-  public static final String RECONNECTION_POLICY = "gora.cassandra.store.reconnectionPolicy";
-  /* long */
-  public static final String CONSTANT_RECONNECTION_POLICY_DELAY = "gora.cassandra.store.constantReconnectionPolicyDelay";
-  /* long */
-  public static final String EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyBaseDelay";
-  /* long */
-  public static final String EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyMaxDelay";
-  /* "DefaultRetryPolicy", "DowngradingConsistencyRetryPolicy", "FallthroughRetryPolicy",
-   * "LoggingDefaultRetryPolicy", "LoggingDowngradingConsistencyRetryPolicy", "LoggingFallthroughRetryPolicy" */
-  public static final String RETRY_POLICY = "gora.cassandra.store.retryPolicy";
-  /* integer */
-  public static final String CONNECTION_TIMEOUT_MILLIS = "gora.cassandra.store.connectionTimeoutMillis";
-  /* boolean */
-  public static final String KEEP_ALIVE = "gora.cassandra.store.keepAlive";
-  /* integer */
-  public static final String READ_TIMEOUT_MILLIS = "gora.cassandra.store.readTimeoutMillis";
-  /* integer */
-  public static final String RECEIVER_BUFFER_SIZE = "gora.cassandra.store.receiverBufferSize";
-  /* boolean */
-  public static final String REUSE_ADDRESS = "gora.cassandra.store.reuseAddress";
-  /* integer */
-  public static final String SEND_BUFFER_SIZE = "gora.cassandra.store.sendBufferSize";
-  /* integer */
-  public static final String SO_LINGER = "gora.cassandra.store.soLinger";
-  /* boolean */
-  public static final String TCP_NODELAY = "gora.cassandra.store.tcpNoDelay";
-  /* boolean */
-  public static final String ENABLE_SSL = "gora.cassandra.store.enableSSL";
-  /* string */
-  public static final String DATA_CENTER = "gora.cassandra.store.dataCenter";
-  /* boolean */
-  public static final String ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL = "gora.cassandra.store.allowRemoteDCsForLocalConsistencyLevel";
-
-  public static final String USE_CASSANDRA_MAPPING_MANAGER = "gora.cassandra.store.useCassandraMappingManager";
-}

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/test/conf/mappingManager/gora-cassandra-mapping.xml
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/mappingManager/gora-cassandra-mapping.xml b/gora-cassandra-cql/src/test/conf/mappingManager/gora-cassandra-mapping.xml
new file mode 100644
index 0000000..5f59ba8
--- /dev/null
+++ b/gora-cassandra-cql/src/test/conf/mappingManager/gora-cassandra-mapping.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+   The value of 'host' attribute of keyspace tag should match exactly what is in
+   gora.properties file. Essentially this means that if you are using port number, you should
+   use it every where regardless of whether it is the default port or not.
+   At runtime Gora will otherwise try to connect to localhost
+   https://issues.apache.org/jira/browse/GORA-269
+
+   The values of 'replication_factor' and 'placement_strategy' 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="EmployeeSpace" durableWrite="false">
+        <placementStrategy name="SimpleStrategy" replication_factor="1"/>
+    </keyspace>
+
+    <keyspace name="WebPage" durableWrite="true">
+        <placementStrategy name="NetworkTopologyStrategy">
+            <datacenter name="dc1" replication_factor="1"/>
+            <datacenter name="dc2" replication_factor="1"/>
+        </placementStrategy>
+    </keyspace>
+
+    <class name="org.apache.gora.examples.generated.Employee1" keyClass="java.lang.String" keyspace="EmployeeSpace"
+           table="Employee" compactStorage="true" id="31323131">
+        <field name="lname" column="name" type="text" ttl="10" static="true"/>
+        <field name="fname" column="name" type="text" ttl="10"/>
+        <field name="srilankan" column="srilankan" type="boolean" ttl="10"/>
+        <field name="age" column="srilankan" type="int" ttl="10"/>
+        <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"
+           compactStorage="true" id="31323131">
+        <field name="lname" column="name" type="text" ttl="10" primarykey="true"/>
+        <field name="fname" column="name" type="text" ttl="10"/>
+        <field name="srilankan" column="srilankan" type="boolean" ttl="10"/>
+        <field name="age" column="srilankan" type="int" ttl="10"/>
+        <field name="id" column="srilankan" type="uuid" ttl="10"/>
+    </class>
+
+    <cassandraKey name="org.apache.gora.examples.generated.WebPage">
+        <partitionKey>
+            <compositeField>
+                <field name="id" type=""/>
+                <field name="name" type=""/>
+            </compositeField>
+            <field name="sensorId" type="UTF8Type"/>
+            <field name="year" type="IntegerType"/>
+        </partitionKey>
+        <clusterKey>
+            <field name="date" type="LongType" order="desc"/>
+        </clusterKey>
+    </cassandraKey>
+
+</gora-otd>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/test/conf/mappingManager/gora.properties
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/conf/mappingManager/gora.properties b/gora-cassandra-cql/src/test/conf/mappingManager/gora.properties
new file mode 100644
index 0000000..012ac08
--- /dev/null
+++ b/gora-cassandra-cql/src/test/conf/mappingManager/gora.properties
@@ -0,0 +1,30 @@
+#
+#  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.
+#
+
+gora.datastore.default=org.apache.gora.cassandra.CassandraStore
+gora.cassandrastore.cluster=Gora Cassandra Test Cluster
+gora.cassandrastore.host=localhost:9160
+# property is annotated in CassandraClient#checkKeyspace()
+# options are ANY, ONE, TWO, THREE, LOCAL_QUORUM, EACH_QUORUM, QUORUM and ALL. 
+gora.cassandrastore.cf.consistency.level=ONE
+gora.cassandrastore.read.consistency.level=QUORUM
+gora.cassandrastore.write.consistency.level=ONE
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/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 ccb9b97..979156b 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
@@ -22,18 +22,22 @@
 
 package org.apache.gora.cassandra;
 
-import org.apache.gora.GoraTestDriver;
-
-import java.io.File;
-
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.service.CassandraDaemon;
-
-// Logging imports
+import org.apache.gora.GoraTestDriver;
 import org.apache.gora.cassandra.store.CassandraStore;
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.store.DataStore;
+import org.apache.gora.store.DataStoreFactory;
+import org.apache.gora.util.GoraException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.util.Properties;
+
+// Logging imports
+
 /**
  * Helper class for third party tests using gora-cassandra backend. 
  * @see GoraTestDriver for test specifics.
@@ -52,6 +56,17 @@ public class GoraCassandraTestDriver extends GoraTestDriver {
 
   private Thread cassandraThread;
 
+  private Properties properties;
+
+  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 temporary base directory of running cassandra instance
    */

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/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
deleted file mode 100644
index 44c54b9..0000000
--- a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStore.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * 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.hadoop.conf.Configuration;
-import org.junit.Before;
-import org.junit.Ignore;
-
-import java.io.IOException;
-
-/**
- * Test for CassandraStore.
- */
-public class TestCassandraStore extends DataStoreTestBase{
-
-  private Configuration conf;
-
-
-  static {
-    setTestDriver(new GoraCassandraTestDriver());
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    super.setUp();
-  }
-
-  public GoraCassandraTestDriver getTestDriver() {
-    return (GoraCassandraTestDriver) testDriver;
-  }
-
-
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQuery() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryStartKey() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryEndKey() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryKeyRange() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryWebPageSingleKey() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryWebPageSingleKeyDefaultFields() throws IOException {}
-  @Ignore("GORA-299 o.a.g.cassandra.CassandraStore#newQuery() should not use query.setFields(getFieldsToQuery(null));")
-  @Override
-  public void testQueryWebPageQueryEmptyResults() throws IOException {}
-  @Ignore("GORA-154 delete() and deleteByQuery() methods are not implemented at CassandraStore, and always returns false or 0")
-  @Override
-  public void testDelete() throws IOException {}
-  @Ignore("GORA-154 delete() and deleteByQuery() methods are not implemented at CassandraStore, and always returns false or 0")
-  @Override
-  public void testDeleteByQuery() throws IOException {}
-  @Ignore("GORA-154 delete() and deleteByQuery() methods are not implemented at CassandraStore, and always returns false or 0")
-  @Override
-  public void testDeleteByQueryFields() throws IOException {}
-  @Ignore("GORA-298 Implement CassandraStore#getPartitions")
-  @Override
-  public void testGetPartitions() throws IOException {}
-}

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/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
new file mode 100644
index 0000000..f302cd5
--- /dev/null
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/store/TestCassandraStoreWithNativeSerialization.java
@@ -0,0 +1,57 @@
+package org.apache.gora.cassandra.store;
+
+import org.apache.gora.cassandra.GoraCassandraTestDriver;
+import org.apache.gora.cassandra.test.nativeSerialization.User;
+import org.apache.gora.store.DataStore;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.time.Instant;
+import java.util.Date;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * This class tests Cassandra Store functionality with Cassandra Native Serialization
+ */
+public class TestCassandraStoreWithNativeSerialization {
+  private static GoraCassandraTestDriver testDriver = new GoraCassandraTestDriver();
+  private static DataStore<UUID, User> userDataStore;
+  private static Properties parameter;
+
+  @BeforeClass
+  public static void setUpClass() throws Exception {
+    setProperties();
+    testDriver.setParameters(parameter);
+    testDriver.setUpClass();
+    userDataStore = testDriver.createDataStore(UUID.class, User.class);
+
+  }
+
+  private static void setProperties() {
+    parameter = new Properties();
+    parameter.setProperty(CassandraStoreParameters.CASSANDRA_SERVERS,"localhost");
+    parameter.setProperty(CassandraStoreParameters.PORT,"9160");
+    parameter.setProperty(CassandraStoreParameters.USE_CASSANDRA_NATIVE_SERIALIZATION, "true");
+  }
+
+
+  @After
+  public void tearDown() throws Exception {
+    testDriver.tearDown();
+  }
+
+  @AfterClass
+  public static void tearDownClass() throws Exception {
+    testDriver.tearDownClass();
+  }
+
+  @Test
+  public void testCreate() {
+    UUID id = UUID.randomUUID();
+    User user1 = new User(id, "madhawa", Date.from(Instant.now()));
+    userDataStore.put(id, user1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/test/nativeSerialization/User.java
----------------------------------------------------------------------
diff --git a/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/test/nativeSerialization/User.java b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/test/nativeSerialization/User.java
new file mode 100644
index 0000000..760fa30
--- /dev/null
+++ b/gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/test/nativeSerialization/User.java
@@ -0,0 +1,122 @@
+package org.apache.gora.cassandra.test.nativeSerialization;
+
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
+import org.apache.avro.Schema;
+import org.apache.gora.persistency.Persistent;
+import org.apache.gora.persistency.Tombstone;
+import org.apache.gora.persistency.impl.PersistentBase;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Created by madhawa on 6/23/17.
+ */
+
+@Table(keyspace = "ks", name = "users",
+        readConsistency = "QUORUM",
+        writeConsistency = "QUORUM",
+        caseSensitiveKeyspace = false,
+        caseSensitiveTable = false)
+public class User implements Persistent {
+  @PartitionKey
+  @Column(name = "user_id")
+  private UUID userId;
+  @Column(name = "name")
+  private String name;
+  @Column(name = "dob")
+  private Date dateOfBirth;
+
+  public User () {
+
+  }
+  public User(UUID userId, String name, Date dateOfBirth) {
+    this.userId = userId;
+    this.name = name;
+    this.dateOfBirth = dateOfBirth;
+  }
+
+
+  public void setUserId(UUID userId) {
+    this.userId = userId;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public void setDateOfBirth(Date dateOfBirth) {
+    this.dateOfBirth = dateOfBirth;
+  }
+
+  @Override
+  public void clear() {
+  }
+
+  @Override
+  public boolean isDirty(int fieldIndex) {
+    return false;
+  }
+
+  @Override
+  public boolean isDirty(String field) {
+    return false;
+  }
+
+  @Override
+  public void setDirty() {
+
+  }
+
+  @Override
+  public void setDirty(int fieldIndex) {
+
+  }
+
+  @Override
+  public void setDirty(String field) {
+
+  }
+
+  @Override
+  public void clearDirty(int fieldIndex) {
+
+  }
+
+  @Override
+  public void clearDirty(String field) {
+
+  }
+
+
+
+
+
+  @Override
+  public Tombstone getTombstone() {
+    return null;
+  }
+
+  @Override
+  public List<Schema.Field> getUnmanagedFields() {
+    return null;
+  }
+
+  @Override
+  public Persistent newInstance() {
+    return new User();
+  }
+
+  @Override
+  public boolean isDirty() {
+    return false;
+  }
+
+  @Override
+  public void clearDirty() {
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/gora/blob/516f366c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bef6928..7c66dcf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -750,7 +750,7 @@
     <amazon.version>1.10.55</amazon.version>
     <!-- Cassandra Dependencies -->
     <cassandra-driver.version>3.1.3</cassandra-driver.version>
-    <cassandra.version>2.0.2</cassandra.version>
+    <cassandra.version>3.10</cassandra.version>
     <hector.version>1.1-4</hector.version>
     <!-- Solr Dependencies -->
     <lucene-solr.version>6.5.1</lucene-solr.version>


Mime
View raw message