Package me.prettyprint.hector.api

Examples of me.prettyprint.hector.api.Keyspace


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

        Cluster cluster = HFactory.getOrCreateCluster(clusterName, host + ":" + port);
        Keyspace keyspace = HFactory.createKeyspace("beautifulKeyspaceName", cluster);
        assertDefaultValuesSchemaExist(cluster);
        assertDefaultValuesDataIsEmpty(cluster);
        EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
    }
View Full Code Here


    assertThat(cluster.describeKeyspace("beautifulKeyspaceName").getCfDefs().get(0).getKeyValidationClass(),
        is(ComparatorType.BYTESTYPE.getClassName()));
  }

  public static void assertDefaultValuesDataIsEmpty(Cluster cluster) {
    Keyspace keyspace = HFactory.createKeyspace("beautifulKeyspaceName", cluster);
    RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(keyspace,
        BytesArraySerializer.get(), BytesArraySerializer.get(), BytesArraySerializer.get());
    query.setColumnFamily("columnFamily1");
    query.setRange(null, null, false, Integer.MAX_VALUE);
    QueryResult<OrderedRows<byte[], byte[], byte[]>> result = query.execute();
View Full Code Here

  }

  @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);
    final QueryResult<OrderedRows<String, String, String>> results = readDataSet(keyspace, columnFamily);
View Full Code Here

  }

  @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);

    writeDataSet(keyspace, columnFamily);
View Full Code Here

    dataLoader.load(MockDataSetHelper.getMockDataSetWithNullColumnValue());

    /* test */
    Cluster cluster = HFactory.getOrCreateCluster(clusterName, host);
        Keyspace keyspace = HFactory.createKeyspace("keyspaceWithNullColumnValue", cluster);
        ColumnQuery<String, String, String> query = HFactory.createColumnQuery(keyspace, StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
        query.setColumnFamily("columnFamilyWithNullColumnValue");
        query.setKey("rowWithNullColumnValue").setName("columnWithNullValue");
        QueryResult<HColumn<String, String>> result = query.execute();
        assertThat(result.get().getValue(),is(""));
View Full Code Here

        dataLoader.load(MockDataSetHelper.getMockDataSetWithTimestampedColumn());

        /* test */
        Cluster cluster = HFactory.getOrCreateCluster(clusterName, host);
        Keyspace keyspace = HFactory.createKeyspace("keyspaceWithTimestampedColumn", cluster);
        ColumnQuery<String, String, String> query = HFactory.createColumnQuery(keyspace, StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
        query.setColumnFamily("columnFamilyWithTimestampedColumn");
        query.setKey("rowWithTimestampedColumn").setName("columnWithTimestamp");
        QueryResult<HColumn<String, String>> result = query.execute();
        assertThat(result.get().getClock(),is(2020L));
View Full Code Here

  }

  @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);
    final QueryResult<OrderedRows<String, Composite, String>> results = readDataSet(keyspace, columnFamily);
View Full Code Here

  }

  @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);

    writeDataSet(keyspace, columnFamily);
View Full Code Here

    try {
      dataLoader.load(MockDataSetHelper.getMockDataSetWithDefaultValues());

      /* verify */
      Cluster cluster = HFactory.getOrCreateCluster(clusterName, host);
      Keyspace keyspace = HFactory.createKeyspace("beautifulKeyspaceName", cluster);
      RangeSlicesQuery<byte[], byte[], byte[]> query = HFactory.createRangeSlicesQuery(keyspace,
          BytesArraySerializer.get(), BytesArraySerializer.get(), BytesArraySerializer.get());
      query.setColumnFamily("columnFamily1");
      query.setRange(null, null, false, Integer.MAX_VALUE);
      QueryResult<OrderedRows<byte[], byte[], byte[]>> result = query.execute();
View Full Code Here

    try {
      dataLoader.load(MockDataSetHelper.getMockDataSetWithSuperColumn());

      /* verify */
      Cluster cluster = HFactory.getOrCreateCluster(clusterName, host);
      Keyspace keyspace = HFactory.createKeyspace("beautifulKeyspaceName", cluster);
      RangeSuperSlicesQuery<byte[], byte[], byte[], byte[]> query = HFactory.createRangeSuperSlicesQuery(
          keyspace, BytesArraySerializer.get(), BytesArraySerializer.get(), BytesArraySerializer.get(),
          BytesArraySerializer.get());
      query.setColumnFamily("beautifulColumnFamilyName");
      query.setRange(null, null, false, Integer.MAX_VALUE);
View Full Code Here

TOP

Related Classes of me.prettyprint.hector.api.Keyspace

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.