улучшение описания пакетов

This commit is contained in:
2024-10-03 16:21:11 +03:00
parent 76b6a36de6
commit 4ad0a32238
12 changed files with 88 additions and 44 deletions

17
.idea/workspace.xml generated
View File

@@ -7,16 +7,17 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneDVMSettings.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneSapforSettings.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/CloneServerObject.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMSettings/UI/DVMSettingsBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMSettings/UI/DVMSettingsBar.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforConfiguration_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforConfiguration_json.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforSettings/SapforSettings.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforSettings/SapforSettings.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforSettings/SapforSettingsBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforSettings/SapforSettingsBar.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMPackage/DVMPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMPackage/DVMPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/RemoteDVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/RemoteDVMTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneSapforSettings.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneSapforSettings.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -35,7 +35,7 @@
"PerformanceAnalyzerPath": "", "PerformanceAnalyzerPath": "",
"ComponentsBackUpsCount": 10, "ComponentsBackUpsCount": 10,
"TestingKernels": 64, "TestingKernels": 64,
"AutoCheckTesting": false, "AutoCheckTesting": true,
"CheckTestingIntervalSeconds": 10, "CheckTestingIntervalSeconds": 10,
"EmailOnTestingProgress": true, "EmailOnTestingProgress": true,
"eraseTestingWorkspaces": true "eraseTestingWorkspaces": true

View File

@@ -84,4 +84,8 @@ public abstract class TestingPackage<J> extends riDBObject {
public void saveConfigurationsAsJson(Vector<? extends Configuration> configurations) { public void saveConfigurationsAsJson(Vector<? extends Configuration> configurations) {
packedConfigurationsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new ConfigurationsJson(configurations))); packedConfigurationsJson = Utils.jsonToPrettyFormat(Utils.gson.toJson(new ConfigurationsJson(configurations)));
} }
//определить завершен пакет с ошибками или нет.
public void checkFinishState() throws Exception{
}
} }

View File

