Skip to content

Commit

Permalink
Update default imports to c11 and add test for pre-1.1 CF cache settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch authored and thobbs committed Jul 17, 2012
1 parent f53253f commit 8c76d0d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pycassa/cassandra/ttypes.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from pycassa.cassandra.c10.ttypes import *
from pycassa.cassandra.c11.ttypes import *
2 changes: 1 addition & 1 deletion pycassa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol

from pycassa.cassandra.c10 import Cassandra
from pycassa.cassandra.c11 import Cassandra
from pycassa.cassandra.constants import (CASSANDRA_07, CASSANDRA_08,
CASSANDRA_10, CASSANDRA_11)
from pycassa.cassandra.ttypes import AuthenticationRequest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connection_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from nose.tools import assert_raises, assert_equal, assert_true
from pycassa import ColumnFamily, ConnectionPool, PoolListener, InvalidRequestError,\
NoConnectionAvailable, MaximumRetryException, AllServersUnavailable
from pycassa.cassandra.c10.ttypes import ColumnPath
from pycassa.cassandra.ttypes import ColumnPath

_credentials = {'username':'jsmith', 'password':'havebadpass'}

Expand Down
25 changes: 25 additions & 0 deletions tests/test_system_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest

from nose import SkipTest
from nose.tools import assert_equal, assert_raises

from pycassa.pool import ConnectionPool
Expand Down Expand Up @@ -93,3 +94,27 @@ def test_column_validators(self):
column_validation_classes=validators)
cf.load_schema()
self.assertEquals(cf.get('key'), {'name': 'John', 'age': 40})

def test_caching_pre_11(self):
version = tuple([int(v) for v in sys._conn.version.split('.')])
if version >= (19, 30, 0):
raise SkipTest('CF specific caching no longer supported.')
sys.create_column_family(TEST_KS, 'CachedCF10',
row_cache_size=100, key_cache_size=100,
row_cache_save_period_in_seconds=3,
key_cache_save_period_in_seconds=3)
pool = ConnectionPool(TEST_KS)
cf = ColumnFamily(pool, 'CachedCF10')
assert_equal(cf._cfdef.row_cache_size, 100)
assert_equal(cf._cfdef.key_cache_size, 100)
assert_equal(cf._cfdef.row_cache_save_period_in_seconds, 3)
assert_equal(cf._cfdef.key_cache_save_period_in_seconds, 3)
sys.alter_column_family(TEST_KS, 'CachedCF10',
row_cache_size=200, key_cache_size=200,
row_cache_save_period_in_seconds=4,
key_cache_save_period_in_seconds=4)
cf1 = ColumnFamily(pool, 'CachedCF10')
assert_equal(cf1._cfdef.row_cache_size, 200)
assert_equal(cf1._cfdef.key_cache_size, 200)
assert_equal(cf1._cfdef.row_cache_save_period_in_seconds, 4)
assert_equal(cf1._cfdef.key_cache_save_period_in_seconds, 4)

0 comments on commit 8c76d0d

Please sign in to comment.