no message
This commit is contained in:
@@ -2,6 +2,7 @@ package TestingSystem.Common;
|
||||
import Common.Constants;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Account.Account;
|
||||
import ProjectData.LanguageName;
|
||||
@@ -68,22 +69,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
((SapforPackage) object).init();
|
||||
}
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
protected void afterEditAction(DBObject object) throws Exception {
|
||||
if (object instanceof DVMPackage) {
|
||||
DVMPackage dvmPackage = (DVMPackage) object;
|
||||
//новый или редактируемый пакет.
|
||||
if (dvmPackage.state == TasksPackageState.Inactive) {//если json не null, требуется его перезапись
|
||||
if (dvmPackage.package_json != null) {
|
||||
Utils.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
|
||||
dvmPackage.saveJson();
|
||||
dvmPackage.package_json = null; // объект больше не нужен.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
@@ -184,6 +169,24 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Test test;
|
||||
int test_id;
|
||||
switch (code) {
|
||||
//TODO запрос на принудительное автоматическое тестирование заданной версии сапфор.
|
||||
case PerformAutoSapforTesting:
|
||||
Print("Запустить автоматическое тестирование SAPFOR");
|
||||
TextLog Log = new TextLog();
|
||||
tryAutoSapforTesting(Log);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
if (!Log.isEmpty()){
|
||||
/*
|
||||
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
|
||||
EmailMessage message = new EmailMessage(
|
||||
"Выполнена сборка системы SAPFOR",
|
||||
"Версия: " + version_s + "\n" + "Статус: " + status,
|
||||
targets
|
||||
);
|
||||
Email(message);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
case DownloadTest:
|
||||
Print("Отправить клиенту тест " + request.arg);
|
||||
test_id = Integer.parseInt(request.arg);
|
||||
@@ -605,5 +608,37 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = serverSapfor;
|
||||
}
|
||||
void tryAutoSapforTesting(TextLog Log) throws Exception {
|
||||
//--
|
||||
Account account = new Account();
|
||||
account.name= "server";
|
||||
account.email= Constants.MailAddress;
|
||||
//-
|
||||
int sapforId = Integer.parseInt(request.arg);
|
||||
if (!db.serverSapfors.containsKey(sapforId)){
|
||||
Log.Writeln_("Версия SAPFOR "+sapforId+" не существует.");
|
||||
return;
|
||||
}
|
||||
ServerSapfor sapfor = db.serverSapfors.get(sapforId);
|
||||
if (!sapfor.state.equals(ServerSapforState.Done)){
|
||||
Log.Writeln_("Выбранная версия SAPFOR "+sapforId+" не собрана!");
|
||||
return;
|
||||
}
|
||||
Vector<SapforConfiguration> configurations= db.sapforConfigurations.getAutoConfigurations();
|
||||
if (configurations.isEmpty()){
|
||||
Log.Writeln_("Не найдено конфигурация для автоматического тестирования!");
|
||||
return;
|
||||
}
|
||||
SapforPackage target = new SapforPackage(account,
|
||||
sapfor,
|
||||
configurations,
|
||||
1,
|
||||
Log);
|
||||
//-
|
||||
beforePublishAction(target);
|
||||
db.InsertS(target);
|
||||
afterPublishAction(target);
|
||||
//--
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user