скачать результатов текущего двм пакета.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package Common;
|
||||
import Common.Database.DataSet;
|
||||
import Common.UI.Menus_2023.ComponentsMenuBar.ComponentsMenuBar;
|
||||
import Repository.Component.ComponentsMenuBar;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Account.Account;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package Common.UI.Menus_2023.ComponentsMenuBar;
|
||||
package Repository.Component;
|
||||
import Common.Current;
|
||||
import Common.UI.Menus_2023.DataMenuBar;
|
||||
import Common.UI.Menus_2023.VisualiserMenu;
|
||||
@@ -89,5 +89,5 @@ public enum ServerCode {
|
||||
GetFirstActiveDVMPackage,
|
||||
DVMPackageNeedsKill, // не доделано.
|
||||
UpdateActiveDVMPackages,
|
||||
GetFirstActiveSapforPackage, SapforPackageNeedsKill, UpdateActiveSapforPackages;
|
||||
GetFirstActiveSapforPackage, SapforPackageNeedsKill, UpdateActiveSapforPackages, DownloadDVMPackage;
|
||||
}
|
||||
|
||||
@@ -552,6 +552,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Print("Получить данные по пакетам Sapfor");
|
||||
UpdateActiveSapforPackages();
|
||||
break;
|
||||
case DownloadDVMPackage:
|
||||
Print("Загрузить пакет DVM");
|
||||
DownloadDVMPackage();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
@@ -832,4 +836,15 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
response.object = res_;
|
||||
}
|
||||
private void DownloadDVMPackage() throws Exception{
|
||||
int dvmPackage_id = (int) request.object;
|
||||
if (!db.dvmPackages.containsKey(dvmPackage_id))
|
||||
throw new RepositoryRefuseException("Не найдено пакета тестирования DVM с ключом "+dvmPackage_id);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
DVMPackage dvmPackage = db.dvmPackages.get(dvmPackage_id);
|
||||
File workspace = dvmPackage.getLocalWorkspace();
|
||||
File results_zip = new File (workspace, "results.zip");
|
||||
File package_json = dvmPackage.getJsonFile();
|
||||
response.object = new Pair(Utils.packFile(results_zip), Utils.packFile(package_json));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ public class DVMPackagesBar extends DataMenuBar {
|
||||
super("пакеты задач DVM", PassCode_2021.AddDVMPackage,
|
||||
PassCode_2021.AddTasksToDVMPackage,
|
||||
PassCode_2021.StartDVMPackage,
|
||||
PassCode_2021.DownloadDVMPackage,
|
||||
PassCode_2021.AbortDVMPackage,
|
||||
PassCode_2021.DeleteDVMPackage
|
||||
// PassCode_2021.ExportTasksPackageToExcel,
|
||||
|
||||
68
src/Visual_DVM_2021/Passes/All/DownloadDVMPackage.java
Normal file
68
src/Visual_DVM_2021/Passes/All/DownloadDVMPackage.java
Normal 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());
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user