кнопка удаления пакетов SAPFOR и их результатов.
This commit is contained in:
11
.idea/workspace.xml
generated
11
.idea/workspace.xml
generated
@@ -8,9 +8,15 @@
|
||||
<component name="ChangeListManager">
|
||||
<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$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/SapforTasksPackagesBar/SapforTasksPackagesBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/SapforTasksPackagesBar/SapforTasksPackagesBar.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TestingBar/TestingBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/TestingBar/TestingBar.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/PackageModeSupervisor/PackageModeSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/PackageModeSupervisor/PackageModeSupervisor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackageSupervisor/SapforTasksPackageSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackageSupervisor/SapforTasksPackageSupervisor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TestingPlanner.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/StartSapforTests.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/TestsSupervisor_2022/TestsSupervisor_2022.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TestsSupervisor_2022/TestsSupervisor_2022.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AbortSapforTaskPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AbortSapforTaskPackage.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforTasksPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteSapforTasksPackage.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -80,7 +86,6 @@
|
||||
<property name="JavaClassFindUsagesOptions.isDerivedClasses" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isFieldsUsages" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isMethodsUsages" value="true" />
|
||||
<property name="OverrideImplement.combined" value="false" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
|
||||
@@ -31,6 +31,9 @@ public class Constants {
|
||||
// public static final String MailPassword = "3s4w9e5fs3c1a89AA"; основной пароль.
|
||||
public static final String MailPassword = "knKn2PpfrC348ZxHtMnT"; //пароль для сапфора как внешнего приложения.
|
||||
//--
|
||||
public static final String package_json = "package_json";
|
||||
public static final String results_json = "results_json";
|
||||
//--
|
||||
public static final PassCode_2021[] terminalSapforTestingCodes = new PassCode_2021[]{
|
||||
PassCode_2021.CreateParallelVariants,
|
||||
PassCode_2021.SPF_SharedMemoryParallelization,
|
||||
|
||||
@@ -3,6 +3,9 @@ import Common.UI.Menus_2023.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class SapforTasksPackagesBar extends DataMenuBar {
|
||||
public SapforTasksPackagesBar() {
|
||||
super("пакеты задач", PassCode_2021.AbortSapforTaskPackage);
|
||||
super("пакеты задач",
|
||||
PassCode_2021.AbortSapforTaskPackage,
|
||||
PassCode_2021.DeleteSapforTasksPackage
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
//--
|
||||
add(new MenuBarButton() {
|
||||
{
|
||||
setText("Оповещение по email");
|
||||
setText("оповещение по email");
|
||||
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
|
||||
Mark();
|
||||
addActionListener(e -> {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PackageModeSupervisor extends ThreadsPlanner {
|
||||
SapforTasksResults_json results_json = new SapforTasksResults_json();
|
||||
public PackageModeSupervisor() throws Exception {
|
||||
super(2000);
|
||||
package_json = (SapforTasksPackage_json) Utils.jsonFromFile(new File(Global.Home, "package_json"), SapforTasksPackage_json.class);
|
||||
package_json = (SapforTasksPackage_json) Utils.jsonFromFile(new File(Global.Home, Constants.package_json), SapforTasksPackage_json.class);
|
||||
Date startDate = new Date();
|
||||
results_json.StartDate = startDate.getTime();
|
||||
File started = new File(Constants.STARTED);
|
||||
@@ -46,7 +46,7 @@ public class PackageModeSupervisor extends ThreadsPlanner {
|
||||
results_json.EndDate = new Date().getTime();
|
||||
//записать результаты всех задач.
|
||||
try {
|
||||
Utils.jsonToFile(results_json, new File(Global.Home, "results_json"));
|
||||
Utils.jsonToFile(results_json, new File(Global.Home, Constants.results_json));
|
||||
//тут же и строить версии.
|
||||
Utils.deleteFilesByExtensions(new File(Global.Home), "proj", "dep"); //Потом txt тоже добавить.
|
||||
FileUtils.writeStringToFile(new File(Constants.DONE), "");
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SapforTasksPackageSupervisor {
|
||||
}
|
||||
//-->>
|
||||
sapforTasksPackage.state = TasksPackageState.RunningExecution;
|
||||
planner.UpdateSapforPackage(sapforTasksPackage);
|
||||
planner.UpdateSapforPackage();
|
||||
System.out.println("done");
|
||||
}
|
||||
void CheckPackageState() throws Exception {
|
||||
@@ -121,11 +121,11 @@ public class SapforTasksPackageSupervisor {
|
||||
File aborted = new File(sapforTasksPackage.workspace, Constants.ABORTED);
|
||||
if (done.exists()) {
|
||||
sapforTasksPackage.state = TasksPackageState.Done;
|
||||
planner.UpdateSapforPackage(sapforTasksPackage);
|
||||
planner.UpdateSapforPackage();
|
||||
System.out.println("package done");
|
||||
} else if (aborted.exists()) {
|
||||
sapforTasksPackage.state = TasksPackageState.Aborted;
|
||||
planner.UpdateSapforPackage(sapforTasksPackage);
|
||||
planner.UpdateSapforPackage();
|
||||
System.out.println("package aborted");
|
||||
} else {
|
||||
System.out.println("package running");
|
||||
@@ -157,13 +157,13 @@ public class SapforTasksPackageSupervisor {
|
||||
System.out.println("PACKAGE " + sapforTasksPackage.id + " NEEDS TO KILL");
|
||||
killPackage();
|
||||
sapforTasksPackage.state = TasksPackageState.Aborted;
|
||||
planner.UpdateSapforPackage(sapforTasksPackage);
|
||||
planner.UpdateSapforPackage();
|
||||
} else {
|
||||
switch (sapforTasksPackage.state) {
|
||||
case TestsSynchronize:
|
||||
TestsSynchronize();
|
||||
sapforTasksPackage.state = TasksPackageState.RunningPreparation;
|
||||
planner.UpdateSapforPackage(sapforTasksPackage);
|
||||
planner.UpdateSapforPackage();
|
||||
break;
|
||||
case RunningPreparation:
|
||||
PackageStart();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package TestingSystem;
|
||||
import Common.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
@@ -6,6 +7,8 @@ import GlobalData.User.User;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.Json.SapforTasksPackage_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import SapforTestingSystem.SapforTasksPackageSupervisor.SapforTasksPackageSupervisor;
|
||||
import TestingSystem.Tasks.TestCompilationTask;
|
||||
@@ -42,16 +45,18 @@ public class TestingPlanner {
|
||||
task_in.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, task_in);
|
||||
}
|
||||
public void UpdatePackage(TasksPackage package_in) throws Exception {
|
||||
package_in.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, package_in);
|
||||
public void UpdatePackage() throws Exception {
|
||||
tasksPackage.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, tasksPackage);
|
||||
//---------------
|
||||
if ((package_in.needsEmail == 1) &&
|
||||
(package_in.state.equals(TasksPackageState.PackageStart) ||
|
||||
(package_in.state.equals(TasksPackageState.Done)))) {
|
||||
if ((tasksPackage.needsEmail == 1) &&
|
||||
(tasksPackage.state.equals(TasksPackageState.PackageStart) ||
|
||||
(tasksPackage.state.equals(TasksPackageState.Done)) ||
|
||||
(tasksPackage.state.equals(TasksPackageState.Aborted))
|
||||
)) {
|
||||
EmailMessage message = new EmailMessage();
|
||||
message.subject = "Состояние пакета задач " + Utils.Brackets(package_in.id) + " изменилось на " + Utils.Brackets(package_in.state.getDescription());
|
||||
message.text = package_in.summary;
|
||||
message.subject = "Состояние пакета задач " + Utils.Brackets(tasksPackage.id) + " изменилось на " + Utils.Brackets(tasksPackage.state.getDescription());
|
||||
message.text = tasksPackage.summary;
|
||||
message.targets.add(email);
|
||||
ServerCommand(ServerCode.Email, message);
|
||||
}
|
||||
@@ -206,17 +211,44 @@ public class TestingPlanner {
|
||||
return String.join("/", user.workspace, ConnectionPass.modules, ConnectionPass.planner);
|
||||
}
|
||||
//--
|
||||
public void UpdateSapforPackage(SapforTasksPackage package_in) throws Exception {
|
||||
package_in.ChangeDate = new Date().getTime();
|
||||
ServerCommand(ServerCode.EditAccountObject, package_in);
|
||||
if ((package_in.needsEmail == 1) &&
|
||||
(package_in.state.equals(TasksPackageState.RunningExecution) ||
|
||||
(package_in.state.equals(TasksPackageState.Done)))) {
|
||||
EmailMessage message = new EmailMessage();
|
||||
message.subject = "Состояние пакета задач SAPFOR" + Utils.Brackets(package_in.id) + " изменилось на " + Utils.Brackets(package_in.state.getDescription());
|
||||
// message.text = package_in.summary;
|
||||
public void UpdateSapforPackage() throws Exception {
|
||||
sapforTasksPackage.ChangeDate = new Date().getTime();
|
||||
EmailMessage message = null;
|
||||
ServerCommand(ServerCode.EditAccountObject, sapforTasksPackage);
|
||||
if (sapforTasksPackage.needsEmail == 1) {
|
||||
switch (sapforTasksPackage.state) {
|
||||
case RunningExecution:
|
||||
case Aborted:
|
||||
message = new EmailMessage();
|
||||
message.subject = "Состояние пакета задач SAPFOR" + Utils.Brackets(sapforTasksPackage.id) + " изменилось на " + Utils.Brackets(sapforTasksPackage.state.getDescription());
|
||||
break;
|
||||
case Done:
|
||||
//результаты.
|
||||
message = new EmailMessage();
|
||||
message.subject = "Состояние пакета задач SAPFOR" + Utils.Brackets(sapforTasksPackage.id) + " изменилось на " + Utils.Brackets(sapforTasksPackage.state.getDescription());
|
||||
message.text = AnalyseSapforPackageResults();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (message != null) {
|
||||
message.targets.add(email);
|
||||
ServerCommand(ServerCode.Email, message);
|
||||
}
|
||||
}
|
||||
//--
|
||||
public String AnalyseSapforPackageResults() throws Exception {
|
||||
String result = "";
|
||||
Vector<String> result_lines = new Vector<>();
|
||||
File results_json_file = new File(sapforTasksPackage.workspace, Constants.results_json);
|
||||
if (results_json_file.exists()) {
|
||||
SapforTasksPackage_json results_json = (SapforTasksPackage_json) Utils.jsonFromFile(results_json_file, SapforTasksPackage_json.class);
|
||||
result = String.join("\n", result_lines);
|
||||
result_lines.add("");
|
||||
LinkedHashMap<String, Vector<SapforTask>> tasksByConfigurations = new LinkedHashMap<>();
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,11 +182,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
)
|
||||
);
|
||||
} else if (object instanceof SapforTasksPackage) {
|
||||
Utils.forceDeleteWithCheck(
|
||||
new File(
|
||||
File workspace = new File(
|
||||
((SapforTasksPackage) object).workspace
|
||||
)
|
||||
);
|
||||
System.out.println(Utils.Brackets(workspace.getAbsolutePath()));
|
||||
Utils.forceDeleteWithCheck(workspace);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -53,23 +53,23 @@ public class TestsSupervisor_2022 {
|
||||
connection.ShellCommand("kill -9 " + tasksPackage.pid);
|
||||
}
|
||||
tasksPackage.state = TasksPackageState.Aborted;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
}else {
|
||||
switch (tasksPackage.state) {
|
||||
case TestsSynchronize:
|
||||
TestsSynchronize();
|
||||
tasksPackage.state = TasksPackageState.PackageWorkspaceCreation;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
break;
|
||||
case PackageWorkspaceCreation:
|
||||
PackageWorkspaceCreation();
|
||||
tasksPackage.state = TasksPackageState.PackageStart;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
break;
|
||||
case PackageStart:
|
||||
PackageStart();
|
||||
tasksPackage.state = TasksPackageState.CompilationWorkspacesCreation;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
break;
|
||||
case CompilationWorkspacesCreation:
|
||||
case CompilationPreparation:
|
||||
@@ -82,12 +82,12 @@ public class TestsSupervisor_2022 {
|
||||
case RunningEnd:
|
||||
DownloadResults();
|
||||
tasksPackage.state = TasksPackageState.Analysis;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
break;
|
||||
case Analysis:
|
||||
AnalyseResults();
|
||||
tasksPackage.state = TasksPackageState.Done;
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -167,7 +167,7 @@ public class TestsSupervisor_2022 {
|
||||
System.out.println(fileName + " last file");
|
||||
tasksPackage.state = TasksPackageState.valueOf(files.get(files.size() - 1).getFilename());
|
||||
if (tasksPackage.state != oldState)
|
||||
planner.UpdatePackage(tasksPackage);
|
||||
planner.UpdatePackage();
|
||||
}
|
||||
}
|
||||
public void DownloadResults() throws Exception {
|
||||
|
||||
@@ -25,6 +25,7 @@ public class AbortSapforTaskPackage extends TestingSystemPass<SapforTasksPackage
|
||||
switch (target.state) {
|
||||
case Done:
|
||||
case Aborted:
|
||||
Log.Writeln_("Пакет уже завершен.");
|
||||
break;
|
||||
default:
|
||||
TasksPackageToKill tasksPackageToKill = new TasksPackageToKill();
|
||||
|
||||
@@ -1,54 +1,51 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Database.Database;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import Common.Current;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
|
||||
import Visual_DVM_2021.Passes.DeleteObjectPass;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import TestingSystem.TasksPackage.TasksPackageState;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.io.File;
|
||||
public class DeleteSapforTasksPackage extends DeleteObjectPass<SapforTasksPackage> {
|
||||
public DeleteSapforTasksPackage() {
|
||||
super(SapforTasksPackage.class);
|
||||
import java.util.Vector;
|
||||
public class DeleteSapforTasksPackage extends TestingSystemPass<SapforTasksPackage> {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected Database getDb() {
|
||||
return Global.testingServer.db;
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
/*
|
||||
if (Current.hasUI()&&Current.HasSapforTasksPackage()) {
|
||||
UI.getMainWindow().getTestingWindow().RemoveSapforPackageFromComparison();
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.SapforTasksPackage)) {
|
||||
target = Current.getSapforTasksPackage();
|
||||
if (!target.state.equals(TasksPackageState.Done) && !target.state.equals(TasksPackageState.Aborted)) {
|
||||
Log.Writeln_("Нельзя удалить активный пакет!");
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
super.body();
|
||||
Utils.delete_with_check(new File(target.workspace));
|
||||
protected void ServerAction() throws Exception {
|
||||
Vector<SapforTasksPackage> vector = new Vector<>();
|
||||
vector.add(target);
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteAccountObjects, Current.getAccount().email, vector));
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
Pass_2021 serverPass = new TestingSystemPass<SapforTasksPackage>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Удаление пакета задач SAPFOR с сервера";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (SapforTasksPackage) args[0];
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.DeleteObject, "", target));
|
||||
}
|
||||
};
|
||||
serverPass.Do(target);
|
||||
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Current.hasUI()&&Current.HasSapforTasksPackage()) {
|
||||
UI.getMainWindow().getTestingWindow().RemoveSapforPackageFromComparison();
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user