Utils { @Deprecated public static void initDatabase(String cqlPath, Session session) throws IOException { logger.warn("Initing database from CQL file: " + cqlPath); InputStream cqlStream = Utils.class.getResourceAsStream(cqlPath); String cql = IOUtils.toString(cqlStream); String[] statements = cql.split("\\Q;\\E"); for (String statement : statements) { statement = statement.trim(); statement = statement.replaceAll("\\Q\n\\E", " "); if (!statement.equals("") && !statement.startsWith(" { logger.info("Executing CQL statement: " + statement); session.execute(statement); } } }  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 testInitDatabase() { boolean expectedExceptionThrown = false; try { Utils.initDatabase(false, "this is a string", null); } catch (IllegalArgumentException e) { expectedExceptionThrown = true; } assertTrue("Expected exception not thrown.", expectedExceptionThrown); expectedExceptionThrown = false; try { Utils.initDatabase(false, "{this is a string}", null); } catch (IllegalArgumentException e) { expectedExceptionThrown = true; } assertTrue("Expected exception not thrown.", expectedExceptionThrown); expectedExceptionThrown = false; try { Utils.initDatabase(false, "{this is a string 'class'}", null); } catch (IllegalArgumentException e) { expectedExceptionThrown = true; } assertTrue("Expected exception not thrown.", expectedExceptionThrown); }