промежуточный. частичный рефакторинг смены глобальный настроек. автоотключение проверки бд тестов если активных пакетов нет.
This commit is contained in:
@@ -1,85 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.TasksPackage.TasksPackage;
|
||||
import TestingSystem.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.util.Vector;
|
||||
public class ActualizePackages extends TestingSystemPass<Object> {
|
||||
boolean needsSynchronize;
|
||||
Vector<TasksPackage> dvmPackages;
|
||||
Vector<SapforTasksPackage> spfPackages;
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
for (TasksPackage p : dvmPackages) {
|
||||
TasksPackageState oldState = p.state;
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetAccountObjectCopyByPK, Current.getAccount().email, new Pair<>(TasksPackage.class, p.id)));
|
||||
TasksPackage actual_package = (TasksPackage) response.object;
|
||||
//-
|
||||
p.SynchronizeFields(actual_package);
|
||||
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
|
||||
needsSynchronize = true; //состояние изменилось, и на Done значит нужно скачивать задачи.
|
||||
server.account_db.Update(p);
|
||||
}
|
||||
//---
|
||||
for (SapforTasksPackage p : spfPackages) {
|
||||
TasksPackageState oldState = p.state;
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetAccountObjectCopyByPK, Current.getAccount().email, new Pair<>(SapforTasksPackage.class, p.id)));
|
||||
SapforTasksPackage actual_package = (SapforTasksPackage) response.object;
|
||||
//-
|
||||
p.SynchronizeFields(actual_package);
|
||||
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
|
||||
needsSynchronize = true; //состояние изменилось, и на Done значит нужно скачивать задачи.
|
||||
server.account_db.Update(p);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
needsSynchronize = false;
|
||||
dvmPackages = server.account_db.getActivePackages();
|
||||
spfPackages = server.account_db.getActiveSapforPackages();
|
||||
return !dvmPackages.isEmpty() || !spfPackages.isEmpty();
|
||||
}
|
||||
@Override
|
||||
protected void performCanNotStart() throws Exception {
|
||||
TestingServer.TimerOff();
|
||||
}
|
||||
@Override
|
||||
protected void showCanNotStart() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
server.account_db.SaveLastSelections();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
server.account_db.packages.ClearUI();
|
||||
server.account_db.sapforTasksPackages.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
server.account_db.packages.ShowUI();
|
||||
server.account_db.sapforTasksPackages.ShowUI();
|
||||
//--->>
|
||||
if (!TestingServer.checkTasks) UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
server.account_db.RestoreLastSelections();
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (needsSynchronize)
|
||||
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.Test.ProjectFiles_json;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
@@ -45,12 +44,10 @@ public class ConvertCorrectnessTests extends TestingSystemPass<File> {
|
||||
passes.get(PassCode_2021.CloseCurrentProject);
|
||||
Current.set(Current.Root, null);
|
||||
Current.set(Current.Version, null);
|
||||
if (TestingServer.checkTasks)
|
||||
TestingServer.TimerOff();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
UI.testingBar.ShowAutoCheckTesting();
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
|
||||
@@ -7,7 +7,6 @@ import ProjectData.Project.db_project_info;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.Test.TestType;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
@@ -61,13 +60,11 @@ public class CreateTestsGroupFromSelectedVersions extends Pass_2021<Vector<db_pr
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (TestingServer.checkTasks)
|
||||
TestingServer.TimerOff();
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
passes.get(PassCode_2021.CloseCurrentProject).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
UI.testingBar.ShowAutoCheckTesting();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
@@ -13,7 +13,6 @@ import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import TestingSystem.Group.Group;
|
||||
import TestingSystem.TasksPackage.TasksPackageState;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
@@ -223,9 +222,9 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
|
||||
//--
|
||||
target.testsNames = String.join(";", testsNames_lower);
|
||||
target.StartDate = new Date().getTime();
|
||||
target.kernels = TestingServer.kernels;
|
||||
target.kernels = Global.properties.TestingKernels;
|
||||
target.state = TasksPackageState.Queued;
|
||||
target.needsEmail = TestingServer.email ? 1 : 0;
|
||||
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||
//---
|
||||
Vector<SapforTasksPackage> packages = new Vector<>();
|
||||
packages.add(target);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import GlobalData.Compiler.CompilerType;
|
||||
import GlobalData.Machine.MachineType;
|
||||
@@ -13,7 +14,6 @@ import TestingSystem.Tasks.TestCompilationTask;
|
||||
import TestingSystem.Tasks.TestRunTask;
|
||||
import TestingSystem.TasksPackage.TasksPackage;
|
||||
import TestingSystem.Test.Test;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
@@ -135,7 +135,7 @@ public class StartTests extends TestingSystemPass<TasksPackage> {
|
||||
target.user_workspace = Current.getUser().workspace;
|
||||
target.dvm_drv = Current.getCompiler().call_command;
|
||||
target.dvm_version = Current.getCompiler().getVersionInfo();
|
||||
target.kernels = TestingServer.kernels;
|
||||
target.kernels = Global.properties.TestingKernels;
|
||||
Vector<TestCompilationTask> tasks = new Vector<>();
|
||||
//1, Проверяем выбраны ли конфиги.
|
||||
if (server.db.configurations.getCheckedCount() == 0) {
|
||||
@@ -200,7 +200,7 @@ public class StartTests extends TestingSystemPass<TasksPackage> {
|
||||
"Задач на компиляцию: " + target.compilationTasksCount + "\n" +
|
||||
"Задач на запуск: " + target.runTasksCount + "\n" +
|
||||
String.join("\n", summary_lines);
|
||||
target.needsEmail = TestingServer.email ? 1 : 0;
|
||||
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||
return !tasks.isEmpty();
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -1,20 +1,42 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.TestingServer;
|
||||
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.util.Vector;
|
||||
public class SynchronizeTestsTasks extends TestingSystemPass<Vector<Integer>> {
|
||||
public class SynchronizeTestsTasks extends Pass_2021 {
|
||||
byte[] db_file_bytes;
|
||||
File new_db_file;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
return Current.getAccount().CheckRegistered(Log);
|
||||
db_file_bytes = null;
|
||||
new_db_file = null;
|
||||
if (Current.getAccount().CheckRegistered(Log)) {
|
||||
TestingSystemPass download = new TestingSystemPass() {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Загрузка базы тестовых задач";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveTestsTasksDatabase, Current.getAccount().email));
|
||||
db_file_bytes = (byte[]) response.object;
|
||||
}
|
||||
};
|
||||
return download.Do();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
@@ -30,37 +52,42 @@ public class SynchronizeTestsTasks extends TestingSystemPass<Vector<Integer>> {
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
server.account_db.Disconnect();
|
||||
Global.testingServer.account_db.Disconnect();
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
server.account_db.packages.ClearUI();
|
||||
server.account_db.sapforTasksPackages.ClearUI();
|
||||
Global.testingServer.account_db.packages.ClearUI();
|
||||
Global.testingServer.account_db.sapforTasksPackages.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.ReceiveTestsTasksDatabase, Current.getAccount().email));
|
||||
response.Unpack(new_db_file = Utils.getTempFileName("tdb"));
|
||||
protected void body() throws Exception {
|
||||
Utils.unpackFile(db_file_bytes, new_db_file = Utils.getTempFileName("tdb"));
|
||||
if (new_db_file.exists()) {
|
||||
Utils.forceDeleteWithCheck(server.account_db.getFile());
|
||||
FileUtils.moveFile(new_db_file, server.account_db.getFile());
|
||||
server.account_db.setFile(Current.getAccount().email);
|
||||
Utils.forceDeleteWithCheck(Global.testingServer.account_db.getFile());
|
||||
FileUtils.moveFile(new_db_file, Global.testingServer.account_db.getFile());
|
||||
Global.testingServer.account_db.setFile(Current.getAccount().email);
|
||||
}
|
||||
server.account_db.Connect();
|
||||
server.account_db.CreateAllTables();
|
||||
server.account_db.prepareTablesStatements();
|
||||
server.account_db.Synchronize();
|
||||
//--
|
||||
Global.testingServer.account_db.Connect();
|
||||
Global.testingServer.account_db.CreateAllTables();
|
||||
Global.testingServer.account_db.prepareTablesStatements();
|
||||
Global.testingServer.account_db.Synchronize();
|
||||
UI.getMainWindow().getTestingWindow().RemountTestTable();
|
||||
//--
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return (response.object != null);
|
||||
return (db_file_bytes != null);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
server.account_db.packages.ShowUI();
|
||||
server.account_db.sapforTasksPackages.ShowUI();
|
||||
if (!TestingServer.checkTasks) UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
|
||||
protected void showFinish() throws Exception {
|
||||
Global.testingServer.account_db.packages.ShowUI();
|
||||
Global.testingServer.account_db.sapforTasksPackages.ShowUI();
|
||||
if (!Global.testingServer.account_db.hasActivePackages()) {
|
||||
Global.properties.updateField("AutoCheckTesting", false);
|
||||
TestingServer.TimerOff();
|
||||
UI.testingBar.ShowAutoCheckTesting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
src/Visual_DVM_2021/Passes/All/UpdateProperty.java
Normal file
28
src/Visual_DVM_2021/Passes/All/UpdateProperty.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Global;
|
||||
import Common.GlobalProperties;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
public class UpdateProperty extends Pass_2021<Object> {
|
||||
//todo в дальнейшем, все настройки перевести в properties, и перенести сюда функционал UpdateSetting (?)
|
||||
String name = "";
|
||||
Field field = null;
|
||||
Object oldValue = null;
|
||||
Object newValue = null;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
name = (String) args[0];
|
||||
newValue = args[1];
|
||||
//--
|
||||
field = GlobalProperties.class.getField(name);
|
||||
oldValue = field.get(Global.properties);
|
||||
//---
|
||||
return !newValue.equals(oldValue);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
field.set(Global.properties, newValue);
|
||||
Global.properties.Update();
|
||||
}
|
||||
}
|
||||
@@ -16,16 +16,13 @@ import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
public class UpdateSetting extends Pass_2021<DBSetting> {
|
||||
|
||||
String NewValue;
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("");
|
||||
VFileChooser fileChooser = new VFileChooser("", "exe");
|
||||
boolean silent;
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = Global.db.settings.get(args[0]);
|
||||
NewValue = target.Value;
|
||||
silent = false;
|
||||
if (args.length == 1) {
|
||||
//интерфейсный режим. получение по клику на пункт меню.
|
||||
switch (target.settingType) {
|
||||
@@ -101,11 +98,8 @@ public class UpdateSetting extends Pass_2021<DBSetting> {
|
||||
}
|
||||
} else {
|
||||
NewValue = args[1].toString();
|
||||
silent = true;
|
||||
}
|
||||
//программный, тихий режим.}
|
||||
//--
|
||||
System.out.println(target.Value + "/" + NewValue);
|
||||
return !NewValue.equals(target.Value);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package Visual_DVM_2021.Passes;
|
||||
public enum PassCode_2021 {
|
||||
Undefined,
|
||||
//-
|
||||
UpdateProperty,
|
||||
ShowAllParallelVariants,
|
||||
ShowParallelVariantsCoverage,
|
||||
AbortSapforTaskPackage,
|
||||
@@ -269,7 +270,6 @@ public enum PassCode_2021 {
|
||||
DownloadTaskTest,
|
||||
//-
|
||||
GetTestsQueueSize,
|
||||
ActualizePackages,
|
||||
AbortSelectedPackages,
|
||||
ApplyCurrentFunction,
|
||||
//->
|
||||
@@ -314,6 +314,8 @@ public enum PassCode_2021 {
|
||||
switch (this) {
|
||||
case Undefined:
|
||||
return "?";
|
||||
case UpdateProperty:
|
||||
return "Обновить параметр";
|
||||
case OpenSapforEtalonVersion:
|
||||
return "Открыть текущую эталонную версию SAPFOR как проект";
|
||||
case OpenSapforVersion:
|
||||
@@ -438,8 +440,6 @@ public enum PassCode_2021 {
|
||||
return "Прерывать отмеченные пакеты задач";
|
||||
case GetTestsQueueSize:
|
||||
return "Очередь перед текущим пакетом";
|
||||
case ActualizePackages:
|
||||
return "Обновить текущий пакет задач";
|
||||
case DownloadTaskTest:
|
||||
return "Загрузить тест текущей задачи";
|
||||
case CopyGroups:
|
||||
|
||||
@@ -244,7 +244,7 @@ public class Pass_2021<T> {
|
||||
Vector<String> ToPrint = new Vector<>();
|
||||
createStack_r(ToDo, ToPrint);
|
||||
if (Global.properties.ConfirmPassesStart && !ToPrint.isEmpty() &&
|
||||
!UI.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))//, SettingName.ConfirmPassesStart)
|
||||
!UI.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))
|
||||
) return false;
|
||||
while (ToDo.size() > 1) {
|
||||
if (!ToDo.pop().start()) return false;
|
||||
|
||||
@@ -10,7 +10,7 @@ public interface TestingWindow extends VisualizerForm {
|
||||
//-
|
||||
void RefreshTabsNames();
|
||||
void FocusTestingSystem();
|
||||
void ShowAutoActualizeTestsState();
|
||||
|
||||
void RemountTestTable();
|
||||
//-
|
||||
void FocusTestingTasks();
|
||||
|
||||
@@ -103,6 +103,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
|
||||
Global.testingServer.db.serverSapfors.ShowUI();
|
||||
Global.testingServer.db.sapforConfigurations.ShowUI();
|
||||
Global.testingServer.account_db.sapforTasksPackages.ShowUI();
|
||||
//---
|
||||
}
|
||||
//-
|
||||
@Override
|
||||
@@ -143,10 +144,6 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
|
||||
testingTabs.setSelectedIndex(2);
|
||||
}
|
||||
@Override
|
||||
public void ShowAutoActualizeTestsState() {
|
||||
UI.testingBar.ShowAutorefresh();
|
||||
}
|
||||
@Override
|
||||
public void FocusTestingTasks() {
|
||||
}
|
||||
@Override
|
||||
@@ -155,7 +152,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
|
||||
}
|
||||
@Override
|
||||
public void ShowCurrentSapforPackageVersion() {
|
||||
sapforVersionSlave.ApplyObject();
|
||||
sapforVersionSlave.ApplyObject();
|
||||
}
|
||||
@Override
|
||||
public void ShowNoSapforPackageVersionEtalon() {
|
||||
|
||||
Reference in New Issue
Block a user