2024-10-14 12:14:01 +03:00
|
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-11 00:00:30 +03:00
|
|
|
|
import Common.Utils.Utils_;
|
2024-10-15 15:13:57 +03:00
|
|
|
|
import Common.Visual.UI;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Current;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
|
|
|
|
|
import _VisualDVM.Passes.Server.TestingSystemPass;
|
2024-10-22 20:25:26 +03:00
|
|
|
|
import _VisualDVM.Repository.Component.ComponentsSet;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.Test.Test;
|
2025-01-23 16:56:45 +03:00
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class DownloadTest extends TestingSystemPass<Test> {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/DownloadBugReport.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-24 23:40:24 +03:00
|
|
|
|
if (Global.mainModule.getAccount().CheckRegistered(Log) &&
|
2024-10-25 00:50:19 +03:00
|
|
|
|
Global.testingServer.db.tests.getUI().CheckCurrent(Log)
|
2024-10-24 23:40:24 +03:00
|
|
|
|
) {
|
|
|
|
|
|
target = Global.testingServer.db.tests.getUI().getCurrent();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performPreparation() throws Exception {
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
2024-10-13 22:08:13 +03:00
|
|
|
|
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
2024-10-14 12:54:52 +03:00
|
|
|
|
Utils_.forceDeleteWithCheck(target.getArchive());
|
|
|
|
|
|
Utils_.forceDeleteWithCheck(target.getHomePath());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2023-11-16 16:20:20 +03:00
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.DownloadTest, String.valueOf(target.id)));
|
2023-11-17 00:04:21 +03:00
|
|
|
|
response.Unpack(target.getArchive());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean validate() {
|
2023-11-17 00:04:21 +03:00
|
|
|
|
return target.getArchive().exists();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
|
super.performDone();
|
2024-10-14 15:19:13 +03:00
|
|
|
|
if (Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
2023-11-17 00:04:21 +03:00
|
|
|
|
target.getArchive().getAbsolutePath(),
|
2025-01-23 16:56:45 +03:00
|
|
|
|
Global.DownloadsDirectory.getAbsolutePath(), false
|
2023-09-17 22:13:42 +03:00
|
|
|
|
))
|
2024-10-15 15:13:57 +03:00
|
|
|
|
if (UI.Question("Тестовый проект успешно загружен под именем\n" +
|
2024-10-11 00:00:30 +03:00
|
|
|
|
Utils_.Brackets(target.getHomePath().getName()) +
|
2023-09-17 22:13:42 +03:00
|
|
|
|
"\nОткрыть его"))
|
2024-10-13 23:55:03 +03:00
|
|
|
|
Global.mainModule.getPass(PassCode.OpenCurrentProject).Do(target.getHomePath());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|