You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/07/15 19:27:25 UTC
cassandra git commit: Make ThriftCompatibilityTest use an actual
Thrift CF
Repository: cassandra
Updated Branches:
refs/heads/trunk bfd0104dc -> 376e552c4
Make ThriftCompatibilityTest use an actual Thrift CF
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/376e552c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/376e552c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/376e552c
Branch: refs/heads/trunk
Commit: 376e552c42e3120638249369029bfa2b9398395c
Parents: bfd0104
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Jul 15 20:23:18 2015 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Jul 15 20:23:18 2015 +0300
----------------------------------------------------------------------
.../cassandra/cql3/ThriftCompatibilityTest.java | 30 +++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/376e552c/test/unit/org/apache/cassandra/cql3/ThriftCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/ThriftCompatibilityTest.java b/test/unit/org/apache/cassandra/cql3/ThriftCompatibilityTest.java
index 71b469b..c65c625 100644
--- a/test/unit/org/apache/cassandra/cql3/ThriftCompatibilityTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ThriftCompatibilityTest.java
@@ -17,15 +17,24 @@
*/
package org.apache.cassandra.cql3;
+import java.util.Collections;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.db.marshal.BytesType;
import org.apache.cassandra.db.marshal.Int32Type;
+import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.schema.KeyspaceParams;
+import org.apache.cassandra.thrift.CfDef;
+import org.apache.cassandra.thrift.ColumnDef;
+import org.apache.cassandra.thrift.ThriftConversion;
import org.apache.cassandra.utils.ByteBufferUtil;
import static org.junit.Assert.assertEquals;
+import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
public class ThriftCompatibilityTest extends SchemaLoader
{
@@ -33,10 +42,23 @@ public class ThriftCompatibilityTest extends SchemaLoader
public static void defineSchema() throws Exception
{
// The before class annotation of SchemaLoader will prepare the service so no need to do it here
- SchemaLoader.createKeyspace("thriftcompat",
- KeyspaceParams.simple(1),
- SchemaLoader.jdbcCFMD("thriftcompat", "JdbcInteger", Int32Type.instance)
- .addColumnDefinition(integerColumn("thriftcompat", "JdbcInteger")));
+ SchemaLoader.createKeyspace("thriftcompat", KeyspaceParams.simple(1), thriftCFM("thriftcompat", "JdbcInteger"));
+ }
+
+ public static CFMetaData thriftCFM(String keyspace, String table)
+ {
+ ColumnDef column = new ColumnDef();
+ column.setName(bytes(42))
+ .setValidation_class(UTF8Type.instance.toString());
+
+ CfDef cf = new CfDef(keyspace, table);
+ cf.setColumn_type("Standard")
+ .setComparator_type(Int32Type.instance.toString())
+ .setDefault_validation_class(UTF8Type.instance.toString())
+ .setKey_validation_class(BytesType.instance.toString())
+ .setColumn_metadata(Collections.singletonList(column));
+
+ return ThriftConversion.fromThrift(cf);
}
private static UntypedResultSet execute(String query)