рефакторинг серверной части сапфора.

This commit is contained in:
2023-12-16 03:57:01 +03:00
parent b7b41ae59c
commit 34c08e7d44
32 changed files with 942 additions and 355 deletions

View File

@@ -13,7 +13,9 @@ import TestingSystem.DVM.DVMPackage.DVMPackageDBTable;
import TestingSystem.DVM.TasksPackage.TasksPackageState;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.SapforPackage.SapforPackageDBTable;
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
import Visual_DVM_2021.Passes.PassCode_2021;
@@ -105,4 +107,34 @@ public class TestsDatabase extends SQLiteDatabase {
}
return null;
}
public SapforPackage getFirstActiveSapforPackage() {
SapforPackage first_active = null;
SapforPackage first_queued = null;
if (!sapforPackages.Data.isEmpty()) {
for (SapforPackage p : sapforPackages.Data.values()) {
switch (p.state) {
case Done:
case Aborted:
break;
case Queued:
if (first_queued == null) first_queued = p;
break;
default:
if (first_active == null) first_active = p; //это и будет первый активный.
break;
}
}
if (first_active != null) return first_active;
if (first_queued != null) {
first_queued.state = TasksPackageState.TestsSynchronize;
try {
Update(first_queued);
} catch (Exception ex) {
ex.printStackTrace();
}
}
return first_queued;
}
return null;
}
}