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

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

View File

@@ -84,4 +84,8 @@ public abstract class TestingPackage<J> extends riDBObject {
public void saveConfigurationsAsJson(Vector<? extends Configuration> 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;
}
}
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 {
testingPackage.ChangeDate = new Date().getTime();
ServerCommand(ServerCode.EditObject, testingPackage);
}
public abstract String packageDescription();
void EmailPackage() throws Exception {
if (testingPackage.needsEmail == 1) {
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.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message);

View File

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