no message
This commit is contained in:
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -8,9 +8,9 @@
|
|||||||
<component name="ChangeListManager">
|
<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 beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Global.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/Repository/RepositoryClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryClient.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Repository/RepositoryClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryClient.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public abstract class RepositoryClient {
|
|||||||
return ServerCommand(code_in, "", null);
|
return ServerCommand(code_in, "", null);
|
||||||
}
|
}
|
||||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||||
throw new PassException("Ошибка взаимодействия с сервером " + code_in);
|
throw new PassException(Utils.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
|
||||||
}
|
}
|
||||||
public abstract void perform() throws Exception;
|
public abstract void perform() throws Exception;
|
||||||
public void Perform(){
|
public void Perform(){
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import Repository.Server.ServerCode;
|
|||||||
import Repository.Server.ServerExchangeUnit_2021;
|
import Repository.Server.ServerExchangeUnit_2021;
|
||||||
import TestingSystem.Common.Group.Group;
|
import TestingSystem.Common.Group.Group;
|
||||||
import TestingSystem.Common.MachineProcess.MachineProcess;
|
import TestingSystem.Common.MachineProcess.MachineProcess;
|
||||||
|
import TestingSystem.Common.MachineProcess.MachineProcessSet;
|
||||||
import TestingSystem.Common.Test.Test;
|
import TestingSystem.Common.Test.Test;
|
||||||
import TestingSystem.Common.Test.TestType;
|
import TestingSystem.Common.Test.TestType;
|
||||||
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||||
import TestingSystem.DVM.DVMPackage.DVMPackage_json;
|
import TestingSystem.DVM.DVMPackage.DVMPackage_json;
|
||||||
import TestingSystem.DVM.DVMTestingChecker;
|
|
||||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||||
@@ -37,6 +37,43 @@ import java.nio.file.Paths;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||||
public String name = "?";
|
public String name = "?";
|
||||||
|
public static MachineProcessSet machinesProcesses= new MachineProcessSet();
|
||||||
|
void StartNecessaryMachines() {
|
||||||
|
try {
|
||||||
|
Vector<String> aborted = new Vector<>();
|
||||||
|
for (MachineProcess process : machinesProcesses.Data.values()) {
|
||||||
|
if (process.isAborted()) {
|
||||||
|
aborted.add(process.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
for (String key : aborted) {
|
||||||
|
machinesProcesses.Data.remove(key);
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
||||||
|
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
||||||
|
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
||||||
|
if (dvmPackage.state.isActive()) {
|
||||||
|
//-
|
||||||
|
if (!machinesProcesses.hasProcessForPackage(dvmPackage)) {
|
||||||
|
MachineProcess new_process = new MachineProcess(dvmPackage);
|
||||||
|
processes_to_start.put(new_process.getUniqueKey(), new_process);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//запуск.
|
||||||
|
for (MachineProcess process : processes_to_start.values()) {
|
||||||
|
process.Start();
|
||||||
|
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||||
|
machinesProcesses.Data.put(process.id, process);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPublishAction(DBObject object) throws Exception {
|
public void afterPublishAction(DBObject object) throws Exception {
|
||||||
if (object instanceof Test) {
|
if (object instanceof Test) {
|
||||||
@@ -55,6 +92,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
//--
|
//--
|
||||||
dvmPackage.saveJson();
|
dvmPackage.saveJson();
|
||||||
dvmPackage.package_json = null; // объект больше не нужен.
|
dvmPackage.package_json = null; // объект больше не нужен.
|
||||||
|
//--
|
||||||
|
|
||||||
} else if (object instanceof SapforPackage) {
|
} else if (object instanceof SapforPackage) {
|
||||||
((SapforPackage) object).init();
|
((SapforPackage) object).init();
|
||||||
}
|
}
|
||||||
@@ -120,12 +159,12 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
testingThread.start();
|
testingThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
DVMTestingChecker dvmTestingChecker = new DVMTestingChecker();
|
// DVMTestingChecker dvmTestingChecker = new DVMTestingChecker();
|
||||||
SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||||
//--
|
//--
|
||||||
protected Thread testingThread = new Thread(() -> {
|
protected Thread testingThread = new Thread(() -> {
|
||||||
while (true) {
|
while (true) {
|
||||||
dvmTestingChecker.Perform();
|
// dvmTestingChecker.Perform();
|
||||||
sapforTestingPlanner.Perform();
|
sapforTestingPlanner.Perform();
|
||||||
System.out.println("sleep...");
|
System.out.println("sleep...");
|
||||||
Utils.sleep(5000);
|
Utils.sleep(5000);
|
||||||
@@ -586,46 +625,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
response.object = db.getFirstActiveDVMPackageCopyForMachineURL(request.arg);
|
response.object = db.getFirstActiveDVMPackageCopyForMachineURL(request.arg);
|
||||||
}
|
}
|
||||||
//-----
|
//-----
|
||||||
void StartNecessaryMachines() {
|
|
||||||
Print("Проверка процессов машин...");
|
|
||||||
try {
|
|
||||||
Vector<String> aborted = new Vector<>();
|
|
||||||
for (MachineProcess process : db.machinesProcesses.Data.values()) {
|
|
||||||
if (process.isAborted()) {
|
|
||||||
aborted.add(process.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//---
|
|
||||||
for (String key : aborted) {
|
|
||||||
Print(key + " остановлен");
|
|
||||||
db.machinesProcesses.Data.remove(key);
|
|
||||||
}
|
|
||||||
//---
|
|
||||||
Print(db.machinesProcesses.size() + " активных процессов");
|
|
||||||
//--
|
|
||||||
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
|
||||||
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
|
||||||
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
|
||||||
if (dvmPackage.state.isActive()) {
|
|
||||||
//-
|
|
||||||
if (!db.machinesProcesses.hasProcessForPackage(dvmPackage)) {
|
|
||||||
MachineProcess new_process = new MachineProcess(dvmPackage);
|
|
||||||
processes_to_start.put(new_process.getUniqueKey(), new_process);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Print("Ожидающие запуск процессы: " + processes_to_start.size());
|
|
||||||
//запуск.
|
|
||||||
for (MachineProcess process : processes_to_start.values()) {
|
|
||||||
process.Start();
|
|
||||||
if (Utils.checkFileCreation(process.getStartedFile())) {
|
|
||||||
db.machinesProcesses.Data.put(process.id, process);
|
|
||||||
Print(process.getUniqueKey()+" запущен");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import java.util.Comparator;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class TestsDatabase extends SQLiteDatabase {
|
public class TestsDatabase extends SQLiteDatabase {
|
||||||
|
|
||||||
public ConfigurationDBTable configurations;
|
public ConfigurationDBTable configurations;
|
||||||
public TestDBTable tests;
|
public TestDBTable tests;
|
||||||
public GroupsDBTable groups;
|
public GroupsDBTable groups;
|
||||||
@@ -47,7 +48,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
|||||||
public ServerSapforsDBTable serverSapfors;
|
public ServerSapforsDBTable serverSapfors;
|
||||||
//---
|
//---
|
||||||
public DVMRunTasksSet dvmRunTasks = new DVMRunTasksSet(); //задачи текущего пакета тестирования DVM
|
public DVMRunTasksSet dvmRunTasks = new DVMRunTasksSet(); //задачи текущего пакета тестирования DVM
|
||||||
public MachineProcessSet machinesProcesses= new MachineProcessSet();
|
|
||||||
//--
|
//--
|
||||||
public TestsDatabase() {
|
public TestsDatabase() {
|
||||||
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
|
super(Paths.get(System.getProperty("user.dir"), "Data", Constants.tests_db_name + ".sqlite").toFile());
|
||||||
|
|||||||
Reference in New Issue
Block a user