private boolean performRepoTest() { boolean testCreateTarget = options.isCreateTarget(); StorageTestResult testResult = transferManager.test(testCreateTarget); logger.log(Level.INFO, "Storage test result ist " + testResult); if (testResult.isTargetExists() && testResult.isTargetCanWrite() && !testResult.isRepoFileExists()) { logger.log(Level.INFO, "--> OKAY: Target exists and is writable, but repo doesn't exist. We're good to go!"); return true; } else if (testCreateTarget && !testResult.isTargetExists() && testResult.isTargetCanCreate()) { logger.log(Level.INFO, "--> OKAY: Target does not exist, but can be created. We're good to go!"); return true; } else { logger.log(Level.INFO, "--> NOT OKAY: Invalid target/repo state. Operation cannot be continued."); result.setResultCode(InitResultCode.NOK_TEST_FAILED); result.setTestResult(testResult); return false; } }
protected void printTestResult(StorageTestResult testResult) { out.println("Details:"); out.println("- Target connect success: " + testResult.isTargetCanConnect()); out.println("- Target exists: " + testResult.isTargetExists()); out.println("- Target creatable: " + testResult.isTargetCanCreate()); out.println("- Target writable: " + testResult.isTargetCanWrite()); out.println("- Repo file exists: " + testResult.isRepoFileExists()); out.println(); if (testResult.getErrorMessage() != null) { out.println("Error message (see log file for details):"); out.println(" " + testResult.getErrorMessage()); } }
else if (!testResult.isTargetCanWrite()) { out.println("ERROR: Repository cannot be initialized, because the target is not writable. This is probably"); out.println(" a permission issue (does the user have write permissions to the target?).");
out.println(" Please check if it really exists and if you can read from it / write to it."); else if (!testResult.isTargetCanWrite()) { out.println("ERROR: Cannot connect to the repository, because the target is not writable. This is probably"); out.println(" a permission issue (does the user have write permissions to the target?).");