промежуточный. частичный рефакторинг смены глобальный настроек. автоотключение проверки бд тестов если активных пакетов нет.
This commit is contained in:
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
@@ -6,7 +6,29 @@
|
||||
</artifacts-to-build>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="" />
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateProperty.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/GlobalProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/GlobalProperties.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Properties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Properties.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TestingBar/TestingBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TestingBar/TestingBar.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/GlobalData/Settings/SettingName.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Settings/SettingName.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TasksDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TasksDatabase.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TasksPackage/TasksPackageState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TasksPackage/TasksPackageState.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ActualizePackages.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ConvertCorrectnessTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestsGroupFromSelectedVersions.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestsGroupFromSelectedVersions.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SynchronizeTestsTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SynchronizeTestsTasks.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateSetting.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Pass_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Pass_2021.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Interface/TestingWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Interface/TestingWindow.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
|
||||
@@ -24,5 +24,9 @@
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"TestingKernels": 4,
|
||||
"AutoCheckTesting": false,
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"EmailOnTestingProgress": false
|
||||
}
|
||||
@@ -4,6 +4,19 @@ import com.google.gson.annotations.Expose;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class GlobalProperties extends Properties {
|
||||
@Override
|
||||
public String getFieldDescription(String fieldName) {
|
||||
switch (fieldName) {
|
||||
case "ShowPassesDone":
|
||||
return "Сообщать об успешном выполнении проходов";
|
||||
case "ConfirmPassesStart":
|
||||
return "Запрашивать подтверждения начала выполнения проходов";
|
||||
case "FocusPassesResult":
|
||||
return "Переходить на результирующую вкладку проходов по их завершении";
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
@Expose
|
||||
public Current.Mode Mode = Current.Mode.Normal;
|
||||
//---
|
||||
@@ -37,7 +50,6 @@ public class GlobalProperties extends Properties {
|
||||
public boolean ShowPassesDone = true;
|
||||
@Expose
|
||||
public boolean FocusPassesResult = true;
|
||||
//-
|
||||
@Expose
|
||||
public String GlobalDBName = "db7.sqlite";
|
||||
@Expose
|
||||
@@ -64,21 +76,17 @@ public class GlobalProperties extends Properties {
|
||||
public String PerformanceAnalyzerPath = "";
|
||||
@Expose
|
||||
public int ComponentsBackUpsCount=10;
|
||||
//- тестирование.
|
||||
@Expose
|
||||
public int TestingKernels = 4; //число ядер для тестирования
|
||||
@Expose
|
||||
public boolean AutoCheckTesting = false; // проверять ли задачи тестирования при включенном визуализаторе.
|
||||
@Expose
|
||||
public int CheckTestingIntervalSeconds = 10; //интервал автопроверки тестирования
|
||||
@Expose
|
||||
public boolean EmailOnTestingProgress = false; //включено ли оповещение по email о результатах тестирования.
|
||||
//-
|
||||
@Override
|
||||
public String getFieldDescription(String fieldName) {
|
||||
switch (fieldName) {
|
||||
case "ShowPassesDone":
|
||||
return "Сообщать об успешном выполнении проходов";
|
||||
case "ConfirmPassesStart":
|
||||
return "Запрашивать подтверждения начала выполнения проходов";
|
||||
case "FocusPassesResult":
|
||||
return "Переходить на результирующую вкладку проходов по их завершении";
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public File getFile() {
|
||||
return Paths.get(System.getProperty("user.dir"),"properties").toFile();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import Common.Utils.Utils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
public abstract class Properties {
|
||||
public void addFlagMenuItem(JMenu menu, String fieldName) {
|
||||
JMenuItem menu_item = new StableMenuItem(getFieldDescription(fieldName),
|
||||
@@ -46,4 +47,32 @@ public abstract class Properties {
|
||||
//--
|
||||
public abstract String getFieldDescription(String fieldName);
|
||||
public abstract File getFile();
|
||||
public boolean updateField(String name, Object newValue) {
|
||||
try {
|
||||
Field field = getClass().getField(name);
|
||||
Object oldValue = field.get(Global.properties);
|
||||
//---
|
||||
if (newValue.equals(oldValue))
|
||||
return false;
|
||||
//--
|
||||
field.set(this, newValue);
|
||||
return true;
|
||||
//--
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void switchAndUpdateFlag(String name){
|
||||
try {
|
||||
Field field = getClass().getField(name);
|
||||
boolean oldValue = (boolean) field.get(Global.properties);
|
||||
boolean newValue = !oldValue;
|
||||
//---
|
||||
field.set(this, newValue);
|
||||
//--
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package Common.UI.Menus_2023.TestingBar;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.Menus_2023.MenuBarButton;
|
||||
import Common.UI.Menus_2023.VisualiserMenuBar;
|
||||
import Common.UI.Themes.VisualiserFonts;
|
||||
@@ -25,9 +26,10 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
add(sKernels = new JSpinner());
|
||||
sKernels.setPreferredSize(new Dimension(60, 26));
|
||||
sKernels.setMaximumSize(new Dimension(60, 26));
|
||||
sKernels.setModel(new SpinnerNumberModel(TestingServer.kernels, 1, 64, 1));
|
||||
sKernels.setModel(new SpinnerNumberModel(Global.properties.TestingKernels, 1, 64, 1));
|
||||
sKernels.setValue(Global.properties.TestingKernels);
|
||||
UI.MakeSpinnerRapid(sKernels, e -> {
|
||||
TestingServer.kernels = (int) sKernels.getValue();
|
||||
Global.properties.updateField("TestingKernels", sKernels.getValue());
|
||||
});
|
||||
//--
|
||||
add(new MenuBarButton() {
|
||||
@@ -36,14 +38,13 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
|
||||
Mark();
|
||||
addActionListener(e -> {
|
||||
TestingServer.email = !TestingServer.email;
|
||||
Global.properties.switchAndUpdateFlag("EmailOnTestingProgress");
|
||||
Mark();
|
||||
});
|
||||
}
|
||||
public void Mark() {
|
||||
setIcon(Utils.getIcon(TestingServer.email ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
setIcon(Utils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
}
|
||||
|
||||
});
|
||||
//--
|
||||
add(autorefreshButton = new MenuBarButton() {
|
||||
@@ -52,23 +53,29 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
setToolTipText("автоматическое обновление состояния пакета задач");
|
||||
Mark();
|
||||
addActionListener(e -> {
|
||||
TestingServer.checkTasks = !TestingServer.checkTasks;
|
||||
TestingServer.switchTimer(TestingServer.checkTasks);
|
||||
Global.properties.switchAndUpdateFlag("AutoCheckTesting");
|
||||
//-
|
||||
if (Global.properties.AutoCheckTesting)
|
||||
TestingServer.TimerOn();
|
||||
else
|
||||
TestingServer.TimerOff();
|
||||
//-
|
||||
Mark();
|
||||
});
|
||||
}
|
||||
public void Mark() {
|
||||
setIcon(Utils.getIcon(TestingServer.checkTasks ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
}
|
||||
});
|
||||
//--
|
||||
add(sCheckTime = new JSpinner());
|
||||
sCheckTime.setPreferredSize(new Dimension(60, 26));
|
||||
sCheckTime.setMaximumSize(new Dimension(60, 26));
|
||||
sCheckTime.setModel(new SpinnerNumberModel(TestingServer.checkIntervalSecond, 10, 3600, 1));
|
||||
sCheckTime.setModel(new SpinnerNumberModel(Global.properties.CheckTestingIntervalSeconds, 10, 3600, 1));
|
||||
sCheckTime.setValue(Global.properties.CheckTestingIntervalSeconds);
|
||||
UI.MakeSpinnerRapid(sCheckTime, e -> {
|
||||
TestingServer.checkIntervalSecond = (int) sCheckTime.getValue();
|
||||
if (TestingServer.checkTasks) TestingServer.ResetTimer();
|
||||
Global.properties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
|
||||
if (Global.properties.AutoCheckTesting) TestingServer.ResetTimer();
|
||||
});
|
||||
add(new JLabel(" сек ") {
|
||||
{
|
||||
@@ -76,7 +83,7 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void ShowAutorefresh() {
|
||||
autorefreshButton.setIcon(Utils.getIcon(TestingServer.checkTasks ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
public void ShowAutoCheckTesting() {
|
||||
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package GlobalData.Settings;
|
||||
public enum SettingName {
|
||||
Undefined,
|
||||
//
|
||||
//совместимость
|
||||
ConfirmPassesStart,
|
||||
ShowPassesDone,
|
||||
@@ -72,10 +73,6 @@ public enum SettingName {
|
||||
}
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
// case VersionsMultiSelection:
|
||||
// return "Режим выбора версий";
|
||||
// case FilesMultiSelection:
|
||||
// return "Режим выбора файлов";
|
||||
case SaveModifications:
|
||||
return "Сохранять копию исходной версии при преобразованиях";
|
||||
case ComparsionDiffMergeOn:
|
||||
|
||||
@@ -145,6 +145,7 @@ public class TasksDatabase extends SQLiteDatabase {
|
||||
return sum;
|
||||
}
|
||||
//--
|
||||
/*
|
||||
public Vector<TasksPackage> getActivePackages() {
|
||||
Vector<TasksPackage> res = new Vector<>();
|
||||
for (TasksPackage p : packages.Data.values())
|
||||
@@ -159,6 +160,7 @@ public class TasksDatabase extends SQLiteDatabase {
|
||||
res.add(p);
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
public SapforTasksPackage getFirstActiveSapforPackage() {
|
||||
SapforTasksPackage first_active = null;
|
||||
SapforTasksPackage first_queued = null;
|
||||
@@ -189,4 +191,15 @@ public class TasksDatabase extends SQLiteDatabase {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean hasActivePackages() {
|
||||
for (TasksPackage tasksPackage : packages.Data.values()) {
|
||||
if (tasksPackage.state.isActive())
|
||||
return true;
|
||||
}
|
||||
for (SapforTasksPackage sapforTasksPackage : sapforTasksPackages.Data.values()) {
|
||||
if (sapforTasksPackage.state.isActive())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,16 @@ public enum TasksPackageState implements StatusEnum {
|
||||
//---------------------------------------
|
||||
Analysis,
|
||||
Done,
|
||||
Aborted
|
||||
;
|
||||
Aborted;
|
||||
public boolean isActive() {
|
||||
switch (this) {
|
||||
case Done:
|
||||
case Aborted:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Font getFont() {
|
||||
switch (this) {
|
||||
|
||||
@@ -46,10 +46,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static TestingSystem.TasksDatabase.tests_db_name;
|
||||
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
public static boolean email = false;
|
||||
public static boolean checkTasks = false;
|
||||
public static int checkIntervalSecond = 10;
|
||||
public static int kernels = 4;
|
||||
LinkedHashMap<String, TasksDatabase> accountsBases = new LinkedHashMap<>();
|
||||
//--------------------------------->>>
|
||||
public TestingServer() {
|
||||
@@ -233,17 +229,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
protected TestingPlanner testingPlanner = new TestingPlanner();
|
||||
protected Thread testingThread = new Thread(() -> testingPlanner.Perform());
|
||||
//------>>>
|
||||
public static void switchTimer(boolean on) {
|
||||
if (on)
|
||||
TimerOn();
|
||||
else
|
||||
TimerOff();
|
||||
}
|
||||
public static Timer checkTimer = null;
|
||||
public static void TimerOn() {
|
||||
checkTasks = true;
|
||||
checkTimer = new Timer(checkIntervalSecond * 1000, e -> {
|
||||
// Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
|
||||
System.out.println("timer on");
|
||||
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
|
||||
Pass_2021.passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
});
|
||||
checkTimer.start();
|
||||
@@ -252,7 +241,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
System.out.println("timer off");
|
||||
if (checkTimer != null)
|
||||
checkTimer.stop();
|
||||
checkTasks = false;
|
||||
}
|
||||
public static void ResetTimer() {
|
||||
TimerOff();
|
||||
@@ -397,8 +385,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
//1 - архивировать пакет.
|
||||
File packageArchive = sapforTasksPackage.getArchive();
|
||||
Utils.forceDeleteWithCheck(packageArchive);
|
||||
System.out.println("src = "+Utils.Brackets(sapforTasksPackage.workspace));
|
||||
System.out.println("dst="+Utils.Brackets(packageArchive.getAbsolutePath()));
|
||||
System.out.println("src = " + Utils.Brackets(sapforTasksPackage.workspace));
|
||||
System.out.println("dst=" + Utils.Brackets(packageArchive.getAbsolutePath()));
|
||||
//---
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (zip.Do(sapforTasksPackage.workspace, packageArchive.getAbsolutePath())) {
|
||||
|
||||
@@ -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