2024-10-09 22:21:57 +03:00
|
|
|
package _VisualDVM.TestingSystem.DVM;
|
2024-04-27 18:44:36 +03:00
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
public class LocalDVMTestingPlanner extends DVMTestingPlanner {
|
|
|
|
|
public LocalDVMTestingPlanner(String[] args) {
|
|
|
|
|
super(args);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean CheckModules() throws Exception {
|
|
|
|
|
/*
|
|
|
|
|
File modulesDirectory = Paths.get(user.workspace, "modules").toFile();
|
|
|
|
|
File version = new File(modulesDirectory,"version.h");
|
|
|
|
|
int current_version = Constants.Nan;
|
|
|
|
|
int actual_version = Constants.planner_version;
|
|
|
|
|
///--
|
|
|
|
|
if (version.exists()) {
|
|
|
|
|
try {
|
|
|
|
|
current_version = Integer.parseInt(FileUtils.readFileToString(version));
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
if (current_version < actual_version) {
|
|
|
|
|
Print("Закачка кода модулей...");
|
|
|
|
|
for (String resource_name : Constants.resourses_names) {
|
|
|
|
|
Print(resource_name);
|
|
|
|
|
File src = Utils.CreateTempResourceFile(resource_name);
|
|
|
|
|
File dst = new File(modulesDirectory, resource_name);
|
|
|
|
|
FileUtils.copyFile(src, dst);
|
|
|
|
|
}
|
|
|
|
|
//--
|
|
|
|
|
Print("Сборка модулей...");
|
|
|
|
|
String modules_log = user.connection.compileModules(modulesDirectory);
|
|
|
|
|
if (!modules_log.isEmpty()) {
|
|
|
|
|
testingPackage.description = modules_log;
|
|
|
|
|
testingPackage.state = TasksPackageState.Aborted;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-10-03 16:21:11 +03:00
|
|
|
public String packageDescription() {
|
|
|
|
|
return "DVM";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-04-27 18:44:36 +03:00
|
|
|
protected void TestsSynchronize() throws Exception {
|
|
|
|
|
testingPackage.readJson();
|
|
|
|
|
LinkedHashMap<Integer, File> tests = getTestsFromJson();
|
|
|
|
|
//синхронизировать их.
|
|
|
|
|
for (int test_id : tests.keySet()) {
|
|
|
|
|
File test = tests.get(test_id);
|
2024-10-14 15:19:13 +03:00
|
|
|
File testDst = Paths.get(testingPackage.user_workspace, "projects", String.valueOf(test_id)).toFile();
|
2024-04-27 18:44:36 +03:00
|
|
|
Print(testDst.getAbsolutePath());
|
2024-10-14 15:19:13 +03:00
|
|
|
FileUtils.copyDirectory(test, testDst);
|
2024-04-27 18:44:36 +03:00
|
|
|
}
|
|
|
|
|
Finalize("+");
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void PackageWorkspaceCreation() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void AnalyseResults() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void PackageStart() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean CheckNextState() throws Exception {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void DownloadResults() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void Kill() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
}
|