2023-11-19 02:12:44 +03:00
|
|
|
|
package TestingSystem.Common;
|
2023-10-24 19:42:01 +03:00
|
|
|
|
import Common.Constants;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import Common.Database.DBObject;
|
|
|
|
|
|
import Common.Global;
|
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 00:25:37 +03:00
|
|
|
|
import GlobalData.Account.Account;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import ProjectData.LanguageName;
|
2023-11-14 00:56:05 +03:00
|
|
|
|
import Repository.EmailMessage;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import Repository.RepositoryRefuseException;
|
|
|
|
|
|
import Repository.RepositoryServer;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Repository.Server.ServerCode;
|
|
|
|
|
|
import Repository.Server.ServerExchangeUnit_2021;
|
|
|
|
|
|
import TestingSystem.Common.Group.Group;
|
2024-04-23 00:36:37 +03:00
|
|
|
|
import TestingSystem.Common.MachineProcess.MachineProcess;
|
|
|
|
|
|
import TestingSystem.Common.MachineProcess.MachineProcessState;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import TestingSystem.Common.Test.Test;
|
|
|
|
|
|
import TestingSystem.Common.Test.TestType;
|
2023-12-15 02:34:30 +03:00
|
|
|
|
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
2023-12-13 02:26:20 +03:00
|
|
|
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
2024-03-22 23:08:51 +03:00
|
|
|
|
import TestingSystem.DVM.DVMPackage.DVMPackage_json;
|
2023-12-14 02:30:56 +03:00
|
|
|
|
import TestingSystem.DVM.DVMTestingPlanner;
|
2024-03-08 01:17:54 +03:00
|
|
|
|
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
2023-12-06 02:43:06 +03:00
|
|
|
|
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
|
|
|
|
|
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
2023-12-16 03:57:01 +03:00
|
|
|
|
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
|
|
|
|
|
import TestingSystem.SAPFOR.SapforTestingPlanner;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.All.DownloadRepository;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.All.ZipFolderPass;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Pass_2021;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import javafx.util.Pair;
|
2023-11-19 00:25:37 +03:00
|
|
|
|
import org.apache.commons.io.FileUtils;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
2024-02-23 21:34:01 +03:00
|
|
|
|
import javax.swing.Timer;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import java.io.File;
|
|
|
|
|
|
import java.nio.file.Paths;
|
2024-02-23 21:34:01 +03:00
|
|
|
|
import java.util.*;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
2024-04-23 22:48:02 +03:00
|
|
|
|
public String name = "?";
|
2023-12-16 03:57:01 +03:00
|
|
|
|
@Override
|
|
|
|
|
|
public void afterPublishAction(DBObject object) throws Exception {
|
2023-12-16 16:52:17 +03:00
|
|
|
|
if (object instanceof Test) {
|
2023-12-16 03:57:01 +03:00
|
|
|
|
Test test = (Test) object;
|
|
|
|
|
|
if (!test.unpackProjectOnServer()) {
|
|
|
|
|
|
db.Delete(test);
|
|
|
|
|
|
throw new RepositoryRefuseException(
|
|
|
|
|
|
"Не удалось прикрепить проект к тесту с id " + test.id
|
|
|
|
|
|
+ "\nТест будет удален"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (object instanceof DVMPackage) {
|
|
|
|
|
|
DVMPackage dvmPackage = (DVMPackage) object;
|
|
|
|
|
|
//--
|
|
|
|
|
|
Utils.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
|
|
|
|
|
|
//--
|
|
|
|
|
|
dvmPackage.saveJson();
|
|
|
|
|
|
dvmPackage.package_json = null; // объект больше не нужен.
|
|
|
|
|
|
} else if (object instanceof SapforPackage) {
|
2024-03-07 18:56:47 +03:00
|
|
|
|
((SapforPackage) object).init();
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void afterDeleteAction(DBObject object) throws Exception {
|
|
|
|
|
|
if (object instanceof Test) {
|
|
|
|
|
|
Test test = (Test) object;
|
|
|
|
|
|
Utils.forceDeleteWithCheck(test.getArchive());
|
|
|
|
|
|
Utils.forceDeleteWithCheck(test.getServerPath());
|
|
|
|
|
|
} else if (object instanceof Group) {
|
|
|
|
|
|
Group group = (Group) object;
|
|
|
|
|
|
Vector<Test> tests = new Vector<>();
|
|
|
|
|
|
for (Test group_test : db.tests.Data.values()) {
|
|
|
|
|
|
if (group_test.group_id == group.id)
|
|
|
|
|
|
tests.add(group_test);
|
|
|
|
|
|
}
|
|
|
|
|
|
for (Test group_test : tests) {
|
|
|
|
|
|
db.Delete(group_test);
|
|
|
|
|
|
Utils.forceDeleteWithCheck(group_test.getArchive());
|
|
|
|
|
|
Utils.forceDeleteWithCheck(group_test.getServerPath());
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (object instanceof ServerSapfor) {
|
|
|
|
|
|
Utils.forceDeleteWithCheck(
|
|
|
|
|
|
new File(
|
|
|
|
|
|
((ServerSapfor) object).home_path
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
} else if (object instanceof SapforConfiguration) {
|
|
|
|
|
|
SapforConfiguration sapforConfiguration = (SapforConfiguration) object;
|
|
|
|
|
|
Vector<SapforConfigurationCommand> commands = new Vector<>();
|
|
|
|
|
|
for (SapforConfigurationCommand command : db.sapforConfigurationCommands.Data.values()) {
|
|
|
|
|
|
if (command.sapforconfiguration_id == sapforConfiguration.id)
|
|
|
|
|
|
commands.add(command);
|
|
|
|
|
|
}
|
|
|
|
|
|
for (SapforConfigurationCommand command : commands) {
|
|
|
|
|
|
db.Delete(command);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (object instanceof DVMPackage) {
|
|
|
|
|
|
DVMPackage dvmPackage = (DVMPackage) object;
|
|
|
|
|
|
File workspace = dvmPackage.getLocalWorkspace();
|
|
|
|
|
|
Utils.forceDeleteWithCheck(workspace);
|
|
|
|
|
|
} else if (object instanceof SapforPackage) {
|
|
|
|
|
|
SapforPackage sapforPackage = (SapforPackage) object;
|
|
|
|
|
|
File workspace = sapforPackage.getLocalWorkspace();
|
|
|
|
|
|
Utils.forceDeleteWithCheck(workspace);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//-->>>
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public TestingServer() {
|
|
|
|
|
|
super(TestsDatabase.class);
|
2024-04-23 22:48:02 +03:00
|
|
|
|
name = Utils.getDateName("testingServer");
|
|
|
|
|
|
System.out.println("ServerName=" + Utils.Brackets(name));
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
//основа
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int getPort() {
|
2024-02-16 21:44:13 +03:00
|
|
|
|
return Global.properties.TestingServerPort;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
//---
|
|
|
|
|
|
@Override
|
2023-10-03 15:07:17 +03:00
|
|
|
|
protected void startAdditionalThreads() {
|
2023-12-16 16:52:17 +03:00
|
|
|
|
testingThread.start();
|
2023-10-03 15:07:17 +03:00
|
|
|
|
}
|
2023-12-16 03:57:01 +03:00
|
|
|
|
protected DVMTestingPlanner DVMTestingPlanner = new DVMTestingPlanner();
|
|
|
|
|
|
protected SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
|
|
|
|
|
//--
|
2024-04-23 00:36:37 +03:00
|
|
|
|
void startNecessaryMachines() {
|
|
|
|
|
|
System.out.println("Запуск необходимых нитей машин...");
|
|
|
|
|
|
//todo. когда БД машин будет перенесена только на сервер. просто идти по всем машинам.
|
|
|
|
|
|
try {
|
2024-04-23 22:48:02 +03:00
|
|
|
|
LinkedHashMap<String, MachineProcess> active_processes = db.machinesProcesses.getSortedByKeys();
|
2024-04-23 00:36:37 +03:00
|
|
|
|
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
|
|
|
|
|
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
|
|
|
|
|
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
|
|
|
|
|
if (dvmPackage.state.isActive()) {
|
|
|
|
|
|
//-
|
|
|
|
|
|
Vector<String> k = new Vector<>();
|
|
|
|
|
|
k.add(dvmPackage.machine_address);
|
|
|
|
|
|
k.add(String.valueOf(dvmPackage.machine_port));
|
|
|
|
|
|
k.add(dvmPackage.user_name);
|
|
|
|
|
|
k.add(dvmPackage.user_workspace);
|
|
|
|
|
|
//-
|
|
|
|
|
|
String key = String.join("_", k);
|
|
|
|
|
|
if (!active_processes.containsKey(key)) {
|
|
|
|
|
|
MachineProcess new_process = new MachineProcess(dvmPackage);
|
|
|
|
|
|
processes_to_start.put(key, new_process);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-23 16:40:05 +03:00
|
|
|
|
System.out.println("Активные процессы: " + active_processes.size());
|
|
|
|
|
|
for (String key : active_processes.keySet()) {
|
2024-04-23 00:36:37 +03:00
|
|
|
|
System.out.println(key);
|
|
|
|
|
|
}
|
|
|
|
|
|
System.out.println("-------------------");
|
2024-04-23 16:40:05 +03:00
|
|
|
|
System.out.println("Ожидающие запуск процессы: " + processes_to_start.size());
|
|
|
|
|
|
for (String key : processes_to_start.keySet()) {
|
2024-04-23 00:36:37 +03:00
|
|
|
|
System.out.println(key);
|
|
|
|
|
|
}
|
|
|
|
|
|
System.out.println("-------------------");
|
2024-04-23 01:39:54 +03:00
|
|
|
|
//запуск.
|
2024-04-23 16:40:05 +03:00
|
|
|
|
for (MachineProcess process : processes_to_start.values()) {
|
|
|
|
|
|
System.out.println("Запуск процесса " + process.getUniqueKey() + " ...");
|
|
|
|
|
|
process.Start();
|
|
|
|
|
|
if (Utils.checkFileCreation(process.getStartedFile())) {
|
|
|
|
|
|
process.state = MachineProcessState.Active;
|
2024-04-23 22:48:02 +03:00
|
|
|
|
db.machinesProcesses.Data.put(process.id, process);
|
2024-04-23 16:40:05 +03:00
|
|
|
|
System.out.println("Выполнено");
|
2024-04-23 22:48:02 +03:00
|
|
|
|
} else {
|
|
|
|
|
|
System.out.println("Не удалось запустить процесс.");
|
2024-04-23 16:40:05 +03:00
|
|
|
|
}
|
2024-04-23 01:39:54 +03:00
|
|
|
|
}
|
2024-04-23 00:36:37 +03:00
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
System.out.println("done");
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
2023-12-16 16:52:17 +03:00
|
|
|
|
protected Thread testingThread = new Thread(() -> {
|
2023-12-16 03:57:01 +03:00
|
|
|
|
while (true) {
|
2024-04-23 00:36:37 +03:00
|
|
|
|
// DVMTestingPlanner.Perform();
|
|
|
|
|
|
// sapforTestingPlanner.Perform();
|
|
|
|
|
|
startNecessaryMachines();
|
|
|
|
|
|
System.out.println("sleep...");
|
|
|
|
|
|
Utils.sleep(5000);
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//------>>>
|
2023-10-03 15:07:17 +03:00
|
|
|
|
public static Timer checkTimer = null;
|
|
|
|
|
|
public static void TimerOn() {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
System.out.println("timer on");
|
|
|
|
|
|
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
|
2023-12-10 02:26:28 +03:00
|
|
|
|
Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
|
2023-10-03 15:07:17 +03:00
|
|
|
|
});
|
|
|
|
|
|
checkTimer.start();
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void TimerOff() {
|
|
|
|
|
|
System.out.println("timer off");
|
|
|
|
|
|
if (checkTimer != null)
|
|
|
|
|
|
checkTimer.stop();
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void ResetTimer() {
|
|
|
|
|
|
TimerOff();
|
|
|
|
|
|
TimerOn();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2023-09-17 22:13:42 +03:00
|
|
|
|
protected void Session() throws Exception {
|
2023-11-17 20:19:32 +03:00
|
|
|
|
Test test;
|
|
|
|
|
|
int test_id;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
switch (code) {
|
|
|
|
|
|
case DownloadTest:
|
|
|
|
|
|
Print("Отправить клиенту тест " + request.arg);
|
2023-11-17 20:19:32 +03:00
|
|
|
|
test_id = Integer.parseInt(request.arg);
|
|
|
|
|
|
if (db.tests.containsKey(test_id)) {
|
|
|
|
|
|
test = db.tests.get(test_id);
|
2023-11-17 00:04:21 +03:00
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.packFile(test.getArchive()));
|
2023-09-17 22:13:42 +03:00
|
|
|
|
} else
|
|
|
|
|
|
throw new RepositoryRefuseException("Теста с именем " + request.arg + " не существует");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ReceiveTestsDatabase:
|
|
|
|
|
|
Print("Получить базу данных тестов");
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = Utils.packFile(db.getFile());
|
|
|
|
|
|
break;
|
2023-11-19 00:25:37 +03:00
|
|
|
|
//---
|
|
|
|
|
|
case RefreshDVMTests:
|
|
|
|
|
|
Print("Синхронизировать репозиторий тестов ");
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2023-11-26 00:30:43 +03:00
|
|
|
|
RefreshDVMTests((Account) request.object, Integer.parseInt(request.arg));
|
2023-11-19 00:25:37 +03:00
|
|
|
|
break;
|
2023-12-14 18:45:41 +03:00
|
|
|
|
case DVMPackageNeedsKill:
|
2023-12-16 03:57:01 +03:00
|
|
|
|
Print("Проверить нуждается ли пакет DVM в убийстве");
|
2023-12-14 18:45:41 +03:00
|
|
|
|
DVMPackageNeedsKill();
|
|
|
|
|
|
break;
|
2023-12-14 23:00:50 +03:00
|
|
|
|
case UpdateActiveDVMPackages:
|
|
|
|
|
|
Print("Получить данные по пакетам DVM");
|
|
|
|
|
|
UpdateActiveDVMPackages();
|
|
|
|
|
|
break;
|
2024-03-21 19:02:08 +03:00
|
|
|
|
case GetFirstActiveSapforPackages:
|
2023-12-16 03:57:01 +03:00
|
|
|
|
Print("Получить первый активный пакет задач SAPFOR");
|
2024-03-21 19:02:08 +03:00
|
|
|
|
GetFirstActiveSapforPackages();
|
2023-12-16 03:57:01 +03:00
|
|
|
|
break;
|
|
|
|
|
|
case SapforPackageNeedsKill:
|
|
|
|
|
|
Print("Проверить нуждает ли пакет SAPFOR в убийстве");
|
|
|
|
|
|
SapforPackageNeedsKill();
|
|
|
|
|
|
break;
|
|
|
|
|
|
case UpdateActiveSapforPackages:
|
|
|
|
|
|
Print("Получить данные по пакетам Sapfor");
|
|
|
|
|
|
UpdateActiveSapforPackages();
|
|
|
|
|
|
break;
|
2023-12-16 11:35:37 +03:00
|
|
|
|
case DownloadDVMPackage:
|
|
|
|
|
|
Print("Загрузить пакет DVM");
|
|
|
|
|
|
DownloadDVMPackage();
|
|
|
|
|
|
break;
|
2023-12-17 19:19:59 +03:00
|
|
|
|
case DownloadDVMPackages:
|
|
|
|
|
|
Print("Загрузить пакеты DVM");
|
|
|
|
|
|
DownloadDVMPackages();
|
|
|
|
|
|
break;
|
2023-12-18 00:04:44 +03:00
|
|
|
|
case DownloadSapforPackage:
|
|
|
|
|
|
Print("Загрузить пакет SAPFOR");
|
|
|
|
|
|
DownloadSapforPackage();
|
|
|
|
|
|
break;
|
2024-02-19 23:49:35 +03:00
|
|
|
|
case InstallServerSapfor:
|
|
|
|
|
|
Print("Установить текущую версию SAPFOR для тестирования");
|
|
|
|
|
|
InstallServerSapfor();
|
|
|
|
|
|
break;
|
2024-03-02 01:44:03 +03:00
|
|
|
|
case ReplaceTestCode:
|
|
|
|
|
|
Print("Заменить код теста");
|
|
|
|
|
|
ReplaceTestCode();
|
|
|
|
|
|
break;
|
2024-03-05 16:49:57 +03:00
|
|
|
|
case ReplaceTestsCodes:
|
|
|
|
|
|
Print("Заменить код тестов");
|
|
|
|
|
|
ReplaceTestsCodes();
|
|
|
|
|
|
break;
|
2024-03-08 01:17:54 +03:00
|
|
|
|
case GetSapforPackagesJson:
|
|
|
|
|
|
Print("Получить информацию о задачах пакетов SAPFOR");
|
|
|
|
|
|
GetSapforPackagesJson();
|
|
|
|
|
|
break;
|
2024-03-22 23:08:51 +03:00
|
|
|
|
case GetDVMPackagesJson:
|
|
|
|
|
|
Print("Получить информацию о задачах пакетов DVM");
|
|
|
|
|
|
GetDVMPackagesJson();
|
|
|
|
|
|
break;
|
2024-03-21 19:02:08 +03:00
|
|
|
|
case GetFirstsActiveDVMPackages:
|
|
|
|
|
|
Print("Получить первые активные пакеты задач DVM на машинах");
|
|
|
|
|
|
GetFirstActiveDVMPackagesByMachines();
|
|
|
|
|
|
break;
|
2024-04-13 20:09:26 +03:00
|
|
|
|
case GetFirstActiveDVMPackageForMachineURL:
|
|
|
|
|
|
Print("Получить первый активный пакет задач DVM на машине с адресом");
|
|
|
|
|
|
GetFirstActiveDVMPackageForMachineURL();
|
|
|
|
|
|
break;
|
2024-04-23 22:48:02 +03:00
|
|
|
|
case GetServerName:
|
|
|
|
|
|
Print("Получить имя сервера");
|
|
|
|
|
|
GetServerName();
|
|
|
|
|
|
break;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
default:
|
|
|
|
|
|
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-19 00:25:37 +03:00
|
|
|
|
//->>
|
2023-11-23 01:00:08 +03:00
|
|
|
|
Pair<Group, Vector<File>> ConvertDirectoryToGroup(File src, LanguageName languageName, TestType
|
|
|
|
|
|
testType, Account account) throws Exception {
|
2023-11-19 00:25:37 +03:00
|
|
|
|
Group object = new Group();
|
|
|
|
|
|
Vector<File> groupFiles = null; //транспорт.
|
|
|
|
|
|
//->>
|
|
|
|
|
|
object.description = src.getName();
|
|
|
|
|
|
object.language = languageName;
|
|
|
|
|
|
object.type = testType;
|
|
|
|
|
|
object.sender_name = account.name;
|
|
|
|
|
|
object.sender_address = account.email;
|
|
|
|
|
|
//-->>
|
|
|
|
|
|
File[] files = src.listFiles(pathname ->
|
|
|
|
|
|
pathname.isFile()
|
|
|
|
|
|
&& !pathname.getName().equals("settings")
|
|
|
|
|
|
&& !pathname.getName().equals("test-analyzer.sh")
|
|
|
|
|
|
&& Utils.getExtension(pathname).startsWith(languageName.getDVMCompile()));
|
|
|
|
|
|
;
|
|
|
|
|
|
if (files != null) {
|
|
|
|
|
|
groupFiles = new Vector<>(Arrays.asList(files));
|
|
|
|
|
|
groupFiles.sort(Comparator.comparing(File::getName));
|
|
|
|
|
|
}
|
|
|
|
|
|
//->>
|
|
|
|
|
|
return new Pair<>(object, groupFiles);
|
|
|
|
|
|
}
|
2023-11-26 00:30:43 +03:00
|
|
|
|
public void RefreshDVMTests(Account account, int sapfor_id) throws Exception {
|
2023-11-25 16:51:35 +03:00
|
|
|
|
ServerSapfor sapfor = null;
|
|
|
|
|
|
if (!db.serverSapfors.containsKey(sapfor_id))
|
|
|
|
|
|
throw new RepositoryRefuseException("Версия SAPFOR с ключом " + sapfor_id + " не найдена.");
|
|
|
|
|
|
sapfor = db.serverSapfors.get(sapfor_id);
|
2023-11-19 00:25:37 +03:00
|
|
|
|
DownloadRepository downloadRepository = new DownloadRepository();
|
|
|
|
|
|
if (!downloadRepository.Do())
|
|
|
|
|
|
throw new RepositoryRefuseException("Не удалось обновить репозиторий");
|
|
|
|
|
|
//-->>
|
|
|
|
|
|
Vector<Pair<Group, Vector<File>>> groups = new Vector<>();
|
|
|
|
|
|
File testsSrc = Paths.get(
|
|
|
|
|
|
Global.RepoDirectory.getAbsolutePath(),
|
|
|
|
|
|
"dvm", "tools", "tester", "trunk", "test-suite").toFile();
|
|
|
|
|
|
LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c};
|
|
|
|
|
|
for (LanguageName languageName : supportedLanguages) {
|
|
|
|
|
|
for (TestType testType : TestType.values()) {
|
|
|
|
|
|
File groupsSrc = null;
|
|
|
|
|
|
switch (testType) {
|
|
|
|
|
|
case Correctness:
|
|
|
|
|
|
String languageSrcName = null;
|
|
|
|
|
|
switch (languageName) {
|
|
|
|
|
|
case fortran:
|
|
|
|
|
|
languageSrcName = "Fortran";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case c:
|
|
|
|
|
|
languageSrcName = "C";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (languageSrcName != null) {
|
|
|
|
|
|
groupsSrc = Paths.get(testsSrc.getAbsolutePath(), "Correctness", languageSrcName).toFile();
|
|
|
|
|
|
File[] groupsDirs = groupsSrc.listFiles(File::isDirectory);
|
|
|
|
|
|
if (groupsDirs != null) {
|
|
|
|
|
|
for (File groupDir : groupsDirs)
|
|
|
|
|
|
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType, account));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case Performance:
|
|
|
|
|
|
File groupDir = Paths.get(testsSrc.getAbsolutePath(), "Performance").toFile();
|
|
|
|
|
|
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType, account));
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
groups.sort(Comparator.comparing(o -> o.getKey().description));
|
|
|
|
|
|
//-теперь создать тесты.
|
|
|
|
|
|
System.out.println("найдено " + groups.size() + " групп");
|
|
|
|
|
|
//--
|
2024-04-07 21:30:11 +03:00
|
|
|
|
for (Pair<Group, Vector<File>> p : groups)
|
|
|
|
|
|
db.RefreshGroup(account, sapfor, p);
|
2023-11-19 00:25:37 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
private void GetFirstActiveDVMPackagesByMachines() {
|
2023-12-15 14:55:16 +03:00
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2024-04-15 22:09:10 +03:00
|
|
|
|
response.object = new Vector<>();
|
2024-04-23 00:36:37 +03:00
|
|
|
|
// db.getFirstActiveDVMPackagesCopies(); //ЗАГЛУШКА. ЗА ПАКЕТЫ ДВМ ОТВЕЧАЕТ ОТДЕЛЬНЫЙ ПРОЦЕСС НА КАЖДУЮ МАШИНУ
|
2024-04-13 20:09:26 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
private void GetFirstActiveSapforPackages() throws Exception {
|
2023-12-16 03:57:01 +03:00
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2024-03-21 19:02:08 +03:00
|
|
|
|
response.object = db.getFirstActiveSapforPackagesCopies();
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
2023-12-14 23:00:50 +03:00
|
|
|
|
//---
|
|
|
|
|
|
void UpdateActiveDVMPackages() throws Exception {
|
2023-12-15 02:34:30 +03:00
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2023-12-15 14:55:16 +03:00
|
|
|
|
Vector<Pair<Integer, Long>> keys_pairs = (Vector<Pair<Integer, Long>>) request.object;
|
2023-12-14 23:00:50 +03:00
|
|
|
|
Vector<DVMPackage> res = new Vector<>();
|
|
|
|
|
|
//--
|
2023-12-15 14:55:16 +03:00
|
|
|
|
for (Pair<Integer, Long> p : keys_pairs) {
|
2023-12-14 23:00:50 +03:00
|
|
|
|
if (db.dvmPackages.containsKey(p.getKey())) {
|
2023-12-15 14:55:16 +03:00
|
|
|
|
DVMPackage actual = db.dvmPackages.get(p.getKey());
|
|
|
|
|
|
if (actual.ChangeDate != p.getValue())
|
|
|
|
|
|
res.add(new DVMPackage(actual));
|
2023-12-14 23:00:50 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
response.object = res;
|
|
|
|
|
|
}
|
2023-12-16 03:57:01 +03:00
|
|
|
|
private void UpdateActiveSapforPackages() {
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
Vector<Pair<Integer, Long>> keys_pairs = (Vector<Pair<Integer, Long>>) request.object;
|
|
|
|
|
|
Vector<SapforPackage> res = new Vector<>();
|
|
|
|
|
|
//--
|
|
|
|
|
|
for (Pair<Integer, Long> p : keys_pairs) {
|
|
|
|
|
|
if (db.sapforPackages.containsKey(p.getKey())) {
|
|
|
|
|
|
SapforPackage actual = db.sapforPackages.get(p.getKey());
|
|
|
|
|
|
if (actual.ChangeDate != p.getValue())
|
|
|
|
|
|
res.add(new SapforPackage(actual));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
response.object = res;
|
|
|
|
|
|
}
|
2023-12-15 02:34:30 +03:00
|
|
|
|
private void DVMPackageNeedsKill() {
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2023-12-18 15:44:48 +03:00
|
|
|
|
response.object = Constants.Nan;
|
2023-12-15 02:34:30 +03:00
|
|
|
|
int packageId = (int) request.object;
|
|
|
|
|
|
for (TestingPackageToKill packageToKill : db.testingPackagesToKill.Data.values()) {
|
|
|
|
|
|
if ((packageToKill.packageId == packageId) && (packageToKill.type == 0)) {
|
2023-12-18 15:44:48 +03:00
|
|
|
|
response.object = packageToKill.id;
|
2023-12-15 02:34:30 +03:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-16 03:57:01 +03:00
|
|
|
|
private void SapforPackageNeedsKill() throws Exception {
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2023-12-18 15:44:48 +03:00
|
|
|
|
response.object = Constants.Nan;
|
2023-12-16 03:57:01 +03:00
|
|
|
|
int packageId = (int) request.object;
|
|
|
|
|
|
for (TestingPackageToKill packageToKill : db.testingPackagesToKill.Data.values()) {
|
|
|
|
|
|
if ((packageToKill.packageId == packageId) && (packageToKill.type == 1)) {
|
2023-12-18 15:44:48 +03:00
|
|
|
|
response.object = packageToKill.id;
|
2023-12-16 03:57:01 +03:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-16 16:52:17 +03:00
|
|
|
|
private void DownloadDVMPackage() throws Exception {
|
2023-12-16 11:35:37 +03:00
|
|
|
|
int dvmPackage_id = (int) request.object;
|
|
|
|
|
|
if (!db.dvmPackages.containsKey(dvmPackage_id))
|
2023-12-16 16:52:17 +03:00
|
|
|
|
throw new RepositoryRefuseException("Не найдено пакета тестирования DVM с ключом " + dvmPackage_id);
|
2023-12-16 11:35:37 +03:00
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
DVMPackage dvmPackage = db.dvmPackages.get(dvmPackage_id);
|
|
|
|
|
|
File workspace = dvmPackage.getLocalWorkspace();
|
2023-12-16 16:52:17 +03:00
|
|
|
|
File results_zip = new File(workspace, "results.zip");
|
2023-12-16 11:35:37 +03:00
|
|
|
|
File package_json = dvmPackage.getJsonFile();
|
|
|
|
|
|
response.object = new Pair(Utils.packFile(results_zip), Utils.packFile(package_json));
|
|
|
|
|
|
}
|
2023-12-17 19:19:59 +03:00
|
|
|
|
private void DownloadDVMPackages() throws Exception {
|
|
|
|
|
|
Vector<Integer> ids = (Vector<Integer>) request.object;
|
|
|
|
|
|
Vector<Pair<Integer, Pair<byte[], byte[]>>> res = new Vector<>();
|
|
|
|
|
|
for (int dvmPackage_id : ids) {
|
|
|
|
|
|
if (!db.dvmPackages.containsKey(dvmPackage_id))
|
|
|
|
|
|
throw new RepositoryRefuseException("Не найдено пакета тестирования DVM с ключом " + dvmPackage_id);
|
|
|
|
|
|
DVMPackage dvmPackage = db.dvmPackages.get(dvmPackage_id);
|
|
|
|
|
|
File workspace = dvmPackage.getLocalWorkspace();
|
|
|
|
|
|
File results_zip = new File(workspace, "results.zip");
|
|
|
|
|
|
File package_json = dvmPackage.getJsonFile();
|
|
|
|
|
|
res.add(new Pair<>(dvmPackage_id, new Pair(Utils.packFile(results_zip), Utils.packFile(package_json))));
|
|
|
|
|
|
}
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = res;
|
|
|
|
|
|
}
|
2023-12-18 00:04:44 +03:00
|
|
|
|
private void DownloadSapforPackage() throws Exception {
|
|
|
|
|
|
int sapforPackage_id = (int) request.object;
|
|
|
|
|
|
if (!db.sapforPackages.containsKey(sapforPackage_id))
|
|
|
|
|
|
throw new RepositoryRefuseException("Не найдено пакета тестирования SAPFOR с ключом " + sapforPackage_id);
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
SapforPackage sapforPackage = db.sapforPackages.get(sapforPackage_id);
|
|
|
|
|
|
File workspace = sapforPackage.getLocalWorkspace();
|
|
|
|
|
|
File results_zip = Utils.getTempFileName("results");
|
|
|
|
|
|
ZipFolderPass zipFolderPass = new ZipFolderPass();
|
|
|
|
|
|
zipFolderPass.Do(workspace.getAbsolutePath(), results_zip.getAbsolutePath());
|
|
|
|
|
|
if (results_zip.exists())
|
|
|
|
|
|
response.object = Utils.packFile(results_zip);
|
2023-12-18 15:44:48 +03:00
|
|
|
|
else
|
|
|
|
|
|
throw new RepositoryRefuseException("Не удалось заархивировать пакет тестирования SAPFOR с ключом " + sapforPackage_id);
|
2023-12-18 00:04:44 +03:00
|
|
|
|
}
|
2024-02-19 23:49:35 +03:00
|
|
|
|
private void InstallServerSapfor() throws Exception {
|
2024-03-02 22:32:42 +03:00
|
|
|
|
int max_version = Constants.Nan;
|
|
|
|
|
|
int current_version = Constants.Nan;
|
|
|
|
|
|
//--
|
|
|
|
|
|
for (ServerSapfor sapfor : db.serverSapfors.Data.values()) {
|
|
|
|
|
|
int version = -1;
|
|
|
|
|
|
try {
|
|
|
|
|
|
version = Integer.parseInt(sapfor.version);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (version > max_version) max_version = version;
|
|
|
|
|
|
}
|
|
|
|
|
|
System.out.println("max Sapfor version is " + max_version);
|
|
|
|
|
|
//--
|
2024-02-19 23:49:35 +03:00
|
|
|
|
File testingSystemHome = new File(Global.Home);
|
|
|
|
|
|
File repo = new File(testingSystemHome, "Repo");
|
2024-03-02 22:32:42 +03:00
|
|
|
|
File repoSapforHome = Paths.get(repo.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN).toFile();
|
2024-02-19 23:49:35 +03:00
|
|
|
|
File repo_bin = new File(repoSapforHome, "Sapfor_F");
|
|
|
|
|
|
//--
|
2024-02-23 21:34:01 +03:00
|
|
|
|
System.out.println("Синхронизация ветви DVM...");
|
2024-02-19 23:49:35 +03:00
|
|
|
|
Utils.startScript(repo, repo, "dvm_checkout",
|
|
|
|
|
|
"svn checkout " +
|
|
|
|
|
|
Constants.REPOSITORY_AUTHENTICATION +
|
|
|
|
|
|
" " + Constants.DVM_REPOSITORY + " 1>dvm_out.txt 2>dvm_err.txt\n").waitFor();
|
2024-02-23 21:34:01 +03:00
|
|
|
|
System.out.println("Синхронизация ветви SAPFOR...");
|
2024-02-19 23:49:35 +03:00
|
|
|
|
Utils.startScript(repo, repo, "spf_checkout",
|
|
|
|
|
|
"svn checkout " +
|
|
|
|
|
|
Constants.REPOSITORY_AUTHENTICATION +
|
|
|
|
|
|
" " + Constants.SAPFOR_REPOSITORY + " 1>spf_out.txt 2>spf_err.txt\n").waitFor();
|
|
|
|
|
|
//--
|
2024-02-23 21:34:01 +03:00
|
|
|
|
if (repo_bin.exists())
|
2024-02-19 23:49:35 +03:00
|
|
|
|
FileUtils.forceDelete(repo_bin);
|
2024-03-02 22:32:42 +03:00
|
|
|
|
//-
|
|
|
|
|
|
File versionFile = Paths.get(repo.getAbsolutePath(), "/sapfor/experts/Sapfor_2017/_src/Utils/version.h").toFile();
|
|
|
|
|
|
if (versionFile.exists()) {
|
|
|
|
|
|
List<String> data = FileUtils.readLines(versionFile);
|
|
|
|
|
|
for (String s : data) {
|
|
|
|
|
|
if (s.startsWith("#define VERSION_SPF ")) {
|
|
|
|
|
|
String[] version_data = s.split("\"");
|
|
|
|
|
|
if (version_data.length > 0) {
|
|
|
|
|
|
String version_s = version_data[1];
|
|
|
|
|
|
//-
|
|
|
|
|
|
try {
|
|
|
|
|
|
current_version = Integer.parseInt(version_s);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
//-
|
|
|
|
|
|
if (current_version == max_version) {
|
|
|
|
|
|
throw new RepositoryRefuseException("Версия SAPFOR " + max_version + " уже собрана!");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-02-19 23:49:35 +03:00
|
|
|
|
//--
|
2024-02-23 21:34:01 +03:00
|
|
|
|
System.out.println("Сборка SAPFOR...");
|
2024-02-19 23:49:35 +03:00
|
|
|
|
Utils.startScript(repoSapforHome, repoSapforHome, "build_sapfor",
|
|
|
|
|
|
"cmake ../ 1>out.txt 2>err.txt\nmake -j 14 1>>out.txt 2>>err.txt\n").waitFor();
|
|
|
|
|
|
//--
|
2024-02-23 21:34:01 +03:00
|
|
|
|
System.out.println("DONE");
|
|
|
|
|
|
File repoSapfor = new File(repoSapforHome, "Sapfor_F");
|
2024-03-02 22:32:42 +03:00
|
|
|
|
System.out.println("Result file is " + Utils.Brackets(repoSapfor.getAbsolutePath()));
|
2024-02-23 21:34:01 +03:00
|
|
|
|
if (repoSapfor.exists()) {
|
|
|
|
|
|
System.out.println("assembly found!");
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
File sapforsDirectory = new File(testingSystemHome, "Sapfors");
|
|
|
|
|
|
//создать папку. Для того чтобы скопировать из репозитория.
|
|
|
|
|
|
File sapforHome = new File(sapforsDirectory, Utils.getDateName("sapfor"));
|
|
|
|
|
|
sapforHome.mkdir();
|
|
|
|
|
|
File sapforBin = new File(sapforHome, "Sapfor_F");
|
|
|
|
|
|
FileUtils.copyFile(repo_bin, sapforBin);
|
|
|
|
|
|
sapforBin.setExecutable(true, false);
|
|
|
|
|
|
// //-->>>
|
|
|
|
|
|
ServerSapfor serverSapfor = new ServerSapfor();
|
|
|
|
|
|
serverSapfor.home_path = sapforHome.getAbsolutePath();
|
|
|
|
|
|
serverSapfor.call_command = sapforBin.getAbsolutePath();
|
|
|
|
|
|
serverSapfor.languageName = LanguageName.fortran;
|
|
|
|
|
|
serverSapfor.buildDate = new Date().getTime();
|
|
|
|
|
|
response.object = serverSapfor;
|
2024-03-02 22:32:42 +03:00
|
|
|
|
serverSapfor.version = String.valueOf(current_version);
|
|
|
|
|
|
//---
|
|
|
|
|
|
EmailSapforAssembly(current_version, true);
|
|
|
|
|
|
//---
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//---
|
|
|
|
|
|
EmailSapforAssembly(current_version, false);
|
|
|
|
|
|
//---
|
|
|
|
|
|
throw new RepositoryRefuseException("Бинарный файл SAPFOR не найден!");
|
|
|
|
|
|
}
|
2024-02-19 23:49:35 +03:00
|
|
|
|
}
|
2024-03-02 01:44:03 +03:00
|
|
|
|
private void ReplaceTestCode() throws Exception {
|
|
|
|
|
|
Test test = (Test) request.object;
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
//---
|
|
|
|
|
|
if (!test.unpackProjectOnServer()) {
|
|
|
|
|
|
db.Delete(test);
|
|
|
|
|
|
throw new RepositoryRefuseException(
|
|
|
|
|
|
"Не удалось прикрепить проект к тесту с id " + test.id
|
|
|
|
|
|
+ "\nТест будет удален"
|
|
|
|
|
|
);
|
2024-03-02 22:32:42 +03:00
|
|
|
|
} else db.Update(test); //обновить список файлов и размерность.
|
|
|
|
|
|
}
|
2024-03-05 16:49:57 +03:00
|
|
|
|
private void ReplaceTestsCodes() throws Exception {
|
|
|
|
|
|
Vector<Test> tests = (Vector<Test>) request.object;
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
2024-03-07 18:56:47 +03:00
|
|
|
|
for (Test test : tests) {
|
2024-03-05 16:49:57 +03:00
|
|
|
|
if (!test.unpackProjectOnServer()) {
|
|
|
|
|
|
db.Delete(test);
|
|
|
|
|
|
throw new RepositoryRefuseException(
|
|
|
|
|
|
"Не удалось прикрепить проект к тесту с id " + test.id
|
|
|
|
|
|
+ "\nТест будет удален"
|
|
|
|
|
|
);
|
|
|
|
|
|
} else db.Update(test); //обновить список файлов и размерность.
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-02 22:32:42 +03:00
|
|
|
|
private void EmailSapforAssembly(int version, boolean done) throws Exception {
|
|
|
|
|
|
String version_s = (version == Constants.Nan) ? "?" : String.valueOf(version);
|
|
|
|
|
|
String status = done ? "Успешно" : "С ошибками";
|
|
|
|
|
|
//-
|
|
|
|
|
|
File out = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.out_file).toFile();
|
|
|
|
|
|
File err = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.err_file).toFile();
|
|
|
|
|
|
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
|
|
|
|
|
|
EmailMessage message = new EmailMessage(
|
|
|
|
|
|
"Выполнена сборка системы SAPFOR",
|
|
|
|
|
|
"Версия: " + version_s + "\n" + "Статус: " + status,
|
|
|
|
|
|
targets
|
|
|
|
|
|
);
|
|
|
|
|
|
//-
|
|
|
|
|
|
Email(message, out, err);
|
2024-03-02 01:44:03 +03:00
|
|
|
|
}
|
2024-04-23 00:36:37 +03:00
|
|
|
|
private void GetDVMPackagesJson() throws Exception {
|
2024-03-22 23:08:51 +03:00
|
|
|
|
Vector<Integer> packages_ids = (Vector<Integer>) request.object;
|
|
|
|
|
|
Vector<DVMPackage_json> jsons = new Vector<>();
|
|
|
|
|
|
for (int package_id : packages_ids) {
|
|
|
|
|
|
if (!db.dvmPackages.containsKey(package_id))
|
|
|
|
|
|
throw new RepositoryRefuseException("Пакета задач DVM " + Utils.Brackets(package_id) + " не существует.");
|
|
|
|
|
|
DVMPackage dvmPackage = db.dvmPackages.get(package_id);
|
|
|
|
|
|
File json = dvmPackage.getJsonFile();
|
|
|
|
|
|
if (!json.exists())
|
|
|
|
|
|
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач DVM " + Utils.Brackets(package_id));
|
|
|
|
|
|
jsons.add((DVMPackage_json) Utils.jsonFromFile(json, DVMPackage_json.class));
|
|
|
|
|
|
}
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = jsons;
|
|
|
|
|
|
}
|
2024-03-08 01:17:54 +03:00
|
|
|
|
private void GetSapforPackagesJson() throws Exception {
|
|
|
|
|
|
Vector<Integer> packages_ids = (Vector<Integer>) request.object;
|
|
|
|
|
|
Vector<SapforPackage_json> jsons = new Vector<>();
|
|
|
|
|
|
for (int package_id : packages_ids) {
|
|
|
|
|
|
if (!db.sapforPackages.containsKey(package_id))
|
|
|
|
|
|
throw new RepositoryRefuseException("Пакета задач SAPFOR " + Utils.Brackets(package_id) + " не существует.");
|
|
|
|
|
|
SapforPackage sapforPackage = db.sapforPackages.get(package_id);
|
|
|
|
|
|
File json = sapforPackage.getJsonFile();
|
|
|
|
|
|
if (!json.exists())
|
|
|
|
|
|
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач SAPFOR " + Utils.Brackets(package_id));
|
|
|
|
|
|
jsons.add((SapforPackage_json) Utils.jsonFromFile(json, SapforPackage_json.class));
|
|
|
|
|
|
}
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = jsons;
|
|
|
|
|
|
}
|
2024-04-23 22:48:02 +03:00
|
|
|
|
private void GetServerName() throws Exception {
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = name;
|
|
|
|
|
|
}
|
2024-04-15 22:09:10 +03:00
|
|
|
|
//--
|
|
|
|
|
|
private void GetFirstActiveDVMPackageForMachineURL() {
|
|
|
|
|
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
|
|
|
|
|
response.object = db.getFirstActiveDVMPackageCopyForMachineURL(request.arg);
|
|
|
|
|
|
}
|
2024-04-21 23:23:57 +03:00
|
|
|
|
//-----
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
2024-03-02 22:32:42 +03:00
|
|
|
|
|