This commit is contained in:
andrei committed 2026-11-17 23:38:32 +01:00
1 parent 7c54387191
commit 6d59ad6805
3 files changed
+3 -43

No files matched your search

@@ -76,7 +76,7 @@ public class CallLogRepository {
public static CallLog get(Path responsePath) throws RepositoryException {
if (! Files.isRegularFile(responsePath))
throw new DoesNotExistException(responsePath, "Unreadable");
String response = "";
String response;
try {
response = FileSystemCache.read(responsePath);
} catch (IOException raise) {
@@ -17,13 +17,8 @@ import java.nio.file.Path;
import java.util.Comparator;
import java.util.logging.Logger;
/**
* IO operations belong here.
* Assume the filesystem to be the single source of truth.
* IDEA filelocks?
*/
public class ProjectRepository {
private static final Logger log = Logger.getLogger(ProjectRepository.class.getName());
public static Project get(Path projectPath) throws RepositoryException {
@@ -45,10 +40,6 @@ public class ProjectRepository {
}
}
public static boolean isProjectFolder(Path projectDir) {
return Files.isReadable(projectDir.resolve("project.yml"));
}
public static void update(Path projectPath, Project project) throws RepositoryException{
try {
var yaml = Yaml.toYaml(project);
@@ -132,37 +123,6 @@ public class ProjectRepository {
}
}
public static void deleteProject(Path projectPath) throws RepositoryException {
if (! Files.exists(projectPath)) {
return;
}
var projectDirectory = projectPath.getParent();
try {
if (! Files.isDirectory(projectDirectory))
return;
try (var walk = Files.walk(projectDirectory)) {
walk.sorted(Comparator.reverseOrder())
.forEach(p -> {
try {
Files.delete(p);
} catch (IOException ignore) {}
});
}
if (Files.exists(projectDirectory))
throw new IOException("Not deleted.");
} catch (IOException io) {
throw new RepositoryException(projectPath, "Could not delete project", io);
} finally {
FileSystemCache.remove(projectDirectory);
ProjectMonitors.trigger(projectDirectory);
}
}
/** Moves the folder of a closed project to the {@link Trash}. @return where it is kept. */
public static Path trashProject(Path projectPath) throws RepositoryException {
try {
@@ -139,7 +139,7 @@ public class StepRepository {
throw new RepositoryException(toStepPath, "Step is not part of '%s'".formatted(toTestCaseFolderPath));
var shiftIndex = targetIndex + (putBefore? 0: 1);
var orderedSteps = new ArrayList<Path>(allSteps);
var orderedSteps = new ArrayList<>(allSteps);
orderedSteps.add(shiftIndex, fromStepPath);
var shifting = new LinkedHashMap<Path, Path>();