@Test(expected = NullPointerException.class) public void getTableMetadataOnNullKeyspace() { CassandraUtils.getTableMetadata(mock(Session.class), null, "table"); }
public static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table) { Preconditions.checkNotNull(session); Preconditions.checkNotNull(keyspace); Preconditions.checkNotNull(table); final KeyspaceMetadata keyspaceMetadata = session.getCluster().getMetadata().getKeyspace(keyspace); if (keyspaceMetadata == null) { throw new IllegalStateException(String.format("Keyspace %s does not exist", keyspace)); } final TableMetadata tableMetadata = keyspaceMetadata.getTable(table); if (tableMetadata == null) { throw new IllegalStateException(String.format("Table %s.%s does not exist", keyspace, table)); } return tableMetadata; }
CassandraUtils { public static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table) { Preconditions.checkNotNull(session); Preconditions.checkNotNull(keyspace); Preconditions.checkNotNull(table); final KeyspaceMetadata keyspaceMetadata = session.getCluster().getMetadata().getKeyspace(keyspace); if (keyspaceMetadata == null) { throw new IllegalStateException(String.format("Keyspace %s does not exist", keyspace)); } final TableMetadata tableMetadata = keyspaceMetadata.getTable(table); if (tableMetadata == null) { throw new IllegalStateException(String.format("Table %s.%s does not exist", keyspace, table)); } return tableMetadata; } }
CassandraUtils { public static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table) { Preconditions.checkNotNull(session); Preconditions.checkNotNull(keyspace); Preconditions.checkNotNull(table); final KeyspaceMetadata keyspaceMetadata = session.getCluster().getMetadata().getKeyspace(keyspace); if (keyspaceMetadata == null) { throw new IllegalStateException(String.format("Keyspace %s does not exist", keyspace)); } final TableMetadata tableMetadata = keyspaceMetadata.getTable(table); if (tableMetadata == null) { throw new IllegalStateException(String.format("Table %s.%s does not exist", keyspace, table)); } return tableMetadata; } private  CassandraUtils(); }
CassandraUtils { public static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table) { Preconditions.checkNotNull(session); Preconditions.checkNotNull(keyspace); Preconditions.checkNotNull(table); final KeyspaceMetadata keyspaceMetadata = session.getCluster().getMetadata().getKeyspace(keyspace); if (keyspaceMetadata == null) { throw new IllegalStateException(String.format("Keyspace %s does not exist", keyspace)); } final TableMetadata tableMetadata = keyspaceMetadata.getTable(table); if (tableMetadata == null) { throw new IllegalStateException(String.format("Table %s.%s does not exist", keyspace, table)); } return tableMetadata; } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value); }
CassandraUtils { public static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table) { Preconditions.checkNotNull(session); Preconditions.checkNotNull(keyspace); Preconditions.checkNotNull(table); final KeyspaceMetadata keyspaceMetadata = session.getCluster().getMetadata().getKeyspace(keyspace); if (keyspaceMetadata == null) { throw new IllegalStateException(String.format("Keyspace %s does not exist", keyspace)); } final TableMetadata tableMetadata = keyspaceMetadata.getTable(table); if (tableMetadata == null) { throw new IllegalStateException(String.format("Table %s.%s does not exist", keyspace, table)); } return tableMetadata; } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value);  }