++
рефакторинг бд файлов тестов.
This commit is contained in:
@@ -86,24 +86,4 @@ public class Group extends riDBObject {
|
||||
if (UI.isActive())
|
||||
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
||||
}
|
||||
public String GenerateMakefile(Test test, String dvm_drv, String flags_in) {
|
||||
//----->>
|
||||
LinkedHashMap<LanguageName, Vector<ProjectFile>> programs = test.getPrograms();
|
||||
Vector<String> titles = new Vector<>();
|
||||
Vector<String> objects = new Vector<>();
|
||||
Vector<String> bodies = new Vector<>();
|
||||
String binary = Utils_.DQuotes("0");
|
||||
//----->>
|
||||
generateForLanguage(dvm_drv, programs, language, titles, objects, bodies, flags_in);
|
||||
//----->>
|
||||
return String.join("\n",
|
||||
"LINK_COMMAND=" + Utils_.DQuotes(dvm_drv) + " " +
|
||||
language.getDVMLink(),
|
||||
"LINK_FLAGS=" + flags_in + "\n",
|
||||
String.join("\n", titles),
|
||||
"all: " + binary,
|
||||
binary + " : " + String.join(" ", objects),
|
||||
"\t" + Utils.MFVar("LINK_COMMAND") + " " + Utils.MFVar("LINK_FLAGS") + " " + String.join(" ", objects) + " -o " + binary,
|
||||
String.join(" ", bodies));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,11 @@ import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.All.UnzipFolderPass;
|
||||
import _VisualDVM.ProjectData.Files.FileType;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestFileJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestFilesJson;
|
||||
import _VisualDVM.TestingSystem.Common.TestFile.TestFile;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class Test extends riDBObject {
|
||||
@Description("DEFAULT 0")
|
||||
@@ -28,13 +23,14 @@ public class Test extends riDBObject {
|
||||
public int group_id = CommonConstants.Nan;
|
||||
@Description("DEFAULT ''")
|
||||
public String extended_description = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String packedFilesJson = "";
|
||||
//--------------------------------------------->>>
|
||||
//--для отправки при публикации---------------->>>
|
||||
@Description("IGNORE")
|
||||
public String temp_project_name = "";
|
||||
@Description("IGNORE")
|
||||
public byte[] project_archive_bytes = null;
|
||||
@Description("IGNORE")
|
||||
public Vector<TestFile> files = null;
|
||||
//public String packedFilesJson; //вывести!
|
||||
//--------------------------------------------->>>
|
||||
public Test(Test test) {
|
||||
this.SynchronizeFields(test);
|
||||
@@ -50,7 +46,6 @@ public class Test extends riDBObject {
|
||||
args = t.args;
|
||||
group_id = t.group_id;
|
||||
extended_description = t.extended_description;
|
||||
packedFilesJson = t.packedFilesJson;
|
||||
}
|
||||
@Override
|
||||
public void select(boolean flag) {
|
||||
@@ -99,21 +94,11 @@ public class Test extends riDBObject {
|
||||
//--
|
||||
return true;
|
||||
}
|
||||
//todo проджект файлы тут не нужны. сделать с учетом джсона
|
||||
public LinkedHashMap<LanguageName, Vector<ProjectFile>> getPrograms() {
|
||||
LinkedHashMap<LanguageName, Vector<ProjectFile>> res = new LinkedHashMap<>();
|
||||
//--
|
||||
res.put(LanguageName.fortran, new Vector<>());
|
||||
res.put(LanguageName.c, new Vector<>());
|
||||
res.put(LanguageName.cpp, new Vector<>());
|
||||
//--
|
||||
TestFilesJson json = Utils_.gson.fromJson(packedFilesJson, TestFilesJson.class);
|
||||
for (TestFileJson file : json.values) {
|
||||
//--
|
||||
if (file.type.equals(FileType.program) &&
|
||||
(!file.language.equals(LanguageName.n)))
|
||||
res.get(file.language).add(new ProjectFile(new File(file.name)));
|
||||
}
|
||||
public Vector<File> getServerFiles(){
|
||||
File path = getServerPath();
|
||||
Vector<File> res = new Vector<>();
|
||||
for (TestFile testFile : Global.testingServer.db.getVectorByFK(this, TestFile.class))
|
||||
res.add(new File(path, testFile.name));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package _VisualDVM.TestingSystem.Common.Test;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Test.UI.TestsForm;
|
||||
import _VisualDVM.TestingSystem.Common.TestFile.TestFile;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class TestDBTable extends iDBTable<Test> {
|
||||
public TestDBTable() {
|
||||
@@ -19,6 +26,12 @@ public class TestDBTable extends iDBTable<Test> {
|
||||
return "тесты";
|
||||
}
|
||||
@Override
|
||||
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
|
||||
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
|
||||
res.put(TestFile.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
return res;
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new TestsForm(this, mountPanel);
|
||||
}
|
||||
@@ -29,9 +42,9 @@ public class TestDBTable extends iDBTable<Test> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Test getTestByDescription(int group_id_in, String description_in) {
|
||||
public Test getStandardTestByDescription(int group_id_in, String description_in) {
|
||||
for (Test test : Data.values()) {
|
||||
if (test.sender_address.equals("vmk-post@yandex.ru") &&
|
||||
if (test.sender_address.equals(Constants.MailAddress) &&
|
||||
(test.group_id == group_id_in) && (test.description.equalsIgnoreCase(description_in)))
|
||||
return test;
|
||||
}
|
||||
@@ -49,18 +62,4 @@ public class TestDBTable extends iDBTable<Test> {
|
||||
}
|
||||
return selectedTests.isEmpty() ? allTests : selectedTests;
|
||||
}
|
||||
|
||||
/*
|
||||
public LinkedHashMap<Integer,Test> getGroupTests(Group group){
|
||||
|
||||
|
||||
Vector<Test> res = new Vector<>();
|
||||
for (Test test: Data.values()){
|
||||
if (test.group_id==group.id){
|
||||
res.add(test);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
}
|
||||
45
src/_VisualDVM/TestingSystem/Common/TestFile/TestFile.java
Normal file
45
src/_VisualDVM/TestingSystem/Common/TestFile/TestFile.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package _VisualDVM.TestingSystem.Common.TestFile;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.ProjectData.Files.projectFile_;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
public class TestFile extends projectFile_ {
|
||||
@Expose
|
||||
@Description("PRIMARY KEY,AUTOINCREMENT")
|
||||
public int id;
|
||||
public int test_id = CommonConstants.Nan;
|
||||
public String name; //имя относительно корневой папки проекта. не ключ.
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public Object getEmptyFK() {
|
||||
return CommonConstants.Nan;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
TestFile src_ = (TestFile) src;
|
||||
id = src_.id;
|
||||
test_id = src_.test_id;
|
||||
name = src_.name;
|
||||
}
|
||||
public TestFile() {
|
||||
}
|
||||
public TestFile(Test test) {
|
||||
test_id = test.id;
|
||||
}
|
||||
public TestFile(File file_in){
|
||||
super(file_in);
|
||||
name = file_in.getName();
|
||||
}
|
||||
public TestFile(Test test, File file_in){
|
||||
this(file_in);
|
||||
test_id = test.id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package _VisualDVM.TestingSystem.Common.TestFile;
|
||||
import Common.Database.Tables.DBTable;
|
||||
public class TestFilesDBTable extends DBTable<Integer,TestFile> {
|
||||
public TestFilesDBTable() {
|
||||
super(Integer.class,TestFile.class);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import _VisualDVM.TestingSystem.Common.Test.Json.TestFileJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestFilesJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.TestingSystem.Common.Test.TestType;
|
||||
import _VisualDVM.TestingSystem.Common.TestFile.TestFile;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
@@ -86,6 +87,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
@Override
|
||||
public void StartAction() throws Exception {
|
||||
try {
|
||||
//--
|
||||
// db.Patch();
|
||||
//--
|
||||
machines_db = new MachinesDatabase();
|
||||
machines_db.Activate();
|
||||
} catch (Exception ex) {
|
||||
@@ -107,6 +111,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
+ "\nТест будет удален"
|
||||
);
|
||||
}
|
||||
db.saveTestFiles(test);
|
||||
db.DetectTestMinMaxDim(db.serverSapfors.getLastDoneVersion(), db.groups.get(test.group_id), test);
|
||||
} else if (object instanceof DVMPackage) {
|
||||
DVMPackage dvmPackage = (DVMPackage) object;
|
||||
@@ -176,6 +181,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
Utils_.forceDeleteWithCheck(test.getServerPath());
|
||||
db.DeleteTestFiles(test);
|
||||
//--
|
||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||
if (dvmConfiguration.tryDeleteTest(test)) {
|
||||
@@ -208,6 +214,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
for (Test group_test : groupTests.values()) {
|
||||
db.Delete(group_test);
|
||||
Utils_.forceDeleteWithCheck(group_test.getServerPath());
|
||||
db.DeleteTestFiles(group_test);
|
||||
}
|
||||
//--
|
||||
} else if (object instanceof ServerSapfor) {
|
||||
@@ -276,6 +283,8 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
int max_installed_version = db.getInstalledSapforMaxVersion();
|
||||
if (max_installed_version == current_version)
|
||||
throw new RepositoryRefuseException("Актуальная версия SAPFOR " + max_installed_version + " уже установлена");
|
||||
ServerSapfor serverSapfor = (ServerSapfor) object;
|
||||
serverSapfor.version = String.valueOf(current_version);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -301,7 +310,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
ServerSapfor sapfor = db.serverSapfors.get(sapforId);
|
||||
TextLog Log = new TextLog();
|
||||
SapforPackage autoPackage = tryAutoSapforTesting(sapfor,Log);
|
||||
SapforPackage autoPackage = tryAutoSapforTesting(sapfor, Log);
|
||||
EmailMessage message = Log.isEmpty() ?
|
||||
new EmailMessage(
|
||||
"Запущено автоматическое тестирование версии " + sapfor.version + " системы SAPFOR",
|
||||
@@ -478,34 +487,30 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
else
|
||||
throw new RepositoryRefuseException("Не удалось заархивировать пакет тестирования SAPFOR с ключом " + sapforPackage_id);
|
||||
}
|
||||
void ReplaceTestCode() throws Exception {
|
||||
Test test = (Test) request.object;
|
||||
void replaceTestCode(Test test, ServerSapfor serverSapfor) throws Exception {
|
||||
if (!test.unpackProjectOnServer()) {
|
||||
db.Delete(test);
|
||||
db.DeleteTestFiles(test);
|
||||
throw new RepositoryRefuseException(
|
||||
"Не удалось прикрепить проект к тесту с id " + test.id
|
||||
+ "\nТест будет удален"
|
||||
);
|
||||
} else {
|
||||
db.Update(test);
|
||||
db.DetectTestMinMaxDim(db.serverSapfors.getLastDoneVersion(), db.groups.get(test.group_id), test);
|
||||
//--
|
||||
db.DeleteTestFiles(test);
|
||||
db.saveTestFiles(test);
|
||||
//--
|
||||
db.DetectTestMinMaxDim(serverSapfor, db.groups.get(test.group_id), test);
|
||||
}
|
||||
}
|
||||
void ReplaceTestCode() throws Exception {
|
||||
replaceTestCode((Test) request.object, db.serverSapfors.getLastDoneVersion());
|
||||
}
|
||||
void ReplaceTestsCodes() throws Exception {
|
||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||
Vector<Test> tests = (Vector<Test>) request.object;
|
||||
for (Test test : tests) {
|
||||
if (!test.unpackProjectOnServer()) {
|
||||
db.Delete(test);
|
||||
throw new RepositoryRefuseException(
|
||||
"Не удалось прикрепить проект к тесту с id " + test.id
|
||||
+ "\nТест будет удален"
|
||||
);
|
||||
} else {
|
||||
db.Update(test);
|
||||
db.DetectTestMinMaxDim(serverSapfor, db.groups.get(test.group_id), test);
|
||||
}
|
||||
}
|
||||
for (Test test : (Vector<Test>) request.object)
|
||||
replaceTestCode(test, serverSapfor);
|
||||
}
|
||||
void GetServerName() throws Exception {
|
||||
response.object = name;
|
||||
@@ -592,7 +597,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
void GetSapforForCompilation() throws Exception {
|
||||
//1. Проверить наличие заказов от пользователя
|
||||
ServerSapfor serverSapfor = db.getSapforCopyForCompilation();
|
||||
|
||||
if (serverSapfor == null) {
|
||||
//2 если нет. проверить есть ли свежие версии.
|
||||
int max_version = db.getInstalledSapforMaxVersion();
|
||||
@@ -716,12 +720,19 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Test test = new Test();
|
||||
test.group_id = group.id;
|
||||
test.description = name;
|
||||
test.packedFilesJson = Utils_.gson.toJson(filesJson);
|
||||
test.sender_address = group.sender_address;
|
||||
test.sender_name = group.sender_name;
|
||||
test.extended_description = descriptions.get(name);
|
||||
db.Insert(test);
|
||||
//---
|
||||
Vector<TestFile> testFiles = new Vector<>();
|
||||
for (File file : files)
|
||||
testFiles.add(new TestFile(test, file));
|
||||
db.BeginTransaction();
|
||||
for (TestFile testFile : testFiles)
|
||||
db.Insert(testFile);
|
||||
db.Commit();
|
||||
//---
|
||||
File testProject = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
//---
|
||||
if (testProject.exists())
|
||||
|
||||
@@ -7,16 +7,15 @@ import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.Files.ProjectFile;
|
||||
import _VisualDVM.ServerObjectsCache.ConfigurationCache;
|
||||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||
import _VisualDVM.TestingSystem.Common.Group.GroupsDBTable;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestFileJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Json.TestFilesJson;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.TestingSystem.Common.Test.TestDBTable;
|
||||
import _VisualDVM.TestingSystem.Common.TestFile.TestFile;
|
||||
import _VisualDVM.TestingSystem.Common.TestFile.TestFilesDBTable;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfigurationDBTable;
|
||||
@@ -44,6 +43,7 @@ import java.util.Vector;
|
||||
public class TestsDatabase extends SQLiteDatabase {
|
||||
public DVMConfigurationDBTable dvmConfigurations;
|
||||
public TestDBTable tests;
|
||||
public TestFilesDBTable testsFiles;
|
||||
public GroupsDBTable groups;
|
||||
public DVMPackageDBTable dvmPackages;
|
||||
public SapforPackageDBTable sapforPackages;
|
||||
@@ -67,6 +67,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
addTable(dvmConfigurations = new DVMConfigurationDBTable());
|
||||
addTable(groups = new GroupsDBTable());
|
||||
addTable(tests = new TestDBTable());
|
||||
addTable(testsFiles = new TestFilesDBTable());
|
||||
addTable(dvmPackages = new DVMPackageDBTable());
|
||||
addTable(sapforPackages = new SapforPackageDBTable());
|
||||
addTable(testingPackagesToKill = new TestingPackagesToKillDBTable());
|
||||
@@ -189,28 +190,25 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void SaveTestFromSingleFile(ServerSapfor sapfor, Group group, Test test, File file) throws Exception {
|
||||
public void importTestFile(Test test, File file) throws Exception {
|
||||
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
Utils_.CheckAndCleanDirectory(testDirectory);
|
||||
File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
||||
FileUtils.copyFile(file, testFile);
|
||||
//----
|
||||
DetectTestMinMaxDim(sapfor, group, test);
|
||||
File dst = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
|
||||
FileUtils.copyFile(file, dst);
|
||||
}
|
||||
//---
|
||||
//---
|
||||
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
||||
Test test = new Test();
|
||||
test.description = testDescription;
|
||||
test.sender_name = account.name;
|
||||
test.sender_address = account.email;
|
||||
test.group_id = group.id;
|
||||
TestFilesJson testFilesJson = new TestFilesJson();
|
||||
testFilesJson.values.add(new TestFileJson(new ProjectFile(file)));
|
||||
test.packedFilesJson = Utils_.gson.toJson(testFilesJson);
|
||||
Insert(test);
|
||||
//->>
|
||||
SaveTestFromSingleFile(sapfor, group, test, file);
|
||||
importTestFile(test, file);
|
||||
TestFile testFile = new TestFile(test,file);
|
||||
Insert(testFile);
|
||||
//--
|
||||
DetectTestMinMaxDim(sapfor, group, test);
|
||||
}
|
||||
public void RefreshGroup(UserAccount account, ServerSapfor sapfor, Pair<Group, Vector<File>> groupData) throws Exception {
|
||||
Group group = groupData.getKey();
|
||||
@@ -226,11 +224,11 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
} else {
|
||||
for (File file : files) {
|
||||
String testDescription = Utils_.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
|
||||
Test oldTest = tests.getTestByDescription(oldGroup.id, testDescription);
|
||||
Test oldTest = tests.getStandardTestByDescription(oldGroup.id, testDescription);
|
||||
if (oldTest == null) {
|
||||
CreateTestFromSingleFile(account, sapfor, oldGroup, file, testDescription);
|
||||
CreateTestFromSingleFile(account, sapfor, oldGroup, file, testDescription);
|
||||
} else {
|
||||
SaveTestFromSingleFile(sapfor, group, oldTest, file);
|
||||
importTestFile(oldTest, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,4 +346,41 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
dvmSettings.ShowUI();
|
||||
super.ResetUI();
|
||||
}
|
||||
public void saveTestFiles(Test test) throws Exception{
|
||||
for (TestFile file : test.files) {
|
||||
file.test_id = test.id;
|
||||
Insert(file);
|
||||
}
|
||||
test.files = null;
|
||||
}
|
||||
public void DeleteTestFiles(Test test) throws Exception {
|
||||
Vector<TestFile> files = getVectorByFK(test, TestFile.class);
|
||||
for (TestFile file : files)
|
||||
Delete(file);
|
||||
}
|
||||
public void Patch() throws Exception{
|
||||
//файлы тестов.
|
||||
/*
|
||||
Vector<TestFile> testFiles = new Vector<>();
|
||||
for (Test test:tests.Data.values()){
|
||||
TestFilesJson json = Utils_.gson.fromJson(test.packedFilesJson, TestFilesJson.class);
|
||||
for (TestFileJson testFileJson: json.values){
|
||||
TestFile testFile = new TestFile();
|
||||
//-
|
||||
testFile.test_id = test.id;
|
||||
testFile.name = testFileJson.name;
|
||||
testFile.style = testFileJson.style;
|
||||
testFile.languageName = testFileJson.language;
|
||||
testFile.fileType= testFileJson.type;
|
||||
//--
|
||||
testFiles.add(testFile);
|
||||
}
|
||||
}
|
||||
BeginTransaction();
|
||||
for (TestFile testFile: testFiles){
|
||||
Insert(testFile);
|
||||
}
|
||||
Commit();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
package _VisualDVM.TestingSystem.DVM;
|
||||
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
|
||||
public String packageDescription() {
|
||||
return "DVM";
|
||||
}
|
||||
@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 {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user