красные галочки для авто тестирования. пока без обновления бд

This commit is contained in:
2024-09-19 23:05:04 +03:00
parent 25cd097445
commit 3863b31328
14 changed files with 80 additions and 407 deletions

View File

@@ -0,0 +1,11 @@
package Common.UI.Tables;
import Common.Utils.Utils;
import TestingSystem.Common.Configuration.Configuration;
public class ConfigurationAutoRenderer extends DBObjectRenderer {
@Override
public void Display() {
if (value != null) {
setIcon(((Configuration)value).GetAutoIcon());
}
}
}

View File

@@ -0,0 +1,13 @@
package Common.UI.Tables;
import TestingSystem.Common.Configuration.Configuration;
public class ConfigurationAutoSwitcher extends DBObjectEditor<Configuration> {
@Override
public void Action() {
value.SwitchAuto();
setIcon(value.GetAutoIcon());
}
@Override
public Object getCellEditorValue() {
return value;
}
}

View File

@@ -4,5 +4,7 @@ public enum TableEditors {
EditorSelect,
EditorHyperlinks,
EditorDimension,
EditorCompilerEnvironmentValue, EditorCompilerOptionParameterValue
EditorCompilerEnvironmentValue,
EditorCompilerOptionParameterValue,
EditorAutoConfiguration
}

View File

@@ -15,5 +15,6 @@ public enum TableRenderers {
RendererCompilerOptionParameterValue,
RendererCompilerEnvironmentValue,
RendererCompilerOptionParameterName,
RendererStatusEnum
RendererStatusEnum,
RendererAutoConfiguration
}

View File

