Промежуточный. Убрал рудимент связанный с хранением ключей задач. Настроил синхронизацию сапфоровских пакетов.

This commit is contained in:
2023-10-12 21:48:22 +03:00
parent d5ff1683cb
commit 6d7367894f
12 changed files with 59 additions and 94 deletions

13
.idea/workspace.xml generated
View File

@@ -7,11 +7,16 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TestingBar/TestingBar.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TasksPackagesMenuBar/TasksPackagesMenuBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TasksPackagesMenuBar/TasksPackagesMenuBar.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/UI/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/UI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.form" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/GlobalData/GlobalDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/GlobalDatabase.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TaskKey/TaskKey_2022.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TaskKey/TaskKeysDBTable.java" beforeDir="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/Visual_DVM_2021/Passes/All/ActualizePackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/ActualizePackages.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/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" />

View File

@@ -30,7 +30,6 @@ import GlobalData.Tasks.CompilationTask.CompilationTasksDBTable;
import GlobalData.Tasks.RunTask.RunTasksDBTable;
import GlobalData.User.UsersDBTable;
import Repository.Component.ComponentType;
import TestingSystem.TaskKey.TaskKeysDBTable;
import Visual_DVM_2021.PassStats.PassStatsDBTable;
import java.nio.file.Paths;
@@ -59,7 +58,6 @@ public class GlobalDatabase extends SQLiteDatabase {
public SplittersDBTable splitters;
public GridsDBTable grids;
//-
public TaskKeysDBTable tasksKeys;
public SapforProfilesDBTable sapforProfiles = null;
//---------
public SapforProfileSettingsDBTable sapforProfilesSettings = null;
@@ -88,7 +86,6 @@ public class GlobalDatabase extends SQLiteDatabase {
addTable(splitters = new SplittersDBTable());
addTable(dvmParameters = new DVMParameterDBTable());
addTable(grids = new GridsDBTable());
addTable(tasksKeys = new TaskKeysDBTable());
addTable(sapforProfiles = new SapforProfilesDBTable());
addTable(sapforProfilesSettings = new SapforProfileSettingsDBTable());
}

View File

@@ -1,4 +1,5 @@
package SapforTestingSystem.SapforTasksPackage;
import Common.Database.DBObject;
import Common.Database.nDBObject;
import TestingSystem.TasksPackage.TasksPackageState;
import com.sun.org.glassfish.gmbal.Description;
@@ -23,4 +24,16 @@ public class SapforTasksPackage extends nDBObject {
//RunningExecution
//Done
//Aborted
@Override
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);
SapforTasksPackage p = (SapforTasksPackage) src;
testsNames = p.testsNames;
sapfor_version = p.sapfor_version;
sapfor_build_date =p.sapfor_build_date;
workspace = p.workspace;
tasksCount = p.tasksCount;
StartDate = p.StartDate;
ChangeDate = p.ChangeDate;
}
}

View File

@@ -1,28 +0,0 @@
package TestingSystem.TaskKey;
import Common.Database.DBObject;
import com.sun.org.glassfish.gmbal.Description;
public class TaskKey_2022 extends DBObject {
@Description("PRIMARY KEY, UNIQUE")
public long task_id = 0;
public String package_id = "";
@Override
public Object getPK() {
return task_id;
}
public TaskKey_2022(TaskKey_2022 src) {
this.SynchronizeFields(src);
}
public TaskKey_2022(long task_id_in, String package_id_in) {
task_id = task_id_in;
package_id = package_id_in;
}
public TaskKey_2022() {
}
@Override
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);
TaskKey_2022 key = (TaskKey_2022) src;
task_id = key.task_id;
package_id = key.package_id;
}
}

View File

@@ -1,7 +0,0 @@
package TestingSystem.TaskKey;
import Common.Database.DBTable;
public class TaskKeysDBTable extends DBTable<Long, TaskKey_2022> {
public TaskKeysDBTable() {
super(Long.class, TaskKey_2022.class);
}
}

View File

