рефакторинг определения размерности тестов на сервере.
This commit is contained in:
@@ -2,7 +2,6 @@ package _VisualDVM.TestingSystem.Common;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.RepositoryRefuseException;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
@@ -174,6 +173,20 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
return res;
|
||||
}
|
||||
//--
|
||||
public void DetectTestMinMaxDim(ServerSapfor serverSapfor, Group group, Test test) throws Exception {
|
||||
switch (group.language) {
|
||||
case fortran:
|
||||
if (serverSapfor != null) {
|
||||
Sapfor.getTestMinMaxDim_F(new File(serverSapfor.call_command), test);
|
||||
Update(test);
|
||||
}
|
||||
break;
|
||||
case c:
|
||||
Sapfor.getTestMinMaxDime_C(test);
|
||||
Update(test);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void SaveTestFromSingleFile(ServerSapfor sapfor, Group group, Test test, File file) throws Exception {
|
||||
File testDirectory = new File(Global.TestsDirectory, String.valueOf(test.id));
|
||||
Utils_.CheckAndCleanDirectory(testDirectory);
|
||||
@@ -187,29 +200,10 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
//----------->>
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
zip.Do(testDirectory.getAbsolutePath(), archive.getAbsolutePath());
|
||||
//---
|
||||
//Определение размерности
|
||||
switch (group.language) {
|
||||
case fortran:
|
||||
// временная папка для анализа. чтобы не засорять нормальную.
|
||||
File tempProject = Utils.getTempFileName("test");
|
||||
FileUtils.forceMkdir(tempProject);
|
||||
FileUtils.copyDirectory(testDirectory, tempProject);
|
||||
//--
|
||||
if (sapfor!=null) {
|
||||
if (Sapfor.getMinMaxDim(Sapfor.getTempCopy(new File(sapfor.call_command)), tempProject, test)) {
|
||||
Update(test);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Не удалось определить размерность теста " + Utils_.Brackets(test.description));
|
||||
}
|
||||
break;
|
||||
case c:
|
||||
test.max_dim = Utils.getCTestMaxDim(testFile);
|
||||
Update(test);
|
||||
break;
|
||||
}
|
||||
DetectTestMinMaxDim(sapfor, group, test);
|
||||
}
|
||||
//---
|
||||
//---
|
||||
public void CreateTestFromSingleFile(UserAccount account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
|
||||
Test test = new Test();
|
||||
test.description = testDescription;
|
||||
|
||||
Reference in New Issue
Block a user