@@ -41,14 +41,29 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
break; break;
} }
} }
protected void UpdatePackageState() throws Exception {
testingPackage.ChangeDate = new Date().getTime();
ServerCommand(ServerCode.EditObject, testingPackage);
switch (testingPackage.state) {
case Done:
case DoneWithErrors:
case Aborted:
case CompilationExecution:
case RunningExecution:
EmailPackage();
break;
}
}
void UpdatePackage() throws Exception { void UpdatePackage() throws Exception {
testingPackage.ChangeDate = new Date().getTime(); testingPackage.ChangeDate = new Date().getTime();
ServerCommand(ServerCode.EditObject, testingPackage); ServerCommand(ServerCode.EditObject, testingPackage);
} }
public abstract String packageDescription();
void EmailPackage() throws Exception { void EmailPackage() throws Exception {
if (testingPackage.needsEmail == 1) { if (testingPackage.needsEmail == 1) {
EmailMessage message = new EmailMessage(); EmailMessage message = new EmailMessage();
message.subject = "Состояние пакета задач " + Utils.Brackets(testingPackage) + " изменилось на " + Utils.Brackets(testingPackage.state.getDescription()); message.subject = "Состояние пакета тестирования "+packageDescription()+ " "+
Utils.Brackets(testingPackage.id) + " изменилось на " + Utils.Brackets(testingPackage.state.getDescription());
message.text = testingPackage.description; message.text = testingPackage.description;
message.targets.add(testingPackage.sender_address); message.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message); ServerCommand(ServerCode.Email, message);

View File

@@ -172,12 +172,12 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
case PerformAutoSapforTesting: case PerformAutoSapforTesting:
Print("Запустить автоматическое тестирование SAPFOR"); Print("Запустить автоматическое тестирование SAPFOR");
TextLog Log = new TextLog(); TextLog Log = new TextLog();
tryAutoSapforTesting(Log); SapforPackage autoPackage = tryAutoSapforTesting(Log);
response = new ServerExchangeUnit_2021(ServerCode.OK); response = new ServerExchangeUnit_2021(ServerCode.OK);
EmailMessage message = Log.isEmpty() ? EmailMessage message = Log.isEmpty() ?
new EmailMessage( new EmailMessage(
"Запущено автоматической тестирование версии " + request.arg + " системы SAPFOR", "Запущено автоматическое тестирование версии " + request.arg + " системы SAPFOR",
"", new Vector<>()) : "Пакет "+ Utils.Brackets(autoPackage.id), new Vector<>()) :
new EmailMessage( new EmailMessage(
"Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR", "Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR",
Log.toString(), Log.toString(),
@@ -606,7 +606,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
response = new ServerExchangeUnit_2021(ServerCode.OK); response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = serverSapfor; response.object = serverSapfor;
} }
void tryAutoSapforTesting(TextLog Log) throws Exception { SapforPackage tryAutoSapforTesting(TextLog Log) throws Exception {
//-- //--
Account account = new Account(); Account account = new Account();
account.name = "server"; account.name = "server";
@@ -617,17 +617,17 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
if (!db.serverSapfors.containsKey(sapforId)) { if (!db.serverSapfors.containsKey(sapforId)) {
Log.Writeln_("Версия SAPFOR " + sapforId + " не существует."); Log.Writeln_("Версия SAPFOR " + sapforId + " не существует.");
return; return null;
} }
ServerSapfor sapfor = db.serverSapfors.get(sapforId); ServerSapfor sapfor = db.serverSapfors.get(sapforId);
if (!sapfor.state.equals(ServerSapforState.Done)) { if (!sapfor.state.equals(ServerSapforState.Done)) {
Log.Writeln_("Выбранная версия SAPFOR " + sapforId + " не собрана!"); Log.Writeln_("Выбранная версия SAPFOR " + sapforId + " не собрана!");
return; return null;
} }
Vector<SapforConfiguration> configurations = db.sapforConfigurations.getAutoConfigurations(); Vector<SapforConfiguration> configurations = db.sapforConfigurations.getAutoConfigurations();
if (configurations.isEmpty()) { if (configurations.isEmpty()) {
Log.Writeln_("Не найдено конфигураций для автоматического тестирования!"); Log.Writeln_("Не найдено конфигураций для автоматического тестирования!");
return; return null;
} }
SapforPackage target = new SapforPackage(account, SapforPackage target = new SapforPackage(account,
sapfor, sapfor,
@@ -637,12 +637,13 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
//- //-
if (target.tasksCount == 0) { if (target.tasksCount == 0) {
Log.Writeln_("Не сформировано ни одной новой задачи."); Log.Writeln_("Не сформировано ни одной новой задачи.");
return; return null;
} }
beforePublishAction(target); beforePublishAction(target);
db.InsertS(target); db.InsertS(target);
afterPublishAction(target); afterPublishAction(target);
//-- //--
return target;
} }
} }

View File

@@ -114,5 +114,9 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) && return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
(!DVMPackageDBTable.filterActive || state.isActive()); (!DVMPackageDBTable.filterActive || state.isActive());
} }
@Override
public void checkFinishState() throws Exception {
}
} }

View File

