v++
сообщение R204
This commit is contained in:
71
src/TestingSystem/DVM/MachineQueueSupervisor.java
Normal file
71
src/TestingSystem/DVM/MachineQueueSupervisor.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package TestingSystem.DVM;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Vector;
|
||||
public class MachineQueueSupervisor {
|
||||
//--
|
||||
Machine machine = null;
|
||||
User user = null;
|
||||
//--
|
||||
DVMPackage testingPackage = null; //текущий пакет.
|
||||
//--
|
||||
protected int getSleepMillis() {
|
||||
return 2000;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
|
||||
TestingSystemPass<Object> pass = new TestingSystemPass<Object>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(code_in, arg, object_in));
|
||||
target = response.object;
|
||||
}
|
||||
};
|
||||
if (!pass.Do()) throw new PassException("Ошибка взаимодействия с сервером " + code_in);
|
||||
return pass.target;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, Serializable object_in) throws Exception {
|
||||
return ServerCommand(code_in, "", object_in);
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in) throws Exception {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
//--
|
||||
public MachineQueueSupervisor(String... args) {
|
||||
Global.isWindows = System.getProperty("os.name").startsWith("Windows");
|
||||
//---
|
||||
String machineAddress = args[0];
|
||||
int machinePort = Integer.parseInt(args[1]);
|
||||
String userName = args[2];
|
||||
String userPassword = args[3];
|
||||
String userWorkspace = args[4];
|
||||
//---
|
||||
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
|
||||
user = new User(userName, userPassword, userWorkspace);
|
||||
//---
|
||||
}
|
||||
public void Start() {
|
||||
try {
|
||||
testingPackage = null;
|
||||
testingPackage = (DVMPackage) ServerCommand(ServerCode.GetFirstActiveDVMPackageForMachineURL, machine.getURL(), null);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user