Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of deprecated APIs #588

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public SerializerPackageImpl(ColumnFamilyDefinition cfDef, boolean ignoreErrors)
}

try {
setColumnType(cfDef.getComparatorType());
setColumnNameType(cfDef.getComparatorType());
}
catch (UnknownComparatorException e) {
if (!ignoreErrors)
Expand Down Expand Up @@ -263,7 +263,7 @@ public Serializer<?> getColumnSerializer(ByteBuffer columnName) {

@Override
public Serializer<?> getColumnSerializer(String columnName) {
return getValueSerializer(StringSerializer.get().toByteBuffer(columnName));
return getColumnSerializer(StringSerializer.get().toByteBuffer(columnName));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public long getSleepTimeMs() {

@Override
public RetryPolicy duplicate() {
return new ConstantBackoff(sleepTimeMs, getMax());
return new ConstantBackoff(sleepTimeMs, getMaxAttemptCount());
}

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void init() {
.buildKeyspace(ThriftFamilyFactory.getInstance());

context.start();
keyspace = context.getEntity();
keyspace = context.getClient();

EMP_CF = ColumnFamily.newColumnFamily(
EMP_CF_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void init() {
.buildKeyspace(ThriftFamilyFactory.getInstance());

context.start();
keyspace = context.getEntity();
keyspace = context.getClient();

EMP_CF = ColumnFamily.newColumnFamily(
EMP_CF_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down Expand Up @@ -124,7 +124,7 @@ public static void createKeyspace() throws Exception {
.build());
;

KeyspaceDefinition ki = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition ki = keyspaceContext.getClient().describeKeyspace();
System.out.println("Describe Keyspace: " + ki.getName());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down Expand Up @@ -225,7 +225,7 @@ public static void createKeyspace() throws Exception {
keyspace.createColumnFamily(UNIQUE_CF, null);
keyspace.createColumnFamily(CF_STANDARD1_COPY, null);

KeyspaceDefinition ki = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition ki = keyspaceContext.getClient().describeKeyspace();
System.out.println("Describe Keyspace: " + ki.getName());

try {
Expand Down Expand Up @@ -959,7 +959,7 @@ public synchronized Boolean apply(Row<Integer, Integer> row) {
.build();

try {
Stopwatch sw = new Stopwatch().start();
Stopwatch sw = Stopwatch.createStarted();
boolean result = reader.call();
long runtimeMillis = sw.stop().elapsed(TimeUnit.MILLISECONDS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void setup() throws Exception {
clusterContext.start();

if (TEST_INIT_KEYSPACE) {
Cluster cluster = clusterContext.getEntity();
Cluster cluster = clusterContext.getClient();
try {
LOG.info("Dropping keyspace: " + TEST_KEYSPACE_NAME);
cluster.dropKeyspace(TEST_KEYSPACE_NAME);
Expand Down Expand Up @@ -143,7 +143,7 @@ public static void teardown() {
public static void populateKeyspace() throws Exception {
LOG.info("Ppoulating keyspace: " + TEST_KEYSPACE_NAME);

Keyspace keyspace = clusterContext.getEntity().getKeyspace(
Keyspace keyspace = clusterContext.getClient().getKeyspace(
TEST_KEYSPACE_NAME);

try {
Expand Down Expand Up @@ -181,7 +181,7 @@ public void testReverseIndex() throws Exception{
LOG.info("Starting");
final AtomicLong counter = new AtomicLong();

Keyspace keyspace = clusterContext.getEntity().getKeyspace(TEST_KEYSPACE_NAME);
Keyspace keyspace = clusterContext.getClient().getKeyspace(TEST_KEYSPACE_NAME);
ReverseIndexQuery
.newQuery(keyspace, CF_DATA, CF_INDEX.getName(),
LongSerializer.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void setup() throws Exception {
clusterContext.start();

if (TEST_INIT_KEYSPACE) {
Cluster cluster = clusterContext.getEntity();
Cluster cluster = clusterContext.getClient();
try {
LOG.info("Dropping keyspace: " + TEST_KEYSPACE_NAME);
cluster.dropKeyspace(TEST_KEYSPACE_NAME);
Expand Down Expand Up @@ -104,7 +104,7 @@ public static void teardown() {
public void testUniqueness() throws Exception {
LOG.info("Starting");

Keyspace keyspace = clusterContext.getEntity().getKeyspace(TEST_KEYSPACE_NAME);
Keyspace keyspace = clusterContext.getClient().getKeyspace(TEST_KEYSPACE_NAME);

UniquenessConstraintWithPrefix<Long> unique = new UniquenessConstraintWithPrefix<Long>(
keyspace, CF_DATA)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down Expand Up @@ -136,7 +136,7 @@ ImmutableMap.<String, Object> builder()

Thread.sleep(CASSANDRA_WAIT_TIME);

KeyspaceDefinition ki = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition ki = keyspaceContext.getClient().describeKeyspace();
Log.info("Describe Keyspace: " + ki.getName());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand Down Expand Up @@ -657,7 +657,7 @@ public Boolean apply(MessageContext message) {
})
.withMessageQueue(scheduler)
.withConsumerCount(5)
.withThreadCount(1 + 10)
.withProcessorThreadCount(1 + 10)
.build();

dispatcher.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void createKeyspace() throws Exception {

keyspaceContext.start();

keyspace = keyspaceContext.getEntity();
keyspace = keyspaceContext.getClient();

try {
keyspace.dropKeyspace();
Expand All @@ -125,7 +125,7 @@ public static void createKeyspace() throws Exception {
keyspace.createColumnFamily(CF_LOTS_OF_ROWS, null);
keyspace.createColumnFamily(CF_CHECKPOINTS, null);

KeyspaceDefinition ki = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition ki = keyspaceContext.getClient().describeKeyspace();
System.out.println("Describe Keyspace: " + ki.getName());

MutationBatch m;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public void testHasValue() throws Exception {

@Test
public void getKeyspaceDefinition() throws Exception {
KeyspaceDefinition def = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition def = keyspaceContext.getClient().describeKeyspace();
Collection<String> fieldNames = def.getFieldNames();
LOG.info("Getting field names");
for (String field : fieldNames) {
Expand All @@ -543,7 +543,7 @@ public void getKeyspaceDefinition() throws Exception {

@Test
public void testCopyKeyspace() throws Exception {
KeyspaceDefinition def = keyspaceContext.getEntity().describeKeyspace();
KeyspaceDefinition def = keyspaceContext.getClient().describeKeyspace();
Properties props = def.getProperties();

for (Entry<Object, Object> prop : props.entrySet()) {
Expand Down Expand Up @@ -588,7 +588,7 @@ public void testNonExistentKeyspace() {
ctx.start();

try {
KeyspaceDefinition keyspaceDef = ctx.getEntity().describeKeyspace();
KeyspaceDefinition keyspaceDef = ctx.getClient().describeKeyspace();
Assert.fail();
} catch (ConnectionException e) {
LOG.info(e.getMessage());
Expand All @@ -599,11 +599,11 @@ public void testNonExistentKeyspace() {
@Test
public void testDescribeRing() throws Exception {
// [TokenRangeImpl [startToken=0, endToken=0, endpoints=[127.0.0.1]]]
List<TokenRange> ring = keyspaceContext.getEntity().describeRing();
List<TokenRange> ring = keyspaceContext.getClient().describeRing();
LOG.info(ring.toString());

// 127.0.0.1
RingDescribeHostSupplier ringSupplier = new RingDescribeHostSupplier(keyspaceContext.getEntity(), 9160);
RingDescribeHostSupplier ringSupplier = new RingDescribeHostSupplier(keyspaceContext.getClient(), 9160);
List<Host> hosts = ringSupplier.get();
Assert.assertEquals(1, hosts.get(0).getTokenRanges().size());
LOG.info(hosts.toString());
Expand Down Expand Up @@ -663,7 +663,7 @@ public void example() {
.buildKeyspace(ThriftFamilyFactory.getInstance());

context.start();
Keyspace keyspace = context.getEntity();
Keyspace keyspace = context.getClient();

MutationBatch m = keyspace.prepareMutationBatch();

Expand Down Expand Up @@ -1934,7 +1934,7 @@ public void testKeyspaceDoesntExist() {
try {
keyspaceContext.start();

Keyspace ks = keyspaceContext.getEntity();
Keyspace ks = keyspaceContext.getClient();

OperationResult<Void> result = null;
try {
Expand Down Expand Up @@ -2734,7 +2734,7 @@ public void testCluster() {
.buildCluster(ThriftFamilyFactory.getInstance());

clusterContext.start();
Cluster cluster = clusterContext.getEntity();
Cluster cluster = clusterContext.getClient();

try {
cluster.describeClusterName();
Expand Down Expand Up @@ -2821,7 +2821,7 @@ public void testWithRetry() {
ColumnFamily<String, String> cf = new ColumnFamily<String, String>(
"DoesntExist", StringSerializer.get(), StringSerializer.get());
try {
MutationBatch m = keyspaceContext.getEntity()
MutationBatch m = keyspaceContext.getClient()
.prepareMutationBatch()
.withRetryPolicy(new ExponentialBackoff(10, 3));
m.withRow(cf, "Key1").putColumn("Column2", "Value2", null);
Expand Down