@@ -55,6 +55,10 @@ public class LocalDVMTestingPlanner extends DVMTestingPlanner {
return true; return true;
} }
@Override @Override
public String packageDescription() {
return "DVM";
}
@Override
protected void TestsSynchronize() throws Exception { protected void TestsSynchronize() throws Exception {
testingPackage.readJson(); testingPackage.readJson();
LinkedHashMap<Integer, File> tests = getTestsFromJson(); LinkedHashMap<Integer, File> tests = getTestsFromJson();

View File

@@ -104,6 +104,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
//-- //--
int ct_count = 0; int ct_count = 0;
int rt_count = 0; int rt_count = 0;
int good=0;
//-- //--
for (DVMCompilationTask compilationTask : testingPackage.package_json.compilationTasks) { for (DVMCompilationTask compilationTask : testingPackage.package_json.compilationTasks) {
compilationTask.dvm_package_id = testingPackage.id; compilationTask.dvm_package_id = testingPackage.id;
@@ -154,13 +155,18 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
} }
if (!runTask.state.equals(TaskState.Done)) if (!runTask.state.equals(TaskState.Done))
hasErrors = true; hasErrors = true;
else good++;
} }
} }
} }
testingPackage.progress = 100; testingPackage.progress = 100;
testingPackage.saveJson(); //запись обновленных результатов пакета в json! testingPackage.saveJson(); //запись обновленных результатов пакета в json!
Print("analysis done, ct_count=" + ct_count + " rt count=" + rt_count); Print("analysis done, ct_count=" + ct_count + " rt count=" + rt_count);
UpdatePackageState(hasErrors ? TasksPackageState.DoneWithErrors : TasksPackageState.Done); testingPackage.state = hasErrors ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
double percent = ( ((double)(good))/testingPackage.tasksCount)*100.0;
testingPackage.description = "Выполнено на "+((int)percent)+"%\n"+
"Всего задач: "+testingPackage.tasksCount+", из них с ошибками "+(testingPackage.tasksCount-good);
UpdatePackageState();
} }
@Override @Override
protected void PackageStart() throws Exception { protected void PackageStart() throws Exception {
@@ -263,4 +269,8 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
} }
return true; return true;
} }
@Override
public String packageDescription() {
return "DVM";
}
} }

View File

@@ -179,12 +179,6 @@ public class SapforPackage_json implements Serializable {
}); });
return names; return names;
} }
public TasksPackageState getState() {
for (SapforTask task : tasks)
if (!task.state.equals(TaskState.Done))
return TasksPackageState.DoneWithErrors;
return TasksPackageState.Done;
}
//--- //---
public SapforPackage_json() { public SapforPackage_json() {
} }

View File

@@ -4,23 +4,18 @@ import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
import Common.UI.VisualCache.ConfigurationCache; import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.SapforConfigurationCache;
import Common.UI.VisualCache.VisualCaches; import Common.UI.VisualCache.VisualCaches;
import Common.Utils.TextLog; import Common.Utils.TextLog;
import Common.Utils.Utils; import Common.Utils.Utils;
import GlobalData.Account.Account; import GlobalData.Account.Account;
import GlobalData.Tasks.TaskState;
import TestingSystem.Common.TasksPackageState; import TestingSystem.Common.TasksPackageState;
import TestingSystem.Common.Test.Test; import TestingSystem.Common.Test.Test;
import TestingSystem.Common.TestingPackage.TestingPackage; import TestingSystem.Common.TestingPackage.TestingPackage;
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
import TestingSystem.SAPFOR.Json.SapforPackage_json; import TestingSystem.SAPFOR.Json.SapforPackage_json;
import TestingSystem.SAPFOR.Json.SapforTest_json;
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration; import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import TestingSystem.SAPFOR.SapforTask.SapforTask; import TestingSystem.SAPFOR.SapforTask.SapforTask;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor; import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import Visual_DVM_2021.Passes.PassCode_2021;
import java.io.File; import java.io.File;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@@ -66,7 +61,7 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
//Запрещено выполнять на нитях, так как прямой доступ к бд. //Запрещено выполнять на нитях, так как прямой доступ к бд.
public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations, public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations,
int neeedsEmail_in, int neeedsEmail_in,
TextLog Log) throws Exception{ TextLog Log) throws Exception {
id = Constants.Nan; id = Constants.Nan;
sender_name = account.name; sender_name = account.name;
sender_address = account.email; sender_address = account.email;
@@ -82,9 +77,9 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
//-- //--
boolean valid = true; boolean valid = true;
//проверка исходных данных тестов и групп //проверка исходных данных тестов и групп
LinkedHashMap<String, Test> testsByDescriptions =new LinkedHashMap<>(); LinkedHashMap<String, Test> testsByDescriptions = new LinkedHashMap<>();
//-- //--
kernels=1; kernels = 1;
for (SapforConfiguration configuration : configurations) { for (SapforConfiguration configuration : configurations) {
kernels = Math.max(configuration.kernels, kernels); kernels = Math.max(configuration.kernels, kernels);
configuration.validate(Log); configuration.validate(Log);
@@ -95,18 +90,33 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
String l_description = test.description.toLowerCase(); String l_description = test.description.toLowerCase();
if (testsByDescriptions.containsKey(l_description)) { if (testsByDescriptions.containsKey(l_description)) {
Log.Writeln_("В пакет не могут входить тесты с одинаковыми именами (без учета регистра):" + test.description.toLowerCase()); Log.Writeln_("В пакет не могут входить тесты с одинаковыми именами (без учета регистра):" + test.description.toLowerCase());
valid=false; valid = false;
} else { } else {
testsByDescriptions.put(l_description, test); testsByDescriptions.put(l_description, test);
} }
} }
} }
valid= Log.isEmpty(); valid = Log.isEmpty();
//формирование задач. //формирование задач.
if (valid){ if (valid) {
package_json= new SapforPackage_json(serverSapfor, testsByDescriptions, configurations, kernels); package_json = new SapforPackage_json(serverSapfor, testsByDescriptions, configurations, kernels);
tasksCount = package_json.tasks.size(); tasksCount = package_json.tasks.size();
saveConfigurationsAsJson(configurations); saveConfigurationsAsJson(configurations);
} }
} }
@Override
public void checkFinishState() throws Exception {
readJson();
int good=0;
int bad = 0;
for (SapforTask task : package_json.tasks) {
if (!task.state.equals(TaskState.Done))
bad++;
else good++;
}
state = (bad > 0) ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
double percent = ( ((double)(good))/tasksCount)*100.0;
description = "Выполнено на "+((int)percent)+"%\n"+
"Всего задач: "+tasksCount+", из них с ошибками "+bad;
}
} }

