Доделаны процессы для разных машин

This commit is contained in:
2024-04-24 22:23:50 +03:00
parent 4d543cb94f
commit c6e5036b9c
12 changed files with 143 additions and 471 deletions

View File

@@ -21,6 +21,7 @@ public abstract class TestingPlanner<P extends TestingPackage> {
}
//---
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
System.out.println("Команда серверу " + code_in.toString() + "arg=" + arg + " object=" + object_in);
TestingSystemPass<Object> pass = new TestingSystemPass<Object>() {
@Override
public String getDescription() {
@@ -31,10 +32,13 @@ public abstract class TestingPlanner<P extends TestingPackage> {
Command(new ServerExchangeUnit_2021(code_in, arg, object_in));
target = response.object;
}
@Override
protected boolean validate() {
return Log.isEmpty();
}
};
if (!pass.Do()) {
ServerConnectionError(code_in);
}
if (!pass.Do())
ServerConnectionError(code_in, pass.Log.toString());
return pass.target;
}
protected Object ServerCommand(ServerCode code_in, Serializable object_in) throws Exception {
@@ -105,22 +109,22 @@ public abstract class TestingPlanner<P extends TestingPackage> {
}
protected void Disconnect() {
}
protected void MachineConnectionError(){
protected void MachineConnectionError() {
}
protected void ServerConnectionError(ServerCode code_in) throws Exception{
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
throw new PassException("Ошибка взаимодействия с сервером " + code_in);
}
// ---
protected void PerformPackage(TestingPackage package_in) throws Exception{
protected void PerformPackage(TestingPackage package_in) throws Exception {
testingPackage = (P) package_in;
//--
Print(testingPackage.id + ":" + testingPackage.state.getDescription());
//--
if (testingPackage.connectionErrosCount>=10){
Print(testingPackage.id+" had 10 connection errors. stop");
if (testingPackage.connectionErrosCount >= 10) {
Print(testingPackage.id + " had 10 connection errors. stop");
UpdatePackageState(TasksPackageState.ConnectionError);
MachineConnectionError();
}else {
} else {
//--
InitSessionCredentials();
if (testingPackage.state.equals(TasksPackageState.Analysis)) {
@@ -182,14 +186,13 @@ public abstract class TestingPlanner<P extends TestingPackage> {
testingPackage = null;
System.gc();
//--
}
public void Perform() {
try {
testingPackage = null;
Vector<P> activePackages = (Vector<P>) ServerCommand(getActivePackagesCode());
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages"); //Тесты:
for (P activePackage: activePackages)
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages"); //Тесты:
for (P activePackage : activePackages)
PerformPackage(activePackage);
} catch (Exception ex) {
ex.printStackTrace();