From 47ddbb2c759c21234fea3c4472eaed4d121b8d26 Mon Sep 17 00:00:00 2001 From: John Myers Date: Fri, 10 Jul 2015 21:37:02 -0700 Subject: [PATCH 1/3] Fix use of deprecated Stopwatch constructor --- .../test/java/com/netflix/astyanax/recipes/MiscUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java index f82f6b61d..2eef63307 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java @@ -959,7 +959,7 @@ public synchronized Boolean apply(Row row) { .build(); try { - Stopwatch sw = new Stopwatch().start(); + Stopwatch sw = Stopwatch.createStarted(); boolean result = reader.call(); long runtimeMillis = sw.stop().elapsed(TimeUnit.MILLISECONDS); From 4b78829fb0e96c4cbcb982eacd224a586145665c Mon Sep 17 00:00:00 2001 From: John Myers Date: Fri, 10 Jul 2015 21:44:45 -0700 Subject: [PATCH 2/3] Fix use of deprecated AstyanaxContext.getEntity() --- .../astyanax/examples/AstCQLClient.java | 2 +- .../netflix/astyanax/examples/AstClient.java | 2 +- .../DefaultEntityManagerNullableTest.java | 2 +- .../entitystore/DefaultEntityManagerTest.java | 2 +- .../DefaultEntityManagerTtlTest.java | 2 +- .../astyanax/recipes/LockRecipeTest.java | 4 ++-- .../netflix/astyanax/recipes/MiscUnitTest.java | 4 ++-- .../recipes/ReverseIndexQueryTest.java | 6 +++--- .../recipes/UniquenessConstraintTest.java | 4 ++-- .../com/netflix/astyanax/thrift/CqlTest.java | 4 ++-- .../com/netflix/astyanax/thrift/QueueTest.java | 2 +- .../thrift/ThriftKeyspaceAllRowsTest.java | 4 ++-- .../thrift/ThriftKeyspaceImplTest.java | 18 +++++++++--------- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java b/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java index ff461183c..e0db587f8 100644 --- a/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java +++ b/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstCQLClient.java @@ -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, diff --git a/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstClient.java b/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstClient.java index 681b839fc..c1c762020 100644 --- a/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstClient.java +++ b/astyanax-examples/src/main/java/com/netflix/astyanax/examples/AstClient.java @@ -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, diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerNullableTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerNullableTest.java index c1e5897cb..a087ad619 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerNullableTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerNullableTest.java @@ -87,7 +87,7 @@ private static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTest.java index 123f22804..17c50373e 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTest.java @@ -94,7 +94,7 @@ private static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTtlTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTtlTest.java index a3a8140f1..fd501d2a0 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTtlTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/entitystore/DefaultEntityManagerTtlTest.java @@ -84,7 +84,7 @@ private static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/LockRecipeTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/LockRecipeTest.java index 89ff1a4c2..b7a757d52 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/LockRecipeTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/LockRecipeTest.java @@ -94,7 +94,7 @@ public static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); @@ -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()); } diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java index 2eef63307..f81459894 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/MiscUnitTest.java @@ -173,7 +173,7 @@ public static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); @@ -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 { diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/ReverseIndexQueryTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/ReverseIndexQueryTest.java index 748a5f86f..872402150 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/ReverseIndexQueryTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/ReverseIndexQueryTest.java @@ -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); @@ -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 { @@ -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()) diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/UniquenessConstraintTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/UniquenessConstraintTest.java index 585aee422..32b418a03 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/recipes/UniquenessConstraintTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/recipes/UniquenessConstraintTest.java @@ -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); @@ -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 unique = new UniquenessConstraintWithPrefix( keyspace, CF_DATA) diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/CqlTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/CqlTest.java index 58bd434f0..cfbdd3955 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/CqlTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/CqlTest.java @@ -102,7 +102,7 @@ public static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); @@ -136,7 +136,7 @@ ImmutableMap. builder() Thread.sleep(CASSANDRA_WAIT_TIME); - KeyspaceDefinition ki = keyspaceContext.getEntity().describeKeyspace(); + KeyspaceDefinition ki = keyspaceContext.getClient().describeKeyspace(); Log.info("Describe Keyspace: " + ki.getName()); } diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java index db056f6df..9324178c4 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java @@ -120,7 +120,7 @@ public static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceAllRowsTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceAllRowsTest.java index 141f8a6e6..d46997607 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceAllRowsTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceAllRowsTest.java @@ -102,7 +102,7 @@ public static void createKeyspace() throws Exception { keyspaceContext.start(); - keyspace = keyspaceContext.getEntity(); + keyspace = keyspaceContext.getClient(); try { keyspace.dropKeyspace(); @@ -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; diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceImplTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceImplTest.java index b0b1f386f..3fe9a045d 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceImplTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/ThriftKeyspaceImplTest.java @@ -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 fieldNames = def.getFieldNames(); LOG.info("Getting field names"); for (String field : fieldNames) { @@ -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 prop : props.entrySet()) { @@ -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()); @@ -599,11 +599,11 @@ public void testNonExistentKeyspace() { @Test public void testDescribeRing() throws Exception { // [TokenRangeImpl [startToken=0, endToken=0, endpoints=[127.0.0.1]]] - List ring = keyspaceContext.getEntity().describeRing(); + List 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 hosts = ringSupplier.get(); Assert.assertEquals(1, hosts.get(0).getTokenRanges().size()); LOG.info(hosts.toString()); @@ -663,7 +663,7 @@ public void example() { .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); - Keyspace keyspace = context.getEntity(); + Keyspace keyspace = context.getClient(); MutationBatch m = keyspace.prepareMutationBatch(); @@ -1934,7 +1934,7 @@ public void testKeyspaceDoesntExist() { try { keyspaceContext.start(); - Keyspace ks = keyspaceContext.getEntity(); + Keyspace ks = keyspaceContext.getClient(); OperationResult result = null; try { @@ -2734,7 +2734,7 @@ public void testCluster() { .buildCluster(ThriftFamilyFactory.getInstance()); clusterContext.start(); - Cluster cluster = clusterContext.getEntity(); + Cluster cluster = clusterContext.getClient(); try { cluster.describeClusterName(); @@ -2821,7 +2821,7 @@ public void testWithRetry() { ColumnFamily cf = new ColumnFamily( "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); From bff6bdf09a454ffc6bd9f6abc044300f20f8e0a6 Mon Sep 17 00:00:00 2001 From: John Myers Date: Fri, 10 Jul 2015 21:59:40 -0700 Subject: [PATCH 3/3] Fix use of deprecated methods --- .../netflix/astyanax/serializers/SerializerPackageImpl.java | 4 ++-- .../main/java/com/netflix/astyanax/retry/ConstantBackoff.java | 2 +- .../src/test/java/com/netflix/astyanax/thrift/QueueTest.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/astyanax-cassandra/src/main/java/com/netflix/astyanax/serializers/SerializerPackageImpl.java b/astyanax-cassandra/src/main/java/com/netflix/astyanax/serializers/SerializerPackageImpl.java index 53593c5e3..144cba082 100644 --- a/astyanax-cassandra/src/main/java/com/netflix/astyanax/serializers/SerializerPackageImpl.java +++ b/astyanax-cassandra/src/main/java/com/netflix/astyanax/serializers/SerializerPackageImpl.java @@ -63,7 +63,7 @@ public SerializerPackageImpl(ColumnFamilyDefinition cfDef, boolean ignoreErrors) } try { - setColumnType(cfDef.getComparatorType()); + setColumnNameType(cfDef.getComparatorType()); } catch (UnknownComparatorException e) { if (!ignoreErrors) @@ -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 diff --git a/astyanax-core/src/main/java/com/netflix/astyanax/retry/ConstantBackoff.java b/astyanax-core/src/main/java/com/netflix/astyanax/retry/ConstantBackoff.java index 98a780b99..9b5a2aaf0 100644 --- a/astyanax-core/src/main/java/com/netflix/astyanax/retry/ConstantBackoff.java +++ b/astyanax-core/src/main/java/com/netflix/astyanax/retry/ConstantBackoff.java @@ -33,7 +33,7 @@ public long getSleepTimeMs() { @Override public RetryPolicy duplicate() { - return new ConstantBackoff(sleepTimeMs, getMax()); + return new ConstantBackoff(sleepTimeMs, getMaxAttemptCount()); } public String toString() { diff --git a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java index 9324178c4..57de8e337 100644 --- a/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java +++ b/astyanax-test/src/test/java/com/netflix/astyanax/thrift/QueueTest.java @@ -657,7 +657,7 @@ public Boolean apply(MessageContext message) { }) .withMessageQueue(scheduler) .withConsumerCount(5) - .withThreadCount(1 + 10) + .withProcessorThreadCount(1 + 10) .build(); dispatcher.start();