Ejemplo n.º 1
0
 public static InitOperationOptions createTestUnreliableInitOperationOptions(
     String machineName, String patterns) throws Exception {
   InitOperationOptions initOperationOptions = createTestInitOperationOptions(machineName);
   initOperationOptions.getConfigTO().getConnectionTO().setType("unreliable_local");
   initOperationOptions.getConfigTO().getConnectionTO().getSettings().put("patterns", patterns);
   return initOperationOptions;
 }
Ejemplo n.º 2
0
  public static InitOperationOptions createTestInitOperationOptions(String machineName)
      throws Exception {
    File tempLocalDir =
        TestFileUtil.createTempDirectoryInSystemTemp(
            createUniqueName("client-" + machineName, machineName));
    File tempRepoDir =
        TestFileUtil.createTempDirectoryInSystemTemp(createUniqueName("repo", machineName));
    tempLocalDir.mkdirs();
    tempRepoDir.mkdirs();

    RepoTO repoTO = createRepoTO();

    // Create config TO
    ConfigTO configTO = new ConfigTO();
    configTO.setMachineName(machineName + Math.abs(new Random().nextInt()));

    // Get Masterkey
    SaltedSecretKey masterKey = getMasterKey();
    configTO.setMasterKey(masterKey);

    // Create connection TO
    Map<String, String> localConnectionSettings = new HashMap<String, String>();
    localConnectionSettings.put("path", tempRepoDir.getAbsolutePath());

    ConnectionTO connectionTO = new ConnectionTO();
    connectionTO.setType("local");
    connectionTO.setSettings(localConnectionSettings);

    configTO.setConnectionTO(connectionTO);

    InitOperationOptions operationOptions = new InitOperationOptions();

    operationOptions.setLocalDir(tempLocalDir);
    operationOptions.setConfigTO(configTO);
    operationOptions.setRepoTO(repoTO);

    operationOptions.setEncryptionEnabled(cryptoEnabled);
    operationOptions.setCipherSpecs(CipherSpecs.getDefaultCipherSpecs());
    operationOptions.setPassword(cryptoEnabled ? "some password" : null);

    return operationOptions;
  }