рабочий вариант отдельных процессов на разные машины
This commit is contained in:
6
.idea/workspace.xml
generated
6
.idea/workspace.xml
generated
@@ -7,10 +7,16 @@
|
|||||||
</component>
|
</component>
|
||||||
<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 afterPath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcessSet.java" afterDir="false" />
|
||||||
<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$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.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/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcessDBTable.java" beforeDir="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/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" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"PerformanceAnalyzerPath": "",
|
"PerformanceAnalyzerPath": "",
|
||||||
"ComponentsBackUpsCount": 10,
|
"ComponentsBackUpsCount": 10,
|
||||||
"TestingKernels": 28,
|
"TestingKernels": 28,
|
||||||
"AutoCheckTesting": false,
|
"AutoCheckTesting": true,
|
||||||
"CheckTestingIntervalSeconds": 10,
|
"CheckTestingIntervalSeconds": 10,
|
||||||
"EmailOnTestingProgress": false,
|
"EmailOnTestingProgress": false,
|
||||||
"eraseTestingWorkspaces": true
|
"eraseTestingWorkspaces": true
|
||||||
|
|||||||
@@ -1157,7 +1157,7 @@ public class Utils {
|
|||||||
for (int i = 1; i <= 10; ++i) {
|
for (int i = 1; i <= 10; ++i) {
|
||||||
System.out.println("Проверка " + i + " существования файла " + Utils.Brackets(file.getAbsolutePath()));
|
System.out.println("Проверка " + i + " существования файла " + Utils.Brackets(file.getAbsolutePath()));
|
||||||
if (file.exists()) return true;
|
if (file.exists()) return true;
|
||||||
else sleep(1000);
|
else sleep(5000);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,14 +70,18 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
protected static void Print(String message) throws IOException {
|
protected static void Print(String message) {
|
||||||
if (printOn) {
|
if (printOn) {
|
||||||
|
try {
|
||||||
Log = new FileWriter("Log.txt", true);
|
Log = new FileWriter("Log.txt", true);
|
||||||
String dmessage = Utils.Brackets("SESSION -> ") + new Date() +
|
String dmessage = Utils.Brackets("SESSION -> ") + new Date() +
|
||||||
" " + message;
|
" " + message;
|
||||||
System.out.println(dmessage);
|
System.out.println(dmessage);
|
||||||
Log.write(dmessage + "\n");
|
Log.write(dmessage + "\n");
|
||||||
Log.close();
|
Log.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected void checkTargets(EmailMessage message_in) {
|
protected void checkTargets(EmailMessage message_in) {
|
||||||
@@ -366,7 +370,7 @@ public abstract class RepositoryServer<D extends Database> {
|
|||||||
}
|
}
|
||||||
public void afterDeleteAction(DBObject object) throws Exception {
|
public void afterDeleteAction(DBObject object) throws Exception {
|
||||||
}
|
}
|
||||||
public void Ping(){
|
public void Ping() {
|
||||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,5 +83,7 @@ public enum ServerCode {
|
|||||||
GetSapforPackagesJson,
|
GetSapforPackagesJson,
|
||||||
GetFirstsActiveDVMPackages,
|
GetFirstsActiveDVMPackages,
|
||||||
Ping,
|
Ping,
|
||||||
GetFirstActiveDVMPackageForMachineURL;
|
GetFirstActiveDVMPackageForMachineURL,
|
||||||
|
GetServerName
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,30 +2,23 @@ package TestingSystem.Common.MachineProcess;
|
|||||||
import Common.Constants;
|
import Common.Constants;
|
||||||
import Common.Current;
|
import Common.Current;
|
||||||
import Common.Database.DBObject;
|
import Common.Database.DBObject;
|
||||||
import Common.Database.iDBObject;
|
|
||||||
import Common.Global;
|
import Common.Global;
|
||||||
import Common.GlobalProperties;
|
import Common.GlobalProperties;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||||
import com.sun.org.glassfish.gmbal.Description;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class MachineProcess extends iDBObject {
|
public class MachineProcess extends DBObject {
|
||||||
@Description("DEFAULT ''")
|
public String id = "";
|
||||||
public String machineAddress = "";
|
public String machineAddress = "";
|
||||||
@Description("DEFAULT -1")
|
|
||||||
public int machinePort = Constants.Nan;
|
public int machinePort = Constants.Nan;
|
||||||
@Description("DEFAULT ''")
|
|
||||||
public String userName = "";
|
public String userName = "";
|
||||||
@Description("DEFAULT ''")
|
|
||||||
public String userPassword = "";
|
public String userPassword = "";
|
||||||
@Description("DEFAULT ''")
|
|
||||||
public String userWorkspace = "";
|
public String userWorkspace = "";
|
||||||
@Description("DEFAULT ''")
|
|
||||||
public String testingSystemRoot = "";
|
public String testingSystemRoot = "";
|
||||||
@Description("DEFAULT 'Inactive'")
|
public String serverName = "";
|
||||||
public MachineProcessState state = MachineProcessState.Inactive; //0 неактивен
|
public MachineProcessState state = MachineProcessState.Inactive; //0 неактивен
|
||||||
//--
|
//--
|
||||||
public MachineProcess() {
|
public MachineProcess() {
|
||||||
@@ -34,12 +27,18 @@ public class MachineProcess extends iDBObject {
|
|||||||
SynchronizeFields(p);
|
SynchronizeFields(p);
|
||||||
}
|
}
|
||||||
public MachineProcess(DVMPackage p) {
|
public MachineProcess(DVMPackage p) {
|
||||||
|
id = Utils.getDateName("machine_process");
|
||||||
machineAddress = p.machine_address;
|
machineAddress = p.machine_address;
|
||||||
machinePort = p.machine_port;
|
machinePort = p.machine_port;
|
||||||
userName = p.user_name;
|
userName = p.user_name;
|
||||||
userPassword = p.user_password;
|
userPassword = p.user_password;
|
||||||
userWorkspace = p.user_workspace;
|
userWorkspace = p.user_workspace;
|
||||||
testingSystemRoot = Global.Home;
|
testingSystemRoot = Global.Home;
|
||||||
|
serverName = Global.testingServer.name;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Object getPK() {
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void SynchronizeFields(DBObject src) {
|
public void SynchronizeFields(DBObject src) {
|
||||||
@@ -51,6 +50,7 @@ public class MachineProcess extends iDBObject {
|
|||||||
userPassword = p.userPassword;
|
userPassword = p.userPassword;
|
||||||
userWorkspace = p.userWorkspace;
|
userWorkspace = p.userWorkspace;
|
||||||
testingSystemRoot = p.testingSystemRoot;
|
testingSystemRoot = p.testingSystemRoot;
|
||||||
|
serverName = p.serverName;
|
||||||
}
|
}
|
||||||
public String getUniqueKey() {
|
public String getUniqueKey() {
|
||||||
Vector<String> res = new Vector<>();
|
Vector<String> res = new Vector<>();
|
||||||
@@ -61,7 +61,7 @@ public class MachineProcess extends iDBObject {
|
|||||||
return String.join("_", res);
|
return String.join("_", res);
|
||||||
}
|
}
|
||||||
public File getWorkspace() {
|
public File getWorkspace() {
|
||||||
return new File(Global.MachinesDirectory, String.valueOf(id));
|
return new File(Global.MachinesDirectory, id);
|
||||||
}
|
}
|
||||||
public File getStartedFile() {
|
public File getStartedFile() {
|
||||||
return new File(getWorkspace(), Constants.STARTED);
|
return new File(getWorkspace(), Constants.STARTED);
|
||||||
@@ -90,6 +90,7 @@ public class MachineProcess extends iDBObject {
|
|||||||
//создание настроек
|
//создание настроек
|
||||||
GlobalProperties properties = new GlobalProperties();
|
GlobalProperties properties = new GlobalProperties();
|
||||||
properties.Mode = Current.Mode.MachineQueue;
|
properties.Mode = Current.Mode.MachineQueue;
|
||||||
|
properties.TestingServerPort = 7996;
|
||||||
Utils.jsonToFile(properties, new File(workspace, "properties"));
|
Utils.jsonToFile(properties, new File(workspace, "properties"));
|
||||||
Vector<String> args = new Vector<>();
|
Vector<String> args = new Vector<>();
|
||||||
args.add(Utils.DQuotes(machineAddress));
|
args.add(Utils.DQuotes(machineAddress));
|
||||||
@@ -98,10 +99,11 @@ public class MachineProcess extends iDBObject {
|
|||||||
args.add(Utils.DQuotes(userPassword));
|
args.add(Utils.DQuotes(userPassword));
|
||||||
args.add(Utils.DQuotes(userWorkspace));
|
args.add(Utils.DQuotes(userWorkspace));
|
||||||
args.add(Utils.DQuotes(testingSystemRoot));
|
args.add(Utils.DQuotes(testingSystemRoot));
|
||||||
|
args.add(Utils.DQuotes(Global.testingServer.name));
|
||||||
//--
|
//--
|
||||||
Utils.startScript(workspace, workspace,
|
Utils.startScript(workspace, workspace,
|
||||||
"start",
|
"start",
|
||||||
"java -jar VisualSapfor.jar " + String.join(" ", args));
|
"java -jar VisualSapfor.jar " + String.join(" ", args)+" ");
|
||||||
//---
|
//---
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
package TestingSystem.Common.MachineProcess;
|
|
||||||
import Common.Database.iDBTable;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Vector;
|
|
||||||
public class MachineProcessDBTable extends iDBTable<MachineProcess> {
|
|
||||||
public MachineProcessDBTable() {
|
|
||||||
super(MachineProcess.class);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String getSingleDescription() {
|
|
||||||
return "процесс машины";
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String getPluralDescription() {
|
|
||||||
return "процессы машины";
|
|
||||||
}
|
|
||||||
public LinkedHashMap<String, MachineProcess> getActiveSortedByKeys(){
|
|
||||||
LinkedHashMap<String, MachineProcess> res = new LinkedHashMap<>();
|
|
||||||
for (MachineProcess process: Data.values()){
|
|
||||||
if (process.state.equals(MachineProcessState.Active))
|
|
||||||
res.put(process.getUniqueKey(), process);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package TestingSystem.Common.MachineProcess;
|
||||||
|
import Common.Database.DataSet;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
public class MachineProcessSet extends DataSet<String, MachineProcess> {
|
||||||
|
public MachineProcessSet() {
|
||||||
|
super(String.class, MachineProcess.class);
|
||||||
|
}
|
||||||
|
public LinkedHashMap<String, MachineProcess> getSortedByKeys() {
|
||||||
|
LinkedHashMap<String, MachineProcess> res = new LinkedHashMap<>();
|
||||||
|
for (MachineProcess process : Data.values())
|
||||||
|
res.put(process.getUniqueKey(), process);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@ import java.io.File;
|
|||||||
import java.nio.file.Paths;
|
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 = "?";
|
||||||
@Override
|
@Override
|
||||||
public void afterPublishAction(DBObject object) throws Exception {
|
public void afterPublishAction(DBObject object) throws Exception {
|
||||||
if (object instanceof Test) {
|
if (object instanceof Test) {
|
||||||
@@ -106,6 +107,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
//-->>>
|
//-->>>
|
||||||
public TestingServer() {
|
public TestingServer() {
|
||||||
super(TestsDatabase.class);
|
super(TestsDatabase.class);
|
||||||
|
name = Utils.getDateName("testingServer");
|
||||||
|
System.out.println("ServerName=" + Utils.Brackets(name));
|
||||||
}
|
}
|
||||||
//основа
|
//основа
|
||||||
@Override
|
@Override
|
||||||
@@ -120,31 +123,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
protected DVMTestingPlanner DVMTestingPlanner = new DVMTestingPlanner();
|
protected DVMTestingPlanner DVMTestingPlanner = new DVMTestingPlanner();
|
||||||
protected SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
protected SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||||
//--
|
//--
|
||||||
void checkMachinesActivity() {
|
|
||||||
System.out.println("Проверка активности нитей машин...");
|
|
||||||
try {
|
|
||||||
Vector<MachineProcess> toUpdate = new Vector<>();
|
|
||||||
for (MachineProcess machineProcess : db.machinesProcesses.Data.values()) {
|
|
||||||
if (machineProcess.isAborted()) {
|
|
||||||
toUpdate.add(machineProcess);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
db.BeginTransaction();
|
|
||||||
for (MachineProcess machineProcess : toUpdate) {
|
|
||||||
machineProcess.state = MachineProcessState.Aborted;
|
|
||||||
db.Update(machineProcess);
|
|
||||||
}
|
|
||||||
db.Commit();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println("done");
|
|
||||||
}
|
|
||||||
void startNecessaryMachines() {
|
void startNecessaryMachines() {
|
||||||
System.out.println("Запуск необходимых нитей машин...");
|
System.out.println("Запуск необходимых нитей машин...");
|
||||||
//todo. когда БД машин будет перенесена только на сервер. просто идти по всем машинам.
|
//todo. когда БД машин будет перенесена только на сервер. просто идти по всем машинам.
|
||||||
try {
|
try {
|
||||||
LinkedHashMap<String, MachineProcess> active_processes = db.machinesProcesses.getActiveSortedByKeys();
|
LinkedHashMap<String, MachineProcess> active_processes = db.machinesProcesses.getSortedByKeys();
|
||||||
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
||||||
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
||||||
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
||||||
@@ -179,9 +162,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
process.Start();
|
process.Start();
|
||||||
if (Utils.checkFileCreation(process.getStartedFile())) {
|
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||||
process.state = MachineProcessState.Active;
|
process.state = MachineProcessState.Active;
|
||||||
db.Insert(process);
|
db.machinesProcesses.Data.put(process.id, process);
|
||||||
System.out.println("Выполнено");
|
System.out.println("Выполнено");
|
||||||
}else {
|
} else {
|
||||||
System.out.println("Не удалось запустить процесс.");
|
System.out.println("Не удалось запустить процесс.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +178,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
while (true) {
|
while (true) {
|
||||||
// DVMTestingPlanner.Perform();
|
// DVMTestingPlanner.Perform();
|
||||||
// sapforTestingPlanner.Perform();
|
// sapforTestingPlanner.Perform();
|
||||||
checkMachinesActivity();
|
|
||||||
startNecessaryMachines();
|
startNecessaryMachines();
|
||||||
System.out.println("sleep...");
|
System.out.println("sleep...");
|
||||||
Utils.sleep(5000);
|
Utils.sleep(5000);
|
||||||
@@ -304,6 +286,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
Print("Получить первый активный пакет задач DVM на машине с адресом");
|
Print("Получить первый активный пакет задач DVM на машине с адресом");
|
||||||
GetFirstActiveDVMPackageForMachineURL();
|
GetFirstActiveDVMPackageForMachineURL();
|
||||||
break;
|
break;
|
||||||
|
case GetServerName:
|
||||||
|
Print("Получить имя сервера");
|
||||||
|
GetServerName();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||||
}
|
}
|
||||||
@@ -647,6 +633,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||||
response.object = jsons;
|
response.object = jsons;
|
||||||
}
|
}
|
||||||
|
private void GetServerName() throws Exception {
|
||||||
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||||
|
response.object = name;
|
||||||
|
}
|
||||||
//--
|
//--
|
||||||
private void GetFirstActiveDVMPackageForMachineURL() {
|
private void GetFirstActiveDVMPackageForMachineURL() {
|
||||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Repository.Component.Sapfor.Sapfor;
|
|||||||
import Repository.RepositoryRefuseException;
|
import Repository.RepositoryRefuseException;
|
||||||
import TestingSystem.Common.Group.Group;
|
import TestingSystem.Common.Group.Group;
|
||||||
import TestingSystem.Common.Group.GroupsDBTable;
|
import TestingSystem.Common.Group.GroupsDBTable;
|
||||||
import TestingSystem.Common.MachineProcess.MachineProcessDBTable;
|
import TestingSystem.Common.MachineProcess.MachineProcessSet;
|
||||||
import TestingSystem.Common.Test.Test;
|
import TestingSystem.Common.Test.Test;
|
||||||
import TestingSystem.Common.Test.TestDBTable;
|
import TestingSystem.Common.Test.TestDBTable;
|
||||||
import TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
|
import TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
|
||||||
@@ -47,8 +47,7 @@ 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 MachineProcessDBTable machinesProcesses;
|
|
||||||
//--
|
//--
|
||||||
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());
|
||||||
@@ -65,7 +64,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
|||||||
addTable(sapforConfigurations = new SapforConfigurationDBTable());
|
addTable(sapforConfigurations = new SapforConfigurationDBTable());
|
||||||
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
|
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
|
||||||
addTable(serverSapfors = new ServerSapforsDBTable());
|
addTable(serverSapfors = new ServerSapforsDBTable());
|
||||||
addTable(machinesProcesses = new MachineProcessDBTable());
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public PassCode_2021 getSynchronizePassCode() {
|
public PassCode_2021 getSynchronizePassCode() {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
boolean local;
|
boolean local;
|
||||||
RemoteFile packageRemoteWorkspace = null;
|
RemoteFile packageRemoteWorkspace = null;
|
||||||
File packageLocalWorkspace = null;
|
File packageLocalWorkspace = null;
|
||||||
|
String serverName = "";
|
||||||
//----
|
//----
|
||||||
public MachineQueueSupervisor(String... args) {
|
public MachineQueueSupervisor(String... args) {
|
||||||
Global.isWindows = System.getProperty("os.name").startsWith("Windows");
|
Global.isWindows = System.getProperty("os.name").startsWith("Windows");
|
||||||
@@ -45,6 +46,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
String userPassword = args[3];
|
String userPassword = args[3];
|
||||||
String userWorkspace = args[4];
|
String userWorkspace = args[4];
|
||||||
String testingSystemRoot = args[5];
|
String testingSystemRoot = args[5];
|
||||||
|
serverName = args[6];
|
||||||
supervisorHome = new File(Global.Home); //при инициализации это текущая папка.
|
supervisorHome = new File(Global.Home); //при инициализации это текущая папка.
|
||||||
//---
|
//---
|
||||||
Global.Log = new Loggable() {
|
Global.Log = new Loggable() {
|
||||||
@@ -74,6 +76,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
Print("userWorkspace=" + Utils.Brackets(userWorkspace));
|
Print("userWorkspace=" + Utils.Brackets(userWorkspace));
|
||||||
Print("root=" + Utils.Brackets(Global.Home));
|
Print("root=" + Utils.Brackets(Global.Home));
|
||||||
Print("local=" + local);
|
Print("local=" + local);
|
||||||
|
Print("serverName=" + serverName);
|
||||||
Print("=====");
|
Print("=====");
|
||||||
//----
|
//----
|
||||||
File started = new File(supervisorHome, Constants.STARTED);
|
File started = new File(supervisorHome, Constants.STARTED);
|
||||||
@@ -454,11 +457,13 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void MachineConnectionError() {
|
protected void MachineConnectionError() {
|
||||||
|
System.out.println("MACHINE CONNECTION ERROR");
|
||||||
Finalize("Количество безуспешных попыток соединения с машиной " + machine.getURL() +
|
Finalize("Количество безуспешных попыток соединения с машиной " + machine.getURL() +
|
||||||
" превысило 10");
|
" превысило 10");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void ServerConnectionError(ServerCode code_in) throws Exception {
|
protected void ServerConnectionError(ServerCode code_in) throws Exception {
|
||||||
|
System.out.println("NO SERVER");
|
||||||
Finalize("Не удалось выполнить команду " + code_in + " на сервере тестирования");
|
Finalize("Не удалось выполнить команду " + code_in + " на сервере тестирования");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -470,6 +475,12 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
@Override
|
@Override
|
||||||
public void Perform() {
|
public void Perform() {
|
||||||
try {
|
try {
|
||||||
|
String currentServerName = (String) ServerCommand(ServerCode.GetServerName);
|
||||||
|
System.out.println("current serverName="+Utils.Brackets(currentServerName));
|
||||||
|
System.out.println("serverName="+Utils.Brackets(serverName));
|
||||||
|
if (!serverName.equals(currentServerName)){
|
||||||
|
Finalize("Устаревшее имя сервера");
|
||||||
|
}
|
||||||
testingPackage = null;
|
testingPackage = null;
|
||||||
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
|
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
|
||||||
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages");
|
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages");
|
||||||
|
|||||||
Reference in New Issue
Block a user