упразднение постоянного хранения тестовых архивов
This commit is contained in:
@@ -178,7 +178,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
protected void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
Utils_.forceDeleteWithCheck(test.getArchive());
|
||||
Utils_.forceDeleteWithCheck(test.getServerPath());
|
||||
//--
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
@@ -211,7 +210,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
//--
|
||||
for (Test group_test : groupTests.values()) {
|
||||
db.Delete(group_test);
|
||||
Utils_.forceDeleteWithCheck(group_test.getArchive());
|
||||
Utils_.forceDeleteWithCheck(group_test.getServerPath());
|
||||
}
|
||||
//--
|
||||
@@ -291,7 +289,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
protected void startAdditionalThreads() {
|
||||
testingThread.start();
|
||||
}
|
||||
|
||||
void PerformAutoSapforTesting() throws Exception {
|
||||
TextLog Log = new TextLog();
|
||||
SapforPackage autoPackage = tryAutoSapforTesting(Log);
|
||||
@@ -311,7 +308,12 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
int test_id = Integer.parseInt(request.arg);
|
||||
if (db.tests.containsKey(test_id)) {
|
||||
Test test = db.tests.get(test_id);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils_.fileToBytes(test.getArchive()));
|
||||
File archive = new File(Global.TempDirectory, Utils_.getDateName(String.valueOf(test.id)));
|
||||
ZipFolderPass zipFolderPass = new ZipFolderPass();
|
||||
if (!zipFolderPass.Do(test.getServerPath().getAbsolutePath(), archive.getAbsolutePath()))
|
||||
throw new RepositoryRefuseException("Не удалось заархивировать тест");
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils_.fileToBytes(archive));
|
||||
FileUtils.forceDelete(archive);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Теста с именем " + request.arg + " не существует");
|
||||
}
|
||||
@@ -690,7 +692,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
}
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
//создание тестов.
|
||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||
Vector<Test> tests = new Vector<>();
|
||||
@@ -699,7 +700,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
File[] files = src.listFiles(pathname -> !pathname.isDirectory());
|
||||
if (files != null && files.length > 0) {
|
||||
//--
|
||||
TestFilesJson filesJson= new TestFilesJson();
|
||||
TestFilesJson filesJson = new TestFilesJson();
|
||||
for (File file : files) {
|
||||
filesJson.values.add(new TestFileJson(new ProjectFile(file)));
|
||||
}
|
||||
@@ -714,19 +715,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
db.Insert(test);
|
||||
//---
|
||||
File testProject = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
File testArchive = new File(Global.TestsDirectory, test.id + ".zip");
|
||||
//---
|
||||
if (testProject.exists())
|
||||
FileUtils.forceDelete(testProject);
|
||||
if (testArchive.exists())
|
||||
FileUtils.forceDelete(testArchive);
|
||||
//---
|
||||
FileUtils.copyDirectory(src, testProject);
|
||||
//---
|
||||
if (!zip.Do(testProject.getAbsolutePath(), testArchive.getAbsolutePath())) {
|
||||
db.Delete(test);
|
||||
throw new RepositoryRefuseException("Не удалось переписать архив проекта");
|
||||
}
|
||||
tests.add(test);
|
||||
db.DetectTestMinMaxDim(serverSapfor, group, test);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user