Utils { public static String calculateITableName(String databaseName, String tableName, String indexName) { String key = databaseName + ":" + tableName + ":" + indexName; Cache c = CacheFactory.getCache("iTableName"); Element e = c.get(key); if (e == null || e.getObjectValue() == null) { StringBuilder sb = new StringBuilder(); sb.append(databaseName); sb.append('_'); sb.append(tableName); sb.append('_'); sb.append(indexName); e = new Element(key, sb.toString().toLowerCase()); c.put(e); } return (String) e.getObjectValue(); }  static String calculateITableName(String databaseName, String tableName, String indexName); static String calculateITableName(Index index); static String calculateITableName(IndexIdentifier indexId); @Deprecated static void initDatabase(String cqlPath, Session session); static void initDatabase(boolean dropDb, String replicationString, Session session); static void initDatabaseSingleReplication(boolean dropDb, Session session); static void setField(String value, IndexField fieldData, BoundStatement bs, int index); static boolean setField(DBObject jsonObject, IndexField fieldData, BoundStatement bs, int index); static String join(String delimiter, Object... objects); static String join(String delimiter, Collection<? extends Object> objects); static boolean equalLists(List<String> one, List<String> two); static void writeFile(String toWrite, String fileName); static String readFile(String fileName); static List<Long> traverse1RowFile(String fileName); static final String EMPTY_STRING; }
@Test public void testCalculateITableName_3args() { logger.debug("calculateITableName"); String databaseName = "myDb"; String tableName = "myTable"; String indexName = "yoIndex"; String expResult = "mydb_mytable_yoindex"; String result = Utils.calculateITableName(databaseName, tableName, indexName); assertEquals(expResult, result); }
@Test public void testCalculateITableName_Index() { logger.debug("calculateITableName"); String databaseName = "myDb"; String tableName = "myTable"; String indexName = "yoIndex"; Index index = new Index(indexName); index.setTable(databaseName, tableName); String expResult = "mydb_mytable_yoindex"; String result = Utils.calculateITableName(index); assertEquals(expResult, result); }
@Test public void testCalculateITableName_IndexIdentifier() { logger.debug("calculateITableName"); IndexIdentifier indexId = new IndexIdentifier(Fixtures.createTestIndexOneField().getId()); String expResult = "mydb_mytable_myindexwithonefield"; String result = Utils.calculateITableName(indexId); assertEquals(expResult, result); }