Пример #1
0
 /*
  * This keyspace exists because we need a way to pull the datacenter information and they only
  * way to do it is if you have a valid keyspace set up.  We will pull the info from here
  * so we can accurately create the actually NetworkTopologyStrategy keyspace.
  */
 private static void ensureTestKeyspaceExists(Cassandra.Client client) {
   try {
     try {
       client.describe_keyspace(CassandraConstants.SIMPLE_RF_TEST_KEYSPACE);
       return;
     } catch (NotFoundException e) {
       // need to create key space
     }
     KsDef testKs =
         new KsDef(
             CassandraConstants.SIMPLE_RF_TEST_KEYSPACE,
             CassandraConstants.SIMPLE_STRATEGY,
             ImmutableList.<CfDef>of());
     testKs.setStrategy_options(
         ImmutableMap.of(CassandraConstants.REPLICATION_FACTOR_OPTION, "1"));
     client.system_add_keyspace(testKs);
   } catch (Exception e) {
     log.warn(e.getMessage(), e);
   }
 }