View File

@@ -46,6 +46,10 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
repo_err = new File(repoSapforHome, Constants.err_file); repo_err = new File(repoSapforHome, Constants.err_file);
} }
@Override @Override
public String packageDescription() {
return "SAPFOR";
}
@Override
protected ServerCode getActivePackagesCode() { protected ServerCode getActivePackagesCode() {
return ServerCode.GetFirstActiveSapforPackages; return ServerCode.GetFirstActiveSapforPackages;
} }
@@ -146,8 +150,8 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
protected void AnalyseResults() throws Exception { protected void AnalyseResults() throws Exception {
//не требуется. //не требуется.
testingPackage.progress = 100; testingPackage.progress = 100;
testingPackage.readJson(); testingPackage.checkFinishState();
UpdatePackageState(testingPackage.package_json.getState()); UpdatePackageState();
} }
@Override @Override
protected void Kill() throws Exception { protected void Kill() throws Exception {
@@ -181,9 +185,6 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
void UpdateSapforState(ServerSapforState state_in) throws Exception { void UpdateSapforState(ServerSapforState state_in) throws Exception {
sapfor.state = state_in; sapfor.state = state_in;
ServerCommand(ServerCode.EditObject, sapfor); ServerCommand(ServerCode.EditObject, sapfor);
if (!sapfor.state.isActive()){
}
} }
void SyncronizeRepository() throws Exception { void SyncronizeRepository() throws Exception {
UpdateSapforState(ServerSapforState.DVMRepositorySynchronization); UpdateSapforState(ServerSapforState.DVMRepositorySynchronization);

View File

@@ -10,7 +10,7 @@ import TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand; import TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
import Visual_DVM_2021.Passes.PassCode_2021; import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.CloneServerObject; import Visual_DVM_2021.Passes.Server.CloneServerObject;
//автоматической
import java.util.Vector; import java.util.Vector;
public class CloneSapforSettings extends CloneServerObject<TestingServer, SapforSettings> { public class CloneSapforSettings extends CloneServerObject<TestingServer, SapforSettings> {
public CloneSapforSettings() { public CloneSapforSettings() {