Package org.cyclop.model

Examples of org.cyclop.model.CqlQuery$CqlQueryJaxb


    qs.execute(new CqlQuery(null, null));
  }

  @Test(expected = BeanValidationException.class)
  public void testExecuteSimple_IncorrectParams() {
    qs.executeSimple(new CqlQuery(null, null), false);
  }
View Full Code Here


    qs.executeSimple(new CqlQuery(null, null), false);
  }

  @Test(expected = QueryException.class)
  public void testExecuteSimple_QueryError() {
    qs.executeSimple(new CqlQuery(CqlQueryType.SELECT, "select * from bara.bara"), false);
  }
View Full Code Here

  public void testExecuteSimple_Select_DoNotUpdateHistory() {
    executeSimpleSelect(false);
  }

  private void executeSimpleSelect(boolean updateHistory) {
    CqlQuery testCql = new CqlQuery(CqlQueryType.SELECT, "select title from cqldemo.mybooks where id="
        + UUID.randomUUID());

    try (QueryHistory.HistoryIterator iterator1 = hs.read().iterator()) {
      if (iterator1.hasNext()) {
        assertNotSame(testCql, iterator1.next().query);
View Full Code Here

  }

  @Test
  public void testExecuteSimple_Insert() {

    CqlQuery testCql = new CqlQuery(CqlQueryType.SELECT,
        "select title from cqldemo.mybooks where id=d0302001-bd93-42a2-8bc8-79bbdbfc7717");
    assertFalse(qs.execute(testCql).iterator().hasNext());

    qs.executeSimple(new CqlQuery(CqlQueryType.INSERT,
        "INSERT INTO CqlDemo.MyBooks (id,title) VALUES (d0302001-bd93-42a2-8bc8-79bbdbfc7717,'some value')"),
        false);

    assertTrue(qs.execute(testCql).iterator().hasNext());
  }
View Full Code Here

    assertTrue(qs.execute(testCql).iterator().hasNext());
  }

  @Test(expected = QueryException.class)
  public void testExecute_QueryError() {
    qs.execute(new CqlQuery(CqlQueryType.SELECT, "select * from bara.bara"), false);
  }
View Full Code Here

    qs.execute(new CqlQuery(CqlQueryType.SELECT, "select * from bara.bara"), false);
  }

  @Test
  public void testExecute_SimplePkWithDynamicColumn() {
    qs.execute(new CqlQuery(CqlQueryType.USE, "USE CqlDemo"));
    CqlQueryResult res = qs.execute(new CqlQuery(CqlQueryType.SELECT, "select * from MyBooks where pages=2212"));

    CqlRowMetadata rowMetadata = res.rowMetadata;
    assertTrue(res.toString(), rowMetadata.columns.contains(new CqlExtendedColumnName(CqlColumnType.REGULAR,
        CqlDataType.create(DataType.varchar()), "title")));

View Full Code Here

  @Test
  public void testCreateReadAndClear() throws Exception {
    QueryFavourites favourites = favService.read();

    for (int i = 0; i < 20; i++) {
      assertTrue(favourites.addWithSizeCheck(new QueryEntry(new CqlQuery(CqlQueryType.SELECT,
          "select * from HistoryStarTest where id=" + i), 1000 + i)));

      assertTrue(favourites.addWithSizeCheck(new QueryEntry(new CqlQuery(CqlQueryType.SELECT,
          "select * from HistoryStarTest where id=" + i), 2000 + i)));

      favService.store(favourites);
      QueryFavourites favQueue = asyncFileStore.getFromWriteQueue(user).get();
      assertNotNull(favQueue);

      // should be the same instance
      assertSame(favourites, favQueue);
    }
    assertEquals(20, favourites.size());

    assertFalse(storage.read(user, QueryFavourites.class).isPresent());

    asyncFileStore.flush();
    assertFalse(asyncFileStore.getFromWriteQueue(user).isPresent());

    assertSame(favourites, favService.read());

    QueryFavourites readFavs = storage.read(user, QueryFavourites.class).get();
    assertNotSame(favourites, readFavs);

    {
      for (int i = 0; i < 20; i++) {
        QueryEntry entry = new QueryEntry(new CqlQuery(CqlQueryType.SELECT,
            "select * from HistoryStarTest where id=" + i), 4000 + i);
        assertTrue(entry.toString(), readFavs.contains(entry));
      }
    }

View Full Code Here

        public Void call() throws Exception {
          for (int i = 0; i < repeatInTest; i++) {
            QueryFavourites readFavs = favService.read();
            favs.add(readFavs);

            QueryEntry fav = new QueryEntry(new CqlQuery(CqlQueryType.SELECT,
                "select * from MyTable2 where id=" + UUID.randomUUID()), 5000 + i);
            int retry = 0;
            while (!readFavs.addWithSizeCheck(fav)) {
              retry++;
              assertTrue(retry < 100);
View Full Code Here

    assertEquals(size, filterRes.result.size());
    assertNotNull(filterRes.normalizedKeywords);
    assertFalse(filterRes.normalizedKeywords.isEmpty());
    int listIdx = 0;
    for (int resIdx : queries) {
      CqlQuery query = filterRes.result.get(listIdx++);
      assertNotNull("Not found: " + QUERIES[resIdx], query);
    }

    assertEquals(size, queries.length);
  }
View Full Code Here

  @Test
  public void testCreateReadAndClear() throws Exception {
    QueryHistory history = historyService.read();

    for (int i = 0; i < 600; i++) {
      historyService.addAndStore(new QueryEntry(new CqlQuery(CqlQueryType.SELECT, "select * " + CR
          + "from HistoryTest where " + CR + "id=" + i), 1000 + i));
      QueryHistory historyQueue = asyncFileStore.getFromWriteQueue(user).get();
      assertNotNull(historyQueue);

      // should be the same instance
      assertSame(history, historyQueue);
    }
    assertEquals(500, history.size());

    asyncFileStore.flush();
    assertFalse(asyncFileStore.getFromWriteQueue(user).isPresent());

    assertSame(history, historyService.read());

    QueryHistory readHist = storage.read(user, QueryHistory.class).get();
    assertNotSame(history, readHist);

    for (int i = 100; i < 600; i++) {
      QueryEntry tofind = new QueryEntry(new CqlQuery(CqlQueryType.SELECT, "select * from HistoryTest where id="
          + i), 2000 + i);
      assertTrue(tofind + " NOT FOUND IN: " + readHist, readHist.contains(tofind));

      ImmutableList<QueryEntry> readList = readHist.copyAsList();
      int index = readList.indexOf(tofind);
View Full Code Here

TOP

Related Classes of org.cyclop.model.CqlQuery$CqlQueryJaxb

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.