Package com.datastax.driver.core

Examples of com.datastax.driver.core.Session$State


        dataLoader.load(new FileDataSet(file), loadingOption);
    }

    private static void cqlDataSetLoad(String host, String port, String file) {
        Cluster cluster = new Cluster.Builder().addContactPoints(host).withPort(Integer.parseInt(port)).build();
        Session session = cluster.connect();
        CQLDataLoader dataLoader = new CQLDataLoader(session);
        dataLoader.load(new FileCQLDataSet(file, false));
    }
View Full Code Here


    // Drop the keyspace
    cm.dropKeyspace(definition.getName());

    // Make sure it is really dropped
    Session session = cm.getEmptySession();
    boolean caught = false;
    try {
      session.execute("USE " + definition.getName() + ";");
    } catch(InvalidQueryException e) {
      caught = true;
    }
    session.close();
    assertTrue(caught);

    cm.teardown();
  }
View Full Code Here

    assertEquals("one",result.get("index_1"));
    assertEquals("two",result.get("index_2"));
    assertEquals("three",result.get("value"));

    // Make sure we have saved both versions of the keyspace
    Session session = cm.getEmptySession();
    StringBuilder sb = new StringBuilder();
    sb.append("SELECT id from \"");
    sb.append(cm.getRhombusKeyspaceName());
    sb.append("\".\"__keyspace_definitions\" where name='");
    sb.append(NewKeyspaceDefinition.getName());
    sb.append("';");
    ResultSet resultSet = session.execute(sb.toString());
    Iterator<Row> rsIter = resultSet.iterator();
    int counter = 0;
    while(rsIter.hasNext()) {
      counter++;
      rsIter.next();
View Full Code Here

  @Test
  public void testKeyspaceCreate() throws IOException {
    ConnectionManager cm = TestHelpers.getTestConnectionManager();
    cm.buildCluster();
    Session session = cm.getEmptySession();
    assertNotNull(session);

    //Drop the functional keyspace if it exists
    try {
      session.execute("DROP KEYSPACE functional_create");
    } catch (InvalidQueryException e) {
      //Ignore
    }

    //Create the functional keyspace
    session.execute("CREATE KEYSPACE functional_create WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }");

    //Change to our functional testing keyspace
    session.execute("USE functional_create");

    //Drop the functional keyspace
    try {
      session.execute("DROP KEYSPACE functional_create");
    } catch (InvalidQueryException e) {
      //Ignore
    }

    //Shutdown the session
    session.close();

    //Teardown the connection manager
    cm.teardown();
  }
View Full Code Here

      indexValues.put("user_id", UUID.fromString("00000003-0000-0030-0040-000000030000"));

      UUID stop = UUID.fromString(uuidList.get(nDataItems-1));
      CDefinition cDefinition = definition.getDefinitions().get("object2");
      BaseCQLStatementIterator unBoundedIterator = (BaseCQLStatementIterator) CObjectCQLGenerator.makeCQLforList(KEYSPACE_NAME, shardIdLists, cDefinition, indexValues, CObjectOrdering.DESCENDING, null, stop, 10l, true, false, false);
      Session session = cm.getRhombusSession(definition);
      CQLExecutor cqlExecutor = new CQLExecutor(session, true, definition.getConsistencyLevel());
      CQLExecutorIterator cqlExecutorIterator = new CQLExecutorIterator(cqlExecutor, unBoundedIterator);
      cqlExecutorIterator.setPageSize(nDataItems);

View Full Code Here

      indexValues.put("user_id", UUID.fromString("00000003-0000-0030-0040-000000030000"));

      UUID stop = UUID.fromString(uuidList.get(nDataItems-1));
      CDefinition cDefinition = definition.getDefinitions().get("object2");
      BaseCQLStatementIterator unBoundedIterator = (BaseCQLStatementIterator) CObjectCQLGenerator.makeCQLforList(KEYSPACE_NAME, shardIdLists, cDefinition, indexValues, CObjectOrdering.DESCENDING, null, stop, 10l, true, false, false);
      Session session = cm.getRhombusSession(definition);
      CQLExecutor cqlExecutor = new CQLExecutor(session, true, definition.getConsistencyLevel());
      CQLExecutorIterator cqlExecutorIterator = new CQLExecutorIterator(cqlExecutor, unBoundedIterator);
      cqlExecutorIterator.setPageSize(nDataItems);

View Full Code Here

      criteria.setIndexKeys(indexValues);

      CObjectCQLGenerator cqlGenerator = om.getCqlGenerator_ONLY_FOR_TESTING();
      CQLStatementIterator unBoundedIterator = cqlGenerator.makeCQLforList(objectType, criteria, false);

      Session session = cm.getRhombusSession(definition);
      CQLExecutor cqlExecutor = new CQLExecutor(session, true, definition.getConsistencyLevel());
      CQLExecutorIterator cqlExecutorIterator = new CQLExecutorIterator(cqlExecutor, unBoundedIterator);
      cqlExecutorIterator.setPageSize(nDataItems-1);

View Full Code Here

      indexValues.put("user_id", UUID.fromString("00000003-0000-0030-0040-000000030000"));

      UUID stop = UUID.fromString(uuidList.get(nDataItems-1));
      CDefinition cDefinition = definition.getDefinitions().get("object2");
      BaseCQLStatementIterator unBoundedIterator = (BaseCQLStatementIterator) CObjectCQLGenerator.makeCQLforList(KEYSPACE_NAME, shardIdLists, cDefinition, indexValues, CObjectOrdering.DESCENDING, null, stop, 10l, true, false, false);
      Session session = cm.getRhombusSession(definition);
      CQLExecutor cqlExecutor = new CQLExecutor(session, true, definition.getConsistencyLevel());
      CQLExecutorIterator cqlExecutorIterator = new CQLExecutorIterator(cqlExecutor, unBoundedIterator);
      cqlExecutorIterator.setPageSize((nDataItems/5));

View Full Code Here

    final int queriesSize = queries.size();
    final int proThread = Math.max(1, queriesSize / conf.queryImport.maxThreadsProImport);

    LOG.debug("Starting parallel import for {} queries, {} pro thread", queriesSize, proThread);
    Session cassSession = session.getSession();

    List<Future<Void>> futures = new ArrayList<>();
    int startIndex = 0;
    int remaining = queriesSize;
    while (remaining > 0) {
View Full Code Here

            }
        }
        String query = select().all().from(db, table).where(eq(keycol, key))
                .getQueryString();
        Cluster cluster = Cluster.builder().addContactPoints("localhost").build();
        Session session = cluster.connect(db);
        ResultSet rs = session.execute(query);
        return convertResultSet(rs);
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Session$State

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.