@@ -330,6 +330,7 @@ public class UI {
TableRenderers.put(RendererCompilerOptionParameterName, new CompilerOptionParameterNameRenderer());
TableRenderers.put(RendererCompilerEnvironmentValue, new CompilerEnvironmentValueRenderer());
TableRenderers.put(RendererStatusEnum, new StatusEnumRenderer());
TableRenderers.put(RendererAutoConfiguration, new ConfigurationAutoRenderer());
//---------------------------------------------
TreeRenderers.put(RendererGraph, new GraphTreeCellRenderer());
TreeRenderers.put(RendererRemoteFile, new RemoteFileRenderer());
@@ -338,12 +339,14 @@ public class UI {
TreeRenderers.put(RendererSapforVersion, new SapforVersionsTreeCellRenderer());
TreeRenderers.put(RendererRule, new RulesTreeCellRenderer());
TreeRenderers.put(RendererSelection, new SelectionTreeCellRenderer());
//----------------------------------------------
TableEditors.put(EditorSelect, new DBObjectSelector());
TableEditors.put(EditorHyperlinks, new VectorEditor());
TableEditors.put(EditorDimension, new DimensionStateChanger());
TableEditors.put(EditorCompilerOptionParameterValue, new CompilerOptionParameterValueEditor());
TableEditors.put(EditorCompilerEnvironmentValue, new CompilerEnvironmentValueEditor());
TableEditors.put(EditorAutoConfiguration, new ConfigurationAutoSwitcher());
//</editor-fold>
}
public static void printAccessible_r(Accessible accessible) {

View File

@@ -8,6 +8,7 @@ import TestingSystem.Common.Test.Json.TestsJson;
import TestingSystem.Common.Test.Test;
import com.sun.org.glassfish.gmbal.Description;
import javax.swing.*;
import java.util.Vector;
public class Configuration extends riDBObject {
//конфигурация = данные для пакета.
@@ -19,12 +20,22 @@ public class Configuration extends riDBObject {
public int maxtime = 300;
@Description("DEFAULT 0")
public int autoTesting = 0;
public String printAuto(){
return autoTesting>0? "Да":"Нет";
public String printAuto() {
return autoTesting > 0 ? "Да" : "Нет";
}
public void SwitchAuto() {
autoTesting = (autoTesting == 0)? 1:0;
}
public ImageIcon GetAutoIcon() {
return Utils.getIcon("/icons/" + (autoTesting==1 ? "RedPick" : "NotPick") + ".png");
}
//--
public String getFlags(){return "";}
public Vector<String> getFlagsArray(){return new Vector<>();}
public String getFlags() {
return "";
}
public Vector<String> getFlagsArray() {
return new Vector<>();
}
//--
@Description("DEFAULT ''")
public String packedGroupsJson = "";
@@ -44,9 +55,9 @@ public class Configuration extends riDBObject {
Configuration c = (Configuration) src;
//--
maxtime = c.maxtime;
autoTesting= c.autoTesting;
autoTesting = c.autoTesting;
//-
packedGroupsJson= c.packedGroupsJson;
packedGroupsJson = c.packedGroupsJson;
packedTestsJson = c.packedTestsJson;
}
//-

View File

@@ -4,6 +4,8 @@ import Common.Database.DBObject;
import Common.Database.iDBTable;
import Common.Global;
import Common.UI.DataSetControlForm;
import Common.UI.Tables.DBObjectSelector;
import Common.UI.Tables.TableEditors;
import Common.UI.Tables.TableRenderers;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCache;
@@ -37,10 +39,10 @@ public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
}
@Override
protected void AdditionalInitColumns() {
columns.get(5).setMaxWidth(300);
columns.get(4).setMaxWidth(300);
columns.get(6).setRenderer(TableRenderers.RendererMultiline);
columns.get(7).setRenderer(TableRenderers.RendererMultiline);
columns.get(8).setRenderer(TableRenderers.RendererMultiline);
columns.get(15).setRenderer(TableRenderers.RendererMultiline);
columns.get(14).setRenderer(TableRenderers.RendererMultiline);
}
};
}
@@ -49,7 +51,6 @@ public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
return new String[]{
"имя",
"автор",
"авто",
"группы",
"тестов",
"флаги",
@@ -72,30 +73,28 @@ public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
case 3:
return object.sender_name;
case 4:
return object.printAuto();
case 5:
return cache.getGroupsDescriptions();
case 6:
case 5:
return cache.getTestsCount();
//todo упростить. и флаги и окружение будут просто одной строкой. мульти не актуально.
case 7:
case 6:
return Utils.unpackStrings(object.flags, true);
case 8:
case 7:
return Utils.unpackStrings(object.environments, true);
//------------------------------------------------------------------------------------
case 9:
case 8:
return object.c_maxtime;
case 10:
case 9:
return object.cube;
case 11:
case 10:
return object.max_proc_count;
case 12:
case 11:
return object.min_dim_proc_count;
case 13:
case 12:
return object.max_dim_proc_count;
case 14:
case 13:
return object.maxtime;
case 15:
case 14:
return Utils.unpackStrings(object.usr_par, true);
default:
return null;

View File

@@ -2,6 +2,7 @@ package TestingSystem.SAPFOR.SapforConfiguration;
import Common.Current;
import Common.Database.*;
import Common.UI.DataSetControlForm;
import Common.UI.Tables.TableEditors;
import Common.UI.Tables.TableRenderers;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCaches;
@@ -36,8 +37,9 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
}
@Override
protected void AdditionalInitColumns() {
columns.get(4).setRenderer(TableRenderers.RendererAutoConfiguration);
columns.get(4).setEditor(TableEditors.EditorAutoConfiguration);
columns.get(5).setMaxWidth(300);
// columns.get(5).setRenderer(TableRenderers.RendererHiddenList);
}
};
}

View File

