diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2755b347..c0fcd43c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,10 +9,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/properties b/properties
index d153c9ee..dc3602c8 100644
--- a/properties
+++ b/properties
@@ -11,8 +11,8 @@
"SMTPPort": 465,
"MailSocketPort": 465,
"collapseCredentials": true,
- "collapseFileGraphs": true,
- "collapseFileMessages": true,
+ "collapseFileGraphs": false,
+ "collapseFileMessages": false,
"collapseProjectTrees": false,
"BackupWorkspace": "_sapfor_x64_backups",
"BackupHour": 5,
diff --git a/src/Repository/Component/Visualiser.java b/src/Repository/Component/Visualiser.java
index 6e59862a..8257c309 100644
--- a/src/Repository/Component/Visualiser.java
+++ b/src/Repository/Component/Visualiser.java
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
@Override
public void GetVersionInfo() {
- version = 1089;
+ version = 1090;
String pattern = "MMM dd yyyy HH:mm:ss";
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
date_text = df.format(getClassBuildTime());
diff --git a/src/TestingSystem/Common/Group/GroupsDBTable.java b/src/TestingSystem/Common/Group/GroupsDBTable.java
index 25ec75bc..e03cc7b9 100644
--- a/src/TestingSystem/Common/Group/GroupsDBTable.java
+++ b/src/TestingSystem/Common/Group/GroupsDBTable.java
@@ -132,9 +132,9 @@ public class GroupsDBTable extends iDBTable {
}
return false;
}
- public Group getGroupByDescription(String description_in) {
+ public Group getGroupByDescription(LanguageName language_in,String description_in) {
for (Group group : Data.values()) {
- if (group.description.equalsIgnoreCase(description_in))
+ if (group.language.equals(language_in)&&group.description.equalsIgnoreCase(description_in))
return group;
}
return null;
diff --git a/src/TestingSystem/Common/Test/TestDBTable.java b/src/TestingSystem/Common/Test/TestDBTable.java
index f974b565..87dd8d58 100644
--- a/src/TestingSystem/Common/Test/TestDBTable.java
+++ b/src/TestingSystem/Common/Test/TestDBTable.java
@@ -100,9 +100,9 @@ public class TestDBTable extends iDBTable {
}
return false;
}
- public Test getTestByDescription(String description_in) {
+ public Test getTestByDescription(int group_id_in, String description_in) {
for (Test test : Data.values()) {
- if (test.description.equalsIgnoreCase(description_in))
+ if ((test.group_id==group_id_in)&&(test.description.equalsIgnoreCase(description_in)))
return test;
}
return null;
diff --git a/src/TestingSystem/Common/TestingServer.java b/src/TestingSystem/Common/TestingServer.java
index a945cb22..1924e836 100644
--- a/src/TestingSystem/Common/TestingServer.java
+++ b/src/TestingSystem/Common/TestingServer.java
@@ -5,7 +5,6 @@ import Common.Global;
import Common.Utils.Utils;
import GlobalData.Account.Account;
import ProjectData.LanguageName;
-import Repository.Component.Sapfor.Sapfor;
import Repository.EmailMessage;
import Repository.RepositoryRefuseException;
import Repository.RepositoryServer;
@@ -299,7 +298,6 @@ public class TestingServer extends RepositoryServer {
throw new RepositoryRefuseException("Не удалось обновить репозиторий");
//-->>
Vector>> groups = new Vector<>();
- LinkedHashMap> res = new LinkedHashMap<>();
File testsSrc = Paths.get(
Global.RepoDirectory.getAbsolutePath(),
"dvm", "tools", "tester", "trunk", "test-suite").toFile();
@@ -338,58 +336,8 @@ public class TestingServer extends RepositoryServer {
//-теперь создать тесты.
System.out.println("найдено " + groups.size() + " групп");
//--
- for (Pair> p : groups) {
- Group group = p.getKey();
- //-
- db.Insert(group);
- Vector testsIds = new Vector<>();
- res.put(group, testsIds);
- //-
- Vector files = p.getValue();
- if (!files.isEmpty()) {
- //->>
- for (File file : files) {
- System.out.println("Создание теста " + file.getName());
- Test test = new Test();
- test.description = Utils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
- test.sender_name = account.name;
- test.sender_address = account.email;
- test.group_id = group.id;
- test.files = file.getName();
- db.Insert(test);
- testsIds.add(test);
- //->>
- 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);
- //----
- //архивация.
- File archive = test.getArchive();
- 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.getMinMaxDim(Sapfor.getTempCopy(new File(sapfor.call_command)), tempProject, test)) {
- db.Update(test);
- } else
- throw new RepositoryRefuseException("Не удалось определить размерность теста " + Utils.Brackets(test.description));
- break;
- case c:
- test.max_dim = Utils.getCTestMaxDim(testFile);
- db.Update(test);
- break;
- }
- }
- }
- }
+ for (Pair> p : groups)
+ db.RefreshGroup(account, sapfor, p);
}
private void GetFirstActiveDVMPackagesByMachines() {
response = new ServerExchangeUnit_2021(ServerCode.OK);
diff --git a/src/TestingSystem/Common/TestsDatabase.java b/src/TestingSystem/Common/TestsDatabase.java
index 69e58163..b13bd648 100644
--- a/src/TestingSystem/Common/TestsDatabase.java
+++ b/src/TestingSystem/Common/TestsDatabase.java
@@ -1,7 +1,14 @@
package TestingSystem.Common;
import Common.Constants;
import Common.Database.SQLITE.SQLiteDatabase;
+import Common.Global;
+import Common.Utils.Utils;
+import GlobalData.Account.Account;
+import Repository.Component.Sapfor.Sapfor;
+import Repository.RepositoryRefuseException;
+import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Group.GroupsDBTable;
+import TestingSystem.Common.Test.Test;
import TestingSystem.Common.Test.TestDBTable;
import TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
import TestingSystem.DVM.Configuration.ConfigurationDBTable;
@@ -12,9 +19,14 @@ import TestingSystem.SAPFOR.SapforConfiguration.SapforConfigurationDBTable;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.SapforPackage.SapforPackageDBTable;
+import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
+import Visual_DVM_2021.Passes.All.ZipFolderPass;
import Visual_DVM_2021.Passes.PassCode_2021;
+import javafx.util.Pair;
+import org.apache.commons.io.FileUtils;
+import java.io.File;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.LinkedHashMap;
@@ -144,4 +156,78 @@ public class TestsDatabase extends SQLiteDatabase {
}
return res;
}
+ //--
+ 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);
+ File testFile = Paths.get(testDirectory.getAbsolutePath(), file.getName()).toFile();
+ FileUtils.copyFile(file, testFile);
+ //----
+ //архивация.
+ File archive = test.getArchive();
+ if (archive.exists())
+ FileUtils.forceDelete(archive);
+ //----------->>
+ 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.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;
+ }
+ }
+ //---
+ public void CreateTestFromSingleFile(Account account, ServerSapfor sapfor, Group group, File file, String testDescription) throws Exception {
+ System.out.println("Создание теста " + file.getName());
+ Test test = new Test();
+ test.description = testDescription;
+ test.sender_name = account.name;
+ test.sender_address = account.email;
+ test.group_id = group.id;
+ test.files = file.getName();
+ Insert(test);
+ //->>
+ SaveTestFromSingleFile(sapfor, group, test, file);
+ }
+ public void RefreshGroup(Account account, ServerSapfor sapfor, Pair> groupData) throws Exception {
+ Group group = groupData.getKey();
+ Vector files = groupData.getValue();
+ //--
+ Group oldGroup = groups.getGroupByDescription(group.language,group.description);
+ if (oldGroup == null) {
+ System.out.println("group "+Utils.Brackets(group.description)+" not found. create.");
+ Insert(group);
+ for (File file : files) {
+ String testDescription = Utils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
+ System.out.println("test "+Utils.Brackets(testDescription) + " create"); //добавить тест.
+ CreateTestFromSingleFile(account, sapfor, group, file, testDescription);
+ }
+ } else {
+ for (File file : files) {
+ String testDescription = Utils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
+ Test oldTest = tests.getTestByDescription(oldGroup.id, testDescription);
+ if (oldTest == null) {
+ System.out.println("test "+Utils.Brackets(testDescription) + " not found. create"); //добавить тест.
+ CreateTestFromSingleFile(account, sapfor, oldGroup, file, testDescription);
+ } else {
+ System.out.println(Utils.Brackets(testDescription) + " found. rewrite"); //добавить тест.
+ SaveTestFromSingleFile(sapfor, group, oldTest, file);
+ }
+ }
+ }
+ }
}
diff --git a/src/TestingSystem/SAPFOR/Json/SapforVersionState.java b/src/TestingSystem/SAPFOR/Json/SapforVersionState.java
index 3934e78d..c6079f69 100644
--- a/src/TestingSystem/SAPFOR/Json/SapforVersionState.java
+++ b/src/TestingSystem/SAPFOR/Json/SapforVersionState.java
@@ -2,5 +2,6 @@ package TestingSystem.SAPFOR.Json;
import java.io.Serializable;
public enum SapforVersionState implements Serializable {
Empty, //версия оказалась пуста.
- Normal //версия построена
+ Normal, //версия построена
+ HasErrors //версия построена, но в журналах есть ошибка.
}
diff --git a/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java b/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java
index 18dd46db..a02a98fd 100644
--- a/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java
+++ b/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java
@@ -8,6 +8,7 @@ import ProjectData.Files.ProjectFile;
import ProjectData.LanguageName;
import ProjectData.Messages.Errors.MessageError;
import ProjectData.Project.db_project_info;
+import Repository.Component.Sapfor.Sapfor;
import TestingSystem.SAPFOR.SapforTask.SapforTask;
import com.google.gson.annotations.Expose;
import org.apache.commons.io.FileUtils;
@@ -76,6 +77,26 @@ public class SapforVersion_json implements Serializable {
parse_err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.parse_err_file).toFile());
out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile());
err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile());
+ //--
+ Vector files = new Vector<>();
+ files.add(parse_out.file);
+ files.add(parse_err.file);
+ files.add(out.file);
+ files.add(err.file);
+ for (File file:files){
+ try {
+ if (file.exists()) {
+ Vector lines = new Vector<>(FileUtils.readLines(file));
+ if (!Sapfor.checkLines(lines)) {
+ state = SapforVersionState.HasErrors;
+ return;
+ }
+ }
+ }
+ catch (Exception ex){
+ ex.printStackTrace();
+ }
+ }
}
public boolean isMatch(SapforVersion_json version_json) {
if (!description.equals(version_json.description)) {