Skip to content
Snippets Groups Projects
Unverified Commit d9cdeaa6 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

TST: refactoring of file storage consistency tests

parent b1cee139
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ import caosdb.server.jobs.JobAnnotation; ...@@ -31,6 +31,7 @@ import caosdb.server.jobs.JobAnnotation;
import caosdb.server.transaction.Retrieve; import caosdb.server.transaction.Retrieve;
import caosdb.server.transaction.Transaction; import caosdb.server.transaction.Transaction;
import caosdb.server.utils.FileStorageConsistencyCheck; import caosdb.server.utils.FileStorageConsistencyCheck;
import caosdb.server.utils.FileUtils;
import caosdb.server.utils.Observable; import caosdb.server.utils.Observable;
import caosdb.server.utils.Observer; import caosdb.server.utils.Observer;
import caosdb.server.utils.Undoable; import caosdb.server.utils.Undoable;
...@@ -149,7 +150,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -149,7 +150,7 @@ public class CheckFileStorageConsistency extends FlagJob {
+ "test_file_storage_consistecy" + "test_file_storage_consistecy"
+ Integer.toString(hashCode())); + Integer.toString(hashCode()));
f1.renameTo(tmp1); Undoable undo1 = FileUtils.rename(f1, tmp1);
getTransaction() getTransaction()
.acceptObserver( .acceptObserver(
...@@ -157,7 +158,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -157,7 +158,7 @@ public class CheckFileStorageConsistency extends FlagJob {
@Override @Override
public boolean notifyObserver(final String e, final Observable sender) { public boolean notifyObserver(final String e, final Observable sender) {
if (e.equals(Transaction.CLEAN_UP)) { if (e.equals(Transaction.CLEAN_UP)) {
tmp1.renameTo(f1); undo1.undo();
return false; return false;
} }
return true; return true;
...@@ -204,7 +205,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -204,7 +205,7 @@ public class CheckFileStorageConsistency extends FlagJob {
+ "test_file_storage_consistecy" + "test_file_storage_consistecy"
+ Integer.toString(hashCode())); + Integer.toString(hashCode()));
final Undoable undo = caosdb.server.utils.FileUtils.rename(f2, tmp2); final Undoable undo2 = caosdb.server.utils.FileUtils.rename(f2, tmp2);
final File overridden = new File(oldPath2); final File overridden = new File(oldPath2);
overridden.createNewFile(); overridden.createNewFile();
...@@ -220,7 +221,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -220,7 +221,7 @@ public class CheckFileStorageConsistency extends FlagJob {
@Override @Override
public boolean notifyObserver(final String e, final Observable sender) { public boolean notifyObserver(final String e, final Observable sender) {
if (e.equals(Transaction.CLEAN_UP)) { if (e.equals(Transaction.CLEAN_UP)) {
undo.undo(); undo2.undo();
return false; return false;
} }
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment