no message
This commit is contained in:
@@ -86,6 +86,7 @@ public enum ServerCode {
|
||||
GetServerName,
|
||||
StartNecessaryMachines,
|
||||
GetSapforForCompilation,
|
||||
GetMaxSapforVersion
|
||||
GetMaxSapforVersion,
|
||||
PerformAutoSapforTesting
|
||||
;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
//--
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@ import Common.UI.VisualCache.ConfigurationCache;
|
||||
import Common.UI.VisualCache.VisualCaches;
|
||||
import Common.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Utils.Utils;
|
||||
import Common.Utils.Vector_;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.UI.SapforConfigurationFields;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
||||
public SapforConfigurationDBTable() {
|
||||
super(SapforConfiguration.class);
|
||||
@@ -30,7 +32,7 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI() {
|
||||
return new DataSetControlForm(this){
|
||||
return new DataSetControlForm(this) {
|
||||
@Override
|
||||
public boolean hasCheckBox() {
|
||||
return true;
|
||||
@@ -75,7 +77,6 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
||||
return cache.getTestsCount();
|
||||
case 8:
|
||||
return object.getFlags();
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -113,7 +114,7 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
||||
Result.KEEP_SPF_DIRECTIVES = Utils.fromBoolean(fields.cbKEEP_SPF_DIRECTIVES.isSelected());
|
||||
Result.STATIC_SHADOW_ANALYSIS = Utils.fromBoolean(fields.cbSTATIC_SHADOW_ANALYSIS.isSelected());
|
||||
Result.MAX_SHADOW_WIDTH = fields.sMAX_SHADOW_WIDTH.getValue();
|
||||
Result.kernels= (int)fields.sKernels.getValue();
|
||||
Result.kernels = (int) fields.sKernels.getValue();
|
||||
}
|
||||
@Override
|
||||
public void SetReadonly() {
|
||||
@@ -128,5 +129,12 @@ public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
||||
res.put(SapforConfigurationCommand.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,10 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
}
|
||||
//---------
|
||||
//конструктор. если 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;
|
||||
sender_name = account.name;
|
||||
sender_address = account.email;
|
||||
@@ -104,8 +107,8 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
//-
|
||||
drv = serverSapfor.call_command;
|
||||
version = serverSapfor.version;
|
||||
needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||
///-------------------------------
|
||||
needsEmail = neeedsEmail_in;
|
||||
package_json = new SapforPackage_json();
|
||||
package_json.sapfor_drv = serverSapfor.call_command;
|
||||
//-
|
||||
|
||||
@@ -2,22 +2,13 @@ package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
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.SAPFOR.Json.SapforConfiguration_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTest_json;
|
||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Server.PublishServerObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class StartSelectedSAPFORConfigurations extends PublishServerObject<TestingServer, SapforPackage> {
|
||||
Vector<SapforConfiguration> configurations;
|
||||
@@ -49,8 +40,12 @@ public class StartSelectedSAPFORConfigurations extends PublishServerObject<Testi
|
||||
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
|
||||
return false;
|
||||
}
|
||||
target = new SapforPackage(Current.getAccount(), Current.getServerSapfor(), configurations, Log);
|
||||
if (target.tasksCount==0){
|
||||
target = new SapforPackage(Current.getAccount(),
|
||||
Current.getServerSapfor(),
|
||||
configurations,
|
||||
Global.properties.EmailOnTestingProgress ? 1 : 0,
|
||||
Log);
|
||||
if (target.tasksCount == 0) {
|
||||
Log.Writeln_("Не сформировано ни одной новой задачи.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import java.io.File;
|
||||
public class TestPass extends Pass_2021<File> {
|
||||
import Common.Current;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
public class TestPass extends TestingSystemPass<ServerSapfor> {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//определить дату изменения проекта.
|
||||
// target = new File("E:\\Tests\\bugreport_1712090719\\SP");
|
||||
// Utils.getNewestFileDate(target);
|
||||
System.out.println("start");
|
||||
for (PassCode_2021 passCode_2021: Constants.startSapforCodes)
|
||||
System.out.println(passCode_2021);
|
||||
//---
|
||||
System.out.println("terminal");
|
||||
for (PassCode_2021 passCode_2021: Constants.terminalSapforCodes)
|
||||
System.out.println(passCode_2021);
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.ServerSapfor)) {
|
||||
target = Current.getServerSapfor();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PerformAutoSapforTesting, String.valueOf(target.id) ));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user