Package com.netflix.astyanax

Examples of com.netflix.astyanax.MutationBatch.execute()


                m.withRow(CF_ALL_ROWS,  i).putColumn(0true);
                if (m.getRowCount() == 50) {
                    m.execute();
                }
            }
            m.execute();

        } catch (Exception e) {
            System.out.println(e.getMessage());
            Assert.fail();
        }
View Full Code Here


        // Phase 1: Write a unique column
        MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel);
        m.withRow(columnFamily, key).putEmptyColumn(prefix + unique, ttl);

        m.execute();

        // Phase 2: Read back all columns. There should be only 1
        ColumnList<String> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel)
                .getKey(key)
                .withColumnRange(new RangeBuilder().setStart(prefix + "\u0000").setEnd(prefix + "\uFFFF").build())
View Full Code Here

            this.monitor.onViolation(key, prefix + unique);

        // Rollback
        m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel);
        m.withRow(columnFamily, key).deleteColumn(prefix + unique);
        m.execute().getResult();

        return null;
    }
}
View Full Code Here

        MutationBatch mb = ks.prepareMutationBatch();
        for (long i=start; i<end; i++) {
            mb.withRow(CF_DUAL_WRITES, rowKey).putColumn(i, "foo");
        }
        mb.execute();
    }

    private void deleteRowFromKS(Keyspace ks, int ... rowKeys) throws ConnectionException {

        MutationBatch mb = ks.prepareMutationBatch();
View Full Code Here

        MutationBatch mb = ks.prepareMutationBatch();
        for (int rowKey : rowKeys) {
            mb.withRow(CF_DUAL_WRITES, rowKey).delete();
        }
        mb.execute();
    }

    private AstyanaxContext<Keyspace> getKeyspaceContext(final String ks, final String seedHost) {
        AstyanaxContext<Keyspace> ctx =
                new AstyanaxContext.Builder()
View Full Code Here

        baseAmount = 0;
       
        MutationBatch m = keyspace.prepareMutationBatch();
        m.withRow(CF_COUNTER1, "CounterRow1").incrementCounterColumn("MyCounter", incrAmount);
        m.execute();
//
//        column = keyspace.prepareQuery(CF_COUNTER1).getRow("CounterRow1").getColumn("MyCounter").execute().getResult();
//        Assert.assertNotNull(column);
//        Assert.assertEquals(baseAmount + incrAmount, column.getLongValue());
//
View Full Code Here

        String counterName = "MyCounter";

        // Increment the column
        MutationBatch m = keyspace.prepareMutationBatch();
        m.withRow(CF_COUNTER1, rowKey).incrementCounterColumn(counterName, 1);
        m.execute();

//        // Read back the value
//        column = keyspace.prepareQuery(CF_COUNTER1).getRow(rowKey).getColumn(counterName).execute().getResult();
//        Assert.assertNotNull(column);
//        Assert.assertEquals(column.getLongValue(), 1);
View Full Code Here

        MutationBatch mb = keyspace.prepareMutationBatch();
        mb.withRow(CF_COL_TIMESTAMP, 1L)
            .setTimestamp(1).putColumn(1L, 1L)
            .setTimestamp(10).putColumn(2L, 2L)
            ;
        mb.execute();
       
        ColumnList<Long> result1 = keyspace.prepareQuery(CF_COL_TIMESTAMP).getRow(1L).execute().getResult();
        Assert.assertEquals(2, result1.size());
        Assert.assertNotNull(result1.getColumnByName(1L));
        Assert.assertNotNull(result1.getColumnByName(2L));
View Full Code Here

            .deleteColumn(1L)
            .setTimestamp(result1.getColumnByName(2L).getTimestamp()-1)
            .deleteColumn(2L)
            .putEmptyColumn(3L, null);
       
        mb.execute();
       
        result1 = keyspace.prepareQuery(CF_COL_TIMESTAMP).getRow(1L).execute().getResult();
        Assert.assertEquals(3, result1.size());
       
        mb = keyspace.prepareMutationBatch();
View Full Code Here

        mb.withRow(CF_COL_TIMESTAMP,  1L)
            .setTimestamp(result1.getColumnByName(1L).getTimestamp()+1)
            .deleteColumn(1L)
            .setTimestamp(result1.getColumnByName(2L).getTimestamp()+1)
            .deleteColumn(2L);
        mb.execute();
       
        result1 = keyspace.prepareQuery(CF_COL_TIMESTAMP).getRow(1L).execute().getResult();
        Assert.assertEquals(1, result1.size());
    }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.