@Test public void testTableCQL() throws Exception { Map<String, DataType.Name> columns = new HashMap<>(); columns.put("key", DataType.Name.BLOB); columns.put("column1", DataType.Name.TEXT); columns.put("value", DataType.Name.BLOB); List<String> partitionKeys = new ArrayList<>(); partitionKeys.add("key"); List<String> columnKeys = new ArrayList<>(); columnKeys.add("column1"); Map<String, String> clusteringOrder = new HashMap<>(); clusteringOrder.put("column1", "DESC"); TableDefinitionImpl table1 = new TableDefinitionImpl( cassandraFig.getApplicationKeyspace(), CQLUtils.quote("table1"), partitionKeys, columnKeys, columns, TableDefinitionImpl.CacheOption.KEYS, clusteringOrder ); String createCQL = table1.getTableCQL(cassandraFig, TableDefinition.ACTION.CREATE); String updateCQL = table1.getTableCQL(cassandraFig, TableDefinition.ACTION.UPDATE); assertTrue( createCQL.contains(CQLUtils.CREATE_TABLE ) && !createCQL.contains( CQLUtils.ALTER_TABLE ) && createCQL.contains( DataType.Name.BLOB.toString() ) && createCQL.contains( DataType.Name.TEXT.toString() ) ); assertTrue( updateCQL.contains( CQLUtils.ALTER_TABLE ) && !updateCQL.contains( CQLUtils.CREATE_TABLE ) && !updateCQL.contains( DataType.Name.BLOB.toString() ) && !updateCQL.contains( DataType.Name.TEXT.toString() ) ); logger.info(createCQL); logger.info(updateCQL); }
public static String quote( String value ){ return "\"" + value + "\""; }
CQLUtils { public static String quote( String value ){ return "\"" + value + "\""; } }
CQLUtils { public static String quote( String value ){ return "\"" + value + "\""; } @Inject  CQLUtils( ); }
CQLUtils { public static String quote( String value ){ return "\"" + value + "\""; } @Inject  CQLUtils( ); static String getFormattedReplication(
        String strategy, String strategyOptions); static String getMapAsCQLString(Map<String, Object> map); static String quote( String value ); static String unquote( String value ); static String spaceSeparatedKeyValue(Map<String, ?> columns); static String getCachingOptions(
        CassandraFig cassandraFig, TableDefinitionImpl.CacheOption cacheOption); static String getCacheValue( TableDefinitionImpl.CacheOption cacheOption ); static String getLegacyCacheValue( TableDefinitionImpl.CacheOption cacheOption ); static int getShortLength(ByteBuffer bb); static ByteBuffer getBytes(ByteBuffer bb, int length); static ByteBuffer getWithShortLength(ByteBuffer bb); }
CQLUtils { public static String quote( String value ){ return "\"" + value + "\""; } @Inject  CQLUtils( ); static String getFormattedReplication(
        String strategy, String strategyOptions); static String getMapAsCQLString(Map<String, Object> map); static String quote( String value ); static String unquote( String value ); static String spaceSeparatedKeyValue(Map<String, ?> columns); static String getCachingOptions(
        CassandraFig cassandraFig, TableDefinitionImpl.CacheOption cacheOption); static String getCacheValue( TableDefinitionImpl.CacheOption cacheOption ); static String getLegacyCacheValue( TableDefinitionImpl.CacheOption cacheOption ); static int getShortLength(ByteBuffer bb); static ByteBuffer getBytes(ByteBuffer bb, int length); static ByteBuffer getWithShortLength(ByteBuffer bb);  }