@@ -2,10 +2,10 @@ package TestingSystem;
import Common.Database.SQLITE.SQLiteDatabase;
import Common.Global;
import GlobalData.Settings.SettingName;
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackagesDBTable;
import TestingSystem.TSetting.TSetting;
import TestingSystem.TSetting.TSettingsDBTable;
import TestingSystem.TaskKey.TaskKey_2022;
import TestingSystem.Tasks.TestCompilationTask;
import TestingSystem.Tasks.TestCompilationTasksDBTable;
import TestingSystem.Tasks.TestRunTask;
@@ -129,20 +129,6 @@ public class TasksDatabase extends SQLiteDatabase {
}
return res;
}
public void CheckKeysActuality() throws Exception {
Vector<TaskKey_2022> toDelete = new Vector<>();
for (TaskKey_2022 taskKey : Global.db.tasksKeys.Data.values()) {
if (!testRunTasks.containsKey(taskKey.task_id) || testRunTasks.get(taskKey.task_id).state.isComplete())
toDelete.add(taskKey);
}
System.out.println("to delete size = " + toDelete.size());
if (!toDelete.isEmpty()) {
Global.db.BeginTransaction();
for (TaskKey_2022 taskKey : toDelete)
Global.db.Delete(taskKey);
Global.db.Commit();
}
}
public long getQueueSize(long date) throws Exception {
long sum = 0L;
for (TasksPackage tasksPackage : packages.Data.values()) {
@@ -163,4 +149,11 @@ public class TasksDatabase extends SQLiteDatabase {
res.add(p);
return res;
}
public Vector<SapforTasksPackage> getActiveSapforPackages() {
Vector<SapforTasksPackage> res = new Vector<>();
for (SapforTasksPackage p : sapforTasksPackages.Data.values())
if (!p.state.equals(TasksPackageState.Done))
res.add(p);
return res;
}
}

View File

@@ -3,6 +3,7 @@ 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;
@@ -11,20 +12,31 @@ import Visual_DVM_2021.Passes.TestingSystemPass;
import javafx.util.Pair;
import java.util.Vector;
public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
public class ActualizePackages extends TestingSystemPass<Object> {
boolean needsSynchronize;
Vector<TasksPackage> dvmPackages;
Vector<SapforTasksPackage> spfPackages;
@Override
protected void ServerAction() throws Exception {
Vector<TasksPackage> actual_packages = new Vector<>();
for (TasksPackage p : target) {
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;
actual_packages.add(actual_package);
//-
p.SynchronizeFields(actual_package);
if (!oldState.equals(p.state) && p.state.equals(TasksPackageState.Done))
needsSynchronize=true; //состояние изменилось, и на 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);
}
}
@@ -34,9 +46,10 @@ public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
}
@Override
protected boolean canStart(Object... args) throws Exception {
needsSynchronize=false;
target = server.account_db.getActivePackages();
return !target.isEmpty();
needsSynchronize = false;
dvmPackages = server.account_db.getActivePackages();
spfPackages = server.account_db.getActiveSapforPackages();
return !dvmPackages.isEmpty() || !spfPackages.isEmpty();
}
@Override
protected void performCanNotStart() throws Exception {
@@ -53,18 +66,20 @@ public class ActualizePackages extends TestingSystemPass<Vector<TasksPackage>> {
@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) {
if (needsSynchronize)
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
}
}
}

View File

@@ -10,6 +10,7 @@ import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommand
import SapforTestingSystem.SapforTasksPackage_info;
import TestingSystem.Group.Group;
import TestingSystem.Test.Test;
import TestingSystem.TestingServer;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.TestingSystemPass;
@@ -188,14 +189,7 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage_info>
@Override
protected void performDone() throws Exception {
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
/*
if (!TestingServer.checkTasks)
TestingServer.TimerOn();
Global.db.BeginTransaction();
for (TestRunTask testRunTask : server.account_db.testRunTasks.Data.values())
if (testRunTask.taskspackage_id.equals(target.id))
Global.db.Insert(new TaskKey_2022(testRunTask.id, target.id));
Global.db.Commit();
*/
}
}

View File

@@ -1,6 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import Common.UI.UI;
import GlobalData.Compiler.CompilerType;
import GlobalData.Machine.MachineType;
@@ -8,9 +7,9 @@ import GlobalData.User.UserState;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.Configuration.ConfigurationInterface;
import TestingSystem.Configuration.UI.ConfigurationDBTable;
import TestingSystem.Group.Group;
import TestingSystem.Group.GroupInterface;
import TestingSystem.TaskKey.TaskKey_2022;
import TestingSystem.Tasks.TestCompilationTask;
import TestingSystem.Tasks.TestRunTask;
import TestingSystem.TasksPackage.TasksPackage;
@@ -199,10 +198,10 @@ public class StartTests extends TestingSystemPass<TasksPackage> {
summary_lines.addAll(configurations_lines);
summary_lines.addAll(groups_lines);
target.summary =
"Задач на компиляцию: " + target.compilationTasksCount + "\n" +
"Задач на компиляцию: " + target.compilationTasksCount + "\n" +
"Задач на запуск: " + target.runTasksCount + "\n" +
String.join("\n", summary_lines);
target.needsEmail = UI.getMainWindow().getTestingWindow().isEmailTestingOn()?1:0;
target.needsEmail = ConfigurationDBTable.email ? 1 : 0;
return !tasks.isEmpty();
}
@Override
@@ -220,11 +219,6 @@ public class StartTests extends TestingSystemPass<TasksPackage> {
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
if (!TestingServer.checkTasks)
TestingServer.TimerOn();
Global.db.BeginTransaction();
for (TestRunTask testRunTask : server.account_db.testRunTasks.Data.values())
if (testRunTask.taskspackage_id.equals(target.id))
Global.db.Insert(new TaskKey_2022(testRunTask.id, target.id));
Global.db.Commit();
}
@Override
protected void showDone() throws Exception {

View File

@@ -53,10 +53,6 @@ public class SynchronizeTestsTasks extends TestingSystemPass<Vector<Integer>> {
UI.getMainWindow().getTestingWindow().RemountTestTable();
}
@Override
protected void performDone() throws Exception {
server.account_db.CheckKeysActuality();
}
@Override
protected boolean validate() {
return (response.object != null);
}

View File

@@ -14,5 +14,4 @@ public interface TestingWindow extends VisualizerForm {
void RemountTestTable();
//-
void FocusTestingTasks();
boolean isEmailTestingOn();
}

View File

@@ -2,7 +2,6 @@ package Visual_DVM_2021.UI.Main;
import Common.Global;
import Common.UI.TextField.StyledTextField;
import Common.UI.UI;
import TestingSystem.Configuration.UI.ConfigurationDBTable;
import Visual_DVM_2021.UI.Interface.FormWithSplitters;
import Visual_DVM_2021.UI.Interface.TestingWindow;
@@ -136,11 +135,6 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
public void FocusTestingTasks() {
}
@Override
public boolean isEmailTestingOn() {
return
ConfigurationDBTable.email;
}
@Override
public void RemountTestTable() {
UI.Clear(packagesPanel);
UI.Clear(testsRunTasksPanel);