Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
Moved roundtrip tests into one keyspace.
Browse files Browse the repository at this point in the history
Removed the unused keyspaces from fauna.
  • Loading branch information
psanford committed Sep 12, 2011
1 parent 5073774 commit 2d0ff43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 128 deletions.
69 changes: 0 additions & 69 deletions conf/0.8/schema.json

This file was deleted.

49 changes: 3 additions & 46 deletions conf/0.8/schema.txt
@@ -1,53 +1,10 @@
create keyspace Twitter with
placement_strategy = 'org.apache.cassandra.locator.LocalStrategy' AND
strategy_options = [{replication_factor:1}];
use Twitter;
create column family Users with comparator = 'UTF8Type';
create column family UserAudits with comparator = 'UTF8Type';
create column family UserCounters with comparator = 'UTF8Type' and
default_validation_class = CounterColumnType;
create column family UserCounterAggregates with column_type = 'Super'
and comparator = 'UTF8Type' and
subcomparator = 'UTF8Type' and
default_validation_class = CounterColumnType;
create column family UserRelationships with
comparator = 'UTF8Type' and
column_type = 'Super' and
subcomparator = 'TimeUUIDType';
create column family Usernames with comparator = 'UTF8Type';
create column family Statuses with comparator = 'UTF8Type';
create column family StatusAudits with comparator = 'UTF8Type';
create column family StatusRelationships with
comparator = 'UTF8Type' and
column_type = 'Super' and
subcomparator = 'TimeUUIDType';
create column family Indexes with
comparator = 'UTF8Type' and
column_type = 'Super';
create column family TimelinishThings with
comparator = 'BytesType';

create keyspace Multiblog with
placement_strategy = 'org.apache.cassandra.locator.LocalStrategy' AND
strategy_options = [{replication_factor:1}];
use Multiblog;
create column family Blogs with comparator = 'TimeUUIDType';
create column family Comments with comparator = 'TimeUUIDType';


create keyspace MultiblogLong with
placement_strategy = 'org.apache.cassandra.locator.LocalStrategy' AND
strategy_options = [{replication_factor:1}];
use MultiblogLong;
create column family Blogs with comparator = 'LongType';
create column family Comments with comparator = 'LongType';

create keyspace TypeConversions with
placement_strategy = 'org.apache.cassandra.locator.LocalStrategy' AND
strategy_options = [{replication_factor:1}];
use TypeConversions;
create column family UUIDColumnConversion with comparator = TimeUUIDType;
create column family SuperUUID with comparator = TimeUUIDType and column_type = Super;
create column family CompositeColumnConversion with comparator = 'CompositeType(IntegerType, UTF8Type)';
create column family IntegerConversion with comparator = 'IntegerType';

create column family LongConversion with comparator = 'LongType';
create column family CounterConversion with comparator = 'UTF8Type' and
default_validation_class = CounterColumnType;
22 changes: 9 additions & 13 deletions spec/roundtrip_spec.rb
Expand Up @@ -13,10 +13,6 @@ def clear_keyspace!(connection)
thrift_options = {:retries => 2, :timeout => 1}
@type_conversions = CassandraCQL::Database.new(conn, {:keyspace => 'TypeConversions'}, thrift_options)
clear_keyspace!(@type_conversions)
@multiblog_long = CassandraCQL::Database.new(conn, {:keyspace => 'MultiblogLong'}, thrift_options)
clear_keyspace!(@multiblog_long)
@twitter = CassandraCQL::Database.new(conn, {:keyspace => 'Twitter'}, thrift_options)
clear_keyspace!(@twitter)
end

context "with comparator IntegerType" do
Expand Down Expand Up @@ -60,11 +56,11 @@ def create_and_fetch_integer_column(int_column_name)

context "with comparator LongType" do
def create_and_fetch_long_column(long_column_name)
cql = 'insert into Blogs (KEY, ?) values (?, ?)'
cql = 'insert into LongConversion (KEY, ?) values (?, ?)'
row_key = 'rationalistic-hammock'
column_value = 'thyroid-hallucinogen'
@multiblog_long.execute(cql, long_column_name, row_key, column_value)
return @multiblog_long.execute('select ? from Blogs where KEY = ?', long_column_name, row_key).fetch
@type_conversions.execute(cql, long_column_name, row_key, column_value)
return @type_conversions.execute('select ? from LongConversion where KEY = ?', long_column_name, row_key).fetch
end

it "should properly convert long values shorter than 4 bytes" do
Expand All @@ -89,16 +85,16 @@ def create_and_fetch_long_column(long_column_name)
context "with comparator CounterColumnType" do
it "should convert counters to long values" do
i = 2**32 + 280647
@twitter.execute("update UserCounters set Montezuma = Montezuma + #{i} where KEY = 'Houston'")
row = @twitter.execute("select Montezuma from UserCounters where KEY = 'Houston'").fetch
@type_conversions.execute("update CounterConversion set Montezuma = Montezuma + #{i} where KEY = 'Houston'")
row = @type_conversions.execute("select Montezuma from CounterConversion where KEY = 'Houston'").fetch
row.column_values.should eq([i])

@twitter.execute("update UserCounters set Montezuma = Montezuma - #{i} where KEY = 'Houston'")
row = @twitter.execute("select Montezuma from UserCounters where KEY = 'Houston'").fetch
@type_conversions.execute("update CounterConversion set Montezuma = Montezuma - #{i} where KEY = 'Houston'")
row = @type_conversions.execute("select Montezuma from CounterConversion where KEY = 'Houston'").fetch
row.column_values.should eq([0])

@twitter.execute("update UserCounters set Montezuma = Montezuma - #{i} where KEY = 'Houston'")
row = @twitter.execute("select Montezuma from UserCounters where KEY = 'Houston'").fetch
@type_conversions.execute("update CounterConversion set Montezuma = Montezuma - #{i} where KEY = 'Houston'")
row = @type_conversions.execute("select Montezuma from CounterConversion where KEY = 'Houston'").fetch
row.column_values.should eq([-i])
end
end
Expand Down

0 comments on commit 2d0ff43

Please sign in to comment.