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;
|
2025-02-04 21:14:14 +03:00
|
|
|
|
import _VisualDVM.Passes.Server.TestingServerPass;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.Test.Test;
|
2025-03-07 17:26:13 +03:00
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
2025-02-04 21:14:14 +03:00
|
|
|
|
public class DownloadTest extends TestingServerPass<Test> {
|
2025-03-07 17:26:13 +03:00
|
|
|
|
File testArchive;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/DownloadBugReport.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2025-03-07 17:26:13 +03:00
|
|
|
|
testArchive= null;
|
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();
|
2025-02-04 21:14:14 +03:00
|
|
|
|
return SendRequest(ServerCode.DownloadTest, String.valueOf(target.id));
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
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.getHomePath());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2025-02-04 21:14:14 +03:00
|
|
|
|
protected void body() throws Exception {
|
2025-03-07 17:26:13 +03:00
|
|
|
|
testArchive= new File(Global.TempDirectory, Utils_.getDateName(String.valueOf(target.id)));
|
|
|
|
|
|
request.server_response.Unpack(testArchive);
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean validate() {
|
2025-03-07 17:26:13 +03:00
|
|
|
|
return testArchive.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(
|
2025-03-07 17:26:13 +03:00
|
|
|
|
testArchive.getAbsolutePath(),
|
2025-01-29 15:20:24 +03:00
|
|
|
|
Global.visualiser.getDownloadsDirectory().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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|