no message
This commit is contained in:
2
.idea/workspace.xml
generated
2
.idea/workspace.xml
generated
@@ -8,8 +8,10 @@
|
|||||||
<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/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.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/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/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" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ import java.awt.datatransfer.DataFlavor;
|
|||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.*;
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
@@ -711,9 +714,12 @@ public class Utils {
|
|||||||
//<editor-fold desc="создание скрипта">
|
//<editor-fold desc="создание скрипта">
|
||||||
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText, Map<String, String> envs) throws Exception {
|
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText, Map<String, String> envs) throws Exception {
|
||||||
//->
|
//->
|
||||||
|
File scriptFile = createScript(scriptDirectory, targetDirectory, name, scriptText);
|
||||||
|
/*
|
||||||
File scriptFile=Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
File scriptFile=Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
||||||
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
||||||
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
||||||
|
*/
|
||||||
//->>
|
//->>
|
||||||
ProcessBuilder procBuilder = new ProcessBuilder(scriptFile.getAbsolutePath());
|
ProcessBuilder procBuilder = new ProcessBuilder(scriptFile.getAbsolutePath());
|
||||||
procBuilder.directory(scriptDirectory);
|
procBuilder.directory(scriptDirectory);
|
||||||
@@ -728,16 +734,12 @@ public class Utils {
|
|||||||
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
||||||
return startScript(scriptDirectory, targetDirectory, name, scriptText, null);
|
return startScript(scriptDirectory, targetDirectory, name, scriptText, null);
|
||||||
}
|
}
|
||||||
public static Process createScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
public static File createScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
||||||
//->
|
//->
|
||||||
File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
||||||
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
||||||
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
||||||
//->>
|
return scriptFile;
|
||||||
ProcessBuilder procBuilder = new ProcessBuilder(scriptFile.getAbsolutePath());
|
|
||||||
procBuilder.directory(scriptDirectory);
|
|
||||||
procBuilder.redirectErrorStream(true);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
//<editor-fold desc="чтение вывода процесса">
|
//<editor-fold desc="чтение вывода процесса">
|
||||||
@@ -1151,5 +1153,13 @@ public class Utils {
|
|||||||
//--
|
//--
|
||||||
return hours + " часов, " + minutes + " минут, " + seconds + " секунд";
|
return hours + " часов, " + minutes + " минут, " + seconds + " секунд";
|
||||||
}
|
}
|
||||||
|
public static boolean checkFileCreation(File file) {
|
||||||
|
for (int i = 1; i <= 10; ++i) {
|
||||||
|
System.out.println("Проверка " + i + " существования файла " + Utils.Brackets(file.getAbsolutePath()));
|
||||||
|
if (file.exists()) return true;
|
||||||
|
else sleep(1000);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,22 @@ public class MachineProcess extends iDBObject {
|
|||||||
public File getWorkspace() {
|
public File getWorkspace() {
|
||||||
return new File(Global.MachinesDirectory, String.valueOf(id));
|
return new File(Global.MachinesDirectory, String.valueOf(id));
|
||||||
}
|
}
|
||||||
|
public File getStartedFile() {
|
||||||
|
return new File(getWorkspace(), Constants.STARTED);
|
||||||
|
}
|
||||||
public File getAbortedFile() {
|
public File getAbortedFile() {
|
||||||
return new File(getWorkspace(), Constants.ABORTED);
|
return new File(getWorkspace(), Constants.ABORTED);
|
||||||
}
|
}
|
||||||
//---
|
//---
|
||||||
|
public boolean isAborted() {
|
||||||
|
File aborted = getAbortedFile();
|
||||||
|
return aborted.exists();
|
||||||
|
}
|
||||||
|
public boolean isStarted() {
|
||||||
|
File started = getStartedFile();
|
||||||
|
return started.exists();
|
||||||
|
}
|
||||||
|
//--
|
||||||
public void Start() {
|
public void Start() {
|
||||||
try {
|
try {
|
||||||
File workspace = getWorkspace();
|
File workspace = getWorkspace();
|
||||||
@@ -85,19 +96,15 @@ public class MachineProcess extends iDBObject {
|
|||||||
args.add(Utils.DQuotes(machinePort));
|
args.add(Utils.DQuotes(machinePort));
|
||||||
args.add(Utils.DQuotes(userName));
|
args.add(Utils.DQuotes(userName));
|
||||||
args.add(Utils.DQuotes(userPassword));
|
args.add(Utils.DQuotes(userPassword));
|
||||||
|
args.add(Utils.DQuotes(userWorkspace));
|
||||||
args.add(Utils.DQuotes(testingSystemRoot));
|
args.add(Utils.DQuotes(testingSystemRoot));
|
||||||
//--
|
//--
|
||||||
//подготовка пакетного режима. Запустит его уже очередь.
|
Utils.startScript(workspace, workspace,
|
||||||
Utils.createScript(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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---
|
|
||||||
public boolean isAborted() {
|
|
||||||
File aborted = getAbortedFile();
|
|
||||||
return aborted.exists();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,9 +177,13 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
for (MachineProcess process : processes_to_start.values()) {
|
for (MachineProcess process : processes_to_start.values()) {
|
||||||
System.out.println("Запуск процесса " + process.getUniqueKey() + " ...");
|
System.out.println("Запуск процесса " + process.getUniqueKey() + " ...");
|
||||||
process.Start();
|
process.Start();
|
||||||
|
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||||
process.state = MachineProcessState.Active;
|
process.state = MachineProcessState.Active;
|
||||||
db.Insert(process);
|
db.Insert(process);
|
||||||
System.out.println("Выполнено");
|
System.out.println("Выполнено");
|
||||||
|
}else {
|
||||||
|
System.out.println("Не удалось запустить процесс.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -76,6 +76,13 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
|||||||
Print("local=" + local);
|
Print("local=" + local);
|
||||||
Print("=====");
|
Print("=====");
|
||||||
//----
|
//----
|
||||||
|
File started = new File(supervisorHome, Constants.STARTED);
|
||||||
|
try {
|
||||||
|
FileUtils.writeStringToFile(started, "");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
Finalize("Can not start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void CheckLocal() {
|
void CheckLocal() {
|
||||||
local = false;
|
local = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user