Esempio n. 1
0
  public static void expectException(Callable<?> callable, Class<?> exception) {
    boolean thrown = false;

    try {
      callable.call();
    } catch (Throwable e) {
      assert e.getClass().equals(exception)
          : e.getClass().getName() + " is not " + exception.getName();
      thrown = true;
    }

    assert thrown : exception.getName() + " not received";
  }
Esempio n. 2
0
  public KsDef toThrift() {
    List<CfDef> cfDefs = new ArrayList<CfDef>();
    for (CFMetaData cfm : cfMetaData().values()) cfDefs.add(cfm.toThrift());
    KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
    ksdef.setStrategy_options(strategyOptions);
    ksdef.setDurable_writes(durableWrites);

    return ksdef;
  }
Esempio n. 3
0
  public RowMutation toSchema(long timestamp) {
    RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, SystemTable.getSchemaKSKey(name));
    ColumnFamily cf = rm.addOrGet(SystemTable.SCHEMA_KEYSPACES_CF);

    cf.addColumn(Column.create(name, timestamp, "name"));
    cf.addColumn(Column.create(durableWrites, timestamp, "durable_writes"));
    cf.addColumn(Column.create(strategyClass.getName(), timestamp, "strategy_class"));
    cf.addColumn(Column.create(json(strategyOptions), timestamp, "strategy_options"));

    for (CFMetaData cfm : cfMetaData.values()) cfm.toSchema(rm, timestamp);

    return rm;
  }