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

TST: refactor file storage consistency tests

parent edf5f38f
No related branches found
No related tags found
No related merge requests found
...@@ -24,20 +24,17 @@ ...@@ -24,20 +24,17 @@
SHELL:=/bin/bash SHELL:=/bin/bash
runserver: runserver:
mvn exec:java mvn exec:java@run
run: compile run: compile
mvn exec:java mvn exec:java@run
run-debug: compile run-debug: compile
mvn exec:java -Dexec.args="silent debug" mvn exec:java@run-debug
compile: easy-units compile: easy-units
mvn compile mvn compile
run-nobackend: compile
mvn exec:java -Dexec.args="silent debug nobackend insecure"
start-portforwarding: start-portforwarding:
sudo iptables -t nat -N CAOSDB sudo iptables -t nat -N CAOSDB
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -g CAOSDB sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -g CAOSDB
......
...@@ -33,6 +33,7 @@ import caosdb.server.transaction.Transaction; ...@@ -33,6 +33,7 @@ import caosdb.server.transaction.Transaction;
import caosdb.server.utils.FileStorageConsistencyCheck; import caosdb.server.utils.FileStorageConsistencyCheck;
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 java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
...@@ -195,6 +196,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -195,6 +196,7 @@ public class CheckFileStorageConsistency extends FlagJob {
if (f2 == null) { if (f2 == null) {
return; return;
} }
final String oldPath2 = f2.getAbsolutePath(); final String oldPath2 = f2.getAbsolutePath();
final File tmp2 = final File tmp2 =
new File( new File(
...@@ -202,7 +204,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -202,7 +204,7 @@ public class CheckFileStorageConsistency extends FlagJob {
+ "test_file_storage_consistecy" + "test_file_storage_consistecy"
+ Integer.toString(hashCode())); + Integer.toString(hashCode()));
f2.renameTo(tmp2); final Undoable undo = caosdb.server.utils.FileUtils.rename(f2, tmp2);
final File overridden = new File(oldPath2); final File overridden = new File(oldPath2);
overridden.createNewFile(); overridden.createNewFile();
...@@ -218,7 +220,7 @@ public class CheckFileStorageConsistency extends FlagJob { ...@@ -218,7 +220,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)) {
tmp2.renameTo(overridden); undo.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