Package com.datastax.driver.core

Examples of com.datastax.driver.core.Cluster.connect()


            ccm = CCMBridge.create("test", 1);
            cluster = Cluster.builder()
                             .addContactPoint(CCMBridge.ipOfNode(1))
                             .withLoadBalancingPolicy(policy)
                             .build();
            cluster.connect();
        } finally {
            if (cluster != null)
                cluster.close();
            if (ccm != null)
                ccm.remove();
View Full Code Here


            .withCredentials((String) configuration.get(cassandraUserOption),
                (String) configuration.get(cassandraPasswordOption))
            .build();

        try {
            return cluster.connect("rhq");
        } catch (Exception e) {
            log.debug("Failed to connect to the storage cluster.", e);
            cluster.shutdown();
            throw e;
        }
View Full Code Here

            public void onRemove(Host host) {
                log.info("host " + host + " removed");
            }
        });

        session = cluster.connect("rhq");
        storageSession = new StorageSession(session);
    }

    @AfterSuite(alwaysRun = true)
    @ShutdownCluster
View Full Code Here

            public void onRemove(Host host) {
                log.info("host " + host + " REMOVED");
            }
        });

        Session session = cluster.connect("rhq");
        StorageSession storageSession = new StorageSession(session);

        MetricsDAO dao = new MetricsDAO(storageSession, new MetricsConfiguration());

        while (true) {
View Full Code Here

        Cluster cluster = new Cluster.Builder()
            .addContactPoint("127.0.0.1")
            .withCredentials("rhqadmin", "rhqadmin")
            .build();
        session = cluster.connect("rhq");

        DateTime endTime =  DateTime.now().hourOfDay().roundFloorCopy();
        DateTime startTime = endTime.minusDays(3);
        DateTime today = endTime.hourOfDay().roundFloorCopy().minusHours(endTime.hourOfDay().roundFloorCopy()
            .hourOfDay().get());
View Full Code Here

        Cluster cluster = new Cluster.Builder()
            .addContactPoint("127.0.0.1")
            .withCredentials("rhqadmin", "rhqadmin")
            .build();
        session = cluster.connect("rhq");

        schemaManager = new SchemaManager("rhqadmin", "1eeb2f255e832171df8592078de921bc",
            new String[] {"127.0.0.1"}, 9042);
        schemaManager.install(new Properties());
        schemaManager.shutdown();
View Full Code Here

            .withCredentials("rhqadmin", "rhqadmin")
            .withPoolingOptions(new PoolingOptions()
                .setCoreConnectionsPerHost(HostDistance.LOCAL, 30)
                .setMaxConnectionsPerHost(HostDistance.LOCAL, 50))
            .build();
        session = cluster.connect("rhq");
        initPreparedStatements();

        DateTime endTime = DateTime.now();
        insert1HourData(numSchedules, endTime);
        insert6HourData(numSchedules, endTime);
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("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

TOP
Copyright © 2018 www.massapi.com. 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.