no message

This commit is contained in:
2024-09-24 20:22:41 +03:00
parent 797f232347
commit 33e6abfbf5
7 changed files with 96 additions and 52 deletions

5
.idea/workspace.xml generated
View File

@@ -8,9 +8,12 @@
<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 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$/src/TestingSystem/SAPFOR/SapforConfiguration/SapforConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforConfiguration/SapforConfiguration.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.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/SapforConfiguration/SapforConfigurationDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforConfiguration/SapforConfigurationDBTable.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/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSelectedSAPFORConfigurations.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.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

@@ -86,6 +86,7 @@ public enum ServerCode {
GetServerName, GetServerName,
StartNecessaryMachines, StartNecessaryMachines,
GetSapforForCompilation, GetSapforForCompilation,
GetMaxSapforVersion GetMaxSapforVersion,
PerformAutoSapforTesting
; ;
} }

View File

@@ -2,6 +2,7 @@ package TestingSystem.Common;
import Common.Constants; import Common.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
import Common.Utils.TextLog;
import Common.Utils.Utils; import Common.Utils.Utils;
import GlobalData.Account.Account; import GlobalData.Account.Account;
import ProjectData.LanguageName; import ProjectData.LanguageName;
@@ -68,22 +69,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
((SapforPackage) object).init(); ((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 @Override
public void afterDeleteAction(DBObject object) throws Exception { public void afterDeleteAction(DBObject object) throws Exception {
if (object instanceof Test) { if (object instanceof Test) {
@@ -184,6 +169,24 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Test test; Test test;
int test_id; int test_id;
switch (code) { 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: case DownloadTest:
Print("Отправить клиенту тест " + request.arg); Print("Отправить клиенту тест " + request.arg);
test_id = Integer.parseInt(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 = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = serverSapfor; 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);
//--
}
} }

View File

@@ -8,10 +8,12 @@ import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCaches; import Common.UI.VisualCache.VisualCaches;
import Common.UI.Windows.Dialog.DBObjectDialog; import Common.UI.Windows.Dialog.DBObjectDialog;
import Common.Utils.Utils; import Common.Utils.Utils;
import Common.Utils.Vector_;
import TestingSystem.SAPFOR.SapforConfiguration.UI.SapforConfigurationFields; import TestingSystem.SAPFOR.SapforConfiguration.UI.SapforConfigurationFields;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand; import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Vector;
public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> { public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
public SapforConfigurationDBTable() { public SapforConfigurationDBTable() {
super(SapforConfiguration.class); super(SapforConfiguration.class);
@@ -75,7 +77,6 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
return cache.getTestsCount(); return cache.getTestsCount();
case 8: case 8:
return object.getFlags(); return object.getFlags();
default: default:
return null; return null;
} }
@@ -128,5 +129,12 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
res.put(SapforConfigurationCommand.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE)); res.put(SapforConfigurationCommand.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
return res; return res;
} }
public Vector<SapforConfiguration> getAutoConfigurations() {
Vector<SapforConfiguration> res = new Vector_<>();
for (SapforConfiguration configuration : Data.values()) {
if (configuration.autoTesting != 0)
res.add(configuration);
}
return res;
}
} }

View File

@@ -95,7 +95,10 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
} }
//--------- //---------
//конструктор. если 0 задач по итогу,значит пакет не запускаем вообще, и смотрим журнал. //конструктор. если 0 задач по итогу,значит пакет не запускаем вообще, и смотрим журнал.
public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations, TextLog Log) throws Exception{ //Запрещено выполнять на нитях, так как прямой доступ к бд.
public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations,
int neeedsEmail_in,
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;
@@ -104,8 +107,8 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
//- //-
drv = serverSapfor.call_command; drv = serverSapfor.call_command;
version = serverSapfor.version; version = serverSapfor.version;
needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
///------------------------------- ///-------------------------------
needsEmail = neeedsEmail_in;
package_json = new SapforPackage_json(); package_json = new SapforPackage_json();
package_json.sapfor_drv = serverSapfor.call_command; package_json.sapfor_drv = serverSapfor.call_command;
//- //-

View File

@@ -2,22 +2,13 @@ package Visual_DVM_2021.Passes.All;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.VisualCache.ConfigurationCache;
import Common.UI.VisualCache.VisualCaches;
import TestingSystem.Common.Test.Test;
import TestingSystem.Common.TestingServer; import TestingSystem.Common.TestingServer;
import TestingSystem.SAPFOR.Json.SapforConfiguration_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.SapforPackage.SapforPackage; import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import TestingSystem.SAPFOR.SapforTask.SapforTask;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState; import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.PublishServerObject; import Visual_DVM_2021.Passes.Server.PublishServerObject;
import java.io.File; import java.io.File;
import java.util.LinkedHashMap;
import java.util.Vector; import java.util.Vector;
public class StartSelectedSAPFORConfigurations extends PublishServerObject<TestingServer, SapforPackage> { public class StartSelectedSAPFORConfigurations extends PublishServerObject<TestingServer, SapforPackage> {
Vector<SapforConfiguration> configurations; Vector<SapforConfiguration> configurations;
@@ -49,7 +40,11 @@ public class StartSelectedSAPFORConfigurations extends PublishServerObject<Testi
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация."); Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
return false; return false;
} }
target = new SapforPackage(Current.getAccount(), Current.getServerSapfor(), configurations, Log); target = new SapforPackage(Current.getAccount(),
Current.getServerSapfor(),
configurations,
Global.properties.EmailOnTestingProgress ? 1 : 0,
Log);
if (target.tasksCount == 0) { if (target.tasksCount == 0) {
Log.Writeln_("Не сформировано ни одной новой задачи."); Log.Writeln_("Не сформировано ни одной новой задачи.");
return false; return false;

View File

@@ -1,21 +1,20 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants; import Common.Current;
import Visual_DVM_2021.Passes.PassCode_2021; import Repository.Server.ServerCode;
import Visual_DVM_2021.Passes.Pass_2021; import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
import java.io.File; import Visual_DVM_2021.Passes.Server.TestingSystemPass;
public class TestPass extends Pass_2021<File> { public class TestPass extends TestingSystemPass<ServerSapfor> {
@Override @Override
protected void body() throws Exception { protected boolean canStart(Object... args) throws Exception {
//определить дату изменения проекта. if (Current.Check(Log, Current.ServerSapfor)) {
// target = new File("E:\\Tests\\bugreport_1712090719\\SP"); target = Current.getServerSapfor();
// Utils.getNewestFileDate(target); return true;
System.out.println("start"); }
for (PassCode_2021 passCode_2021: Constants.startSapforCodes) return false;
System.out.println(passCode_2021); }
//--- @Override
System.out.println("terminal"); protected void ServerAction() throws Exception {
for (PassCode_2021 passCode_2021: Constants.terminalSapforCodes) Command(new ServerExchangeUnit_2021(ServerCode.PerformAutoSapforTesting, String.valueOf(target.id) ));
System.out.println(passCode_2021);
} }
} }