@Test public void testCreateTable() throws Exception { Exception ex= null; try { service.createTable(TABLE, columns, "timestamp"); } catch (Exception e) { ex= e; } assertEquals("Expected null but exception found", null, ex); }
public void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName) { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : getStreamFieldsAndTypes(columns).entrySet()) { sb.append(addQuotes(entry.getKey())); sb.append(" "); sb.append(entry.getValue()); sb.append(","); } try { session.execute(String .format("CREATE TABLE %s.%s (%s timeuuid, %s PRIMARY KEY (%s)) WITH compression = {'sstable_compression': ''}", STREAMING.STREAMING_KEYSPACE_NAME, addQuotes(tableName), addQuotes(timestampColumnName), sb.toString(), addQuotes(timestampColumnName))); } catch (AlreadyExistsException e) { log.info("Stream table {} already exists", tableName); } }
SaveToCassandraOperationsService { public void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName) { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : getStreamFieldsAndTypes(columns).entrySet()) { sb.append(addQuotes(entry.getKey())); sb.append(" "); sb.append(entry.getValue()); sb.append(","); } try { session.execute(String .format("CREATE TABLE %s.%s (%s timeuuid, %s PRIMARY KEY (%s)) WITH compression = {'sstable_compression': ''}", STREAMING.STREAMING_KEYSPACE_NAME, addQuotes(tableName), addQuotes(timestampColumnName), sb.toString(), addQuotes(timestampColumnName))); } catch (AlreadyExistsException e) { log.info("Stream table {} already exists", tableName); } } }
SaveToCassandraOperationsService { public void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName) { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : getStreamFieldsAndTypes(columns).entrySet()) { sb.append(addQuotes(entry.getKey())); sb.append(" "); sb.append(entry.getValue()); sb.append(","); } try { session.execute(String .format("CREATE TABLE %s.%s (%s timeuuid, %s PRIMARY KEY (%s)) WITH compression = {'sstable_compression': ''}", STREAMING.STREAMING_KEYSPACE_NAME, addQuotes(tableName), addQuotes(timestampColumnName), sb.toString(), addQuotes(timestampColumnName))); } catch (AlreadyExistsException e) { log.info("Stream table {} already exists", tableName); } } SaveToCassandraOperationsService(Session session); }
SaveToCassandraOperationsService { public void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName) { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : getStreamFieldsAndTypes(columns).entrySet()) { sb.append(addQuotes(entry.getKey())); sb.append(" "); sb.append(entry.getValue()); sb.append(","); } try { session.execute(String .format("CREATE TABLE %s.%s (%s timeuuid, %s PRIMARY KEY (%s)) WITH compression = {'sstable_compression': ''}", STREAMING.STREAMING_KEYSPACE_NAME, addQuotes(tableName), addQuotes(timestampColumnName), sb.toString(), addQuotes(timestampColumnName))); } catch (AlreadyExistsException e) { log.info("Stream table {} already exists", tableName); } } SaveToCassandraOperationsService(Session session); Boolean check(); void refreshTablenames(); void checkKeyspace(); void createKeyspace(String keyspaceName); void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName); Insert createInsertStatement(String streamName, List<ColumnNameTypeValue> columns, String timestampColumnName); void alterTable(String streamName, Set<String> oldColumnNames, List<ColumnNameTypeValue> columns); HashMap<String, Integer> getTableNames(); Session getSession(); }
SaveToCassandraOperationsService { public void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName) { StringBuilder sb = new StringBuilder(); for (Entry<String, String> entry : getStreamFieldsAndTypes(columns).entrySet()) { sb.append(addQuotes(entry.getKey())); sb.append(" "); sb.append(entry.getValue()); sb.append(","); } try { session.execute(String .format("CREATE TABLE %s.%s (%s timeuuid, %s PRIMARY KEY (%s)) WITH compression = {'sstable_compression': ''}", STREAMING.STREAMING_KEYSPACE_NAME, addQuotes(tableName), addQuotes(timestampColumnName), sb.toString(), addQuotes(timestampColumnName))); } catch (AlreadyExistsException e) { log.info("Stream table {} already exists", tableName); } } SaveToCassandraOperationsService(Session session); Boolean check(); void refreshTablenames(); void checkKeyspace(); void createKeyspace(String keyspaceName); void createTable(String tableName, List<ColumnNameTypeValue> columns, String timestampColumnName); Insert createInsertStatement(String streamName, List<ColumnNameTypeValue> columns, String timestampColumnName); void alterTable(String streamName, Set<String> oldColumnNames, List<ColumnNameTypeValue> columns); HashMap<String, Integer> getTableNames(); Session getSession();  }