@@ -1,77 +0,0 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Database.Database;
import Common.Global;
import TestingSystem.Common.TasksPackageState;
import TestingSystem.SAPFOR.Json.SapforPackage_json;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
import Visual_DVM_2021.Passes.AddObjectPass;
import java.io.File;
public class AddSapforPackage extends AddObjectPass<SapforPackage> {
@Override
public String getIconPath() {
return "/icons/CreateProject.png";
}
protected File sapfor = null;
//---
//временный вариант. в дальнейшем, следует сделать возможность формирования.(?)
public AddSapforPackage() {
super(SapforPackage.class);
}
@Override
protected Database getDb() {
return Global.testingServer.db;
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (!Current.getAccount().CheckRegistered(Log)) {
return false;
}
if (!Current.Check(Log, Current.ServerSapfor))
return false;
if (!Current.getServerSapfor().state.equals(ServerSapforState.Done)) {
Log.Writeln_("Выбранная версия SAPFOR не собрана!");
return false;
}
if (!Current.getServerSapfor().state.equals(ServerSapforState.Done)) {
Log.Writeln_("Выбранная версия SAPFOR не собрана!");
return false;
}
for (SapforPackage sapforPackage : Global.testingServer.db.sapforPackages.Data.values()) {
if (sapforPackage.state.equals(TasksPackageState.Draft)) {
Log.Writeln_("Может существовать только один пакет, готовящийся к публикации.");
return false;
}
}
//--
target = new SapforPackage();
target.id = Constants.Nan;
target.state = TasksPackageState.Draft;
//-
target.sender_name = Current.getAccount().name;
target.sender_address = Current.getAccount().email;
//-
target.drv = Current.getServerSapfor().call_command;
target.version = Current.getServerSapfor().version;
target.kernels = Global.properties.TestingKernels;
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
//--
target.sapforId = Current.getServerSapfor().id;
//
SapforPackage_json package_json = new SapforPackage_json();
target.package_json = package_json;
///-------------------------------
package_json.kernels = target.kernels;
package_json.sapfor_drv = Current.getServerSapfor().call_command;
///-------------------------------
return true;
}
@Override
protected void body() throws Exception {
//черновик не вставляется в бд. идет только как элемент списка.
Global.testingServer.db.sapforPackages.Data.put(target.id, target);
}
}

View File

@@ -1,272 +0,0 @@
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 TestingSystem.SAPFOR.SapforTask.SapforTask;
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 testingSet; //то, что добавляем.
//--
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;
//--
protected Vector<SapforTask> new_tasks = 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;
}
//---
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;
}
//--
testingSet = new SapforTestingSet_json();
testingSet.id = target.package_json.getMaxSetId();
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;
testingSet.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.name=configuration.description;
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);
//--->>
testingSet.configurations.add(configuration_json);
//-->>
}
new_tasks = target.getActualTestingSetTasks(testingSet);
if (new_tasks.size() == 0) {
Log.Writeln_("Не сформировано ни одной новой задачи.\n" +
"Задачи уже присутствуют в пакете, или не отмечено ни одного теста.");
return false;
}
return UI.Question("Будет добавлено " + new_tasks.size() + " задач. Продолжить");
}
//
return false;
}
@Override
protected void body() throws Exception {
//-->>
target.package_json.testingSets.add(testingSet);
for (SapforTask task : new_tasks) {
task.id = target.package_json.getMaxTaskId();
target.package_json.tasks.add(task);
}
target.tasksCount += new_tasks.size();
}
@Override
protected void showDone() throws Exception {
Global.testingServer.db.sapforPackages.ShowUI(target.id);
//----
// Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
// target.saveJson();
//---
}
}

View File

@@ -1,13 +0,0 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import Visual_DVM_2021.Passes.StartTestingPackage;
public class StartSapforPackage extends StartTestingPackage<SapforPackage> {
public StartSapforPackage() {
super(SapforPackage.class);
}
@Override
protected Current getCurrentName() {
return Current.SapforPackage;
}
}

View File

@@ -301,10 +301,7 @@ public enum PassCode_2021 {
DeleteDVMPackage,
AbortDVMPackage,
//->
AddSapforPackage,
AddTasksToSapforPackage,
DeleteSapforPackage,
StartSapforPackage,
AbortSapforPackage,
DownloadDVMPackage,
DownloadDVMPackages,
@@ -414,8 +411,6 @@ public enum PassCode_2021 {
return "Клонировать пакет SAPFOR с текущей версией";
case CloneDVMPackage:
return "Клонировать пакет DVM c текущим компилятором";
case AddTasksToSapforPackage:
return "Добавить задачи в пакет SAPFOR";
case SPF_InsertPrivateFromGUI:
return "Вставка директив приватизации";
case CreateTestFromSelectedFiles:
@@ -426,12 +421,8 @@ public enum PassCode_2021 {
return "Синхронизация пакетов задач DVM";
case AbortSapforPackage:
return "Прервать пакет тестирования SAPFOR";
case StartSapforPackage:
return "Запустить пакет задач SAPFOR";
case DeleteSapforPackage:
return "Удалить пакеты тестирования SAPFOR";
case AddSapforPackage:
return "Создать пустой пакет";
case AbortDVMPackage:
return "Прервать пакет тестирования DVM";
case DeleteDVMPackage:

BIN
src/icons/RedPick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB