упразднение постоянного хранения тестовых архивов
This commit is contained in:
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -8,14 +8,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ComponentsServer/Component/Sapfor/Sapfor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromDirectory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromDirectory.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CreateTestFromFile.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/TestCache.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ServerObjectsCache/TestCache.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Json/TestFileJson.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Json/TestFileJson.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Json/TestsFilesJson.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Json/TestFilesJson.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadTest.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ServerCode.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Test.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/Test.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Constants {
|
||||
//
|
||||
//7998 отладочный порт. теперь.
|
||||
public static final int ComponentsServerPort = 7995; //7795
|
||||
public static final int TestingServerPort = 7996; //7996
|
||||
public static final int TestingServerPort = 7998; //7996
|
||||
public static final int SocketTimeout = 0;
|
||||
//-
|
||||
public static final String ServerAddress = "alex-freenas.ddns.net";
|
||||
|
||||
@@ -7,13 +7,17 @@ import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Server.TestingServerPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
|
||||
import java.io.File;
|
||||
public class DownloadTest extends TestingServerPass<Test> {
|
||||
File testArchive;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadBugReport.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
testArchive= null;
|
||||
if (Global.mainModule.getAccount().CheckRegistered(Log) &&
|
||||
Global.testingServer.db.tests.getUI().CheckCurrent(Log)
|
||||
) {
|
||||
@@ -26,22 +30,22 @@ public class DownloadTest extends TestingServerPass<Test> {
|
||||
protected void performPreparation() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
||||
Utils_.forceDeleteWithCheck(target.getArchive());
|
||||
Utils_.forceDeleteWithCheck(target.getHomePath());
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
request.server_response.Unpack(target.getArchive());
|
||||
testArchive= new File(Global.TempDirectory, Utils_.getDateName(String.valueOf(target.id)));
|
||||
request.server_response.Unpack(testArchive);
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return target.getArchive().exists();
|
||||
return testArchive.exists();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
||||
target.getArchive().getAbsolutePath(),
|
||||
testArchive.getAbsolutePath(),
|
||||
Global.visualiser.getDownloadsDirectory().getAbsolutePath(), false
|
||||
))
|
||||
if (UI.Question("Тестовый проект успешно загружен под именем\n" +
|
||||
|
||||
@@ -131,6 +131,8 @@ public enum ServerCode {
|
||||
return "Дублирование объекта на сервере";
|
||||
case UpdateActiveDVMPackages:
|
||||
return "Актуализация активных DVM пакетов на сервере";
|
||||
case RefreshDVMTests:
|
||||
return "Синхронизация стандартных DVM тестов";
|
||||
default:
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ public class Test extends riDBObject {
|
||||
public String args = ""; //аргументы командной строки. на всякий случай поле зарезервирую. пусть будут.
|
||||
@Description("DEFAULT -1")
|
||||
public int group_id = CommonConstants.Nan;
|
||||
//@Description("DEFAULT ''")
|
||||
//public String files = ""; //файлы теста
|
||||
@Description("DEFAULT ''")
|
||||
public String extended_description="";
|
||||
@Description("DEFAULT ''")
|
||||
@@ -64,10 +62,6 @@ public class Test extends riDBObject {
|
||||
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
||||
}
|
||||
//-
|
||||
public File getArchive() {
|
||||
return new File(Global.TestsDirectory, id + ".zip");
|
||||
}
|
||||
//-
|
||||
public File getServerPath() {
|
||||
return new File(Global.TestsDirectory, String.valueOf(id));
|
||||
}
|
||||
@@ -85,7 +79,6 @@ public class Test extends riDBObject {
|
||||
File tmpArchive = new File(Global.TempDirectory, temp_project_name + ".zip");
|
||||
File tmpProject = new File(Global.TempDirectory, temp_project_name);
|
||||
File testProject = new File(Global.TestsDirectory, String.valueOf(id));
|
||||
File testArchive = new File(Global.TestsDirectory, id + ".zip");
|
||||
//--
|
||||
if (tmpArchive.exists())
|
||||
FileUtils.forceDelete(tmpArchive);
|
||||
@@ -93,11 +86,9 @@ public class Test extends riDBObject {
|
||||
FileUtils.forceDelete(tmpProject);
|
||||
if (testProject.exists())
|
||||
FileUtils.forceDelete(testProject);
|
||||
if (testArchive.exists())
|
||||
FileUtils.forceDelete(testArchive);
|
||||
//--
|
||||
Utils_.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
|
||||
//--
|
||||
//-- делается через другое имя, потому что на момент публикации теста архив не мог знать ид теста.
|
||||
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
|
||||
if (!unzipFolderPass.Do(
|
||||
tmpArchive.getAbsolutePath(),
|
||||
@@ -106,10 +97,9 @@ public class Test extends riDBObject {
|
||||
}
|
||||
//--
|
||||
FileUtils.moveDirectory(tmpProject, testProject);
|
||||
if (tmpArchive.exists())
|
||||
FileUtils.forceDelete(tmpArchive);
|
||||
//--
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (!zip.Do(testProject.getAbsolutePath(), testArchive.getAbsolutePath()))
|
||||
throw new RepositoryRefuseException("Не удалось переписать архив проекта");
|
||||
return true;
|
||||
}
|
||||
//todo проджект файлы тут не нужны. сделать с учетом джсона
|
||||
@@ -129,5 +119,4 @@ public class Test extends riDBObject {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-
|
||||
}
|
||||
|
||||
@@ -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<>();
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -194,13 +194,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
||||
FileUtils.copyFile(file, testFile);
|
||||
//----
|
||||
//архивация.
|
||||
File archive = test.getArchive();
|
||||
if (archive.exists())
|
||||
FileUtils.forceDelete(archive);
|
||||
//----------->>
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
zip.Do(testDirectory.getAbsolutePath(), archive.getAbsolutePath());
|
||||
DetectTestMinMaxDim(sapfor, group, test);
|
||||
}
|
||||
//---
|
||||
|
||||
Reference in New Issue
Block a user