упразднение постоянного хранения тестовых архивов
This commit is contained in:
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -8,14 +8,9 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<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$/.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/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/DownloadTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/DownloadTest.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/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Repository/Server/ServerCode.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/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/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/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" />
|
<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 отладочный порт. теперь.
|
//7998 отладочный порт. теперь.
|
||||||
public static final int ComponentsServerPort = 7995; //7795
|
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 int SocketTimeout = 0;
|
||||||
//-
|
//-
|
||||||
public static final String ServerAddress = "alex-freenas.ddns.net";
|
public static final String ServerAddress = "alex-freenas.ddns.net";
|
||||||
|
|||||||
@@ -7,13 +7,17 @@ import _VisualDVM.Passes.PassCode;
|
|||||||
import _VisualDVM.Passes.Server.TestingServerPass;
|
import _VisualDVM.Passes.Server.TestingServerPass;
|
||||||
import _VisualDVM.Repository.Server.ServerCode;
|
import _VisualDVM.Repository.Server.ServerCode;
|
||||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
public class DownloadTest extends TestingServerPass<Test> {
|
public class DownloadTest extends TestingServerPass<Test> {
|
||||||
|
File testArchive;
|
||||||
@Override
|
@Override
|
||||||
public String getIconPath() {
|
public String getIconPath() {
|
||||||
return "/icons/DownloadBugReport.png";
|
return "/icons/DownloadBugReport.png";
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
|
testArchive= null;
|
||||||
if (Global.mainModule.getAccount().CheckRegistered(Log) &&
|
if (Global.mainModule.getAccount().CheckRegistered(Log) &&
|
||||||
Global.testingServer.db.tests.getUI().CheckCurrent(Log)
|
Global.testingServer.db.tests.getUI().CheckCurrent(Log)
|
||||||
) {
|
) {
|
||||||
@@ -26,22 +30,22 @@ public class DownloadTest extends TestingServerPass<Test> {
|
|||||||
protected void performPreparation() throws Exception {
|
protected void performPreparation() throws Exception {
|
||||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||||
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
||||||
Utils_.forceDeleteWithCheck(target.getArchive());
|
|
||||||
Utils_.forceDeleteWithCheck(target.getHomePath());
|
Utils_.forceDeleteWithCheck(target.getHomePath());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
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
|
@Override
|
||||||
protected boolean validate() {
|
protected boolean validate() {
|
||||||
return target.getArchive().exists();
|
return testArchive.exists();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void performDone() throws Exception {
|
protected void performDone() throws Exception {
|
||||||
super.performDone();
|
super.performDone();
|
||||||
if (Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
if (Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
||||||
target.getArchive().getAbsolutePath(),
|
testArchive.getAbsolutePath(),
|
||||||
Global.visualiser.getDownloadsDirectory().getAbsolutePath(), false
|
Global.visualiser.getDownloadsDirectory().getAbsolutePath(), false
|
||||||
))
|
))
|
||||||
if (UI.Question("Тестовый проект успешно загружен под именем\n" +
|
if (UI.Question("Тестовый проект успешно загружен под именем\n" +
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ public enum ServerCode {
|
|||||||
return "Дублирование объекта на сервере";
|
return "Дублирование объекта на сервере";
|
||||||
case UpdateActiveDVMPackages:
|
case UpdateActiveDVMPackages:
|
||||||
return "Актуализация активных DVM пакетов на сервере";
|
return "Актуализация активных DVM пакетов на сервере";
|
||||||
|
case RefreshDVMTests:
|
||||||
|
return "Синхронизация стандартных DVM тестов";
|
||||||
default:
|
default:
|
||||||
return this.toString();
|
return this.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ public class Test extends riDBObject {
|
|||||||
public String args = ""; //аргументы командной строки. на всякий случай поле зарезервирую. пусть будут.
|
public String args = ""; //аргументы командной строки. на всякий случай поле зарезервирую. пусть будут.
|
||||||
@Description("DEFAULT -1")
|
@Description("DEFAULT -1")
|
||||||
public int group_id = CommonConstants.Nan;
|
public int group_id = CommonConstants.Nan;
|
||||||
//@Description("DEFAULT ''")
|
|
||||||
//public String files = ""; //файлы теста
|
|
||||||
@Description("DEFAULT ''")
|
@Description("DEFAULT ''")
|
||||||
public String extended_description="";
|
public String extended_description="";
|
||||||
@Description("DEFAULT ''")
|
@Description("DEFAULT ''")
|
||||||
@@ -64,10 +62,6 @@ public class Test extends riDBObject {
|
|||||||
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
||||||
}
|
}
|
||||||
//-
|
//-
|
||||||
public File getArchive() {
|
|
||||||
return new File(Global.TestsDirectory, id + ".zip");
|
|
||||||
}
|
|
||||||
//-
|
|
||||||
public File getServerPath() {
|
public File getServerPath() {
|
||||||
return new File(Global.TestsDirectory, String.valueOf(id));
|
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 tmpArchive = new File(Global.TempDirectory, temp_project_name + ".zip");
|
||||||
File tmpProject = new File(Global.TempDirectory, temp_project_name);
|
File tmpProject = new File(Global.TempDirectory, temp_project_name);
|
||||||
File testProject = new File(Global.TestsDirectory, String.valueOf(id));
|
File testProject = new File(Global.TestsDirectory, String.valueOf(id));
|
||||||
File testArchive = new File(Global.TestsDirectory, id + ".zip");
|
|
||||||
//--
|
//--
|
||||||
if (tmpArchive.exists())
|
if (tmpArchive.exists())
|
||||||
FileUtils.forceDelete(tmpArchive);
|
FileUtils.forceDelete(tmpArchive);
|
||||||
@@ -93,11 +86,9 @@ public class Test extends riDBObject {
|
|||||||
FileUtils.forceDelete(tmpProject);
|
FileUtils.forceDelete(tmpProject);
|
||||||
if (testProject.exists())
|
if (testProject.exists())
|
||||||
FileUtils.forceDelete(testProject);
|
FileUtils.forceDelete(testProject);
|
||||||
if (testArchive.exists())
|
|
||||||
FileUtils.forceDelete(testArchive);
|
|
||||||
//--
|
//--
|
||||||
Utils_.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
|
Utils_.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
|
||||||
//--
|
//-- делается через другое имя, потому что на момент публикации теста архив не мог знать ид теста.
|
||||||
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
|
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
|
||||||
if (!unzipFolderPass.Do(
|
if (!unzipFolderPass.Do(
|
||||||
tmpArchive.getAbsolutePath(),
|
tmpArchive.getAbsolutePath(),
|
||||||
@@ -106,10 +97,9 @@ public class Test extends riDBObject {
|
|||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
FileUtils.moveDirectory(tmpProject, testProject);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
//todo проджект файлы тут не нужны. сделать с учетом джсона
|
//todo проджект файлы тут не нужны. сделать с учетом джсона
|
||||||
@@ -129,5 +119,4 @@ public class Test extends riDBObject {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//-
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
protected void afterDeleteAction(DBObject object) throws Exception {
|
protected void afterDeleteAction(DBObject object) throws Exception {
|
||||||
if (object instanceof Test) {
|
if (object instanceof Test) {
|
||||||
Test test = (Test) object;
|
Test test = (Test) object;
|
||||||
Utils_.forceDeleteWithCheck(test.getArchive());
|
|
||||||
Utils_.forceDeleteWithCheck(test.getServerPath());
|
Utils_.forceDeleteWithCheck(test.getServerPath());
|
||||||
//--
|
//--
|
||||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||||
@@ -211,7 +210,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
//--
|
//--
|
||||||
for (Test group_test : groupTests.values()) {
|
for (Test group_test : groupTests.values()) {
|
||||||
db.Delete(group_test);
|
db.Delete(group_test);
|
||||||
Utils_.forceDeleteWithCheck(group_test.getArchive());
|
|
||||||
Utils_.forceDeleteWithCheck(group_test.getServerPath());
|
Utils_.forceDeleteWithCheck(group_test.getServerPath());
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
@@ -291,7 +289,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
protected void startAdditionalThreads() {
|
protected void startAdditionalThreads() {
|
||||||
testingThread.start();
|
testingThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformAutoSapforTesting() throws Exception {
|
void PerformAutoSapforTesting() throws Exception {
|
||||||
TextLog Log = new TextLog();
|
TextLog Log = new TextLog();
|
||||||
SapforPackage autoPackage = tryAutoSapforTesting(Log);
|
SapforPackage autoPackage = tryAutoSapforTesting(Log);
|
||||||
@@ -311,7 +308,12 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
int test_id = Integer.parseInt(request.arg);
|
int test_id = Integer.parseInt(request.arg);
|
||||||
if (db.tests.containsKey(test_id)) {
|
if (db.tests.containsKey(test_id)) {
|
||||||
Test test = db.tests.get(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
|
} else
|
||||||
throw new RepositoryRefuseException("Теста с именем " + request.arg + " не существует");
|
throw new RepositoryRefuseException("Теста с именем " + request.arg + " не существует");
|
||||||
}
|
}
|
||||||
@@ -690,7 +692,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ZipFolderPass zip = new ZipFolderPass();
|
|
||||||
//создание тестов.
|
//создание тестов.
|
||||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||||
Vector<Test> tests = new Vector<>();
|
Vector<Test> tests = new Vector<>();
|
||||||
@@ -699,7 +700,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
File[] files = src.listFiles(pathname -> !pathname.isDirectory());
|
File[] files = src.listFiles(pathname -> !pathname.isDirectory());
|
||||||
if (files != null && files.length > 0) {
|
if (files != null && files.length > 0) {
|
||||||
//--
|
//--
|
||||||
TestFilesJson filesJson= new TestFilesJson();
|
TestFilesJson filesJson = new TestFilesJson();
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
filesJson.values.add(new TestFileJson(new ProjectFile(file)));
|
filesJson.values.add(new TestFileJson(new ProjectFile(file)));
|
||||||
}
|
}
|
||||||
@@ -714,19 +715,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
db.Insert(test);
|
db.Insert(test);
|
||||||
//---
|
//---
|
||||||
File testProject = new File(Global.TestsDirectory, String.valueOf(test.id));
|
File testProject = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||||
File testArchive = new File(Global.TestsDirectory, test.id + ".zip");
|
|
||||||
//---
|
//---
|
||||||
if (testProject.exists())
|
if (testProject.exists())
|
||||||
FileUtils.forceDelete(testProject);
|
FileUtils.forceDelete(testProject);
|
||||||
if (testArchive.exists())
|
|
||||||
FileUtils.forceDelete(testArchive);
|
|
||||||
//---
|
|
||||||
FileUtils.copyDirectory(src, testProject);
|
FileUtils.copyDirectory(src, testProject);
|
||||||
//---
|
//---
|
||||||
if (!zip.Do(testProject.getAbsolutePath(), testArchive.getAbsolutePath())) {
|
|
||||||
db.Delete(test);
|
|
||||||
throw new RepositoryRefuseException("Не удалось переписать архив проекта");
|
|
||||||
}
|
|
||||||
tests.add(test);
|
tests.add(test);
|
||||||
db.DetectTestMinMaxDim(serverSapfor, group, test);
|
db.DetectTestMinMaxDim(serverSapfor, group, test);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,13 +194,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
|||||||
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
||||||
FileUtils.copyFile(file, testFile);
|
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);
|
DetectTestMinMaxDim(sapfor, group, test);
|
||||||
}
|
}
|
||||||
//---
|
//---
|
||||||
|
|||||||
Reference in New Issue
Block a user