промежуточный. изменение Сапфора . теперь можно формировать пакеты.
This commit is contained in:
@@ -118,7 +118,8 @@ public class Global {
|
||||
Utils.CheckDirectory(TestsDirectory = Paths.get(Home, Tests).toFile());
|
||||
Utils.CheckDirectory(PerformanceAnalyzerDirectory = Paths.get(Home, PerformanceAnalyzer).toFile());
|
||||
Utils.CheckDirectory(DVMPackagesDirectory = Paths.get(Home, DVMPackages).toFile());
|
||||
Utils.CheckDirectory(SapforPackagesDirectory = Paths.get(Home, "SapforPackages").toFile());
|
||||
//через пару версий заменить на clean.
|
||||
Utils.CheckAndCleanDirectory(SapforPackagesDirectory = Paths.get(Home, "SapforPackages").toFile());
|
||||
}
|
||||
public static void CheckServerDirectories() {
|
||||
Utils.CheckDirectory(ComponentsDirectory = Paths.get(Home, components).toFile());
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package TestingSystem.Common;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.PerformSapforTask;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
|
||||
import java.io.File;
|
||||
public class TaskThread extends Thread {
|
||||
public SapforTask task = null;
|
||||
public TaskThread(SapforTask task_, File sapfor_drv, SapforConfiguration_json sapforConfiguration_json) {
|
||||
public TaskThread(SapforTask task_, File sapfor_drv,
|
||||
SapforTestingSet_json set_json,
|
||||
SapforConfiguration_json configuration_json) {
|
||||
super(() -> {
|
||||
while (!task_.state.isComplete()) {
|
||||
task_.Reset();
|
||||
new PerformSapforTask().Do(
|
||||
sapfor_drv,
|
||||
sapforConfiguration_json,
|
||||
set_json,
|
||||
configuration_json,
|
||||
task_
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,16 +13,21 @@ import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class SapforTasksPackage_json implements Serializable {
|
||||
public class SapforPackage_json implements Serializable {
|
||||
@Expose
|
||||
public int kernels = 1;
|
||||
@Expose
|
||||
public String sapfor_drv = ""; //файл с сапфором. Имя уникально для сценария.
|
||||
//--
|
||||
@Expose
|
||||
public List<SapforTest_json> tests = new Vector<>();
|
||||
public int max_set_id = 0;
|
||||
public int getMaxSetId(){
|
||||
return max_set_id++;
|
||||
}
|
||||
//--
|
||||
@Expose
|
||||
public List<SapforConfiguration_json> configurations = new Vector<>();
|
||||
//---
|
||||
public List<SapforTestingSet_json> testingSets = new Vector<>(); //сет = конфигурации + тесты.
|
||||
//--
|
||||
@Expose
|
||||
public List<SapforTask> tasks = new Vector<>();
|
||||
//-
|
||||
@@ -1,267 +0,0 @@
|
||||
package TestingSystem.SAPFOR.Json;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
import TestingSystem.SAPFOR.SapforTask.MatchState;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class SapforTasksResults_json implements Serializable {
|
||||
/*
|
||||
//---
|
||||
public PackageSummary root = null;
|
||||
public PackageSummary comparison_root = null;
|
||||
//---
|
||||
@Expose
|
||||
public long StartDate = 0;
|
||||
@Expose
|
||||
public long EndDate = 0;
|
||||
@Expose
|
||||
public List<SapforTask> tasks = new Vector<>();
|
||||
//все задачи по ключам.
|
||||
public LinkedHashMap<String, SapforTask> allTasks = new LinkedHashMap<>();
|
||||
public LinkedHashMap<TaskState, LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>>> sortedTasks = new LinkedHashMap<>();
|
||||
//-- задачи, отсортированные для сравнения.
|
||||
public LinkedHashMap<MatchState, LinkedHashMap<TaskState, LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>>>> comparisonSortedTasks = new LinkedHashMap<>();
|
||||
//----
|
||||
public void buildTree(SapforTasksPackage package_in) {
|
||||
root = new PackageSummary();
|
||||
//---
|
||||
for (TaskState state : sortedTasks.keySet()) {
|
||||
//--
|
||||
StateSummary stateSummary = new StateSummary(state);
|
||||
//--
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> tasksByConfigurations = sortedTasks.get(state);
|
||||
for (int configuration_id : tasksByConfigurations.keySet()) {
|
||||
//--
|
||||
DefaultMutableTreeNode configurationNode = null;
|
||||
//--
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = tasksByConfigurations.get(configuration_id);
|
||||
for (String group : groups_tasks.keySet()) {
|
||||
//--
|
||||
GroupSummary groupSummary = new GroupSummary(group);
|
||||
//--
|
||||
for (SapforTask task : groups_tasks.get(group)) {
|
||||
//--
|
||||
stateSummary.count++;
|
||||
root.count++;
|
||||
//--
|
||||
if (configurationNode == null) {
|
||||
configurationNode = new ConfigurationSummary(configuration_id, task);
|
||||
}
|
||||
//--
|
||||
groupSummary.add(task.getVersionsTree(new File(package_in.getLocalWorkspace(), String.valueOf(configuration_id))));
|
||||
}
|
||||
if (configurationNode != null)
|
||||
configurationNode.add(groupSummary);
|
||||
}
|
||||
stateSummary.add(configurationNode);
|
||||
}
|
||||
if (stateSummary.count > 0) {
|
||||
root.add(stateSummary);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void buildComparisonTree(SapforTasksPackage package_in) {
|
||||
comparison_root = new PackageSummary();
|
||||
for (MatchState match_state : comparisonSortedTasks.keySet()) {
|
||||
//--
|
||||
MatchesSummary matchesSummary = new MatchesSummary(match_state);
|
||||
//---
|
||||
LinkedHashMap<TaskState, LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>>> task_states = comparisonSortedTasks.get(match_state);
|
||||
//---
|
||||
for (TaskState state : task_states.keySet()) {
|
||||
//--
|
||||
StateSummary stateSummary = new StateSummary(state);
|
||||
//--
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> tasksByConfigurations = task_states.get(state);
|
||||
for (int configuration_id : tasksByConfigurations.keySet()) {
|
||||
//--
|
||||
DefaultMutableTreeNode configurationNode = null;
|
||||
//--
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = tasksByConfigurations.get(configuration_id);
|
||||
for (String group : groups_tasks.keySet()) {
|
||||
//--
|
||||
GroupSummary groupSummary = new GroupSummary(group);
|
||||
//--
|
||||
for (SapforTask task : groups_tasks.get(group)) {
|
||||
//--
|
||||
stateSummary.count++;
|
||||
matchesSummary.count++;
|
||||
comparison_root.count++;
|
||||
//--
|
||||
if (configurationNode == null) {
|
||||
configurationNode = new ConfigurationSummary(configuration_id, task);
|
||||
}
|
||||
//--
|
||||
groupSummary.add(task.getVersionsTree(new File(package_in.getLocalWorkspace(), String.valueOf(configuration_id))));
|
||||
}
|
||||
if (configurationNode != null)
|
||||
configurationNode.add(groupSummary);
|
||||
}
|
||||
stateSummary.add(configurationNode);
|
||||
}
|
||||
if (stateSummary.count > 0) {
|
||||
matchesSummary.add(stateSummary);
|
||||
}
|
||||
}
|
||||
//---
|
||||
if (matchesSummary.count > 0) {
|
||||
comparison_root.add(matchesSummary);
|
||||
}
|
||||
}
|
||||
}
|
||||
//----
|
||||
public void SortTasks() {
|
||||
sortedTasks.clear();
|
||||
//--
|
||||
for (TaskState state : TaskState.values()) {
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> configuration_tasks = new LinkedHashMap<>();
|
||||
sortedTasks.put(state, configuration_tasks);
|
||||
//--
|
||||
for (SapforTask task : tasks) {
|
||||
if (task.state.equals(state)) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = null;
|
||||
if (configuration_tasks.containsKey(task.sapfor_configuration_id)) {
|
||||
groups_tasks = configuration_tasks.get(task.sapfor_configuration_id);
|
||||
} else {
|
||||
groups_tasks = new LinkedHashMap<>();
|
||||
configuration_tasks.put(task.sapfor_configuration_id, groups_tasks);
|
||||
}
|
||||
Vector<SapforTask> tasks_ = null;
|
||||
if (groups_tasks.containsKey(task.group_description)) {
|
||||
tasks_ = groups_tasks.get(task.group_description);
|
||||
} else {
|
||||
tasks_ = new Vector<>();
|
||||
groups_tasks.put(task.group_description, tasks_);
|
||||
}
|
||||
tasks_.add(task);
|
||||
}
|
||||
}
|
||||
//--
|
||||
}
|
||||
//--
|
||||
for (TaskState state : TaskState.values()) {
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> configuration_tasks = sortedTasks.get(state);
|
||||
for (int configuration_id : configuration_tasks.keySet()) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = configuration_tasks.get(configuration_id);
|
||||
for (String group : groups_tasks.keySet()) {
|
||||
Vector<SapforTask> tasks_ = groups_tasks.get(group);
|
||||
tasks_.sort(Comparator.comparing(SapforTask::getUniqueKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SortTasksForComparison() {
|
||||
comparisonSortedTasks.clear();
|
||||
//раскидать задачи по состояниям, конфигам, группам
|
||||
for (MatchState matchState : MatchState.values()) {
|
||||
LinkedHashMap<TaskState, LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>>> state_tasks = new LinkedHashMap<>();
|
||||
comparisonSortedTasks.put(matchState, state_tasks);
|
||||
//--
|
||||
for (TaskState state : TaskState.values()) {
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> configuration_tasks = new LinkedHashMap<>();
|
||||
state_tasks.put(state, configuration_tasks);
|
||||
//--
|
||||
for (SapforTask task : tasks) {
|
||||
if (task.match.equals(matchState) && task.state.equals(state)) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = null;
|
||||
if (configuration_tasks.containsKey(task.sapfor_configuration_id)) {
|
||||
groups_tasks = configuration_tasks.get(task.sapfor_configuration_id);
|
||||
} else {
|
||||
groups_tasks = new LinkedHashMap<>();
|
||||
configuration_tasks.put(task.sapfor_configuration_id, groups_tasks);
|
||||
}
|
||||
Vector<SapforTask> tasks = null;
|
||||
if (groups_tasks.containsKey(task.group_description)) {
|
||||
tasks = groups_tasks.get(task.group_description);
|
||||
} else {
|
||||
tasks = new Vector<>();
|
||||
groups_tasks.put(task.group_description, tasks);
|
||||
}
|
||||
tasks.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
}
|
||||
//рассортировать задачи в группах по ключам.
|
||||
for (MatchState matchState : MatchState.values()) {
|
||||
LinkedHashMap<TaskState, LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>>> state_tasks = comparisonSortedTasks.get(matchState);
|
||||
for (TaskState state : TaskState.values()) {
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> configuration_tasks = state_tasks.get(state);
|
||||
for (int configuration_id : configuration_tasks.keySet()) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> groups_tasks = configuration_tasks.get(configuration_id);
|
||||
for (String group : groups_tasks.keySet()) {
|
||||
Vector<SapforTask> tasks_ = groups_tasks.get(group);
|
||||
tasks_.sort(Comparator.comparing(SapforTask::getUniqueKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DropComparison() {
|
||||
comparison_root = null;
|
||||
comparisonSortedTasks.clear();
|
||||
for (SapforTask task : allTasks.values())
|
||||
task.match = MatchState.NotMatch;
|
||||
}
|
||||
//---
|
||||
public String getEmailSummary() {
|
||||
String res = "";
|
||||
Vector<String> summary_lines = new Vector<>();
|
||||
summary_lines.add("Всего задач: " + tasks.size());
|
||||
for (TaskState state : sortedTasks.keySet()) {
|
||||
LinkedHashMap<Integer, LinkedHashMap<String, Vector<SapforTask>>> tasksByConfigurations = sortedTasks.get(state);
|
||||
if (!tasksByConfigurations.isEmpty()) {
|
||||
int count = 0;
|
||||
if (!state.equals(TaskState.Done)) {
|
||||
Vector<String> flagsLines = new Vector<>();
|
||||
for (int configuration_id : tasksByConfigurations.keySet()) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> tasksByGroups = tasksByConfigurations.get(configuration_id);
|
||||
for (String group : tasksByGroups.keySet()) {
|
||||
Vector<SapforTask> tasks = tasksByGroups.get(group);
|
||||
flagsLines.add("Группа " + group + ": " + tasks.size());
|
||||
count += tasks.size();
|
||||
for (SapforTask task : tasks) {
|
||||
task.versionsDescription = task.getVersionsChain();
|
||||
flagsLines.add(
|
||||
"тест: " +
|
||||
Utils.Brackets(task.test_description) + " " +
|
||||
"флаги: "
|
||||
+ Utils.Brackets(task.flags) + " " +
|
||||
"версии: " +
|
||||
task.versionsDescription
|
||||
// + " " + "конфигурация " + task.sapfor_configuration_id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
summary_lines.add(state.getDescription() + " :" + count);
|
||||
summary_lines.addAll(flagsLines);
|
||||
} else {
|
||||
for (int configurationId : tasksByConfigurations.keySet()) {
|
||||
LinkedHashMap<String, Vector<SapforTask>> tasksByGroups = tasksByConfigurations.get(configurationId);
|
||||
for (String group : tasksByGroups.keySet()) {
|
||||
Vector<SapforTask> tasks = tasksByGroups.get(group);
|
||||
for (SapforTask task : tasks)
|
||||
task.versionsDescription = task.getVersionsChain();
|
||||
count += tasks.size();
|
||||
}
|
||||
}
|
||||
summary_lines.add(state.getDescription() + " :" + count);
|
||||
}
|
||||
}
|
||||
}
|
||||
res = String.join("\n", summary_lines);
|
||||
return res;
|
||||
}
|
||||
//---
|
||||
*/
|
||||
}
|
||||
15
src/TestingSystem/SAPFOR/Json/SapforTestingSet_json.java
Normal file
15
src/TestingSystem/SAPFOR/Json/SapforTestingSet_json.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package TestingSystem.SAPFOR.Json;
|
||||
import Common.Constants;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class SapforTestingSet_json implements Serializable {
|
||||
@Expose
|
||||
public int id = Constants.Nan;
|
||||
@Expose
|
||||
public List<SapforTest_json> tests = new Vector<>();
|
||||
@Expose
|
||||
public List<SapforConfiguration_json> configurations = new Vector<>();
|
||||
}
|
||||
@@ -3,9 +3,9 @@ import Common.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTasksPackage_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTasksResults_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTest_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
import TestingSystem.Common.TaskThread;
|
||||
import TestingSystem.Common.ThreadsPlanner.ThreadsPlanner;
|
||||
@@ -17,12 +17,12 @@ import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class PackageModeSupervisor extends ThreadsPlanner {
|
||||
SapforTasksPackage_json package_json = null;
|
||||
SapforPackage_json package_json = null;
|
||||
File sapfor_drv=null;
|
||||
|
||||
public PackageModeSupervisor() throws Exception {
|
||||
super(2000);
|
||||
package_json = (SapforTasksPackage_json) Utils.jsonFromFile(new File(Constants.package_json), SapforTasksPackage_json.class);
|
||||
package_json = (SapforPackage_json) Utils.jsonFromFile(new File(Constants.package_json), SapforPackage_json.class);
|
||||
//--
|
||||
File sapfor_src = new File(package_json.sapfor_drv);
|
||||
sapfor_drv = new File(Global.Home,Utils.getDateName("SAPFOR_F"));
|
||||
@@ -38,24 +38,30 @@ public class PackageModeSupervisor extends ThreadsPlanner {
|
||||
//формирование списка задач.
|
||||
setMaxKernels(package_json.kernels);
|
||||
int max_rask_id=0;
|
||||
for (SapforConfiguration_json sapforConfiguration_json : package_json.configurations) {
|
||||
for (SapforTest_json test : package_json.tests) {
|
||||
//--- чтобы было можно на нее сослаться после выполнения всех нитей.
|
||||
SapforTask task = new SapforTask();
|
||||
task.id = max_rask_id++;
|
||||
task.group_description = test.group_description;
|
||||
task.test_description = test.description;
|
||||
task.flags = sapforConfiguration_json.flags;
|
||||
task.sapfor_configuration_id = sapforConfiguration_json.id;
|
||||
task.sapfortaskspackage_id = Integer.parseInt(new File(Global.Home).getName());
|
||||
package_json.tasks.add(task);
|
||||
Vector<String> codes_s = new Vector<>();
|
||||
for (PassCode_2021 code : sapforConfiguration_json.codes) {
|
||||
codes_s.add(code.toString());
|
||||
for (SapforTestingSet_json set_json: package_json.testingSets) {
|
||||
for (SapforConfiguration_json sapforConfiguration_json : set_json.configurations) {
|
||||
for (SapforTest_json test : set_json.tests) {
|
||||
//--- чтобы было можно на нее сослаться после выполнения всех нитей.
|
||||
SapforTask task = new SapforTask();
|
||||
task.id = max_rask_id++;
|
||||
task.group_description = test.group_description;
|
||||
task.test_description = test.description;
|
||||
task.flags = sapforConfiguration_json.flags;
|
||||
task.sapfor_configuration_id = sapforConfiguration_json.id;
|
||||
task.sapfortaskspackage_id = Integer.parseInt(new File(Global.Home).getName());
|
||||
package_json.tasks.add(task);
|
||||
Vector<String> codes_s = new Vector<>();
|
||||
for (PassCode_2021 code : sapforConfiguration_json.codes) {
|
||||
codes_s.add(code.toString());
|
||||
}
|
||||
task.codes = String.join(" ", codes_s);
|
||||
//---
|
||||
addThread(new TaskThread(task,
|
||||
sapfor_drv,
|
||||
set_json,
|
||||
sapforConfiguration_json)
|
||||
);
|
||||
}
|
||||
task.codes = String.join(" ", codes_s);
|
||||
//---
|
||||
addThread(new TaskThread(task, sapfor_drv, sapforConfiguration_json));
|
||||
}
|
||||
}
|
||||
interruptThread.start();
|
||||
|
||||
@@ -5,6 +5,7 @@ import Common.Utils.Utils;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
import Repository.Component.Sapfor.Sapfor;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforVersion_json;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
@@ -28,7 +29,8 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
}
|
||||
//--
|
||||
File sapfor_drv;
|
||||
SapforConfiguration_json sapforConfiguration_json;
|
||||
SapforTestingSet_json set_json;
|
||||
SapforConfiguration_json configuration_json;
|
||||
SapforVersion_json version_json;
|
||||
//-----
|
||||
File root;
|
||||
@@ -38,12 +40,16 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
sapfor_drv = (File) args[0];
|
||||
sapforConfiguration_json = (SapforConfiguration_json) args[1];
|
||||
target = (SapforTask) args[2];
|
||||
set_json = (SapforTestingSet_json) args[1];
|
||||
configuration_json = (SapforConfiguration_json) args[2];
|
||||
target = (SapforTask) args[3];
|
||||
version_json = null;
|
||||
//--->>
|
||||
parentTask = Paths.get(Global.Home, String.valueOf(sapforConfiguration_json.id), target.test_description).toFile();
|
||||
root = new File(Global.Home, String.valueOf(sapforConfiguration_json.id));
|
||||
parentTask = Paths.get(Global.Home,
|
||||
String.valueOf(set_json.id),
|
||||
String.valueOf(configuration_json.id),
|
||||
target.test_description).toFile();
|
||||
root = new File(Global.Home, String.valueOf(configuration_json.id));
|
||||
task = null;
|
||||
//--->>
|
||||
return true;
|
||||
@@ -61,7 +67,7 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
task = new File(parentTask, "v1");
|
||||
Utils.CheckAndCleanDirectory(task); //папка для преобразования.
|
||||
//если версия пустая, это тоже результат тестирования. Поэтому должна учитываться в древе.
|
||||
target.versions.add(version_json =new SapforVersion_json(
|
||||
target.versions.add(version_json = new SapforVersion_json(
|
||||
root.getAbsolutePath(),
|
||||
task.getAbsolutePath(), code.getDescription()));
|
||||
//---
|
||||
@@ -109,7 +115,7 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
protected void body() throws Exception {
|
||||
target.StartDate = new Date().getTime();
|
||||
target.versions.add(version_json = new SapforVersion_json(target.test_description, ""));
|
||||
for (PassCode_2021 code : sapforConfiguration_json.codes) {
|
||||
for (PassCode_2021 code : configuration_json.codes) {
|
||||
if (parse()) {
|
||||
if (code.equals(PassCode_2021.CreateParallelVariants))
|
||||
variants();
|
||||
|
||||
@@ -3,19 +3,15 @@ import Common.Constants;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Global;
|
||||
import TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
import TestingSystem.SAPFOR.Json.SapforTasksPackage_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
public class SapforPackage extends TestingPackage<SapforTasksPackage_json> {
|
||||
public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
@Description("DEFAULT ''")
|
||||
public String testsNames = "";//имена тестов через ; для отображения
|
||||
//---
|
||||
public int sapforId = Constants.Nan; // так как сапфор на машине.
|
||||
@Description("DEFAULT ''")
|
||||
public String testsIds = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String configurationsIds = "";
|
||||
public SapforPackage(){
|
||||
|
||||
}
|
||||
@@ -28,12 +24,10 @@ public class SapforPackage extends TestingPackage<SapforTasksPackage_json> {
|
||||
SapforPackage p = (SapforPackage) src;
|
||||
testsNames = p.testsNames;
|
||||
sapforId = p.sapforId;
|
||||
testsIds = p.testsIds;
|
||||
configurationsIds = p.configurationsIds;
|
||||
}
|
||||
@Override
|
||||
public Class getJsonClass() {
|
||||
return SapforTasksPackage_json.class;
|
||||
return SapforPackage_json.class;
|
||||
}
|
||||
@Override
|
||||
public File getHomeDirectory() {
|
||||
|
||||
@@ -6,6 +6,7 @@ public class SapforPackagesBar extends DataMenuBar {
|
||||
super("пакеты задач SAPFOR",
|
||||
PassCode_2021.SynchronizeTests,
|
||||
PassCode_2021.AddSapforPackage,
|
||||
PassCode_2021.AddTasksToSapforPackage,
|
||||
PassCode_2021.StartSapforPackage,
|
||||
PassCode_2021.AbortSapforPackage,
|
||||
PassCode_2021.DeleteSapforPackage
|
||||
|
||||
@@ -5,10 +5,11 @@ import Common.Global;
|
||||
import Common.GlobalProperties;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import TestingSystem.Common.TestingPlanner;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.TestingPlanner;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTest_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -37,20 +38,22 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
protected void TestsSynchronize() throws Exception {
|
||||
testingPackage.readJson();
|
||||
//--
|
||||
//копирование тестов по конфигурациям.
|
||||
for (SapforConfiguration_json configuration_json : testingPackage.package_json.configurations) {
|
||||
//--
|
||||
//-->>
|
||||
File configurationWorkspace = new File(workspace, String.valueOf(configuration_json.id));
|
||||
FileUtils.forceMkdir(configurationWorkspace);
|
||||
//--->>>
|
||||
for (SapforTest_json test_json : testingPackage.package_json.tests) {
|
||||
File test_root = new File(configurationWorkspace, test_json.description);
|
||||
Utils.CheckAndCleanDirectory(test_root);
|
||||
FileUtils.copyDirectory(new File(Global.TestsDirectory, String.valueOf(test_json.id)), test_root);
|
||||
for (SapforTestingSet_json set_json : testingPackage.package_json.testingSets) {
|
||||
File setWorkspace = new File(workspace, String.valueOf(set_json.id));
|
||||
FileUtils.forceMkdir(setWorkspace);
|
||||
//копирование тестов по конфигурациям.
|
||||
for (SapforConfiguration_json configuration_json : set_json.configurations) {
|
||||
//--
|
||||
File configurationWorkspace = new File(setWorkspace, String.valueOf(configuration_json.id));
|
||||
FileUtils.forceMkdir(configurationWorkspace);
|
||||
//--->>>
|
||||
for (SapforTest_json test_json : set_json.tests) {
|
||||
File test_root = new File(configurationWorkspace, test_json.description);
|
||||
Utils.CheckAndCleanDirectory(test_root);
|
||||
FileUtils.copyDirectory(new File(Global.TestsDirectory, String.valueOf(test_json.id)), test_root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void PackageWorkspaceCreation() throws Exception {
|
||||
@@ -76,7 +79,7 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
Print("waiting for package start...");
|
||||
Utils.sleep(1000);
|
||||
}
|
||||
File pid = new File(workspace,"PID");
|
||||
File pid = new File(workspace, "PID");
|
||||
testingPackage.PID = FileUtils.readFileToString(pid, Charset.defaultCharset());
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -3,160 +3,15 @@ import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Index;
|
||||
import ProjectData.LanguageName;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTasksPackage_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTest_json;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class AddSapforPackage extends AddObjectPass<SapforPackage> {
|
||||
//--
|
||||
protected int allTasksCount = 0;
|
||||
protected LinkedHashMap<Integer, Vector<Integer>> groupsTests = null;
|
||||
protected LinkedHashMap<String, Test> testsByDescriptions = null;
|
||||
protected Vector<String> testsNames_lower = null; //все тесты что участвуют здесь
|
||||
protected Vector<LanguageName> groupsLanguages = null;
|
||||
protected Vector<String> testsIds = null;
|
||||
protected Vector<String> configurationsIds = null;
|
||||
protected File sapfor = null;
|
||||
//---
|
||||
protected boolean checkTestName(Test test) {
|
||||
String name = test.description.toLowerCase();
|
||||
if (testsNames_lower.contains(name)) {
|
||||
Log.Writeln_("В пакет не могут входить тесты с одинаковыми именами (без учета регистра):" + test.description.toLowerCase());
|
||||
return false;
|
||||
}
|
||||
testsNames_lower.add(name);
|
||||
return true;
|
||||
}
|
||||
protected boolean getGroupTests(int groupId) {
|
||||
Vector<Integer> groupTests = new Vector<>();
|
||||
Vector<Integer> selectedGroupTests = new Vector<>();
|
||||
//---
|
||||
for (Test test : Global.testingServer.db.tests.Data.values()) {
|
||||
if (test.group_id == groupId) {
|
||||
groupTests.add(test.id);
|
||||
if (test.isSelected())
|
||||
selectedGroupTests.add(test.id);
|
||||
}
|
||||
}
|
||||
if (!groupTests.isEmpty() && !selectedGroupTests.isEmpty())
|
||||
groupTests = selectedGroupTests;
|
||||
//---
|
||||
if (groupTests.isEmpty()) {
|
||||
Log.Writeln_("Пустая группа тестов: " + groupId);
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (int testId : groupTests) {
|
||||
Test test = Global.testingServer.db.tests.get(testId);
|
||||
if (!checkTestName(test))
|
||||
return false;
|
||||
else
|
||||
testsByDescriptions.put(test.description, test);
|
||||
}
|
||||
//--
|
||||
groupsTests.put(groupId, groupTests);
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
boolean checkTerminalCode(SapforConfiguration sapforConfiguration, PassCode_2021 code, int count, Vector<PassCode_2021> codes) {
|
||||
if (count > 2) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" возможно только один раз.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if ((count == 1) && codes.size() > 1) {
|
||||
if (!codes.lastElement().equals(code)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" может быть только завершающей командой!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
boolean checkStartingCode(SapforConfiguration sapforConfiguration, PassCode_2021 code, int count, Vector<PassCode_2021> codes) {
|
||||
if (count > 2) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" возможно только один раз.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if ((count == 1) && codes.size() > 1) {
|
||||
if (!codes.firstElement().equals(code)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" может быть только первой командой!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
public boolean getConfigurationCommands(SapforConfiguration sapforConfiguration) {
|
||||
//1. получить список всех команд.
|
||||
Vector<PassCode_2021> codes = new Vector<>();
|
||||
//-- счетчик завершающих команд.
|
||||
LinkedHashMap<PassCode_2021, Index> terminalCodesCount = new LinkedHashMap<>();
|
||||
for (PassCode_2021 code : Constants.terminalSapforTestingCodes)
|
||||
terminalCodesCount.put(code, new Index());
|
||||
//--
|
||||
LinkedHashMap<PassCode_2021, Index> startingCodesCount = new LinkedHashMap<>();
|
||||
for (PassCode_2021 code : Constants.startingSapforTestingCodes)
|
||||
startingCodesCount.put(code, new Index());
|
||||
//--
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id == sapforConfiguration.id) {
|
||||
codes.add(command.passCode);
|
||||
//---
|
||||
for (PassCode_2021 t_code : Constants.terminalSapforTestingCodes) {
|
||||
if (command.passCode.equals(t_code))
|
||||
terminalCodesCount.get(t_code).Inc();
|
||||
}
|
||||
//---
|
||||
for (PassCode_2021 s_code : Constants.startingSapforTestingCodes) {
|
||||
if (command.passCode.equals(s_code))
|
||||
startingCodesCount.get(s_code).Inc();
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
if (codes.size() == 0) {
|
||||
Log.Writeln_("Пустая конфигурация:" + sapforConfiguration.id);
|
||||
return false;
|
||||
}
|
||||
for (PassCode_2021 t_code : Constants.terminalSapforTestingCodes) {
|
||||
if (!checkTerminalCode(sapforConfiguration, t_code,
|
||||
terminalCodesCount.get(t_code).getValue(), codes
|
||||
))
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
for (PassCode_2021 s_code : Constants.startingSapforTestingCodes) {
|
||||
if (!checkStartingCode(sapforConfiguration, s_code,
|
||||
startingCodesCount.get(s_code).getValue(), codes
|
||||
))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
//временный вариант. в дальнейшем, следует сделать возможность формирования.(?)
|
||||
public AddSapforPackage() {
|
||||
super(SapforPackage.class);
|
||||
@@ -178,60 +33,9 @@ public class AddSapforPackage extends AddObjectPass<SapforPackage> {
|
||||
}
|
||||
}
|
||||
//--
|
||||
allTasksCount = 0;
|
||||
groupsTests = new LinkedHashMap<>();
|
||||
testsNames_lower = new Vector<>();
|
||||
testsByDescriptions = new LinkedHashMap<>();
|
||||
groupsLanguages = new Vector<>();
|
||||
testsIds = new Vector<>();
|
||||
configurationsIds = new Vector<>();
|
||||
//--
|
||||
if (Global.testingServer.db.sapforConfigurations.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной конфигурации SAPFOR.");
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||
if (!getConfigurationCommands(configuration))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (Global.testingServer.db.groups.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной группы тестов");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (Group group : Global.testingServer.db.groups.getCheckedItems()) {
|
||||
//---
|
||||
if (!groupsLanguages.contains(group.language))
|
||||
groupsLanguages.add(group.language);
|
||||
//-
|
||||
if (groupsLanguages.get(0) != LanguageName.fortran) {
|
||||
Log.Writeln_("Поддерживается пакетный режим только для языка Fortran!");
|
||||
return false;
|
||||
}
|
||||
if (groupsLanguages.size() > 1) {
|
||||
Log.Writeln_("Запуск тестов на разных языках в рамках одного пакета запрещен!");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
if (!getGroupTests(group.id))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (int i = 0; i < Global.testingServer.db.sapforConfigurations.getCheckedCount(); ++i) {
|
||||
for (Vector<Integer> tests : groupsTests.values())
|
||||
allTasksCount += tests.size();
|
||||
}
|
||||
//--
|
||||
for (Test test : testsByDescriptions.values())
|
||||
testsIds.add(String.valueOf(test.id));
|
||||
//--
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems())
|
||||
configurationsIds.add(String.valueOf(configuration.id));
|
||||
//--
|
||||
target = new SapforPackage();
|
||||
target.id = Constants.Nan;
|
||||
target.state = TasksPackageState.Draft;
|
||||
//-
|
||||
target.sender_name = Current.getAccount().name;
|
||||
target.sender_address = Current.getAccount().email;
|
||||
@@ -241,45 +45,15 @@ public class AddSapforPackage extends AddObjectPass<SapforPackage> {
|
||||
target.kernels = Global.properties.TestingKernels;
|
||||
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||
//--
|
||||
target.tasksCount = allTasksCount;
|
||||
target.testsIds = String.join("\n", testsIds);
|
||||
target.configurationsIds = String.join("\n", configurationsIds);
|
||||
//--
|
||||
target.sapforId = Current.getServerSapfor().id;
|
||||
target.testsNames = String.join(";", testsNames_lower);
|
||||
//
|
||||
SapforTasksPackage_json package_json = new SapforTasksPackage_json();
|
||||
SapforPackage_json package_json = new SapforPackage_json();
|
||||
target.package_json = package_json;
|
||||
///-------------------------------
|
||||
package_json.kernels = target.kernels;
|
||||
for (Test test : testsByDescriptions.values()) {
|
||||
SapforTest_json test_json = new SapforTest_json();
|
||||
test_json.id = test.id;
|
||||
test_json.description = test.description;
|
||||
test_json.group_description = Global.testingServer.db.groups.get(test.group_id).description;
|
||||
package_json.tests.add(test_json);
|
||||
}
|
||||
///-------------------------------
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||
//--
|
||||
SapforConfiguration_json configuration_json = new SapforConfiguration_json();
|
||||
configuration_json.id = configuration.id;
|
||||
configuration_json.flags = configuration.getFlags();
|
||||
Vector<PassCode_2021> codes = configuration.getPassCodes();
|
||||
//--- коррекцию кода нельзя вызвать если инклуды есть. в общем случае.
|
||||
if (!codes.firstElement().equals(PassCode_2021.SPF_InsertIncludesPass))
|
||||
configuration_json.codes.add(PassCode_2021.SPF_CorrectCodeStylePass); //всегда добавляется.
|
||||
//--
|
||||
configuration_json.codes.addAll(codes);
|
||||
//--->>
|
||||
package_json.configurations.add(configuration_json);
|
||||
//-->>
|
||||
}
|
||||
package_json.sapfor_drv = Current.getServerSapfor().call_command;
|
||||
///-------------------------------
|
||||
return (UI.Question("Будет добавлено:\n"
|
||||
+ allTasksCount + " задач\n" +
|
||||
"Продолжить"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,6 @@ public class AddTasksToDVMPackage extends Pass_2021<DVMPackage> {
|
||||
}
|
||||
json.compilationTasks.addAll(tasks);
|
||||
target.tasksCount += tasks_count;
|
||||
//target.saveJson();
|
||||
Global.testingServer.db.Update(target);
|
||||
}
|
||||
@Override
|
||||
|
||||
265
src/Visual_DVM_2021/Passes/All/AddTasksToSapforPackage.java
Normal file
265
src/Visual_DVM_2021/Passes/All/AddTasksToSapforPackage.java
Normal file
@@ -0,0 +1,265 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Index;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.LanguageName;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTest_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
||||
SapforTestingSet_json testing_set; //то, что добавляем.
|
||||
//--
|
||||
protected int setTasksCount = 0;
|
||||
protected LinkedHashMap<Integer, Vector<Integer>> groupsTests = null;
|
||||
protected LinkedHashMap<String, Test> testsByDescriptions = null;
|
||||
protected Vector<String> testsNames_lower = null; //все тесты что участвуют здесь
|
||||
protected Vector<LanguageName> groupsLanguages = null;
|
||||
protected File sapfor = null;
|
||||
//--
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/AddTasks.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
//--
|
||||
boolean checkTerminalCode(SapforConfiguration sapforConfiguration, PassCode_2021 code, int count, Vector<PassCode_2021> codes) {
|
||||
if (count > 2) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" возможно только один раз.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if ((count == 1) && codes.size() > 1) {
|
||||
if (!codes.lastElement().equals(code)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" может быть только завершающей командой!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
boolean checkStartingCode(SapforConfiguration sapforConfiguration, PassCode_2021 code, int count, Vector<PassCode_2021> codes) {
|
||||
if (count > 2) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" возможно только один раз.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if ((count == 1) && codes.size() > 1) {
|
||||
if (!codes.firstElement().equals(code)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": " +
|
||||
code.getDescription() +
|
||||
" может быть только первой командой!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
//--
|
||||
public boolean checkConfigurationCommands(SapforConfiguration sapforConfiguration) {
|
||||
//1. получить список всех команд.
|
||||
Vector<PassCode_2021> codes = new Vector<>();
|
||||
//-- счетчик завершающих команд.
|
||||
LinkedHashMap<PassCode_2021, Index> terminalCodesCount = new LinkedHashMap<>();
|
||||
for (PassCode_2021 code : Constants.terminalSapforTestingCodes)
|
||||
terminalCodesCount.put(code, new Index());
|
||||
//--
|
||||
LinkedHashMap<PassCode_2021, Index> startingCodesCount = new LinkedHashMap<>();
|
||||
for (PassCode_2021 code : Constants.startingSapforTestingCodes)
|
||||
startingCodesCount.put(code, new Index());
|
||||
//--
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id == sapforConfiguration.id) {
|
||||
codes.add(command.passCode);
|
||||
//---
|
||||
for (PassCode_2021 t_code : Constants.terminalSapforTestingCodes) {
|
||||
if (command.passCode.equals(t_code))
|
||||
terminalCodesCount.get(t_code).Inc();
|
||||
}
|
||||
//---
|
||||
for (PassCode_2021 s_code : Constants.startingSapforTestingCodes) {
|
||||
if (command.passCode.equals(s_code))
|
||||
startingCodesCount.get(s_code).Inc();
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
if (codes.size() == 0) {
|
||||
Log.Writeln_("Пустая конфигурация:" + sapforConfiguration.id);
|
||||
return false;
|
||||
}
|
||||
for (PassCode_2021 t_code : Constants.terminalSapforTestingCodes) {
|
||||
if (!checkTerminalCode(sapforConfiguration, t_code,
|
||||
terminalCodesCount.get(t_code).getValue(), codes
|
||||
))
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
for (PassCode_2021 s_code : Constants.startingSapforTestingCodes) {
|
||||
if (!checkStartingCode(sapforConfiguration, s_code,
|
||||
startingCodesCount.get(s_code).getValue(), codes
|
||||
))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
protected boolean checkTestName(Test test) {
|
||||
String name = test.description.toLowerCase();
|
||||
if (testsNames_lower.contains(name)) {
|
||||
Log.Writeln_("В пакет не могут входить тесты с одинаковыми именами (без учета регистра):" + test.description.toLowerCase());
|
||||
return false;
|
||||
}
|
||||
testsNames_lower.add(name);
|
||||
return true;
|
||||
}
|
||||
protected boolean getGroupTests(int groupId) {
|
||||
Vector<Integer> groupTests = new Vector<>();
|
||||
Vector<Integer> selectedGroupTests = new Vector<>();
|
||||
//---
|
||||
for (Test test : Global.testingServer.db.tests.Data.values()) {
|
||||
if (test.group_id == groupId) {
|
||||
groupTests.add(test.id);
|
||||
if (test.isSelected())
|
||||
selectedGroupTests.add(test.id);
|
||||
}
|
||||
}
|
||||
if (!groupTests.isEmpty() && !selectedGroupTests.isEmpty())
|
||||
groupTests = selectedGroupTests;
|
||||
//---
|
||||
if (groupTests.isEmpty()) {
|
||||
Log.Writeln_("Пустая группа тестов: " + groupId);
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (int testId : groupTests) {
|
||||
Test test = Global.testingServer.db.tests.get(testId);
|
||||
if (!checkTestName(test))
|
||||
return false;
|
||||
else
|
||||
testsByDescriptions.put(test.description, test);
|
||||
}
|
||||
//--
|
||||
groupsTests.put(groupId, groupTests);
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.SapforPackage)) {
|
||||
target = Current.getSapforPackage();
|
||||
if (!target.state.equals(TasksPackageState.Draft)) {
|
||||
Log.Writeln_("Пакет " + Utils.Brackets(target.id) + " не готовится к публикации!");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
setTasksCount = 0;
|
||||
groupsTests = new LinkedHashMap<>();
|
||||
testsNames_lower = new Vector<>();
|
||||
testsByDescriptions = new LinkedHashMap<>();
|
||||
groupsLanguages = new Vector<>();
|
||||
//--
|
||||
if (Global.testingServer.db.sapforConfigurations.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной конфигурации SAPFOR.");
|
||||
return false;
|
||||
}
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||
if (!checkConfigurationCommands(configuration))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (Global.testingServer.db.groups.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одной группы тестов");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (Group group : Global.testingServer.db.groups.getCheckedItems()) {
|
||||
//---
|
||||
if (!groupsLanguages.contains(group.language))
|
||||
groupsLanguages.add(group.language);
|
||||
//-
|
||||
if (groupsLanguages.get(0) != LanguageName.fortran) {
|
||||
Log.Writeln_("Поддерживается пакетный режим только для языка Fortran!");
|
||||
return false;
|
||||
}
|
||||
if (groupsLanguages.size() > 1) {
|
||||
Log.Writeln_("Запуск тестов на разных языках в рамках одного пакета запрещен!");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
if (!getGroupTests(group.id))
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
for (int i = 0; i < Global.testingServer.db.sapforConfigurations.getCheckedCount(); ++i) {
|
||||
for (Vector<Integer> tests : groupsTests.values())
|
||||
setTasksCount += tests.size();
|
||||
}
|
||||
return UI.Question("Будет добавлено " + setTasksCount + " задач. Продолжить");
|
||||
}
|
||||
//
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
testing_set = new SapforTestingSet_json();
|
||||
testing_set.id = target.package_json.getMaxSetId();
|
||||
Vector<String> testsNames = new Vector<>();
|
||||
for (Test test : testsByDescriptions.values()) {
|
||||
SapforTest_json test_json = new SapforTest_json();
|
||||
test_json.id = test.id;
|
||||
test_json.description = test.description;
|
||||
test_json.group_description = Global.testingServer.db.groups.get(test.group_id).description;
|
||||
testing_set.tests.add(test_json);
|
||||
//-
|
||||
testsNames.add(test.description);
|
||||
}
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||
//--
|
||||
SapforConfiguration_json configuration_json = new SapforConfiguration_json();
|
||||
configuration_json.id = configuration.id;
|
||||
configuration_json.flags = configuration.getFlags();
|
||||
Vector<PassCode_2021> codes = configuration.getPassCodes();
|
||||
//--- коррекцию кода нельзя вызвать если инклуды есть. в общем случае.
|
||||
if (!codes.firstElement().equals(PassCode_2021.SPF_InsertIncludesPass))
|
||||
configuration_json.codes.add(PassCode_2021.SPF_CorrectCodeStylePass); //всегда добавляется.
|
||||
//--
|
||||
configuration_json.codes.addAll(codes);
|
||||
//--->>
|
||||
testing_set.configurations.add(configuration_json);
|
||||
//-->>
|
||||
}
|
||||
//-->>
|
||||
target.package_json.testingSets.add(testing_set);
|
||||
target.tasksCount += setTasksCount;
|
||||
target.testsNames += String.join(";", testsNames) + ";";
|
||||
Global.testingServer.db.Update(target);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.testingServer.db.sapforPackages.ShowUI(target.id);
|
||||
}
|
||||
}
|
||||
@@ -304,6 +304,7 @@ public enum PassCode_2021 {
|
||||
AbortDVMPackage,
|
||||
//->
|
||||
AddSapforPackage,
|
||||
AddTasksToSapforPackage,
|
||||
DeleteSapforPackage,
|
||||
StartSapforPackage,
|
||||
AbortSapforPackage,
|
||||
@@ -316,6 +317,8 @@ public enum PassCode_2021 {
|
||||
switch (this) {
|
||||
case Undefined:
|
||||
return "?";
|
||||
case AddTasksToSapforPackage:
|
||||
return "Добавить задачи в пакет SAPFOR";
|
||||
case SPF_InsertPrivateFromGUI:
|
||||
return "Вставка директив для нераспределяемых массивов";
|
||||
case CreateTestFromSelectedFiles:
|
||||
|
||||
@@ -198,6 +198,7 @@ public class SapforPackagesComparisonForm {
|
||||
package1 = object;
|
||||
package2 = slave.object;
|
||||
//--
|
||||
/*
|
||||
if (!package1.testsIds.equals(package2.testsIds)) {
|
||||
Log.Writeln_("Наборы тестов пакетов не совпадают!");
|
||||
return false;
|
||||
@@ -206,6 +207,7 @@ public class SapforPackagesComparisonForm {
|
||||
Log.Writeln_("Наборы конфигураций не совпадают!");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
for (String key1 : package1.package_json.allTasks.keySet()) {
|
||||
if (!package2.package_json.allTasks.containsKey(key1)) {
|
||||
|
||||
Reference in New Issue
Block a user