Package com.pardot.rhombus.cobject.statement

Examples of com.pardot.rhombus.cobject.statement.BoundedLazyCQLStatementIterator


      indexkeys.put("foreignid","777");
      indexkeys.put("type", "5");
      indexkeys.put("instance", "222222");

      // creating a iterator that has both start and end and both are inclusive
      BoundedLazyCQLStatementIterator boundedLazyIterator = (BoundedLazyCQLStatementIterator) CObjectCQLGenerator.makeCQLforList(KEYSPACE_NAME, shardIdLists, def, indexkeys, CObjectOrdering.DESCENDING, null, stop, 10l, true, false, false);
      CQLStatement actual = boundedLazyIterator.next();
      CQLStatement expected = CQLStatement.make(
          "SELECT * FROM \"testspace\".\"testtypef9bf3332bb4ec879849ec43c67776131\" WHERE shardid = ? AND foreignid = ? AND instance = ? AND type = ? AND id <= ? ORDER BY id DESC LIMIT 10 ALLOW FILTERING;",
          TABLE_NAME,
          arrayFromValues(Long.valueOf(1),"777","222222","5", stop)
      );

      assertEquals(expected.getQuery(), actual.getQuery());
      assertEquals(expected.getValues()[0], actual.getValues()[0]);
      assertEquals(expected.getValues()[1], actual.getValues()[1]);
      assertEquals(expected.getValues()[2], actual.getValues()[2]);
      assertEquals(expected.getValues()[3], actual.getValues()[3]);
      assertEquals(expected.getValues()[4], actual.getValues()[4]);


      // testing if next start uuid is correctly applied
      UUID nextUuid = UUID.fromString("ada375b1-a2d9-11e2-99a3-3f36d3955e43");
      boundedLazyIterator.setNextUuid(nextUuid);

      assertTrue(boundedLazyIterator.hasNext());
      actual = boundedLazyIterator.next();

      assertEquals(expected.getQuery(), actual.getQuery());
      assertEquals(expected.getValues()[0], actual.getValues()[0]);
      assertEquals(expected.getValues()[1], actual.getValues()[1]);
      assertEquals(expected.getValues()[2], actual.getValues()[2]);
      assertEquals(expected.getValues()[3], actual.getValues()[3]);
      assertEquals(nextUuid, actual.getValues()[4]);

      // testing iterator that has both start and end , non inclusive
      boundedLazyIterator = (BoundedLazyCQLStatementIterator) CObjectCQLGenerator.makeCQLforList(KEYSPACE_NAME, shardIdLists, def, indexkeys, CObjectOrdering.DESCENDING, null, stop, 10l, false, false, false);
      actual = boundedLazyIterator.next();
      expected = CQLStatement.make(
          "SELECT * FROM \"testspace\".\"testtypef9bf3332bb4ec879849ec43c67776131\" WHERE shardid = ? AND foreignid = ? AND instance = ? AND type = ? AND id < ? ORDER BY id DESC LIMIT 10 ALLOW FILTERING;",
          TABLE_NAME,
          arrayFromValues(Long.valueOf(1),"777","222222","5", stop)
      );

      assertEquals(expected.getQuery(), actual.getQuery());
      assertEquals(expected.getValues()[0], actual.getValues()[0]);
      assertEquals(expected.getValues()[1], actual.getValues()[1]);
      assertEquals(expected.getValues()[2], actual.getValues()[2]);
      assertEquals(expected.getValues()[3], actual.getValues()[3]);
      assertEquals(expected.getValues()[4], actual.getValues()[4]);

      // testing if next start uuid is correctly applied
      nextUuid = UUID.fromString("ada375b1-a2d9-11e2-99a3-3f36d3955e43");
      boundedLazyIterator.setNextUuid(nextUuid);

      assertTrue(boundedLazyIterator.hasNext());
      actual = boundedLazyIterator.next();

      expected = CQLStatement.make(
          "SELECT * FROM \"testspace\".\"testtypef9bf3332bb4ec879849ec43c67776131\" WHERE shardid = ? AND foreignid = ? AND instance = ? AND type = ? AND id <= ? ORDER BY id DESC LIMIT 10 ALLOW FILTERING;",
          TABLE_NAME,
          arrayFromValues(Long.valueOf(1),"777","222222","5", nextUuid)
View Full Code Here

TOP

Related Classes of com.pardot.rhombus.cobject.statement.BoundedLazyCQLStatementIterator

Copyright © 2018 www.massapicom. 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.