Package me.prettyprint.cassandra.service

Examples of me.prettyprint.cassandra.service.CassandraHostConfigurator


    dataLoader.load(new ClassPathYamlDataSet("integration/emptyDataSetWithReversedComparatorOnSimpleType.yaml"));
  }

  @Test
  public void writeAndReadFromCfCreatedUsingCassandraUnit() {
    final Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9170"));
    final Keyspace keyspace = HFactory.createKeyspace(KEYSPACE_NAME, cluster);

    final String columnFamily = "columnFamilyWithReversedComparatorOnSimpleType";

    writeDataSet(keyspace, columnFamily);
View Full Code Here


    assertResultsAreSortedAccordingToComparator(results);
  }

  @Test
  public void writeAndReadFromCfCreatedUsingHector() {
    final Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9170"));
    final Keyspace keyspace = HFactory.createKeyspace(KEYSPACE_NAME, cluster);

    final String columnFamily = "manuallyCreated";
    createColumnFamily(cluster, columnFamily);
View Full Code Here

    dataLoader.load(new ClassPathYamlDataSet("integration/emptyDataSetWithReversedComparatorOnCompositeTypes.yaml"));
  }

  @Test
  public void writeAndReadFromCfCreatedUsingCassandraUnit() {
    final Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9170"));
    final Keyspace keyspace = HFactory.createKeyspace(KEYSPACE_NAME, cluster);

    final String columnFamily = "columnFamilyWithReversedComparatorOnCompTypes";

    writeDataSet(keyspace, columnFamily);
View Full Code Here

    assertResultsAreSortedAccordingToComparator(results);
  }

  @Test
  public void writeAndReadFromCfCreatedUsingHector() {
    final Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9170"));
    final Keyspace keyspace = HFactory.createKeyspace(KEYSPACE_NAME, cluster);

    final String columnFamily = "manuallyCreated";
    createColumnFamily(cluster, columnFamily);
View Full Code Here

        EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
  }

  private void testIfTheEmbeddedCassandraServerIsUpOnHost(String hostAndPort) {
        Random random = new Random();
    Cluster cluster = HFactory.getOrCreateCluster("TestCluster" + random.nextInt(), new CassandraHostConfigurator(hostAndPort));
    assertThat(cluster.getConnectionManager().getActivePools().size(), is(1));
    KeyspaceDefinition keyspaceDefinition = cluster.describeKeyspace("system");
    assertThat(keyspaceDefinition, notNullValue());
    assertThat(keyspaceDefinition.getReplicationFactor(), is(1));
  }
View Full Code Here

    private static void dropKeyspaces() {
        String host = DatabaseDescriptor.getRpcAddress().getHostName();
        int port = DatabaseDescriptor.getRpcPort();
        log.debug("Cleaning cassandra keyspaces on " + host + ":" + port);
        Cluster cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator(host + ":" + port));
        /* get all keyspace */
        List<KeyspaceDefinition> keyspaces = cluster.describeKeyspaces();

        /* drop all keyspace except internal cassandra keyspace */
        for (KeyspaceDefinition keyspaceDefinition : keyspaces) {
View Full Code Here

  private StringSerializer stringSerializer = new StringSerializer();
 
  public void initialize() throws Exception {
    this.cassandraMapping.loadConfiguration();
    this.cluster = HFactory.getOrCreateCluster(this.cassandraMapping.getClusterName(), new CassandraHostConfigurator(this.cassandraMapping.getHostName()));
   
    // add keyspace to cluster
    checkKeyspace();
   
    // Just create a Keyspace object on the client side, corresponding to an already existing keyspace with already created column families.
View Full Code Here

    // get cassandra mapping with persistent class
    this.persistentClass = persistentClass;
    this.cassandraMapping = CassandraMappingManager.getManager().get(persistentClass);

    this.cluster = HFactory.getOrCreateCluster(this.cassandraMapping.getClusterName(), new CassandraHostConfigurator(this.cassandraMapping.getHostName()));
   
    // add keyspace to cluster
    checkKeyspace();
   
    // Just create a Keyspace object on the client side, corresponding to an already existing keyspace with already created column families.
View Full Code Here

    if ( embedded == null ) {
      embedded = new EmbeddedServerHelper();
      embedded.setup();
    }

    cassandraHostConfigurator = new CassandraHostConfigurator("localhost:9157");
    cluster = HFactory.getOrCreateCluster(clusterName, cassandraHostConfigurator);

    buildTestSchema();
  }
View Full Code Here

        log.info("Configuring Cassandra keyspace");
        String cassandraHost = env.getProperty("cassandra.host");
        String cassandraClusterName = env.getProperty("cassandra.clusterName");
        String cassandraKeyspace = env.getProperty("cassandra.keyspace");

        CassandraHostConfigurator cassandraHostConfigurator = new CassandraHostConfigurator(cassandraHost);
        cassandraHostConfigurator.setMaxActive(100);
        if (env.acceptsProfiles(Constants.SPRING_PROFILE_METRICS)) {
            log.debug("Cassandra Metrics monitoring enabled");
            HOpTimer hOpTimer = new MetricsOpTimer(cassandraClusterName);
            cassandraHostConfigurator.setOpTimer(hOpTimer);
        }
        ThriftCluster cluster = new ThriftCluster(cassandraClusterName, cassandraHostConfigurator);
        this.myCluster = cluster; // Keep a pointer to the cluster, as Hector is buggy and can't find it again...
        ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
        consistencyLevelPolicy.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);
View Full Code Here

TOP

Related Classes of me.prettyprint.cassandra.service.CassandraHostConfigurator

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.