рефакторинг. неудачные наименования классов, и остатки старых вариантов
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||
public class AddSapfor extends AddObjectPass<RemoteSapfor> {
|
||||
public AddSapfor() { super(RemoteSapfor.class); }
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Machine)){
|
||||
if (Current.getMachine().type.equals(MachineType.Server)){
|
||||
target = d.newInstance();
|
||||
return fillObjectFields();
|
||||
}else Log.Writeln_("Тестирование SAPFOR поддерживается только на удаленном одиночном сервере.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import SapforTestingSystem.Json.SapforScenarioResults_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
public class AnalyseSapforPackageResults extends Pass_2021<SapforScenarioResults_json> {
|
||||
File packageWorkspace;
|
||||
File scenarioFile;
|
||||
//--
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
//--
|
||||
packageWorkspace = new File((String) args[0]);
|
||||
scenarioFile = new File(packageWorkspace, "results.txt");
|
||||
//--
|
||||
// String packed = FileUtils.readFileToString(scenarioFile, Charset.defaultCharset());
|
||||
// target = Utils.gson.fromJson(packed, ScenarioResults_json.class);
|
||||
//---
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (SapforTask task: target.tasks) {
|
||||
task.id=Global.db.IncSapforMaxTaskId();
|
||||
Global.db.Insert(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.DataSet;
|
||||
import SapforTestingSystem.SapforTask.SapforTaskResult;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
public class CompareSapforPackages extends Pass_2021 {
|
||||
DataSet<String, SapforTaskResult> masterTasks;
|
||||
DataSet<String, SapforTaskResult> slaveTasks;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
masterTasks = (DataSet<String, SapforTaskResult>) args[0];
|
||||
slaveTasks = (DataSet<String, SapforTaskResult>) args[1];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
public class DeleteSapfor extends DeleteObjectPass<RemoteSapfor>{
|
||||
public DeleteSapfor() {
|
||||
super(RemoteSapfor.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,15 @@ import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.SapforScenario.SapforScenario;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.io.File;
|
||||
public class DeleteSapforScenario extends DeleteObjectPass<SapforScenario> {
|
||||
public class DeleteSapforScenario extends DeleteObjectPass<SapforTasksPackage> {
|
||||
public DeleteSapforScenario() {
|
||||
super(SapforScenario.class);
|
||||
super(SapforTasksPackage.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
@@ -34,14 +34,14 @@ public class DeleteSapforScenario extends DeleteObjectPass<SapforScenario> {
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
Pass_2021 serverPass = new TestingSystemPass<SapforScenario>() {
|
||||
Pass_2021 serverPass = new TestingSystemPass<SapforTasksPackage>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Удаление сценария задач SAPFOR с сервера";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (SapforScenario) args[0];
|
||||
target = (SapforTasksPackage) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import Visual_DVM_2021.Passes.EditObjectPass;
|
||||
public class EditSapfor extends EditObjectPass<RemoteSapfor> {
|
||||
public EditSapfor() {
|
||||
super(RemoteSapfor.class);
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.db;
|
||||
}
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.LanguageName;
|
||||
import ProjectData.Messages.Errors.MessageError;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTaskResult;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
|
||||
import static java.lang.Character.isDigit;
|
||||
public class OpenSapforTest extends Pass_2021<SapforTaskResult> {
|
||||
String last_version = null;
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
last_version = null;
|
||||
Current targetName = (Current) args[0];
|
||||
if (Current.Check(Log, targetName)) {
|
||||
target = (SapforTaskResult) Current.get(targetName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/OpenProject.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
public MessageError unpackMessage(String line_in) throws Exception {
|
||||
MessageError res = new MessageError();
|
||||
res.file = "";
|
||||
res.line = Constants.Nan;
|
||||
res.value = "";
|
||||
String line = line_in.substring(9);
|
||||
System.out.println(line);
|
||||
int i = 0;
|
||||
int s = 0;
|
||||
String lexeme = "";
|
||||
//#1020: red43.fdv: line 988]: Active DVM directives are not supported (turn on DVM-directive support option)
|
||||
for (char c : line.toCharArray()) {
|
||||
// System.out.print("<s=" + s + ">");
|
||||
// System.out.println(c);
|
||||
switch (s) {
|
||||
case 0:
|
||||
//поиск groups_s
|
||||
if (c == '#') {
|
||||
s = 1;
|
||||
lexeme = "";
|
||||
} else return null;
|
||||
break;
|
||||
case 1:
|
||||
//group_s
|
||||
if (isDigit(c)) {
|
||||
res.group_s += c;
|
||||
lexeme += c;
|
||||
} else if (c == ':') {
|
||||
s = 2;
|
||||
res.group = Integer.parseInt(lexeme);
|
||||
} else return null;
|
||||
break;
|
||||
case 2:
|
||||
//поиск filename
|
||||
if (c == ' ') {
|
||||
s = 3;
|
||||
} else return null;
|
||||
break;
|
||||
case 3:
|
||||
//filename
|
||||
if (c == ':') {
|
||||
s = 4;
|
||||
} else {
|
||||
res.file += c;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//поиск line
|
||||
if (c == ' ') {
|
||||
s = 5;
|
||||
lexeme = "";
|
||||
} else return null;
|
||||
break;
|
||||
case 5:
|
||||
//line
|
||||
if (c == ' ') {
|
||||
if (!lexeme.equals("line"))
|
||||
return null;
|
||||
else {
|
||||
s = 6;
|
||||
lexeme = "";
|
||||
}
|
||||
} else {
|
||||
lexeme += c;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
//line number
|
||||
if (isDigit(c)) {
|
||||
lexeme += c;
|
||||
} else if (c == ']') {
|
||||
res.line = Integer.parseInt(lexeme);
|
||||
s = 7;
|
||||
} else return null;
|
||||
break;
|
||||
case 7:
|
||||
//Поиск value
|
||||
if (c == ':') {
|
||||
s = 8;
|
||||
} else return null;
|
||||
break;
|
||||
case 8:
|
||||
if (c == ' ') {
|
||||
s = 9;
|
||||
} else return null;
|
||||
break;
|
||||
case 9:
|
||||
//value
|
||||
res.value += c;
|
||||
break;
|
||||
}
|
||||
;
|
||||
++i;
|
||||
}
|
||||
//--
|
||||
if (s != 9)
|
||||
return null;
|
||||
//--
|
||||
return res;
|
||||
}
|
||||
public void readMessagesFromFileDump(File file, Vector<MessageError> messages) throws Exception {
|
||||
Vector<String> lines = new Vector<>(FileUtils.readLines(file));
|
||||
//ERROR - [#1020: red43.fdv: line 988]: Active DVM directives are not supported (turn on DVM-directive support option)
|
||||
if (!lines.isEmpty()) {
|
||||
for (int i = lines.size() - 1; i >= 0; --i) {
|
||||
String line = lines.get(i);
|
||||
if (line.startsWith("ERROR - ")) {
|
||||
// System.out.println(i + ":" + Utils.Brackets(line));
|
||||
MessageError message = unpackMessage(line);
|
||||
if (message != null)
|
||||
messages.add(message);
|
||||
//--
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void checkVersion(SapforVersion_json version, boolean isTransformation) throws Exception {
|
||||
ShowMessage2(version.description + " — " + version.version);
|
||||
db_project_info project = new db_project_info();
|
||||
project.Home = new File(version.version);
|
||||
project.name = project.Home.getName();
|
||||
project.description = version.description;
|
||||
project.languageName = LanguageName.fortran;
|
||||
project.creationDate = Utils.getDateNumber();
|
||||
//--
|
||||
Vector<MessageError> messages = new Vector<>();
|
||||
//--
|
||||
if (isTransformation) {
|
||||
File p_out = Paths.get(project.Home.getAbsolutePath(), Constants.data, "parse_out.txt").toFile();
|
||||
File out = Paths.get(project.Home.getAbsolutePath(), Constants.data, "out.txt").toFile();
|
||||
//--
|
||||
if (p_out.exists()) {
|
||||
project.Log += (FileUtils.readFileToString(p_out));
|
||||
readMessagesFromFileDump(p_out, messages);
|
||||
}
|
||||
if (out.exists()) {
|
||||
project.Log += "\n" + FileUtils.readFileToString(out);
|
||||
readMessagesFromFileDump(out, messages);
|
||||
}
|
||||
//--
|
||||
|
||||
}
|
||||
project.CreateVisualiserData();
|
||||
//---
|
||||
if (isTransformation && !messages.isEmpty()) {
|
||||
project.Open();
|
||||
project.db.BeginTransaction();
|
||||
System.out.println("messages size=" + messages.size());
|
||||
for (MessageError m : messages) {
|
||||
if (project.db.files.containsKey(m.file)) {
|
||||
DBProjectFile file = project.db.files.Data.get(m.file);
|
||||
file.CreateAndAddNewMessage(1, m.value, m.line, m.group);
|
||||
//update file
|
||||
project.db.Update(file);
|
||||
}
|
||||
}
|
||||
project.db.Commit();
|
||||
project.db.Disconnect();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
/*
|
||||
File resultsFile = Paths.get(target.sapforTasksPackage.workspace, target.task.test_description, db_project_info.data, "results.txt").toFile();
|
||||
String resultsText = FileUtils.readFileToString(resultsFile);
|
||||
SapforTask savedTask = Utils.gson.fromJson(resultsText, SapforTask.class);
|
||||
//--->>
|
||||
if (target.task.versions_tree_built == 0) {
|
||||
ShowMessage1("Построение дерева версий..");
|
||||
for (SapforVersion_json version : savedTask.versions)
|
||||
checkVersion(version, true);
|
||||
for (SapforVersion_json version : savedTask.variants)
|
||||
checkVersion(version, false);
|
||||
target.task.versions_tree_built = 1;
|
||||
Global.db.Update(target.task);
|
||||
}
|
||||
if (!savedTask.variants.isEmpty()) {
|
||||
last_version = savedTask.variants.lastElement().version;
|
||||
} else if (!savedTask.versions.isEmpty())
|
||||
last_version = savedTask.versions.lastElement().version;
|
||||
*/
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return last_version != null;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
passes.get(PassCode_2021.OpenCurrentProject).Do(new File(last_version));
|
||||
}
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.GlobalProperties;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.LanguageName;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.Json.SapforConfiguration_json;
|
||||
import SapforTestingSystem.Json.PackageModeScenario_json;
|
||||
import SapforTestingSystem.SapforConfiguration.SapforConfiguration;
|
||||
import SapforTestingSystem.SapforConfiguration.SapforConfigurationInterface;
|
||||
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import SapforTestingSystem.SapforScenario.SapforScenario;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.Test.TestInterface;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//НЕАКТУАЛЬНО, ВСЕ НА СЕРВЕРЕ
|
||||
public class StartSapforTests extends Pass_2021<SapforScenario> {
|
||||
protected int allTasksCount = 0;
|
||||
//--
|
||||
protected LinkedHashMap<String, Vector<String>> groupsTests = null;
|
||||
//--
|
||||
protected LinkedHashMap<String, Test> allTests = null;
|
||||
protected Vector<String> testsNames_lower = null; //все тесты что участвуют здесь
|
||||
protected Vector<LanguageName> groupsLanguages = null;
|
||||
protected File sapfor = null;
|
||||
//---
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Start.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
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(String groupId) {
|
||||
Vector<String> groupTests = new Vector<>();
|
||||
Vector<String> selectedGroupTests = new Vector<>();
|
||||
//---
|
||||
for (Test test : Global.testingServer.db.tests.Data.values()) {
|
||||
if (test.group_id.equals(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 (String testId : groupTests) {
|
||||
Test test = Global.testingServer.db.tests.get(testId);
|
||||
if (!checkTestName(test))
|
||||
return false;
|
||||
else
|
||||
allTests.put(test.description, test);
|
||||
}
|
||||
//--
|
||||
groupsTests.put(groupId, groupTests);
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
public boolean getConfigurationCommands(SapforConfiguration sapforConfiguration) {
|
||||
//1. получить список всех команд.
|
||||
Vector<PassCode_2021> codes = new Vector<>();
|
||||
int v = 0;
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id.equals(sapforConfiguration.id)) {
|
||||
codes.add(command.passCode);
|
||||
if (command.passCode.equals(PassCode_2021.CreateParallelVariants))
|
||||
v++;
|
||||
}
|
||||
}
|
||||
//--
|
||||
if (codes.size() == 0) {
|
||||
Log.Writeln_("Пустая конфигурация:" + sapforConfiguration.id);
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (v > 2) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": построение параллельных вариантов возможно единожды.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if ((v == 1) && codes.size() > 1) {
|
||||
if (!codes.lastElement().equals(PassCode_2021.CreateParallelVariants)) {
|
||||
Log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": построение параллельных вариантов может быть только завершающей командой!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
//--
|
||||
allTasksCount = 0;
|
||||
target = null;
|
||||
//--
|
||||
groupsTests = new LinkedHashMap<>();
|
||||
//--->>
|
||||
testsNames_lower = new Vector<>();
|
||||
allTests = 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 (!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<String> tests : groupsTests.values())
|
||||
allTasksCount += tests.size();
|
||||
}
|
||||
//--
|
||||
return (UI.Question("Будет запущено:\n"
|
||||
+ allTasksCount + " задач\n" +
|
||||
"Продолжить")) && new TestingSystemPass() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Синхронизация тестов";
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
for (Test test : allTests.values()) {
|
||||
ShowMessage1("загрузка " + test.description);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DownloadTest, test.id));
|
||||
response.Unpack(TestInterface.getArchive(test));
|
||||
}
|
||||
}
|
||||
}.Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//---
|
||||
ShowMessage1("Распаковка тестов...");
|
||||
//сразу в задачи распаковывать нельзя, потому что копируются под ид,а не дескриптион.
|
||||
for (Test test : allTests.values()) {
|
||||
ShowMessage2(test.description);
|
||||
File testDst = new File(Global.TestsDirectory, test.id);
|
||||
Utils.delete_with_check(testDst);
|
||||
passes.get(PassCode_2021.UnzipFolderPass).Do(
|
||||
TestInterface.getArchive(test).getAbsolutePath(),
|
||||
Global.TestsDirectory.getAbsolutePath(), false
|
||||
);
|
||||
}
|
||||
target = new SapforScenario();
|
||||
target.sapfor_version = String.valueOf(Current.getSapfor().version);
|
||||
target.tasksCount = allTasksCount;
|
||||
Global.db.Insert(target);
|
||||
//--->>>
|
||||
File scenarioWorkspace = new File(Global.visualiser.getWorkspace(), String.valueOf(target.id));
|
||||
Utils.CheckAndCleanDirectory(scenarioWorkspace);
|
||||
target.workspace = scenarioWorkspace.getAbsolutePath();
|
||||
target.testsNames = String.join(";", testsNames_lower);
|
||||
sapfor = new File(target.workspace, Utils.getDateName("SAPFOR_F") + (Global.isWindows ? ".exe" : "")); //развилка на линукс
|
||||
ShowMessage2("Копирование SAPFOR");
|
||||
FileUtils.copyFile(Current.getSapfor().getFile(), sapfor);
|
||||
if (!sapfor.setExecutable(true))
|
||||
throw new PassException("Не удалось сделать файл " + sapfor.getName() + " исполняемым!");
|
||||
ShowMessage2("Копирование визуализатора");
|
||||
File visualiser = new File(target.workspace, "VisualSapfor.jar");
|
||||
FileUtils.copyFile(Global.visualiser.getFile(), visualiser);
|
||||
ShowMessage2("Создание настроек");
|
||||
GlobalProperties properties = new GlobalProperties();
|
||||
properties.Mode = Current.Mode.Scenario;
|
||||
properties.threadsNum = 4;
|
||||
properties.threadsTimeout = 2000;
|
||||
//----
|
||||
Utils.jsonToFile(properties, new File(target.workspace, "properties"));
|
||||
//----
|
||||
File scenarioFile = new File(target.workspace, "scenario");
|
||||
PackageModeScenario_json scenario_json = new PackageModeScenario_json();
|
||||
scenario_json.sapfor_drv = sapfor.getName();
|
||||
scenario_json.tests.addAll(allTests.keySet());
|
||||
//----
|
||||
Global.db.Update(target);
|
||||
ShowMessage1("Создание рабочих пространств...");
|
||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||
SapforTasksPackage sapforTasksPackage = new SapforTasksPackage();
|
||||
Vector<PassCode_2021> codes = SapforConfigurationInterface.getPassCodes(configuration);
|
||||
Vector<String> passesNames = codes.stream().map(PassCode_2021::getDescription).collect(Collectors.toCollection(Vector::new));
|
||||
//--
|
||||
sapforTasksPackage.sapforscenario_id = target.id;
|
||||
sapforTasksPackage.sapforconfiguration_id = configuration.id;
|
||||
sapforTasksPackage.flags = SapforConfigurationInterface.getFlags(configuration);
|
||||
sapforTasksPackage.passesNames = String.join(";", passesNames);
|
||||
//--xcopy
|
||||
Global.db.Insert(sapforTasksPackage);
|
||||
sapforTasksPackage.workspace = Paths.get(
|
||||
Global.visualiser.getWorkspace().getAbsolutePath(),
|
||||
String.valueOf(target.id),
|
||||
String.valueOf(sapforTasksPackage.id)
|
||||
).toFile().getAbsolutePath();
|
||||
//---
|
||||
Utils.CheckAndCleanDirectory(new File(sapforTasksPackage.workspace));
|
||||
//---
|
||||
for (Vector<String> testIds : groupsTests.values()) {
|
||||
for (String testId : testIds) {
|
||||
Test test = Global.testingServer.db.tests.get(testId);
|
||||
ShowMessage2(test.description);
|
||||
//--
|
||||
File taskWorkspace = new File(sapforTasksPackage.workspace, test.description);
|
||||
Utils.CheckAndCleanDirectory(taskWorkspace);
|
||||
//--
|
||||
FileUtils.copyDirectory(new File(Global.TestsDirectory, test.id), taskWorkspace);
|
||||
}
|
||||
}
|
||||
Global.db.Update(sapforTasksPackage);
|
||||
//--->>
|
||||
SapforConfiguration_json package_json = new SapforConfiguration_json();
|
||||
package_json.id = String.valueOf(sapforTasksPackage.id);
|
||||
package_json.flags = sapforTasksPackage.flags;
|
||||
package_json.codes.addAll(codes);
|
||||
//--->>
|
||||
scenario_json.packages.add(package_json);
|
||||
}
|
||||
//--
|
||||
Utils.jsonToFile(scenario_json, scenarioFile);
|
||||
//--
|
||||
Utils.startScript_(scenarioWorkspace, scenarioWorkspace, "start", "java -jar VisualSapfor.jar");
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
Pass_2021.passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
// Global.testingServer.db.sapforScenarios.ShowUI(target.getPK());
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
// Global.db.sapforScenarios.ShowUI();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class SynchronizeTests extends TestingSystemPass<Object> {
|
||||
server.db.configurations.ShowUI();
|
||||
server.db.groups.ShowUI();
|
||||
server.db.sapforConfigurations.ShowUI();
|
||||
server.db.sapforScenarios.ShowUI();
|
||||
server.db.sapforTasksPackages.ShowUI();
|
||||
server.db.RestoreLastSelections();
|
||||
UI.getMainWindow().getTestingWindow().ShowCheckedTestsCount();
|
||||
//для отображения числа ядер.
|
||||
|
||||
Reference in New Issue
Block a user