промежуточный. вариант с разбитием конфигурации сапфора и настройки как отдельный объект

This commit is contained in:
2024-09-27 22:50:47 +03:00
parent 30b51180c4
commit 4547fd10bd
27 changed files with 777 additions and 69 deletions

View File

@@ -0,0 +1,14 @@
package TestingSystem.Common.Settings;
import Common.Database.DBObject;
import Common.Database.riDBObject;
import TestingSystem.SAPFOR.SapforSettings.SapforSettings;
//предопределенный набор настроек тестируемой системы. сохраняется для упрощения.
public abstract class Settings extends riDBObject {
public String flags="";
@Override
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);
Settings s = (Settings) src;
flags=s.flags;
}
}

View File

@@ -25,6 +25,8 @@ import TestingSystem.SAPFOR.Json.SapforPackage_json;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
import TestingSystem.SAPFOR.SapforTestingPlanner;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
@@ -110,6 +112,16 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
SapforPackage sapforPackage = (SapforPackage) object;
File workspace = sapforPackage.getLocalWorkspace();
Utils.forceDeleteWithCheck(workspace);
} else if (object instanceof SapforSettings) {
SapforSettings sapforSettings = (SapforSettings) object;
Vector<SapforSettingsCommand> commands = new Vector<>();
for (SapforSettingsCommand command : db.sapforSettingsCommands.Data.values()) {
if (command.sapforsettings_id== sapforSettings.id)
commands.add(command);
}
for (SapforSettingsCommand command : commands) {
db.Delete(command);
}
}
}
//-->>>
@@ -641,30 +653,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
afterPublishAction(target);
//--
}
/*
public void PATCH() {
for (DVMPackage testingPackage : db.dvmPackages.Data.values()) {
boolean hasErrors = false;
try {
testingPackage.readJson();
//---------------------------------------------------
for (DVMCompilationTask compilationTask : testingPackage.package_json.compilationTasks) {
if (!compilationTask.state.equals(TaskState.Done))
hasErrors = true;
for (DVMRunTask runTask : compilationTask.runTasks) {
if (!runTask.state.equals(TaskState.Done))
hasErrors = true;
}
}
if (hasErrors)
testingPackage.state = TasksPackageState.DoneWithErrors;
//---------------------------------------------------
db.Update(testingPackage);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
*/
}

View File

@@ -19,6 +19,8 @@ import TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.SapforPackage.SapforPackageDBTable;
import TestingSystem.SAPFOR.SapforSettings.SapforSettingsDBTable;
import TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommandsDBTable;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
@@ -33,7 +35,6 @@ import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Vector;
public class TestsDatabase extends SQLiteDatabase {
public DVMConfigurationDBTable dvm_configurations;
public TestDBTable tests;
public GroupsDBTable groups;
@@ -48,6 +49,8 @@ public class TestsDatabase extends SQLiteDatabase {
public ServerSapforsDBTable serverSapfors;
//---
public DVMRunTasksSet dvmRunTasks = new DVMRunTasksSet(); //задачи текущего пакета тестирования DVM
public SapforSettingsDBTable sapforSettings;
public SapforSettingsCommandsDBTable sapforSettingsCommands;
//--
public TestsDatabase() {
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
@@ -64,6 +67,8 @@ public class TestsDatabase extends SQLiteDatabase {
addTable(sapforConfigurations = new SapforConfigurationDBTable());
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
addTable(serverSapfors = new ServerSapforsDBTable());
addTable(sapforSettings = new SapforSettingsDBTable());
addTable(sapforSettingsCommands = new SapforSettingsCommandsDBTable());
}
@Override
public PassCode_2021 getSynchronizePassCode() {
@@ -272,19 +277,18 @@ public class TestsDatabase extends SQLiteDatabase {
return res;
}
public ServerSapfor getSapforCopyForCompilation() {
for (ServerSapfor serverSapfor: serverSapfors.Data.values()){
if (serverSapfor.state.equals(ServerSapforState.Queued)){
for (ServerSapfor serverSapfor : serverSapfors.Data.values()) {
if (serverSapfor.state.equals(ServerSapforState.Queued)) {
return new ServerSapfor(serverSapfor);
}
}
return null;
}
public Integer getInstalledSapforMaxVersion() {
int max_version=Constants.Nan;
int max_version = Constants.Nan;
for (ServerSapfor sapfor : serverSapfors.Data.values()) {
if (sapfor.state.equals(ServerSapforState.Done)) {
int version=Constants.Nan;
int version = Constants.Nan;
try {
version = Integer.parseInt(sapfor.version);
} catch (Exception ex) {
@@ -295,15 +299,14 @@ public class TestsDatabase extends SQLiteDatabase {
}
return max_version;
}
public boolean hasActiveSapfors(){
for (ServerSapfor serverSapfor: serverSapfors.Data.values()){
if (serverSapfor.state.isActive())
return true;
public boolean hasActiveSapfors() {
for (ServerSapfor serverSapfor : serverSapfors.Data.values()) {
if (serverSapfor.state.isActive())
return true;
}
return false;
}
public void UnselectAllGTC(){
public void UnselectAllGTC() {
groups.CheckAll(false);
tests.CheckAll(false);
dvm_configurations.CheckAll(false);