Package org.cyclop.model

Examples of org.cyclop.model.CqlQuery


    while (scanner.hasNext()) {
      String nextStr = StringUtils.trimToNull(scanner.next());
      if (nextStr == null) {
        continue;
      }
      CqlQuery query = new CqlQuery(CqlQueryType.UNKNOWN, nextStr);
      long startTime = System.currentTimeMillis();
      try {
        LOG.debug("Executing: {}", query);
        queryService.executeSimple(query, config.isUpdateHistory());
        resultWriter.success(query, System.currentTimeMillis() - startTime);
View Full Code Here


    while (scanner.hasNext()) {
      String nextStr = StringUtils.trimToNull(scanner.next());
      if (nextStr == null) {
        continue;
      }
      CqlQuery query = new CqlQuery(CqlQueryType.UNKNOWN, nextStr);
      build.add(query);
    }
    ImmutableList<CqlQuery> res = build.build();

    if (LOG.isDebugEnabled()) {
View Full Code Here

    if (queryRunning) {
      LOG.warn("Query still running - cannot execute second one");
      return;
    }

    CqlQuery query = editorPanel.getEditorContent();

    if (query == null) {
      return;
    }
    queryRunning = true;
View Full Code Here

    String editorValue = editor.getDefaultModelObjectAsString();
    editorValue = StringUtils.trimToNull(editorValue);
    if (editorValue == null || currentCompletion == null) {
      return null;
    }
    CqlQuery cq = new CqlQuery(currentCompletion.queryName, editorValue);
    return cq;
  }
View Full Code Here

        if (StringUtils.isEmpty(editorValue)) {
          cqlCompletion = completionService.findInitialCompletion();
        } else {
          RequestCycle requestCycle = RequestCycle.get();
          int index = requestCycle.getRequest().getRequestParameters().getParameterValue("cursorPos").toInt();
          CqlQuery cqlQuery = new CqlQuery(CqlQueryType.UNKNOWN, editorValue);
          cqlCompletion = completionService.findCompletion(cqlQuery, index);
        }
        if (cqlCompletion.cqlCompletion.isEmpty() || cqlCompletion.equals(currentCompletion)) {
          return;
        }
View Full Code Here

    assertEquals(0, hist.size());
    try (QueryHistory.HistoryIterator iterator = hist.iterator()) {
      assertFalse(iterator.hasNext());
    }

    CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable");
    QueryEntry histEntry = new QueryEntry(query, 234);
    assertFalse(hist.contains(histEntry));
    try {
      hist.iterator().next();
      fail();
View Full Code Here

  public void testEmptyFavourites() {
    QueryFavourites hist = new QueryFavourites();
    assertEquals(0, hist.size());
    assertFalse(hist.copyAsSortedSet().iterator().hasNext());

    CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable");
    QueryEntry histEntry = new QueryEntry(query, 6456);
    assertFalse(hist.contains(histEntry));
    try {
      hist.copyAsSortedSet().iterator().next();
      fail();
View Full Code Here

  @Test
  public void testCreateAndRead_SingleHistoryEntry() {
    UserIdentifier userId = new UserIdentifier(UUID.randomUUID());
    QueryHistory newHistory = new QueryHistory();

    CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable");
    QueryEntry histEntry = new QueryEntry(query, 6645);
    newHistory.add(histEntry);

    storage.store(userId, newHistory);

View Full Code Here

  @Test
  public void testCreateAndRead_SingleFavouritesEntry() {
    UserIdentifier userId = new UserIdentifier(UUID.randomUUID());
    QueryFavourites newHistory = new QueryFavourites();

    CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable");
    QueryEntry favEntry = new QueryEntry(query, 234);
    newHistory.addWithSizeCheck(favEntry);

    storage.store(userId, newHistory);

View Full Code Here

  public void testLimitFavourites() {
    UserIdentifier userId = new UserIdentifier(UUID.randomUUID());
    QueryFavourites history = new QueryFavourites();
    {
      for (int i = 0; i < 50; i++) {
        CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable where id=" + i);
        assertTrue(history.addWithSizeCheck(new QueryEntry(query, 234)));
      }
      assertEquals(50, history.size());
    }

    checkFavLimitContent(history);

    {
      for (int i = 0; i < 10; i++) {
        CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTableA where id=" + i);
        assertFalse(history.addWithSizeCheck(new QueryEntry(query, 456)));
      }
      checkFavLimitContent(history);
    }

    {
      for (int i = 0; i < 20; i++) {
        CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable where id=" + i);
        assertTrue(history.addWithSizeCheck(new QueryEntry(query, 234)));
      }
      checkFavLimitContent(history);
    }

View Full Code Here

TOP

Related Classes of org.cyclop.model.CqlQuery

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.