no message
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
package TestingSystem.SAPFOR.SapforConfiguration;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Global;
|
||||
import Common.UI.VisualCache.ConfigurationCache;
|
||||
import Common.UI.VisualCache.VisualCaches;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.LanguageName;
|
||||
import TestingSystem.Common.Configuration.Configuration;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
@@ -55,4 +62,55 @@ public class SapforConfiguration extends Configuration {
|
||||
}
|
||||
public SapforConfiguration() {
|
||||
}
|
||||
@Override
|
||||
public boolean validate(TextLog Log) {
|
||||
//1. проверка цепочки команд на корректность
|
||||
Vector<PassCode_2021> codes = Global.testingServer.db.sapforConfigurationCommands.getCodes(this);
|
||||
if (codes.size() == 0) {
|
||||
Log.Writeln_("Конфигурация:" + id + " не содержит ни одного прохода.");
|
||||
return false;
|
||||
}
|
||||
int first = 0;
|
||||
int last = codes.size() - 1;
|
||||
Vector<PassCode_2021> matches = new Vector<>();
|
||||
for (int i = 0; i < codes.size(); ++i) {
|
||||
PassCode_2021 code = codes.get(i);
|
||||
if (code.isSapforStart()) {
|
||||
if (i > first) {
|
||||
Log.Writeln_("Неверная конфигурация:" + id + ": проход" +
|
||||
Utils.Brackets(code.getDescription()) +
|
||||
" может быть только первым!");
|
||||
}
|
||||
}
|
||||
if (code.isSapforTerminal()) {
|
||||
if (i < last) {
|
||||
Log.Writeln_("Неверная конфигурация:" + id + ": проход " +
|
||||
Utils.Brackets(code.getDescription()) +
|
||||
" может быть только последним!");
|
||||
}
|
||||
}
|
||||
if (matches.contains(code)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + id + ": проход " +
|
||||
Utils.Brackets(code.getDescription()) +
|
||||
" запрещено применять более одного раза!");
|
||||
} else matches.add(code);
|
||||
}
|
||||
//2. Проверка входящих групп и тестов на корректность
|
||||
ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(this);
|
||||
//--
|
||||
Vector<Group> groups = cache.getGroups();
|
||||
Vector<Test> tests = cache.getTests();
|
||||
Vector<LanguageName> groupsLanguages = new Vector<>();
|
||||
//-
|
||||
for (Group group : groups) {
|
||||
if (!groupsLanguages.contains(group.language))
|
||||
groupsLanguages.add(group.language);
|
||||
}
|
||||
if ((groupsLanguages.size() > 1)||(!groupsLanguages.contains(LanguageName.fortran))) {
|
||||
Log.Writeln_("Запуск тестов на разных языках в рамках одного пакета запрещен!\n" +
|
||||
"Поддерживается пакетный режим только для языка Fortran");
|
||||
}
|
||||
//-
|
||||
return Log.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import Common.Database.iDBTable;
|
||||
import Common.UI.DataSetControlForm;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.DBObjectDialog;
|
||||
import TestingSystem.Common.Configuration.Configuration;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.UI.SapforConfigurationCommandFields;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class SapforConfigurationCommandsDBTable extends iDBTable<SapforConfigurationCommand> {
|
||||
public SapforConfigurationCommandsDBTable() {
|
||||
super(SapforConfigurationCommand.class);
|
||||
@@ -20,7 +23,7 @@ public class SapforConfigurationCommandsDBTable extends iDBTable<SapforConfigura
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI() {
|
||||
return new DataSetControlForm(this){
|
||||
return new DataSetControlForm(this) {
|
||||
@Override
|
||||
public boolean hasCheckBox() {
|
||||
return true;
|
||||
@@ -68,4 +71,12 @@ public class SapforConfigurationCommandsDBTable extends iDBTable<SapforConfigura
|
||||
}
|
||||
};
|
||||
}
|
||||
public Vector<PassCode_2021> getCodes(Configuration configuration) {
|
||||
Vector<PassCode_2021> res = new Vector<>();
|
||||
for (SapforConfigurationCommand command : Data.values()) {
|
||||
if (command.sapforconfiguration_id == configuration.id)
|
||||
res.add(command.passCode);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user