/**
   * Create DbClient to embedded DB
   *
   * @return
   */
  protected static DbClient createDbClient() {
    ENCRYPTION_PROVIDER.setCoordinator(ModelTestSuite.getCoordinator());

    DbClientContext localCtx = new DbClientContext();
    localCtx.setClusterName("Test");
    localCtx.setKeyspaceName("Test");

    DbClientImpl dbClient = new DbClientImpl();
    dbClient.setCoordinatorClient(ModelTestSuite.getCoordinator());
    dbClient.setEncryptionProvider(ENCRYPTION_PROVIDER);
    dbClient.setBypassMigrationLock(true);
    dbClient.setDbVersionInfo(ModelTestSuite.getDbVersionInfo());
    dbClient.setLocalContext(localCtx);

    VdcUtil.setDbClient(dbClient);
    dbClient.start();

    return dbClient;
  }
  /** Initializes the keystore/truststore if the paths have been provided. */
  private void initKeystoreAndTruststore() {
    try {
      DbClientContext ctx = _dbClient.getLocalContext();

      if (isGeoDbsvc()) {
        ctx = _dbClient.getGeoContext();
      }

      String keystorePath = ctx.getKeyStoreFile();
      String truststorePath = ctx.getTrustStoreFile();

      if (keystorePath == null && truststorePath == null) {
        _log.info("Skipping keystore/truststore initialization, no paths provided");
        return;
      }

      String password = ctx.getTrustStorePassword();
      CassandraKeystoreHandler keystoreHandler =
          new CassandraKeystoreHandler(_coordinator, keystorePath, truststorePath, password);

      if (keystorePath != null) {
        _log.info("Initializing keystore for current node: {}", keystorePath);
        keystoreHandler.saveKeyStore();
      } else {
        _log.info("Skipping keystore initialization, no path provided");
      }

      if (truststorePath != null) {
        _log.info("Initializing truststore for current node: {}", truststorePath);
        keystoreHandler.saveTrustStore();
      } else {
        _log.info("Skipping truststore initialization, no path provided");
      }
    } catch (Exception e) {
      _log.error("Unexpected exception during initializing cassandra keystore", e);
      throw new IllegalStateException(e);
    }
  }
  public static DbClientImpl newDBClient() throws Exception {
    ZkConnection zkConnection = new ZkConnection();
    zkConnection.setServer(Lists.newArrayList(new URI("coordinator://localhost:2181")));
    zkConnection.build();

    DualInetAddress dualInetAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
    Map<String, DualInetAddress> addresses = Maps.newHashMap();
    addresses.put("localhost", dualInetAddress);

    CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
    map.setNodeId("standalone");
    map.setDualInetAddress(dualInetAddress);
    map.setControllerNodeIPLookupMap(addresses);

    CoordinatorClientImpl coordinatorClient = new CoordinatorClientImpl();
    coordinatorClient.setZkConnection(zkConnection);
    coordinatorClient.setInetAddessLookupMap(map);
    coordinatorClient.start();

    DbClientContext localContext = new DbClientContext();
    localContext.setKeyspaceName("StorageOS");
    localContext.setClusterName("StorageOs");

    DbClientContext geoContext = new DbClientContext();
    geoContext.setKeyspaceName("GeoStorageOs");
    geoContext.setClusterName("GeoStorageOs");

    DbVersionInfo versionInfo = new DbVersionInfo();
    versionInfo.setSchemaVersion("2.0");

    DbClientImpl client = new DbClientImpl();
    client.setDbVersionInfo(versionInfo);
    client.setLocalContext(localContext);
    client.setGeoContext(geoContext);
    client.setCoordinatorClient(coordinatorClient);
    client.setLocalContext(new DbClientContext());

    client.start();

    VdcUtil.setDbClient(client);

    return client;
  }