скачать результатов текущего двм пакета.

This commit is contained in:
2023-12-16 11:35:37 +03:00
parent ad19ee2665
commit e69769713b
9 changed files with 147 additions and 25 deletions

View File

@@ -0,0 +1,68 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Utils.Utils;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.DVM.DVMPackage.DVMPackage;
import TestingSystem.DVM.TasksPackage.TasksPackageState;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import javafx.util.Pair;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.Date;
public class DownloadDVMPackage extends TestingSystemPass<DVMPackage> {
@Override
public String getIconPath() {
return "/icons/Apply.png";
}
@Override
public String getButtonText() {
return "";
}
File workspace;
File results_zip;
File results;
File loaded;
@Override
protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.DVMPackage)){
//--
target = Current.getDVMPackage();
workspace = target.getLocalWorkspace();
results_zip = new File(workspace, "results.zip");
results = new File(workspace, "results");
loaded = new File(workspace, Constants.LOADED);
//--
if (!target.state.equals(TasksPackageState.Done)){
Log.Writeln_("Возможно скачать только завершённый пакет!");
return false;
}
if (loaded.exists()){
Log.Writeln_("Пакет уже загружен");
return false;
}
return true;
}
return false;
}
@Override
protected void performPreparation() throws Exception {
Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.DownloadDVMPackage,"", target.id));
}
@Override
protected void performDone() throws Exception {
super.performDone();
Pair<byte[], byte[]> packed = (Pair<byte[], byte[]>) response.object;
Utils.unpackFile(packed.getKey(), results_zip);
Utils.unpackFile(packed.getValue(), target.getJsonFile());
passes.get(PassCode_2021.UnzipFolderPass).Do(results_zip.getAbsolutePath(), workspace.getAbsolutePath());
FileUtils.writeStringToFile(loaded, new Date().toString());
}
}

View File

@@ -319,6 +319,7 @@ public enum PassCode_2021 {
DeleteSapforPackage,
StartSapforPackage,
AbortSapforPackage,
DownloadDVMPackage,
//->
TestPass;
public String getDescription() {
@@ -339,6 +340,8 @@ public enum PassCode_2021 {
return "Удалить пакет задач DVM";
case StartDVMPackage:
return "Запустить пакет задач DVM";
case DownloadDVMPackage:
return "Скачать пакет задач DVM";
case AddTasksToDVMPackage:
return "Добавить задачи в пакет тестирования DVM";
case AddDVMPackage: