no message
This commit is contained in:
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -7,9 +7,11 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTest/SapforTest.java" 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/ModesSupervisors/PackageModeSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/ModesSupervisors/PackageModeSupervisor.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/SapforTestingSystem/SapforTest/SapforTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTest/SapforTest.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -3,10 +3,12 @@ import Common.Global;
|
||||
import Common.Utils.InterruptThread;
|
||||
import Common.Utils.Utils;
|
||||
import SapforTestingSystem.Json.Scenario_json;
|
||||
import SapforTestingSystem.SapforTest.SapforTest;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
public class PackageModeSupervisor {
|
||||
@@ -24,6 +26,8 @@ public class PackageModeSupervisor {
|
||||
File sapfor_drv;
|
||||
File scenarioFile;
|
||||
//--->>
|
||||
LinkedHashMap<String, SapforTest> allTests = new LinkedHashMap<>();
|
||||
//--->>>
|
||||
Vector<String> activeTests = new Vector<>();
|
||||
Stack<String> waitingTests = new Stack<>();
|
||||
//--->>
|
||||
@@ -34,11 +38,10 @@ public class PackageModeSupervisor {
|
||||
String packed = FileUtils.readFileToString(scenarioFile, Charset.defaultCharset());
|
||||
scenario = Utils.gson.fromJson(packed, Scenario_json.class);
|
||||
//--->>
|
||||
/*
|
||||
for (String test : scenario.tests)
|
||||
for (String test : scenario.tests) {
|
||||
allTests.put(test, new SapforTest(Global.Home, test));
|
||||
waitingTests.push(test);
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
public boolean isFinished(String test) {
|
||||
return true;
|
||||
@@ -55,14 +58,18 @@ public class PackageModeSupervisor {
|
||||
activeTests.remove(test);
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public boolean startWaitingTests() throws Exception {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public void finalize(){
|
||||
Global.Log.Print("END");
|
||||
}
|
||||
//--->>
|
||||
public void Do() {
|
||||
try {
|
||||
Global.Log.Print("START");
|
||||
interruptThread.start();
|
||||
//--->>
|
||||
init();
|
||||
@@ -70,8 +77,13 @@ public class PackageModeSupervisor {
|
||||
while (checkActiveTests() && startWaitingTests()) {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
finalize();
|
||||
//--->>
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,6 +1052,18 @@ public class Utils {
|
||||
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
||||
return startScript(scriptDirectory, targetDirectory, name, scriptText, null);
|
||||
}
|
||||
|
||||
public static Process startScript_(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
|
||||
//->
|
||||
File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
||||
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
||||
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
||||
//->>
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(scriptFile.getAbsolutePath());
|
||||
procBuilder.directory(scriptDirectory);
|
||||
procBuilder.redirectErrorStream(true);
|
||||
return null;
|
||||
}
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="чтение вывода процесса">
|
||||
public static String readLine(Process process) throws Exception {
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
package SapforTestingSystem.SapforTest;
|
||||
import GlobalData.Tasks.TaskState;
|
||||
|
||||
import java.io.File;
|
||||
public class SapforTest {
|
||||
public String description;
|
||||
public File home;
|
||||
public TaskState state;
|
||||
//--
|
||||
public SapforTest(String packageHome, String description_in) {
|
||||
description = description_in;
|
||||
state = TaskState.Waiting;
|
||||
home = new File(packageHome, description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,6 @@ public class StartSapforTests extends Pass_2021<Vector<SapforTasksPackage_2023>>
|
||||
).toFile().getAbsolutePath();
|
||||
//---
|
||||
Utils.CheckAndCleanDirectory(new File(sapforTasksPackage_2023.workspace));
|
||||
Utils.CheckAndCleanDirectory(new File(sapforTasksPackage_2023.workspace, "state"));
|
||||
sapfor = new File(sapforTasksPackage_2023.workspace, "SAPFOR_F.exe"); //развилка на линукс
|
||||
ShowMessage2("Копирование SAPFOR");
|
||||
FileUtils.copyFile(Current.getSapfor().getFile(), sapfor);
|
||||
@@ -282,10 +281,12 @@ public class StartSapforTests extends Pass_2021<Vector<SapforTasksPackage_2023>>
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
|
||||
//тут должен быть планировщик и очередь пакетов. отдельной нитью.
|
||||
for (SapforTasksPackage_2023 sapforTasksPackage_2023 : target) {
|
||||
File workspaceFile = new File(sapforTasksPackage_2023.workspace);
|
||||
Utils.startScript(workspaceFile, workspaceFile, "start", "java -jar VisualSapfor.jar");
|
||||
// Utils.startScript(workspaceFile, workspaceFile, "start", "java -jar VisualSapfor.jar");
|
||||
Utils.startScript_(workspaceFile, workspaceFile, "start", "java -jar VisualSapfor.jar");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user