@Test public void batchStatementTest() { final CMapSync map = mapService.getMap(RING_OF_POWER_TABLE); final CQuery query = CQueryBuilder.createPreparedRemoveQuery() .addFilters() .eq(COL_QUOTES) .noMoreFilters() .noFiltering(); final CPreparedPut preparedPutQuery = mapService.preparePut(RING_OF_POWER_TABLE); final CPreparedRemove preparedRemoveQuery = mapService.prepareRemove(RING_OF_POWER_TABLE, query); final CPreparedPut.PreparedPutExecutor preparedPutExecutor = preparedPutQuery .bind() .bindTo(COL_QUOTES, newQuote()) .bindTo(COL_TIMESTAMP, DateTime.now(DateTimeZone.UTC)) .stopBinding(); final CPreparedRemove.PreparedRemoveExecutor preparedRemoveExecutor = preparedRemoveQuery.bind().bindTo(COL_QUOTES, newQuote()).stopBinding(); final CBatch batch = mapService.batch(); batch.put(preparedPutExecutor); batch.remove(preparedRemoveExecutor); batch.apply(); assertEquals(1, Lists.newArrayList(map.all()).size()); }
@Test public void putPreparedStatement() { final CMapSync map = mapService.getMap(RING_OF_POWER_TABLE); final CPreparedPut preparedQuery = mapService.preparePut(RING_OF_POWER_TABLE); final CPreparedPut.PreparedPutExecutor preparedExecutor = preparedQuery .bind() .bindTo(COL_QUOTES, newQuote()) .bindTo(COL_TIMESTAMP, DateTime.now(DateTimeZone.UTC)) .stopBinding(); preparedExecutor.execute(); assertEquals(1, Lists.newArrayList(map.all()).size()); preparedQuery .bind() .bindTo(COL_TIMESTAMP, DateTime.now(DateTimeZone.UTC)) .bindTo(COL_QUOTES, newQuote()) .stopBinding() .execute(); assertEquals(2, Lists.newArrayList(map.all()).size()); }