2024-10-09 22:21:57 +03:00
|
|
|
|
package _VisualDVM.TestingSystem.Common;
|
2024-10-07 14:22:52 +03:00
|
|
|
|
import Common.CommonConstants;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import Common.Database.SQLITE.SQLiteDatabase;
|
2024-10-11 00:00:30 +03:00
|
|
|
|
import Common.Utils.Utils_;
|
2025-02-18 16:21:20 +03:00
|
|
|
|
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
2025-02-18 20:14:14 +03:00
|
|
|
|
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Constants;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentJson;
|
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionJson;
|
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
2025-02-04 16:06:49 +03:00
|
|
|
|
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.Common.Group.Group;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.Group.GroupsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.Test.Test;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.Test.TestDBTable;
|
2025-03-20 17:48:18 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.Common.TestFile.TestFile;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.Common.TestFile.TestFilesDBTable;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMCompilationOption.DVMCompilationOption;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMCompilationOption.DVMCompilationOptionsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptionsSet;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMCompilationOptionsSet.DVMCompilationOptionsSetsDBTable;
|
2025-02-04 16:06:49 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfigurationDBTable;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationGroup.DVMConfigurationGroup;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationGroup.DVMConfigurationGroupsDBTable;
|
2025-03-23 02:14:23 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationSettings.DVMConfigurationSettings;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationSettings.DVMConfigurationSettingsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationTest.DVMConfigurationTest;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMConfigurationTest.DVMConfigurationTestsDBTable;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMEnvironment.DVMEnvironment;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMEnvironment.DVMEnvironmentsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMEnvironmentsSet.DVMEnvironmentsSet;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMEnvironmentsSet.DVMEnvironmentsSetsDBTable;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackageDBTable;
|
2025-03-23 18:44:12 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMPackageConfiguration.DVMPackageConfiguration;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMPackageConfiguration.DVMPackageConfigurationsDBTable;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettingsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTasksSet;
|
2025-02-04 16:06:49 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
|
2025-03-21 23:02:53 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationGroup.SapforConfigurationGroup;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationGroup.SapforConfigurationGroupsDBTable;
|
2025-03-23 02:14:23 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationSettings.SapforConfigurationSettings;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationSettings.SapforConfigurationSettingsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationTest.SapforConfigurationTest;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforConfigurationTest.SapforConfigurationTestsDBTable;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforPackage.SapforPackageDBTable;
|
2025-03-23 18:44:12 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforPackageConfiguration.SapforPackageConfiguration;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforPackageConfiguration.SapforPackageConfigurationsDBTable;
|
2025-03-25 14:09:11 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettingsDBTable;
|
2025-03-25 14:09:11 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommandsDBTable;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
|
|
|
|
|
|
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
|
2024-04-07 21:30:11 +03:00
|
|
|
|
import javafx.util.Pair;
|
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
2024-04-07 21:30:11 +03:00
|
|
|
|
import java.io.File;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
import java.nio.file.Paths;
|
2024-03-21 19:02:08 +03:00
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
|
import java.util.Vector;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class TestsDatabase extends SQLiteDatabase {
|
2025-03-21 17:02:45 +03:00
|
|
|
|
public GroupsDBTable groups;
|
|
|
|
|
|
//--
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public TestDBTable tests;
|
2025-03-20 17:48:18 +03:00
|
|
|
|
public TestFilesDBTable testsFiles;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
//---
|
|
|
|
|
|
public DVMSettingsDBTable dvmSettings;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
public DVMCompilationOptionsSetsDBTable dvmCompilationOptionsSets;
|
|
|
|
|
|
public DVMCompilationOptionsDBTable dvmCompilationOptions;
|
|
|
|
|
|
public DVMEnvironmentsSetsDBTable dvmEnvironmentsSets;
|
|
|
|
|
|
public DVMEnvironmentsDBTable dvmEnvironments;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
public DVMConfigurationDBTable dvmConfigurations;
|
|
|
|
|
|
public DVMConfigurationGroupsDBTable dvmConfigurationGroups;
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public DVMConfigurationTestsDBTable dvmConfigurationTests;
|
|
|
|
|
|
public DVMConfigurationSettingsDBTable dvmConfigurationSettings;
|
2023-12-11 18:29:15 +03:00
|
|
|
|
public DVMPackageDBTable dvmPackages;
|
2025-03-23 18:44:12 +03:00
|
|
|
|
public DVMPackageConfigurationsDBTable dvmPackageConfigurations;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
public DVMRunTasksSet dvmRunTasks = new DVMRunTasksSet();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//--
|
2023-10-03 15:07:17 +03:00
|
|
|
|
public ServerSapforsDBTable serverSapfors;
|
2024-09-27 22:50:47 +03:00
|
|
|
|
public SapforSettingsDBTable sapforSettings;
|
|
|
|
|
|
public SapforSettingsCommandsDBTable sapforSettingsCommands;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
public SapforConfigurationDBTable sapforConfigurations;
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public SapforConfigurationGroupsDBTable sapforConfigurationGroups;
|
|
|
|
|
|
public SapforConfigurationTestsDBTable sapforConfigurationTests;
|
|
|
|
|
|
public SapforConfigurationSettingsDBTable sapforConfigurationSettings;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
public SapforPackageDBTable sapforPackages;
|
2025-03-23 18:44:12 +03:00
|
|
|
|
public SapforPackageConfigurationsDBTable sapforPackageConfigurations;
|
2025-03-21 17:02:45 +03:00
|
|
|
|
//--
|
|
|
|
|
|
public TestingPackagesToKillDBTable testingPackagesToKill;
|
2024-04-21 23:23:57 +03:00
|
|
|
|
//--
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public TestsDatabase() {
|
2023-11-14 20:08:19 +03:00
|
|
|
|
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void initAllTables() throws Exception {
|
|
|
|
|
|
addTable(groups = new GroupsDBTable());
|
|
|
|
|
|
addTable(tests = new TestDBTable());
|
2025-03-20 17:48:18 +03:00
|
|
|
|
addTable(testsFiles = new TestFilesDBTable());
|
2025-03-21 17:02:45 +03:00
|
|
|
|
//--
|
|
|
|
|
|
addTable(dvmSettings = new DVMSettingsDBTable());
|
2025-03-25 01:56:48 +03:00
|
|
|
|
//--
|
|
|
|
|
|
addTable(dvmCompilationOptionsSets = new DVMCompilationOptionsSetsDBTable());
|
|
|
|
|
|
addTable(dvmCompilationOptions = new DVMCompilationOptionsDBTable());
|
2025-03-25 14:09:11 +03:00
|
|
|
|
addTable(dvmEnvironmentsSets = new DVMEnvironmentsSetsDBTable());
|
2025-03-25 01:56:48 +03:00
|
|
|
|
addTable(dvmEnvironments = new DVMEnvironmentsDBTable());
|
|
|
|
|
|
//---
|
2025-03-21 17:02:45 +03:00
|
|
|
|
addTable(dvmConfigurations = new DVMConfigurationDBTable());
|
|
|
|
|
|
addTable(dvmConfigurationGroups = new DVMConfigurationGroupsDBTable());
|
2025-03-23 02:14:23 +03:00
|
|
|
|
addTable(dvmConfigurationTests = new DVMConfigurationTestsDBTable());
|
|
|
|
|
|
addTable(dvmConfigurationSettings = new DVMConfigurationSettingsDBTable());
|
2023-12-11 18:29:15 +03:00
|
|
|
|
addTable(dvmPackages = new DVMPackageDBTable());
|
2025-03-23 21:24:09 +03:00
|
|
|
|
addTable(dvmPackageConfigurations = new DVMPackageConfigurationsDBTable());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//-
|
2023-10-03 15:07:17 +03:00
|
|
|
|
addTable(serverSapfors = new ServerSapforsDBTable());
|
2024-09-27 22:50:47 +03:00
|
|
|
|
addTable(sapforSettings = new SapforSettingsDBTable());
|
|
|
|
|
|
addTable(sapforSettingsCommands = new SapforSettingsCommandsDBTable());
|
2025-03-21 17:02:45 +03:00
|
|
|
|
addTable(sapforConfigurations = new SapforConfigurationDBTable());
|
2025-03-23 02:14:23 +03:00
|
|
|
|
addTable(sapforConfigurationGroups = new SapforConfigurationGroupsDBTable());
|
|
|
|
|
|
addTable(sapforConfigurationTests = new SapforConfigurationTestsDBTable());
|
|
|
|
|
|
addTable(sapforConfigurationSettings = new SapforConfigurationSettingsDBTable());
|
2025-03-21 17:02:45 +03:00
|
|
|
|
addTable(sapforPackages = new SapforPackageDBTable());
|
2025-03-23 18:44:12 +03:00
|
|
|
|
addTable(sapforPackageConfigurations = new SapforPackageConfigurationsDBTable());
|
2025-03-21 17:02:45 +03:00
|
|
|
|
//--
|
|
|
|
|
|
addTable(testingPackagesToKill = new TestingPackagesToKillDBTable());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2024-10-09 23:37:58 +03:00
|
|
|
|
public PassCode getSynchronizePassCode() {
|
|
|
|
|
|
return PassCode.SynchronizeTests;
|
2023-11-16 16:20:20 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
public Vector<SapforPackage> getFirstActiveSapforPackagesCopies() {
|
|
|
|
|
|
Vector<SapforPackage> res = new Vector<>();
|
|
|
|
|
|
Vector<SapforPackage> packages = new Vector<>();
|
|
|
|
|
|
SapforPackage activePackage = null;
|
|
|
|
|
|
//1. получить активные пакеты.
|
|
|
|
|
|
for (SapforPackage p : sapforPackages.Data.values()) {
|
|
|
|
|
|
switch (p.state) {
|
|
|
|
|
|
case Done:
|
|
|
|
|
|
case Aborted:
|
|
|
|
|
|
case Draft:
|
2024-04-08 01:30:46 +03:00
|
|
|
|
case ConnectionError:
|
2024-09-25 01:27:02 +03:00
|
|
|
|
case DoneWithErrors:
|
2024-03-21 19:02:08 +03:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
packages.add(p);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//2. отсортировать по приоритету.
|
|
|
|
|
|
packages.sort(new Comparator<SapforPackage>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int compare(SapforPackage o1, SapforPackage o2) {
|
|
|
|
|
|
return Integer.compare(o1.state.ordinal(), o2.state.ordinal());
|
2023-12-14 02:30:56 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
});
|
|
|
|
|
|
if (!packages.isEmpty()) {
|
|
|
|
|
|
activePackage = packages.lastElement();
|
|
|
|
|
|
if (activePackage.state.equals(TasksPackageState.Queued)) {
|
|
|
|
|
|
activePackage.state = TasksPackageState.TestsSynchronize;
|
2023-12-14 02:30:56 +03:00
|
|
|
|
try {
|
2024-03-21 19:02:08 +03:00
|
|
|
|
Update(activePackage);
|
2023-12-14 02:30:56 +03:00
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
res.add(new SapforPackage(activePackage));
|
|
|
|
|
|
; //копия чтобы не было конфликта доступа с нитью планировщика.
|
2023-12-14 02:30:56 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
return res;
|
2023-12-14 02:30:56 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
public Vector<DVMPackage> getFirstActiveDVMPackagesCopies() {
|
|
|
|
|
|
Vector<DVMPackage> res = new Vector<>();
|
|
|
|
|
|
//--
|
|
|
|
|
|
LinkedHashMap<String, Vector<DVMPackage>> packagesByMachines = new LinkedHashMap<>();
|
|
|
|
|
|
//----
|
|
|
|
|
|
//1. Получить список активных пакетов по машинам.
|
|
|
|
|
|
for (DVMPackage dvmPackage : dvmPackages.Data.values()) {
|
|
|
|
|
|
switch (dvmPackage.state) {
|
|
|
|
|
|
case Done:
|
2024-09-25 01:27:02 +03:00
|
|
|
|
case DoneWithErrors:
|
2024-03-21 19:02:08 +03:00
|
|
|
|
case Aborted:
|
|
|
|
|
|
case Draft:
|
2024-04-08 01:30:46 +03:00
|
|
|
|
case ConnectionError:
|
2024-03-21 19:02:08 +03:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
//активен.
|
|
|
|
|
|
Vector<DVMPackage> packages = null;
|
|
|
|
|
|
//--
|
|
|
|
|
|
if (packagesByMachines.containsKey(dvmPackage.machine_address)) {
|
|
|
|
|
|
packages = packagesByMachines.get(dvmPackage.machine_address);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
packages = new Vector<>();
|
|
|
|
|
|
packagesByMachines.put(dvmPackage.machine_address, packages);
|
|
|
|
|
|
}
|
|
|
|
|
|
packages.add(dvmPackage);
|
|
|
|
|
|
break;
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
//2. Выбрать для каждой машины наиболее приоритетный пакет.
|
|
|
|
|
|
for (String machine : packagesByMachines.keySet()) {
|
|
|
|
|
|
Vector<DVMPackage> packages = packagesByMachines.get(machine);
|
|
|
|
|
|
if (!packages.isEmpty()) {
|
|
|
|
|
|
packages.sort(new Comparator<DVMPackage>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int compare(DVMPackage o1, DVMPackage o2) {
|
|
|
|
|
|
return Integer.compare(o1.state.ordinal(), o2.state.ordinal());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//-
|
|
|
|
|
|
DVMPackage activePackage = packages.lastElement();
|
|
|
|
|
|
if (activePackage.state.equals(TasksPackageState.Queued)) {
|
|
|
|
|
|
activePackage.state = TasksPackageState.TestsSynchronize;
|
|
|
|
|
|
try {
|
|
|
|
|
|
Update(activePackage);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
res.add(new DVMPackage(activePackage)); //копия чтобы не было конфликта доступа с нитью планировщика.
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-21 19:02:08 +03:00
|
|
|
|
return res;
|
2023-12-16 03:57:01 +03:00
|
|
|
|
}
|
2024-04-07 21:30:11 +03:00
|
|
|
|
//--
|
2025-03-06 21:48:51 +03:00
|
|
|
|
public void DetectTestMinMaxDim(ServerSapfor serverSapfor, Group group, Test test) throws Exception {
|
|
|
|
|
|
switch (group.language) {
|
|
|
|
|
|
case fortran:
|
|
|
|
|
|
if (serverSapfor != null) {
|
|
|
|
|
|
Sapfor.getTestMinMaxDim_F(new File(serverSapfor.call_command), test);
|
|
|
|
|
|
Update(test);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case c:
|
|
|
|
|
|
Sapfor.getTestMinMaxDime_C(test);
|
|
|
|
|
|
Update(test);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-20 17:48:18 +03:00
|
|
|
|
public void importTestFile(Test test, File file) throws Exception {
|
2024-04-07 21:30:11 +03:00
|
|
|
|
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
2024-10-14 12:54:52 +03:00
|
|
|
|
Utils_.CheckAndCleanDirectory(testDirectory);
|
2025-03-20 17:48:18 +03:00
|
|
|
|
File dst = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
|
|
|
|
|
FileUtils.copyFile(file, dst);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
}
|
2025-02-18 20:14:14 +03:00
|
|
|
|
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
2024-04-07 21:30:11 +03:00
|
|
|
|
Test test = new Test();
|
|
|
|
|
|
test.description = testDescription;
|
|
|
|
|
|
test.sender_name = account.name;
|
|
|
|
|
|
test.sender_address = account.email;
|
|
|
|
|
|
test.group_id = group.id;
|
|
|
|
|
|
Insert(test);
|
|
|
|
|
|
//->>
|
2025-03-20 17:48:18 +03:00
|
|
|
|
importTestFile(test, file);
|
2025-03-21 23:02:53 +03:00
|
|
|
|
TestFile testFile = new TestFile(test, file);
|
2025-03-20 17:48:18 +03:00
|
|
|
|
Insert(testFile);
|
|
|
|
|
|
//--
|
|
|
|
|
|
DetectTestMinMaxDim(sapfor, group, test);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
}
|
2025-02-18 20:14:14 +03:00
|
|
|
|
public void RefreshGroup(UserAccount account, ServerSapfor sapfor, Pair<Group, Vector<File>> groupData) throws Exception {
|
2024-04-07 21:30:11 +03:00
|
|
|
|
Group group = groupData.getKey();
|
|
|
|
|
|
Vector<File> files = groupData.getValue();
|
|
|
|
|
|
//--
|
2024-04-15 22:09:10 +03:00
|
|
|
|
Group oldGroup = groups.getGroupByDescription(group.language, group.description);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
if (oldGroup == null) {
|
|
|
|
|
|
Insert(group);
|
|
|
|
|
|
for (File file : files) {
|
2024-10-11 00:00:30 +03:00
|
|
|
|
String testDescription = Utils_.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
|
2024-04-07 21:30:11 +03:00
|
|
|
|
CreateTestFromSingleFile(account, sapfor, group, file, testDescription);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (File file : files) {
|
2024-10-11 00:00:30 +03:00
|
|
|
|
String testDescription = Utils_.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
|
2025-03-20 17:48:18 +03:00
|
|
|
|
Test oldTest = tests.getStandardTestByDescription(oldGroup.id, testDescription);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
if (oldTest == null) {
|
2025-03-21 23:02:53 +03:00
|
|
|
|
CreateTestFromSingleFile(account, sapfor, oldGroup, file, testDescription);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
} else {
|
2025-03-20 17:48:18 +03:00
|
|
|
|
importTestFile(oldTest, file);
|
2024-04-07 21:30:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-15 22:09:10 +03:00
|
|
|
|
public Vector<DVMPackage> getFirstActiveDVMPackageCopyForMachineURL(String arg) {
|
|
|
|
|
|
Vector<DVMPackage> res = new Vector<>();
|
|
|
|
|
|
Vector<DVMPackage> machinePackages = new Vector<>();
|
|
|
|
|
|
//--
|
|
|
|
|
|
//1. Получить список активных пакетов для машины.
|
|
|
|
|
|
for (DVMPackage dvmPackage : dvmPackages.Data.values()) {
|
|
|
|
|
|
switch (dvmPackage.state) {
|
|
|
|
|
|
case Done:
|
2024-09-25 01:27:02 +03:00
|
|
|
|
case DoneWithErrors:
|
2024-04-15 22:09:10 +03:00
|
|
|
|
case Aborted:
|
|
|
|
|
|
case Draft:
|
|
|
|
|
|
case ConnectionError:
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2025-02-21 01:57:15 +03:00
|
|
|
|
if (dvmPackage.getMachineURL().equals(arg))
|
2024-04-15 22:09:10 +03:00
|
|
|
|
machinePackages.add(dvmPackage);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!machinePackages.isEmpty()) {
|
|
|
|
|
|
machinePackages.sort(new Comparator<DVMPackage>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int compare(DVMPackage o1, DVMPackage o2) {
|
|
|
|
|
|
return Integer.compare(o1.state.ordinal(), o2.state.ordinal());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//-
|
|
|
|
|
|
DVMPackage activePackage = machinePackages.lastElement();
|
|
|
|
|
|
if (activePackage.state.equals(TasksPackageState.Queued)) {
|
|
|
|
|
|
activePackage.state = TasksPackageState.TestsSynchronize;
|
|
|
|
|
|
try {
|
|
|
|
|
|
Update(activePackage);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-05-07 01:06:47 +03:00
|
|
|
|
res.add(new DVMPackage(activePackage));
|
2024-04-15 22:09:10 +03:00
|
|
|
|
}
|
|
|
|
|
|
return res;
|
2024-04-13 20:09:26 +03:00
|
|
|
|
}
|
2024-05-07 01:06:47 +03:00
|
|
|
|
public ServerSapfor getSapforCopyForCompilation() {
|
2024-09-27 22:50:47 +03:00
|
|
|
|
for (ServerSapfor serverSapfor : serverSapfors.Data.values()) {
|
|
|
|
|
|
if (serverSapfor.state.equals(ServerSapforState.Queued)) {
|
2024-05-07 01:06:47 +03:00
|
|
|
|
return new ServerSapfor(serverSapfor);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2025-03-13 00:32:20 +03:00
|
|
|
|
public ServerSapfor getSapforForVersion(String version_in) {
|
|
|
|
|
|
for (ServerSapfor serverSapfor : serverSapfors.Data.values()) {
|
2025-03-12 21:04:22 +03:00
|
|
|
|
if (serverSapfor.version.equals(version_in))
|
|
|
|
|
|
return serverSapfor;
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-05-08 01:56:17 +03:00
|
|
|
|
public Integer getInstalledSapforMaxVersion() {
|
2024-10-07 14:22:52 +03:00
|
|
|
|
int max_version = CommonConstants.Nan;
|
2024-05-08 01:56:17 +03:00
|
|
|
|
for (ServerSapfor sapfor : serverSapfors.Data.values()) {
|
|
|
|
|
|
if (sapfor.state.equals(ServerSapforState.Done)) {
|
2024-10-07 14:22:52 +03:00
|
|
|
|
int version = CommonConstants.Nan;
|
2024-05-08 01:56:17 +03:00
|
|
|
|
try {
|
|
|
|
|
|
version = Integer.parseInt(sapfor.version);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (version > max_version) max_version = version;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return max_version;
|
|
|
|
|
|
}
|
2024-09-27 22:50:47 +03:00
|
|
|
|
public boolean hasActiveSapfors() {
|
|
|
|
|
|
for (ServerSapfor serverSapfor : serverSapfors.Data.values()) {
|
|
|
|
|
|
if (serverSapfor.state.isActive())
|
|
|
|
|
|
return true;
|
2024-05-17 01:33:39 +03:00
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2024-09-27 22:50:47 +03:00
|
|
|
|
public void UnselectAllGTC() {
|
2024-10-22 15:25:06 +03:00
|
|
|
|
groups.getUI().SelectAll(false);
|
|
|
|
|
|
tests.getUI().SelectAll(false);
|
2024-11-15 00:44:23 +03:00
|
|
|
|
dvmConfigurations.getUI().SelectAll(false);
|
2024-09-10 01:50:44 +03:00
|
|
|
|
}
|
2024-10-06 21:18:53 +03:00
|
|
|
|
//todo возможно рассмотреть вариант с синхроннизацией тестов для пакетов через команду серверу а не в нити
|
|
|
|
|
|
//во избежание конфликта доступа,или удалением тестов во время копирования(?)
|
2025-02-18 23:45:24 +03:00
|
|
|
|
@Override
|
2025-03-13 00:32:20 +03:00
|
|
|
|
public void DropUI() {
|
2025-02-18 23:45:24 +03:00
|
|
|
|
super.DropUI();
|
2025-02-04 16:06:49 +03:00
|
|
|
|
dvmConfigurations.ClearUI();
|
|
|
|
|
|
groups.ClearUI();
|
|
|
|
|
|
sapforConfigurations.ClearUI();
|
|
|
|
|
|
serverSapfors.ClearUI();
|
|
|
|
|
|
dvmPackages.ClearUI();
|
|
|
|
|
|
sapforPackages.ClearUI();
|
|
|
|
|
|
sapforSettings.ClearUI();
|
|
|
|
|
|
dvmSettings.ClearUI();
|
|
|
|
|
|
}
|
2025-02-18 23:45:24 +03:00
|
|
|
|
@Override
|
2025-03-13 00:32:20 +03:00
|
|
|
|
public void ResetUI() {
|
2025-02-04 16:06:49 +03:00
|
|
|
|
VisualCaches.ClearDataForClass(DVMConfiguration.class);
|
|
|
|
|
|
VisualCaches.ClearDataForClass(SapforConfiguration.class);
|
|
|
|
|
|
VisualCaches.ClearDataForClass(DVMPackage.class);
|
|
|
|
|
|
VisualCaches.ClearDataForClass(SapforPackage.class);
|
|
|
|
|
|
//server.db.machines
|
|
|
|
|
|
dvmConfigurations.ShowUI();
|
|
|
|
|
|
groups.ShowUI();
|
|
|
|
|
|
sapforConfigurations.ShowUI();
|
|
|
|
|
|
serverSapfors.ShowUI();
|
|
|
|
|
|
dvmPackages.ShowUI();
|
|
|
|
|
|
sapforPackages.ShowUI();
|
|
|
|
|
|
sapforSettings.ShowUI();
|
|
|
|
|
|
dvmSettings.ShowUI();
|
2025-02-18 23:45:24 +03:00
|
|
|
|
super.ResetUI();
|
2025-02-04 16:06:49 +03:00
|
|
|
|
}
|
2025-03-21 23:02:53 +03:00
|
|
|
|
public void saveTestFiles(Test test) throws Exception {
|
2025-03-20 17:48:18 +03:00
|
|
|
|
for (TestFile file : test.files) {
|
|
|
|
|
|
file.test_id = test.id;
|
|
|
|
|
|
Insert(file);
|
|
|
|
|
|
}
|
|
|
|
|
|
test.files = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void DeleteTestFiles(Test test) throws Exception {
|
|
|
|
|
|
Vector<TestFile> files = getVectorByFK(test, TestFile.class);
|
|
|
|
|
|
for (TestFile file : files)
|
|
|
|
|
|
Delete(file);
|
|
|
|
|
|
}
|
2025-03-23 22:03:17 +03:00
|
|
|
|
public void saveDVMPackageConfigurations(DVMPackage dvmPackage) throws Exception {
|
|
|
|
|
|
for (DVMPackageConfiguration packageConfiguration : dvmPackage.configurations) {
|
|
|
|
|
|
packageConfiguration.dvmpackage_id = dvmPackage.id;
|
|
|
|
|
|
Insert(packageConfiguration);
|
|
|
|
|
|
}
|
|
|
|
|
|
dvmPackage.configurations = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void saveSapforPackageConfigurations(SapforPackage dvmPackage) throws Exception {
|
|
|
|
|
|
for (SapforPackageConfiguration packageConfiguration : dvmPackage.configurations) {
|
|
|
|
|
|
packageConfiguration.sapforpackage_id = dvmPackage.id;
|
|
|
|
|
|
Insert(packageConfiguration);
|
|
|
|
|
|
}
|
|
|
|
|
|
dvmPackage.configurations = null;
|
|
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public Vector<Integer> getDVMConfigurationGroupsIds(DVMConfiguration configuration) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
for (DVMConfigurationGroup dvmConfigurationGroup : dvmConfigurationGroups.Data.values()) {
|
|
|
|
|
|
if (dvmConfigurationGroup.dvmconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(dvmConfigurationGroup.group_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Vector<Integer> getDVMConfigurationTestsIds(DVMConfiguration configuration) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
if (configuration.groupsOnly == 0) {
|
|
|
|
|
|
for (DVMConfigurationTest dvmConfigurationTest : dvmConfigurationTests.Data.values()) {
|
|
|
|
|
|
if (dvmConfigurationTest.dvmconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(dvmConfigurationTest.test_id);
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
} else {
|
|
|
|
|
|
Vector<Integer> groups_ids = getDVMConfigurationGroupsIds(configuration);
|
|
|
|
|
|
for (int groud_id : groups_ids)
|
|
|
|
|
|
res.addAll(getFKi(groud_id, Group.class, Test.class));
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Vector<Integer> getDVMConfigurationSettingsIds(DVMConfiguration configuration) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
for (DVMConfigurationSettings dvmConfigurationSettings : dvmConfigurationSettings.Data.values()) {
|
|
|
|
|
|
if (dvmConfigurationSettings.dvmconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(dvmConfigurationSettings.dvmsettings_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
|
|
|
|
|
//--
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public Vector<Integer> getSapforConfigurationGroupsIds(SapforConfiguration configuration) {
|
2025-03-21 23:02:53 +03:00
|
|
|
|
Vector<Integer> res = new Vector<>();
|
2025-03-23 02:14:23 +03:00
|
|
|
|
for (SapforConfigurationGroup sapforConfigurationGroup : sapforConfigurationGroups.Data.values()) {
|
|
|
|
|
|
if (sapforConfigurationGroup.sapforconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(sapforConfigurationGroup.group_id);
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public Vector<Integer> getSapforConfigurationTestsIds(SapforConfiguration configuration) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
if (configuration.groupsOnly == 0) {
|
|
|
|
|
|
for (SapforConfigurationTest sapforConfigurationTest : sapforConfigurationTests.Data.values()) {
|
|
|
|
|
|
if (sapforConfigurationTest.sapforconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(sapforConfigurationTest.test_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Vector<Integer> groups_ids = getSapforConfigurationGroupsIds(configuration);
|
|
|
|
|
|
for (int groud_id : groups_ids)
|
|
|
|
|
|
res.addAll(getFKi(groud_id, Group.class, Test.class));
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public Vector<Integer> getSapforConfigurationSettingsIds(SapforConfiguration configuration) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
for (SapforConfigurationSettings sapforConfigurationSettings : sapforConfigurationSettings.Data.values()) {
|
|
|
|
|
|
if (sapforConfigurationSettings.sapforconfiguration_id == configuration.id)
|
|
|
|
|
|
res.add(sapforConfigurationSettings.sapforsettings_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
2025-03-21 23:02:53 +03:00
|
|
|
|
public LinkedHashMap<Integer, Vector<Integer>> getDVMConfigurationGroupsTestsIds(DVMConfiguration configuration) {
|
2025-03-23 02:14:23 +03:00
|
|
|
|
LinkedHashMap<Integer, Vector<Integer>> res = new LinkedHashMap<>();
|
|
|
|
|
|
Vector<Integer> all_tests_ids = getDVMConfigurationTestsIds(configuration);
|
|
|
|
|
|
for (int group_id : getDVMConfigurationGroupsIds(configuration)) {
|
|
|
|
|
|
Vector<Integer> test_ids = new Vector<>();
|
|
|
|
|
|
for (int test_id : all_tests_ids) {
|
|
|
|
|
|
if (tests.get(test_id).group_id == group_id)
|
|
|
|
|
|
test_ids.add(test_id);
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
res.put(group_id, test_ids);
|
2025-03-21 23:02:53 +03:00
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2025-03-23 02:14:23 +03:00
|
|
|
|
public LinkedHashMap<Integer, Vector<Integer>> getSapforConfigurationGroupsTestsIds(SapforConfiguration configuration) {
|
|
|
|
|
|
LinkedHashMap<Integer, Vector<Integer>> res = new LinkedHashMap<>();
|
|
|
|
|
|
Vector<Integer> all_tests_ids = getSapforConfigurationTestsIds(configuration);
|
|
|
|
|
|
for (int group_id : getSapforConfigurationGroupsIds(configuration)) {
|
|
|
|
|
|
Vector<Integer> test_ids = new Vector<>();
|
|
|
|
|
|
for (int test_id : all_tests_ids) {
|
|
|
|
|
|
if (tests.get(test_id).group_id == group_id)
|
|
|
|
|
|
test_ids.add(test_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
res.put(group_id, test_ids);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
2025-03-23 21:24:09 +03:00
|
|
|
|
public Vector<Integer> getDVMPackageConfigurationsIds(DVMPackage dvmPackage) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
for (DVMPackageConfiguration dvmPackageConfiguration : dvmPackageConfigurations.Data.values()) {
|
|
|
|
|
|
if (dvmPackageConfiguration.dvmpackage_id == dvmPackage.id)
|
|
|
|
|
|
res.add(dvmPackageConfiguration.dvmconfiguration_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Vector<Integer> getSapforPackageConfigurationsIds(SapforPackage sapforPackage) {
|
|
|
|
|
|
Vector<Integer> res = new Vector<>();
|
|
|
|
|
|
for (SapforPackageConfiguration sapforPackageConfiguration : sapforPackageConfigurations.Data.values()) {
|
|
|
|
|
|
if (sapforPackageConfiguration.sapforpackage_id == sapforPackage.id)
|
|
|
|
|
|
res.add(sapforPackageConfiguration.sapforconfiguration_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2025-03-25 01:56:48 +03:00
|
|
|
|
//--
|
|
|
|
|
|
public OptionsSetJson convertOptionsToJson(DVMSettings dvmSettings_in) {
|
|
|
|
|
|
OptionsSetJson res = new OptionsSetJson();
|
|
|
|
|
|
if (dvmSettings_in.id != CommonConstants.Nan) {
|
|
|
|
|
|
Vector<DVMCompilationOptionsSet> optionsSets = getVectorByFK(dvmSettings_in, DVMCompilationOptionsSet.class);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMCompilationOptionsSet optionsSet : optionsSets) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
Vector<DVMCompilationOption> options = getVectorByFK(optionsSet, DVMCompilationOption.class);
|
|
|
|
|
|
OptionsJson optionsJson = new OptionsJson();
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMCompilationOption option : options) {
|
|
|
|
|
|
optionsJson.values.add(new OptionJson(option.name, option.value));
|
2025-03-25 01:56:48 +03:00
|
|
|
|
}
|
|
|
|
|
|
res.values.add(optionsJson);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public EnvironmentsSetJson convertEnvironmentsToJson(DVMSettings dvmSettings_in) {
|
|
|
|
|
|
EnvironmentsSetJson res = new EnvironmentsSetJson();
|
|
|
|
|
|
if (dvmSettings_in.id != CommonConstants.Nan) {
|
|
|
|
|
|
Vector<DVMEnvironmentsSet> environmentsSets = getVectorByFK(dvmSettings_in, DVMEnvironmentsSet.class);
|
|
|
|
|
|
for (DVMEnvironmentsSet environmentsSet : environmentsSets) {
|
|
|
|
|
|
Vector<DVMEnvironment> environments = getVectorByFK(environmentsSet, DVMEnvironment.class);
|
|
|
|
|
|
EnvironmentsJson environmentsJson = new EnvironmentsJson();
|
|
|
|
|
|
for (DVMEnvironment option : environments) {
|
|
|
|
|
|
environmentsJson.values.add(new EnvironmentJson(option.name, option.value));
|
|
|
|
|
|
}
|
|
|
|
|
|
res.values.add(environmentsJson);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void DeleteDVMSettingsOptions(DVMSettings dvmSettings) throws Exception {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
Vector<DVMCompilationOptionsSet> optionsSets = getVectorByFK(dvmSettings, DVMCompilationOptionsSet.class);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMCompilationOptionsSet optionsSet : optionsSets) {
|
|
|
|
|
|
DeleteDependencies(optionsSet);
|
|
|
|
|
|
Delete(optionsSet);
|
2025-03-25 01:56:48 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public void InsertDVMSettingsOptions(DVMSettings dvmSettings) throws Exception {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
OptionsSetJson optionsSetJson = Utils_.gson.fromJson(dvmSettings.packedCompilationOptionsJson, OptionsSetJson.class);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (OptionsJson optionsJson : optionsSetJson.values) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
DVMCompilationOptionsSet optionsSet = new DVMCompilationOptionsSet(dvmSettings);
|
|
|
|
|
|
Insert(optionsSet);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (OptionJson optionJson : optionsJson.values) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
DVMCompilationOption option = new DVMCompilationOption();
|
2025-03-25 14:09:11 +03:00
|
|
|
|
option.dvmcompilationoptionsset_id = optionsSet.id;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
option.name = optionJson.name;
|
|
|
|
|
|
option.value = optionJson.value;
|
|
|
|
|
|
Insert(option);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public void DeleteDVMSettingsEnvironments(DVMSettings dvmSettings) throws Exception {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
Vector<DVMEnvironmentsSet> environmentsSets = getVectorByFK(dvmSettings, DVMEnvironmentsSet.class);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMEnvironmentsSet environmentsSet : environmentsSets) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
DeleteDependencies(environmentsSet);
|
|
|
|
|
|
Delete(environmentsSet);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public void InsertDVMSettingsEnvironments(DVMSettings dvmSettings) throws Exception {
|
|
|
|
|
|
EnvironmentsSetJson environmentsSetJson = Utils_.gson.fromJson(dvmSettings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
|
|
|
|
|
for (EnvironmentsJson environmentsJson : environmentsSetJson.values) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
DVMEnvironmentsSet environmentsSet = new DVMEnvironmentsSet(dvmSettings);
|
|
|
|
|
|
Insert(environmentsSet);
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (EnvironmentJson environmentJson : environmentsJson.values) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
DVMEnvironment environment = new DVMEnvironment();
|
2025-03-25 14:09:11 +03:00
|
|
|
|
environment.dvmenvironmentsset_id = environmentsSet.id;
|
2025-03-25 01:56:48 +03:00
|
|
|
|
environment.name = environmentJson.name;
|
|
|
|
|
|
environment.value = environmentJson.value;
|
|
|
|
|
|
Insert(environment);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public void CloneDVMSettings(DVMSettings dvmSettings_src, DVMSettings dvmSettings_dst) throws Exception {
|
|
|
|
|
|
//--
|
|
|
|
|
|
Vector<DVMCompilationOptionsSet> optionsSets_src = getVectorByFK(dvmSettings_src, DVMCompilationOptionsSet.class);
|
|
|
|
|
|
for (DVMCompilationOptionsSet optionsSet_src : optionsSets_src) {
|
|
|
|
|
|
DVMCompilationOptionsSet optionsSet_dst = new DVMCompilationOptionsSet(dvmSettings_dst);
|
|
|
|
|
|
Insert(optionsSet_dst);
|
|
|
|
|
|
//--
|
|
|
|
|
|
Vector<DVMCompilationOption> options_src = getVectorByFK(optionsSet_src, DVMCompilationOption.class);
|
|
|
|
|
|
Vector<DVMCompilationOption> options_dst = new Vector<>();
|
|
|
|
|
|
//--
|
|
|
|
|
|
for (DVMCompilationOption option_src : options_src) {
|
|
|
|
|
|
DVMCompilationOption option_dst = new DVMCompilationOption();
|
|
|
|
|
|
option_dst.dvmcompilationoptionsset_id = optionsSet_dst.id;
|
|
|
|
|
|
option_dst.name = option_src.name;
|
|
|
|
|
|
option_dst.value = option_src.value;
|
|
|
|
|
|
Insert(option_dst);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
|
|
|
|
|
Vector<DVMEnvironmentsSet> environmentsSets_src = getVectorByFK(dvmSettings_src, DVMEnvironmentsSet.class);
|
|
|
|
|
|
for (DVMEnvironmentsSet environmentsSet_src : environmentsSets_src) {
|
|
|
|
|
|
DVMEnvironmentsSet environmentsSet_dst = new DVMEnvironmentsSet(dvmSettings_dst);
|
|
|
|
|
|
Insert(environmentsSet_dst);
|
|
|
|
|
|
//--
|
|
|
|
|
|
Vector<DVMEnvironment> environments_src = getVectorByFK(environmentsSet_src, DVMEnvironment.class);
|
|
|
|
|
|
Vector<DVMEnvironment> environments_dst = new Vector<>();
|
|
|
|
|
|
//--
|
|
|
|
|
|
for (DVMEnvironment environment_src : environments_src) {
|
|
|
|
|
|
DVMEnvironment environment_dst = new DVMEnvironment();
|
|
|
|
|
|
environment_dst.dvmenvironmentsset_id = environmentsSet_dst.id;
|
|
|
|
|
|
environment_dst.name = environment_src.name;
|
|
|
|
|
|
environment_dst.value = environment_src.value;
|
|
|
|
|
|
Insert(environment_dst);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void CloneSapforSettings(SapforSettings src, SapforSettings dst) throws Exception {
|
|
|
|
|
|
for (SapforSettingsCommand src_command : getVectorByFK(src, SapforSettingsCommand.class)) {
|
|
|
|
|
|
SapforSettingsCommand dst_command = new SapforSettingsCommand();
|
|
|
|
|
|
dst_command.sapforsettings_id = dst.id;
|
|
|
|
|
|
dst_command.passCode = src_command.passCode;
|
|
|
|
|
|
Insert(dst_command);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
2025-03-25 01:56:48 +03:00
|
|
|
|
public void Patch() throws Exception {
|
|
|
|
|
|
/*
|
|
|
|
|
|
Vector<DVMCompilationOptionsSet> sets = new Vector<>();
|
|
|
|
|
|
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
|
|
|
|
|
OptionsSetJson optionsSetJson = Utils_.gson.fromJson(dvm_settings.packedCompilationOptionsJson, OptionsSetJson.class);
|
|
|
|
|
|
for (OptionsJson optionsJson : optionsSetJson.values) {
|
|
|
|
|
|
DVMCompilationOptionsSet set = new DVMCompilationOptionsSet(dvm_settings);
|
|
|
|
|
|
set.options = new Vector<>();
|
|
|
|
|
|
for (OptionJson optionJson : optionsJson.values) {
|
|
|
|
|
|
set.options.add(new DVMCompilationOption(optionJson.name, optionJson.value));
|
|
|
|
|
|
}
|
|
|
|
|
|
sets.add(set);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
BeginTransaction();
|
|
|
|
|
|
for (DVMCompilationOptionsSet set : sets) {
|
|
|
|
|
|
Insert(set);
|
|
|
|
|
|
|
|
|
|
|
|
for (DVMCompilationOption option : set.options) {
|
|
|
|
|
|
option.dvmcompilationoptionsset_id = set.id;
|
|
|
|
|
|
Insert(option);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Commit();
|
|
|
|
|
|
*/
|
|
|
|
|
|
/*
|
|
|
|
|
|
Vector<DVMEnvironmentsSet> sets = new Vector<>();
|
|
|
|
|
|
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
|
|
|
|
|
EnvironmentsSetJson environmentsSetJson = Utils_.gson.fromJson(dvm_settings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
|
|
|
|
|
for (EnvironmentsJson environmentsJson : environmentsSetJson.values) {
|
|
|
|
|
|
DVMEnvironmentsSet set = new DVMEnvironmentsSet(dvm_settings);
|
|
|
|
|
|
set.environments = new Vector<>();
|
|
|
|
|
|
for (EnvironmentJson environmentJson : environmentsJson.values) {
|
|
|
|
|
|
set.environments.add(new DVMEnvironment(environmentJson.name, environmentJson.value));
|
|
|
|
|
|
}
|
|
|
|
|
|
sets.add(set);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
BeginTransaction();
|
|
|
|
|
|
for (DVMEnvironmentsSet set : sets) {
|
|
|
|
|
|
Insert(set);
|
|
|
|
|
|
for (DVMEnvironment option : set.environments) {
|
|
|
|
|
|
option.dvmenvironmentsset_id = set.id;
|
|
|
|
|
|
Insert(option);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Commit();
|
|
|
|
|
|
*/
|
2025-03-25 14:09:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
public static String printOptionsLine(Vector<DVMCompilationOption> options) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
Vector<String> res = new Vector<>();
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMCompilationOption option : options)
|
2025-03-25 01:56:48 +03:00
|
|
|
|
res.add(option.print());
|
|
|
|
|
|
return String.join(" ", res);
|
|
|
|
|
|
}
|
2025-03-25 14:09:11 +03:00
|
|
|
|
public static String printEnvironmentsLine(Vector<DVMEnvironment> environments) {
|
2025-03-25 01:56:48 +03:00
|
|
|
|
Vector<String> res = new Vector<>();
|
2025-03-25 14:09:11 +03:00
|
|
|
|
for (DVMEnvironment environment : environments)
|
2025-03-25 01:56:48 +03:00
|
|
|
|
res.add(environment.print());
|
|
|
|
|
|
return String.join(" ", res);
|
|
|
|
|
|
}
|
|
|
|
|
|
public Vector<Pair<String, String>> getTasksParameters(DVMSettings dvmSettings_in) {
|
|
|
|
|
|
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
|
|
|
|
|
Vector<Pair<String, String>> res = new Vector<>();
|
|
|
|
|
|
Vector<DVMCompilationOptionsSet> optionsSets = getVectorByFK(dvmSettings_in, DVMCompilationOptionsSet.class);
|
|
|
|
|
|
Vector<DVMEnvironmentsSet> environmentsSets = getVectorByFK(dvmSettings_in, DVMEnvironmentsSet.class);
|
|
|
|
|
|
//--
|
|
|
|
|
|
for (int i = 0; i < optionsSets.size(); ++i) {
|
|
|
|
|
|
Vector<DVMCompilationOption> options = getVectorByFK(optionsSets.get(i), DVMCompilationOption.class);
|
|
|
|
|
|
Vector<DVMEnvironment> environments = getVectorByFK(environmentsSets.get(i), DVMEnvironment.class);
|
|
|
|
|
|
String optionsLine = printOptionsLine(options);
|
|
|
|
|
|
String environmentsLine = (i < environmentsSets.size()) ? printEnvironmentsLine(environments) : "";
|
|
|
|
|
|
res.add(new Pair<>(
|
|
|
|
|
|
optionsLine,
|
|
|
|
|
|
environmentsLine));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (optionsSets.size() < environmentsSets.size()) {
|
|
|
|
|
|
for (int i = optionsSets.size(); i < environmentsSets.size(); ++i) {
|
|
|
|
|
|
res.add(new Pair<>(
|
|
|
|
|
|
"",
|
|
|
|
|
|
printEnvironmentsLine(getVectorByFK(environmentsSets.get(i), DVMEnvironment.class))
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|