восстановление тестирование сапфор с инкрементными ключами.

This commit is contained in:
2023-11-18 02:25:12 +03:00
parent b708f4d35d
commit f52139a8b5
9 changed files with 140 additions and 127 deletions

View File

@@ -5,44 +5,37 @@ import Common.Global;
import Common.UI.UI;
import Common.Utils.Index;
import ProjectData.LanguageName;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import TestingSystem.DVM.TasksPackage.TasksPackageState;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.Common.Group.Group;
import TestingSystem.DVM.TasksPackage.TasksPackageState;
import TestingSystem.Common.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import Visual_DVM_2021.Passes.Server.PublishServerAccountObject;
import java.io.File;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Vector;
public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
public class StartSapforTests extends PublishServerAccountObject<SapforTasksPackage> {
protected int allTasksCount = 0;
//--
protected LinkedHashMap<Integer, Vector<Integer>> groupsTests = null;
//--
protected LinkedHashMap<String, Test> allTests = null;
protected LinkedHashMap<String, Test> testsByDescriptions = null;
protected Vector<String> testsNames_lower = null; //все тесты что участвуют здесь
protected Vector<LanguageName> groupsLanguages = null;
protected Vector<String> testsIds = null;
protected Vector<String> configurationsIds = null;
protected File sapfor = null;
//---
//--
public StartSapforTests() {
super(SapforTasksPackage.class);
}
//---
@Override
public String getIconPath() {
return "/icons/Start.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected boolean needsAnimation() {
return true;
}
//--
protected boolean checkTestName(Test test) {
String name = test.description.toLowerCase();
@@ -57,7 +50,7 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
Vector<Integer> groupTests = new Vector<>();
Vector<Integer> selectedGroupTests = new Vector<>();
//---
for (Test test : Global.testingServer.db.tests.Data.values()) {
for (Test test : server.db.tests.Data.values()) {
if (test.group_id==groupId) {
groupTests.add(test.id);
if (test.isSelected())
@@ -77,7 +70,7 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
if (!checkTestName(test))
return false;
else
allTests.put(test.description, test);
testsByDescriptions.put(test.description, test);
}
//--
groupsTests.put(groupId, groupTests);
@@ -137,16 +130,15 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
}
//--
@Override
protected boolean canStart(Object... args) throws Exception {
public boolean fillObjectFields() throws Exception {
//--
allTasksCount = 0;
target = null;
//--
groupsTests = new LinkedHashMap<>();
//--->>
testsNames_lower = new Vector<>();
allTests = new LinkedHashMap<>();
testsByDescriptions = new LinkedHashMap<>();
groupsLanguages = new Vector<>();
testsIds =new Vector<>();
configurationsIds = new Vector<>();
//-->>
if (!Current.getAccount().CheckRegistered(Log)) {
return false;
@@ -193,19 +185,7 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
allTasksCount += tests.size();
}
//--
return (UI.Question("Будет запущено:\n"
+ allTasksCount + " задач\n" +
"Продолжить"));
}
//--
@Override
protected void ServerAction() throws Exception {
target = new SapforTasksPackage();
//target.genName();
//--
Vector<String> testsIds = new Vector<>();
Vector<String> configurationsIds = new Vector<>();
for (Test test : allTests.values())
for (Test test : testsByDescriptions.values())
testsIds.add(String.valueOf(test.id));
//--
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems())
@@ -216,9 +196,7 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
target.configurationsIds = String.join("\n", configurationsIds);
//--
target.sapforId = Current.getServerSapfor().id;
target.sapfor_drv = Current.getServerSapfor().call_command;
target.sapfor_version = Current.getServerSapfor().version;
target.sapfor_build_date = Current.getServerSapfor().buildDate;
//--
target.testsNames = String.join(";", testsNames_lower);
target.StartDate = new Date().getTime();
@@ -226,21 +204,9 @@ public class StartSapforTests extends TestingSystemPass<SapforTasksPackage> {
target.state = TasksPackageState.Queued;
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
//---
Vector<SapforTasksPackage> packages = new Vector<>();
packages.add(target);
Command(new ServerExchangeUnit_2021(ServerCode.PublishAccountObjects, Current.getAccount().email, packages));
}
@Override
protected void performDone() throws Exception {
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
/*
if (!TestingServer.checkTasks)
TestingServer.TimerOn();
*/
}
@Override
protected void showDone() throws Exception {
server.account_db.sapforTasksPackages.ui_.Select(target.id);
// UI.getMainWindow().getTestingWindow().ShowAutoActualizeTestsState();
//--
return (UI.Question("Будет запущено:\n"
+ allTasksCount + " задач\n" +
"Продолжить"));
}
}

View File

@@ -0,0 +1,21 @@
package Visual_DVM_2021.Passes.Server;
import Common.Current;
import Common.Database.Database;
import Common.Database.riDBObject;
import Common.Global;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.Common.TestingServer;
public class PublishServerAccountObject<D extends riDBObject> extends PublishServerObject<TestingServer, D> {
public PublishServerAccountObject(Class<D> d_in) {
super(Global.testingServer, d_in);
}
@Override
protected Database getDb() {
return Global.testingServer.account_db;
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.PublishAccountAIObject, Current.getAccount().email, target));
}
}