no message

This commit is contained in:
2024-10-14 15:19:13 +03:00
parent 8eef367bd4
commit 5e09fb44ea
634 changed files with 3751 additions and 3263 deletions

View File

@@ -1,18 +1,18 @@
package _VisualDVM.TestingSystem.Common;
import Common.CommonConstants;
import Common.Utils.Loggable;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Machine.Machine;
import _VisualDVM.GlobalData.Machine.MachineType;
import _VisualDVM.GlobalData.User.User;
import _VisualDVM.Repository.EmailMessage;
import _VisualDVM.Repository.RepositoryClient;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
import _VisualDVM.TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
import _VisualDVM.Repository.RepositoryClient;
import Common.Utils.Loggable;
import _VisualDVM.Utils;
import javafx.util.Pair;
import org.apache.commons.io.FileUtils;
@@ -26,6 +26,49 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
protected File supervisorHome = null;
protected Machine machine = null;
protected User user = null;
//---
public TestingPlanner() {
}
public TestingPlanner(String... args) {
//---
String machineAddress = args[0];
int machinePort = Integer.parseInt(args[1]);
String userName = args[2];
String userPassword = args[3];
String userWorkspace = args[4];
String testingSystemRoot = args[5];
serverName = args[6];
supervisorHome = Utils_.getHomeDirectory(); //при инициализации это текущая папка.
//---
Utils_.MainLog = new Loggable() {
@Override
public String getLogHomePath() {
return supervisorHome.getAbsolutePath();
}
@Override
public String getLogName() {
return Global.mode.toString();
}
};
Utils_.MainLog.ClearLog();
//--
Utils_.setHomePath(testingSystemRoot);
Global.CheckTestingSystemDirectories();
//---
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
user = new User(userName, userPassword, userWorkspace);
//---
Print("machineAddress=" + Utils_.Brackets(machineAddress));
Print("machinePort=" + Utils_.Brackets(String.valueOf(machinePort)));
Print("userName=" + Utils_.Brackets(userName));
Print("userPassword=" + Utils_.Brackets(userPassword));
Print("userWorkspace=" + Utils_.Brackets(userWorkspace));
Print("root=" + Utils_.Brackets(Utils_.getHomePath()));
Print("serverName=" + serverName);
Print("=====");
//----
Utils.createEmptyFile(Constants.STARTED);
}
//----
protected void UpdatePackageState(TasksPackageState state_in) throws Exception {
testingPackage.state = state_in;
@@ -62,8 +105,8 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
void EmailPackage() throws Exception {
if (testingPackage.needsEmail == 1) {
EmailMessage message = new EmailMessage();
message.subject = "Состояние пакета тестирования "+packageDescription()+ " "+
Utils_.Brackets(testingPackage.id) + " изменилось на " + Utils_.Brackets(testingPackage.state.getDescription());
message.subject = "Состояние пакета тестирования " + packageDescription() + " " +
Utils_.Brackets(testingPackage.id) + " изменилось на " + Utils_.Brackets(testingPackage.state.getDescription());
message.text = testingPackage.description;
message.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message);
@@ -76,10 +119,11 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
protected void InitSessionCredentials() {
}
protected abstract void TestsSynchronize() throws Exception;
;
protected abstract void PackageWorkspaceCreation() throws Exception;
protected void AnalyseResults() throws Exception {
UpdatePackageState(TasksPackageState.Done);
};
}
protected abstract void PackageStart() throws Exception;
protected abstract boolean CheckNextState() throws Exception;
protected abstract void DownloadResults() throws Exception;
@@ -116,7 +160,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
ServerCommand(ServerCode.DeleteObjectByPK, new Pair(TestingPackageToKill.class, ptk_id));
} else {
//--
System.out.println(testingPackage.id+":"+testingPackage.state.getDescription());
System.out.println(testingPackage.id + ":" + testingPackage.state.getDescription());
switch (testingPackage.state) {
case TestsSynchronize:
TestsSynchronize();
@@ -184,48 +228,6 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
public String getPlanner() {
return String.join("/", user.workspace, "modules", "planner");
}
//---
public TestingPlanner(){}
public TestingPlanner(String... args) {
//---
String machineAddress = args[0];
int machinePort = Integer.parseInt(args[1]);
String userName = args[2];
String userPassword = args[3];
String userWorkspace = args[4];
String testingSystemRoot = args[5];
serverName = args[6];
supervisorHome = Utils_.getHomeDirectory(); //при инициализации это текущая папка.
//---
Utils_.MainLog = new Loggable() {
@Override
public String getLogHomePath() {
return supervisorHome.getAbsolutePath();
}
@Override
public String getLogName() {
return Global.mode.toString();
}
};
Utils_.MainLog.ClearLog();
//--
Utils_.setHomePath(testingSystemRoot);
Global.CheckTestingSystemDirectories();
//---
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
user = new User(userName, userPassword, userWorkspace);
//---
Print("machineAddress=" + Utils_.Brackets(machineAddress));
Print("machinePort=" + Utils_.Brackets(String.valueOf(machinePort)));
Print("userName=" + Utils_.Brackets(userName));
Print("userPassword=" + Utils_.Brackets(userPassword));
Print("userWorkspace=" + Utils_.Brackets(userWorkspace));
Print("root=" + Utils_.Brackets(Utils_.getHomePath()));
Print("serverName=" + serverName);
Print("=====");
//----
Utils.createEmptyFile(Constants.STARTED);
}
/*
void CheckLocal() {
local = false;