Package com.datastax.driver.core

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


    }
    CassandraVirtualDataWindow result = null;
    synchronized (_cluster) {
      try {
        _log.info("Started connecting to cluster...");
        final Session session = _cluster.connect(_configuration
            .getKeyspace());
        _log.info("Finished connecting to cluster...");

        result = new CassandraVirtualDataWindow(session,
            _configuration.getTable(), context);
View Full Code Here


    public <T> T executeWithSession(String schemaName, SessionCallable<T> sessionCallable)
    {
        NoHostAvailableException lastException = null;
        for (int i = 0; i < 2; i++) {
            Session session = getSession(schemaName);
            try {
                return sessionCallable.executeWithSession(session);
            }
            catch (NoHostAvailableException e) {
                lastException = e;
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
        .withPort(9142)
        .build();
    Session session = cluster.connect("cassandra_unit_keyspace");

    ResultSet result = session.execute("select * from testCQLTable1 WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570717");
    String val = result.iterator().next().getString("value");
    assertEquals("1- Cql loaded string", val);

    result = session.execute("select * from testCQLTable2 WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570727");
    val = result.iterator().next().getString("value");
    assertEquals("2- Cql loaded string", val);
  }
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
        .withPort(9142)
        .build();
    Session session = cluster.connect("myownkeyspace");
    ResultSet result = session.execute("select * from testCQLTableKS WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570787");
    String val = result.iterator().next().getString("value");
    assertEquals("KS- Cql loaded string", val);
  }
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
        .withPort(9142)
        .build();
    Session session = cluster.connect("cassandra_unit_keyspace");
    ResultSet result = session.execute("select * from testCQLTableRootLocation WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570797");
    String val = result.iterator().next().getString("value");
    assertEquals("Root- Cql loaded string", val);
  }
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
        .withPort(9142)
        .build();
    Session session = cluster.connect("cassandra_unit_keyspace");
    ResultSet result = session.execute("select * from testCQLTable WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570737");
    String val = result.iterator().next().getString("value");
    assertEquals("Cql loaded string", val);
  }
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
        .withPort(9142)
        .build();
    Session session = cluster.connect("cassandra_unit_keyspace");
    ResultSet result = session.execute("select * from testCQLTable1 WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570717");
    String val = result.iterator().next().getString("value");
    assertEquals("1- Cql loaded string", val);
  }
View Full Code Here

  private void test() {
    Cluster cluster = Cluster.builder()
        .addContactPoints("127.0.0.1")
            .withPort(9142)
        .build();
    Session session = cluster.connect("cassandra_unit_keyspace");
    ResultSet result = session.execute("select * from testCQLTable WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570737");
    String val = result.iterator().next().getString("value");
    assertEquals("Cql loaded string", val);
  }
View Full Code Here

        case cql:
          dataset = dataSetLocations(testContext, cassandraDataSet);
          datasetIterator = dataset.listIterator();

          Cluster cluster = new Cluster.Builder().addContactPoints(host).withPort(port).build();
          Session session = cluster.connect();
         
          CQLDataLoader cqlDataLoader = new CQLDataLoader(session);
          while (datasetIterator.hasNext()) {
            String next = datasetIterator.next();
            boolean dropAndCreateKeyspace = datasetIterator.previousIndex() == 0;
View Full Code Here

        String[] args = {"-f", targetFileDataSet, "-h", host, "-p", port};
        CassandraUnitCommandLineLoader.main(args);

        com.datastax.driver.core.Cluster cluster =
                new com.datastax.driver.core.Cluster.Builder().addContactPoints(host).withPort(Integer.parseInt(port)).build();
        Session session = cluster.connect();

        ResultSet result = session.execute("select * from mykeyspace.testCQLTable WHERE id=1690e8da-5bf8-49e8-9583-4dff8a570737");
        String val = result.iterator().next().getString("value");
        Assert.assertThat("Cql loaded string",is(val));

        EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
    }
View Full Code Here

TOP

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

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.