2023-09-18 23:22:17 +03:00
|
|
|
package Common.ModesSupervisors;
|
2023-09-20 00:53:45 +03:00
|
|
|
import Common.Global;
|
2023-09-18 23:22:17 +03:00
|
|
|
import Common.Utils.InterruptThread;
|
2023-09-20 00:53:45 +03:00
|
|
|
import Common.Utils.Utils;
|
|
|
|
|
import TestingSystem.Sapfor.Scenario_json;
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.nio.charset.Charset;
|
2023-09-18 23:22:17 +03:00
|
|
|
public class PackageModeSupervisor {
|
2023-09-20 00:53:45 +03:00
|
|
|
Thread interruptThread = new InterruptThread(5000, () -> {
|
2023-09-19 19:16:15 +03:00
|
|
|
System.exit(0);
|
|
|
|
|
return null;
|
|
|
|
|
});
|
2023-09-20 00:53:45 +03:00
|
|
|
//--->>
|
|
|
|
|
int free_kernels = 4;
|
|
|
|
|
int busy_kernels = 0;
|
|
|
|
|
//--->>
|
|
|
|
|
Scenario_json scenario;
|
|
|
|
|
//--->>
|
|
|
|
|
File packageWorkspace;
|
|
|
|
|
//--->>
|
|
|
|
|
File sapfor_drv;
|
|
|
|
|
File scenarioFile;
|
|
|
|
|
//--->>
|
2023-09-18 23:22:17 +03:00
|
|
|
public void Start() {
|
|
|
|
|
try {
|
|
|
|
|
interruptThread.start();
|
2023-09-20 00:53:45 +03:00
|
|
|
//--->>
|
|
|
|
|
packageWorkspace = new File(Global.Home);
|
|
|
|
|
scenarioFile = new File(packageWorkspace, "scenario.txt");
|
|
|
|
|
sapfor_drv = new File(packageWorkspace, "SAPFOR_F.exe");
|
|
|
|
|
//--->>
|
|
|
|
|
String packed = FileUtils.readFileToString(scenarioFile, Charset.defaultCharset());
|
|
|
|
|
scenario = Utils.gson.fromJson(packed, Scenario_json.class);
|
2023-09-18 23:22:17 +03:00
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-20 00:53:45 +03:00
|
|
|
//--->>
|
|
|
|
|
public void startTest() {
|
|
|
|
|
}
|
2023-09-18 23:22:17 +03:00
|
|
|
}
|