2024-09-15 01:36:19 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
|
|
|
|
|
import Common.Current;
|
|
|
|
|
|
import Common.Global;
|
|
|
|
|
|
import Common.UI.UI;
|
2024-10-01 17:33:08 +03:00
|
|
|
|
import Common.UI.VisualCache.DVMConfigurationCache;
|
2024-09-18 13:37:11 +03:00
|
|
|
|
import Common.UI.VisualCache.VisualCaches;
|
2024-09-15 01:36:19 +03:00
|
|
|
|
import Common.Utils.Utils;
|
|
|
|
|
|
import GlobalData.Compiler.CompilerType;
|
|
|
|
|
|
import GlobalData.Machine.MachineType;
|
|
|
|
|
|
import GlobalData.User.UserState;
|
|
|
|
|
|
import TestingSystem.Common.Group.Group;
|
|
|
|
|
|
import TestingSystem.Common.Test.Test;
|
|
|
|
|
|
import TestingSystem.Common.TestingServer;
|
2024-09-16 15:41:43 +03:00
|
|
|
|
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
2024-09-15 01:36:19 +03:00
|
|
|
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
2024-10-01 17:33:08 +03:00
|
|
|
|
import TestingSystem.DVM.DVMSettings.DVMSettings;
|
2024-09-15 01:36:19 +03:00
|
|
|
|
import TestingSystem.DVM.DVMTasks.DVMCompilationTask;
|
|
|
|
|
|
import TestingSystem.DVM.DVMTasks.DVMRunTask;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Server.PublishServerObject;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
|
import java.util.Vector;
|
2024-09-16 16:03:39 +03:00
|
|
|
|
public class StartSelectedDVMConfigurations extends PublishServerObject<TestingServer, DVMPackage> {
|
|
|
|
|
|
public StartSelectedDVMConfigurations() {
|
2024-09-15 01:36:19 +03:00
|
|
|
|
super(Global.testingServer, DVMPackage.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/Start.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
//--
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
|
if (!Current.getAccount().CheckRegistered(Log)) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2024-09-19 17:37:34 +03:00
|
|
|
|
if (!Current.Check(Log, Current.Machine, Current.User, Current.Compiler))
|
|
|
|
|
|
return false;
|
|
|
|
|
|
if (!Current.getMachine().type.equals(MachineType.Server)) {
|
|
|
|
|
|
Log.Writeln_("Тестирование поддерживается только на одиночном удалённом сервере.");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!Current.getUser().state.equals(UserState.ready_to_work)) {
|
|
|
|
|
|
Log.Writeln_("Пользователь не готов к работе. Выполните инициализацию пользователя!");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!Current.getCompiler().type.equals(CompilerType.dvm)) {
|
|
|
|
|
|
Log.Writeln_("Тестирование поддерживается только для DVM компиляторов.");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!Current.getCompiler().versionLoaded)
|
|
|
|
|
|
passes.get(PassCode_2021.ShowCompilerVersion).Do(Current.getCompiler(), false);
|
2024-10-01 17:33:08 +03:00
|
|
|
|
//-----
|
|
|
|
|
|
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getCheckedOrCurrent();
|
|
|
|
|
|
if (configurations.isEmpty()) {
|
|
|
|
|
|
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
|
|
|
|
|
|
return false;
|
2024-09-20 01:52:39 +03:00
|
|
|
|
}
|
2024-10-01 17:33:08 +03:00
|
|
|
|
//---
|
|
|
|
|
|
target= new DVMPackage(
|
2024-09-19 17:37:34 +03:00
|
|
|
|
Current.getAccount(),
|
|
|
|
|
|
Current.getMachine(),
|
|
|
|
|
|
Current.getUser(),
|
2024-09-20 01:52:39 +03:00
|
|
|
|
Current.getCompiler(),
|
2024-10-01 17:33:08 +03:00
|
|
|
|
configurations,
|
|
|
|
|
|
Global.properties.EmailOnTestingProgress ? 1 : 0
|
|
|
|
|
|
);
|
2024-09-20 01:52:39 +03:00
|
|
|
|
//----
|
2024-10-01 17:33:08 +03:00
|
|
|
|
if (target.tasksCount == 0) {
|
2024-09-19 17:37:34 +03:00
|
|
|
|
Log.Writeln_("Задач не найдено.");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2024-10-01 17:33:08 +03:00
|
|
|
|
return UI.Question("Будет запущено " + target.tasksCount + " задач. Продолжить");
|
2024-09-15 01:36:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|