@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()); }
@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 } }
@Test public void testGetKeySpaceFailoverPolicy() throws HectorException { Keyspace k = client.getKeyspace( "Keyspace1", CassandraClient.DEFAULT_CONSISTENCY_LEVEL, FailoverPolicy.FAIL_FAST); assertNotNull(k); assertEquals(FailoverPolicy.FAIL_FAST, k.getFailoverPolicy()); }