Ejemplo n.º 1
0
  @Test
  public void testGetKeySpaceConsistencyLevel() throws HectorException {
    Keyspace k =
        client.getKeyspace(
            "Keyspace1", ConsistencyLevel.ALL, CassandraClient.DEFAULT_FAILOVER_POLICY);
    assertNotNull(k);
    assertEquals(ConsistencyLevel.ALL, k.getConsistencyLevel());

    k =
        client.getKeyspace(
            "Keyspace1", ConsistencyLevel.ZERO, CassandraClient.DEFAULT_FAILOVER_POLICY);
    assertNotNull(k);
    assertEquals(ConsistencyLevel.ZERO, k.getConsistencyLevel());
  }
Ejemplo n.º 2
0
  @Test
  public void testGetKeySpaceString() throws HectorException {
    Keyspace k = client.getKeyspace("Keyspace1");
    assertNotNull(k);
    assertEquals(CassandraClient.DEFAULT_CONSISTENCY_LEVEL, k.getConsistencyLevel());

    // negative path
    try {
      k = client.getKeyspace("KeyspaceDoesntExist");
      fail("Should have thrown an exception IllegalArgumentException");
    } catch (IllegalArgumentException e) {
      // good
    }
  }