93 lines
3.1 KiB
Java
93 lines
3.1 KiB
Java
package TestingSystem.DVM;
|
|
import Common.Constants;
|
|
import Common.Global;
|
|
import Common.Utils.Utils;
|
|
import GlobalData.RemoteFile.RemoteFile;
|
|
import Repository.Server.ServerCode;
|
|
import TestingSystem.Common.TasksPackageState;
|
|
import TestingSystem.Common.TestingPlanner;
|
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
import java.io.File;
|
|
import java.nio.file.Paths;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Vector;
|
|
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));
|
|
System.out.println("current version ="+current_version);
|
|
} catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
else {
|
|
System.out.println("version not exists");
|
|
}
|
|
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
|
|
protected void TestsSynchronize() throws Exception {
|
|
testingPackage.readJson();
|
|
LinkedHashMap<Integer, File> tests = getTestsFromJson();
|
|
//синхронизировать их.
|
|
for (int test_id : tests.keySet()) {
|
|
File test = tests.get(test_id);
|
|
File testDst = Paths.get(testingPackage.user_workspace,"projects", String.valueOf(test_id)).toFile();
|
|
Print(testDst.getAbsolutePath());
|
|
FileUtils.copyDirectory(test,testDst);
|
|
}
|
|
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 {
|
|
}
|
|
|
|
}
|