создание пакета из нескольких старых
This commit is contained in:
10
.idea/workspace.xml
generated
10
.idea/workspace.xml
generated
@@ -8,17 +8,11 @@
|
|||||||
<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$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" 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/TaskThread.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TaskThread.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/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforTestingSet_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforTestingSet_json.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PackageModeSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PackageModeSupervisor.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.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/AddTasksToSapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AddTasksToSapforPackage.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AddTasksToSapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/AddTasksToSapforPackage.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CompareDVMRunTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CompareDVMRunTasks.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneSapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CloneSapforPackage.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CompareSapforPackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CompareSapforPackages.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" />
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
package Repository.Server;
|
package Repository.Server;
|
||||||
import Visual_DVM_2021.Passes.All.DownloadDVMPackages;
|
|
||||||
public enum ServerCode {
|
public enum ServerCode {
|
||||||
Undefined,
|
Undefined,
|
||||||
ReadFile,
|
ReadFile,
|
||||||
@@ -80,5 +79,6 @@ public enum ServerCode {
|
|||||||
InstallServerSapfor,
|
InstallServerSapfor,
|
||||||
ReplaceTestCode,
|
ReplaceTestCode,
|
||||||
ReplaceTestsCodes,
|
ReplaceTestsCodes,
|
||||||
|
GetSapforPackagesJson,
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import TestingSystem.Common.Test.TestType;
|
|||||||
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||||
import TestingSystem.DVM.DVMTestingPlanner;
|
import TestingSystem.DVM.DVMTestingPlanner;
|
||||||
|
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||||
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
|
||||||
@@ -249,6 +250,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
Print("Заменить код тестов");
|
Print("Заменить код тестов");
|
||||||
ReplaceTestsCodes();
|
ReplaceTestsCodes();
|
||||||
break;
|
break;
|
||||||
|
case GetSapforPackagesJson:
|
||||||
|
Print("Получить информацию о задачах пакетов SAPFOR");
|
||||||
|
GetSapforPackagesJson();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||||
}
|
}
|
||||||
@@ -623,5 +628,20 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
//-
|
//-
|
||||||
Email(message, out, err);
|
Email(message, out, err);
|
||||||
}
|
}
|
||||||
|
private void GetSapforPackagesJson() throws Exception {
|
||||||
|
Vector<Integer> packages_ids = (Vector<Integer>) request.object;
|
||||||
|
Vector<SapforPackage_json> jsons = new Vector<>();
|
||||||
|
for (int package_id : packages_ids) {
|
||||||
|
if (!db.sapforPackages.containsKey(package_id))
|
||||||
|
throw new RepositoryRefuseException("Пакета задач SAPFOR " + Utils.Brackets(package_id) + " не существует.");
|
||||||
|
SapforPackage sapforPackage = db.sapforPackages.get(package_id);
|
||||||
|
File json = sapforPackage.getJsonFile();
|
||||||
|
if (!json.exists())
|
||||||
|
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач SAPFOR " + Utils.Brackets(package_id));
|
||||||
|
jsons.add((SapforPackage_json) Utils.jsonFromFile(json, SapforPackage_json.class));
|
||||||
|
}
|
||||||
|
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||||
|
response.object = jsons;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import Common.Global;
|
|||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import TestingSystem.Common.TestingPackage.TestingPackage;
|
import TestingSystem.Common.TestingPackage.TestingPackage;
|
||||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||||
|
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
|
||||||
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
import TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||||
import com.sun.org.glassfish.gmbal.Description;
|
import com.sun.org.glassfish.gmbal.Description;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Vector;
|
||||||
public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||||
@Description("DEFAULT ''")
|
@Description("DEFAULT ''")
|
||||||
public String testsNames = "";//имена тестов через ; для отображения
|
public String testsNames = "";//имена тестов через ; для отображения
|
||||||
@@ -42,4 +44,19 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
|||||||
saveJson();
|
saveJson();
|
||||||
package_json = null; // объект больше не нужен.
|
package_json = null; // объект больше не нужен.
|
||||||
}
|
}
|
||||||
|
//-проверка, какие задачи из набора, не пересекаются с уже имеющимися в пакете.
|
||||||
|
public Vector<SapforTask> getActualTestingSetTasks(SapforTestingSet_json testingSet){
|
||||||
|
Vector<SapforTask> possible_tasks = testingSet.createTasks();
|
||||||
|
Vector<String> keys = package_json.getTasksKeys();
|
||||||
|
Vector<SapforTask> new_tasks = new Vector<>();
|
||||||
|
//----
|
||||||
|
for (SapforTask task : possible_tasks) {
|
||||||
|
String key = task.getUniqueKey();
|
||||||
|
if (!keys.contains(key)) {
|
||||||
|
keys.add(key);
|
||||||
|
new_tasks.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new_tasks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.io.File;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
||||||
SapforTestingSet_json testing_set; //то, что добавляем.
|
SapforTestingSet_json testingSet; //то, что добавляем.
|
||||||
//--
|
//--
|
||||||
protected LinkedHashMap<Integer, Vector<Integer>> groupsTests = null;
|
protected LinkedHashMap<Integer, Vector<Integer>> groupsTests = null;
|
||||||
protected LinkedHashMap<String, Test> testsByDescriptions = null;
|
protected LinkedHashMap<String, Test> testsByDescriptions = null;
|
||||||
@@ -215,14 +215,14 @@ public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
testing_set = new SapforTestingSet_json();
|
testingSet = new SapforTestingSet_json();
|
||||||
testing_set.id = target.package_json.getMaxSetId();
|
testingSet.id = target.package_json.getMaxSetId();
|
||||||
for (Test test : testsByDescriptions.values()) {
|
for (Test test : testsByDescriptions.values()) {
|
||||||
SapforTest_json test_json = new SapforTest_json();
|
SapforTest_json test_json = new SapforTest_json();
|
||||||
test_json.id = test.id;
|
test_json.id = test.id;
|
||||||
test_json.description = test.description;
|
test_json.description = test.description;
|
||||||
test_json.group_description = Global.testingServer.db.groups.get(test.group_id).description;
|
test_json.group_description = Global.testingServer.db.groups.get(test.group_id).description;
|
||||||
testing_set.tests.add(test_json);
|
testingSet.tests.add(test_json);
|
||||||
}
|
}
|
||||||
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
for (SapforConfiguration configuration : Global.testingServer.db.sapforConfigurations.getCheckedItems()) {
|
||||||
//--
|
//--
|
||||||
@@ -236,20 +236,11 @@ public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
|||||||
//--
|
//--
|
||||||
configuration_json.codes.addAll(codes);
|
configuration_json.codes.addAll(codes);
|
||||||
//--->>
|
//--->>
|
||||||
testing_set.configurations.add(configuration_json);
|
testingSet.configurations.add(configuration_json);
|
||||||
//-->>
|
//-->>
|
||||||
}
|
}
|
||||||
Vector<SapforTask> possible_tasks = testing_set.createTasks();
|
new_tasks = target.getActualTestingSetTasks(testingSet);
|
||||||
Vector<String> keys = target.package_json.getTasksKeys();
|
if (new_tasks.size() == 0) {
|
||||||
new_tasks = new Vector<>();
|
|
||||||
for (SapforTask task : possible_tasks) {
|
|
||||||
String key = task.getUniqueKey();
|
|
||||||
if (!keys.contains(key)) {
|
|
||||||
keys.add(key);
|
|
||||||
new_tasks.add(task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (new_tasks.size()==0){
|
|
||||||
Log.Writeln_("Не сформировано ни одной новой задачи.\n" +
|
Log.Writeln_("Не сформировано ни одной новой задачи.\n" +
|
||||||
"Задачи уже присутствуют в пакете, или не отмечено ни одного теста.");
|
"Задачи уже присутствуют в пакете, или не отмечено ни одного теста.");
|
||||||
return false;
|
return false;
|
||||||
@@ -262,21 +253,20 @@ public class AddTasksToSapforPackage extends Pass_2021<SapforPackage> {
|
|||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
//-->>
|
//-->>
|
||||||
target.package_json.testingSets.add(testing_set);
|
target.package_json.testingSets.add(testingSet);
|
||||||
for (SapforTask task: new_tasks){
|
for (SapforTask task : new_tasks) {
|
||||||
task.id = target.package_json.getMaxTaskId();
|
task.id = target.package_json.getMaxTaskId();
|
||||||
target.package_json.tasks.add(task);
|
target.package_json.tasks.add(task);
|
||||||
}
|
}
|
||||||
target.tasksCount += new_tasks.size();
|
target.tasksCount += new_tasks.size();
|
||||||
target.testsNames = String.join(";", target.package_json.getTestsNames());
|
target.testsNames = String.join(";", target.package_json.getTestsNames());
|
||||||
Global.testingServer.db.Update(target);
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void showDone() throws Exception {
|
protected void showDone() throws Exception {
|
||||||
Global.testingServer.db.sapforPackages.ShowUI(target.id);
|
Global.testingServer.db.sapforPackages.ShowUI(target.id);
|
||||||
//----
|
//----
|
||||||
Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
|
// Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
|
||||||
target.saveJson();
|
// target.saveJson();
|
||||||
//---
|
//---
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,8 @@ import Common.Database.Database;
|
|||||||
import Common.Global;
|
import Common.Global;
|
||||||
import Common.UI.UI;
|
import Common.UI.UI;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import TestingSystem.Common.Group.Group;
|
import Repository.Server.ServerCode;
|
||||||
|
import Repository.Server.ServerExchangeUnit_2021;
|
||||||
import TestingSystem.Common.TasksPackageState;
|
import TestingSystem.Common.TasksPackageState;
|
||||||
import TestingSystem.Common.Test.Test;
|
import TestingSystem.Common.Test.Test;
|
||||||
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
import TestingSystem.SAPFOR.Json.SapforConfiguration_json;
|
||||||
@@ -14,15 +15,58 @@ import TestingSystem.SAPFOR.Json.SapforTest_json;
|
|||||||
import TestingSystem.SAPFOR.Json.SapforTestingSet_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 Visual_DVM_2021.Passes.AddObjectPass;
|
import Visual_DVM_2021.Passes.AddObjectPass;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class CloneSapforPackage extends AddObjectPass<SapforPackage> {
|
public class CloneSapforPackage extends AddObjectPass<SapforPackage> {
|
||||||
SapforPackage src;
|
Vector<SapforPackage> srcPackages;
|
||||||
|
//--
|
||||||
|
Vector<String> inexistingTests;
|
||||||
|
Vector<String> inexistingConfigurations;
|
||||||
|
//--
|
||||||
public CloneSapforPackage() {
|
public CloneSapforPackage() {
|
||||||
super(SapforPackage.class);
|
super(SapforPackage.class);
|
||||||
}
|
}
|
||||||
|
protected SapforTestingSet_json cloneTestingSet(SapforTestingSet_json src) {
|
||||||
|
SapforTestingSet_json dst = new SapforTestingSet_json();
|
||||||
|
dst.id = target.package_json.getMaxSetId();
|
||||||
|
//--
|
||||||
|
for (SapforTest_json src_TestJson : src.tests) {
|
||||||
|
if (Global.testingServer.db.tests.containsKey(src_TestJson.id)) {
|
||||||
|
System.out.println("test=" + src_TestJson.id);
|
||||||
|
Test test = Global.testingServer.db.tests.get(src_TestJson.id);
|
||||||
|
SapforTest_json testJson = new SapforTest_json();
|
||||||
|
//--
|
||||||
|
testJson.id = test.id;
|
||||||
|
testJson.description = test.description;
|
||||||
|
testJson.group_description = src_TestJson.group_description;
|
||||||
|
//--
|
||||||
|
dst.tests.add(testJson);
|
||||||
|
//--
|
||||||
|
} else {
|
||||||
|
inexistingTests.add(String.valueOf(src_TestJson.id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
for (SapforConfiguration_json src_configuration : src.configurations) {
|
||||||
|
if (Global.testingServer.db.sapforConfigurations.containsKey(src_configuration.id)) {
|
||||||
|
System.out.println("configuration=" + src_configuration.id);
|
||||||
|
SapforConfiguration configuration = Global.testingServer.db.sapforConfigurations.get(src_configuration.id);
|
||||||
|
SapforConfiguration_json configurationJson = new SapforConfiguration_json();
|
||||||
|
//--
|
||||||
|
configurationJson.id = configuration.id;
|
||||||
|
configurationJson.flags = src_configuration.flags;
|
||||||
|
configurationJson.codes.addAll(src_configuration.codes);
|
||||||
|
//--
|
||||||
|
dst.configurations.add(configurationJson);
|
||||||
|
} else {
|
||||||
|
inexistingConfigurations.add(String.valueOf(src_configuration.id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getIconPath() {
|
public String getIconPath() {
|
||||||
return "/icons/MultiFiles.png";
|
return "/icons/MultiFiles.png";
|
||||||
@@ -33,125 +77,110 @@ public class CloneSapforPackage extends AddObjectPass<SapforPackage> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
src = null;
|
srcPackages = new Vector<>();
|
||||||
if (!Current.getAccount().CheckRegistered(Log)) {
|
if (!Current.getAccount().CheckRegistered(Log))
|
||||||
return false;
|
return false;
|
||||||
|
//--
|
||||||
|
if (!Current.Check(Log, Current.ServerSapfor))
|
||||||
|
return false;
|
||||||
|
//--
|
||||||
|
if (Global.testingServer.db.sapforPackages.getCheckedCount() > 0) {
|
||||||
|
srcPackages = Global.testingServer.db.sapforPackages.getCheckedItems();
|
||||||
|
} else {
|
||||||
|
if (Current.Check(Log, Current.SapforPackage)) {
|
||||||
|
srcPackages.add(Current.getSapforPackage());
|
||||||
|
} else return false;
|
||||||
}
|
}
|
||||||
if (Current.Check(Log, Current.ServerSapfor, Current.SapforPackage)) {
|
//--
|
||||||
//-
|
for (SapforPackage sapforPackage : Global.testingServer.db.sapforPackages.Data.values()) {
|
||||||
for (SapforPackage sapforPackage : Global.testingServer.db.sapforPackages.Data.values()) {
|
if (sapforPackage.state.equals(TasksPackageState.Draft)) {
|
||||||
if (sapforPackage.state.equals(TasksPackageState.Draft)) {
|
Log.Writeln_("Может существовать только один пакет, готовящийся к публикации.");
|
||||||
Log.Writeln_("Может существовать только один пакет, готовящийся к публикации.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
src = Current.getSapforPackage();
|
|
||||||
if (!src.state.equals(TasksPackageState.Done)) {
|
|
||||||
Log.Writeln_("Возможно повторить только завершенный пакет!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!src.isLoaded())
|
|
||||||
passes.get(PassCode_2021.DownloadSapforPackage).Do(src);
|
|
||||||
//-
|
|
||||||
if (!src.isLoaded())
|
|
||||||
return false;
|
|
||||||
//----
|
|
||||||
Vector<String> inexistingTests = new Vector<>();
|
|
||||||
Vector<String> inexistingConfigurations = new Vector<>();
|
|
||||||
//---->>
|
|
||||||
target = new SapforPackage();
|
|
||||||
target.id = Constants.Nan;
|
|
||||||
//-
|
|
||||||
target.sender_name = Current.getAccount().name;
|
|
||||||
target.sender_address = Current.getAccount().email;
|
|
||||||
//-
|
|
||||||
target.drv = Current.getServerSapfor().call_command;
|
|
||||||
target.version = Current.getServerSapfor().version;
|
|
||||||
target.kernels = Global.properties.TestingKernels;
|
|
||||||
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
|
||||||
//--
|
|
||||||
target.sapforId = Current.getServerSapfor().id;
|
|
||||||
//--
|
|
||||||
target.kernels = Global.properties.TestingKernels;
|
|
||||||
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
|
||||||
//--
|
|
||||||
target.tasksCount = 0;
|
|
||||||
//--
|
|
||||||
src.readJson();
|
|
||||||
target.package_json = new SapforPackage_json();
|
|
||||||
///-------------------------------
|
|
||||||
target.package_json.kernels = target.kernels;
|
|
||||||
target.package_json.sapfor_drv = target.drv;
|
|
||||||
//--
|
|
||||||
Vector<String> testsNames = new Vector<>();
|
|
||||||
//--
|
|
||||||
for (SapforTestingSet_json src_testingSet : src.package_json.testingSets) {
|
|
||||||
int tests_count = 0;
|
|
||||||
int configurations_count = 0;
|
|
||||||
//--
|
|
||||||
SapforTestingSet_json testingSet = new SapforTestingSet_json();
|
|
||||||
testingSet.id = target.package_json.getMaxSetId();
|
|
||||||
//--
|
|
||||||
for (SapforTest_json src_TestJson : src_testingSet.tests) {
|
|
||||||
if (Global.testingServer.db.tests.containsKey(src_TestJson.id)) {
|
|
||||||
System.out.println("test=" + src_TestJson.id);
|
|
||||||
Test test = Global.testingServer.db.tests.get(src_TestJson.id);
|
|
||||||
SapforTest_json testJson = new SapforTest_json();
|
|
||||||
//--
|
|
||||||
testJson.id = test.id;
|
|
||||||
testJson.description = test.description;
|
|
||||||
testJson.group_description = src_TestJson.group_description;
|
|
||||||
//--
|
|
||||||
testingSet.tests.add(testJson);
|
|
||||||
//--
|
|
||||||
testsNames.add(test.description);
|
|
||||||
tests_count++;
|
|
||||||
}else {
|
|
||||||
inexistingTests.add(String.valueOf(src_TestJson.id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
for (SapforConfiguration_json src_configuration : src_testingSet.configurations) {
|
|
||||||
if (Global.testingServer.db.sapforConfigurations.containsKey(src_configuration.id)) {
|
|
||||||
System.out.println("configuration=" + src_configuration.id);
|
|
||||||
SapforConfiguration configuration = Global.testingServer.db.sapforConfigurations.get(src_configuration.id);
|
|
||||||
SapforConfiguration_json configurationJson = new SapforConfiguration_json();
|
|
||||||
//--
|
|
||||||
configurationJson.id = configuration.id;
|
|
||||||
configurationJson.flags = src_configuration.flags;
|
|
||||||
configurationJson.codes.addAll(src_configuration.codes);
|
|
||||||
//--
|
|
||||||
testingSet.configurations.add(configurationJson);
|
|
||||||
configurations_count++;
|
|
||||||
}else {
|
|
||||||
inexistingConfigurations.add(String.valueOf(src_configuration.id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
target.package_json.testingSets.add(testingSet);
|
|
||||||
target.tasksCount += tests_count * configurations_count;
|
|
||||||
target.testsNames += String.join(";", testsNames) + ";";
|
|
||||||
}
|
|
||||||
//--
|
|
||||||
for (String test_id: inexistingTests){
|
|
||||||
System.out.println("Тест "+test_id+" не найден!");
|
|
||||||
}
|
|
||||||
for (String configiration_id: inexistingConfigurations){
|
|
||||||
System.out.println("Конфигурация "+configiration_id+" не найдена!");
|
|
||||||
}
|
|
||||||
return inexistingTests.isEmpty()&&inexistingConfigurations.isEmpty()||
|
|
||||||
UI.Question(
|
|
||||||
(inexistingTests.isEmpty()? "" :(inexistingTests.size()+ " тестов отсутствует;"))+
|
|
||||||
(inexistingConfigurations.isEmpty()? "" : (inexistingConfigurations.size()+ " конфигураций отсутствует;"))
|
|
||||||
+"\nПродолжить");
|
|
||||||
}
|
}
|
||||||
return false;
|
//--
|
||||||
|
Vector<Integer> src_ids = new Vector<>();
|
||||||
|
Vector<SapforPackage_json> src_jsons = new Vector<>();
|
||||||
|
for (SapforPackage src : srcPackages) {
|
||||||
|
if (src.state.equals(TasksPackageState.Draft)) {
|
||||||
|
Log.Writeln_("Пакет " + Utils.Brackets(src.id) + " является черновиком.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
src_ids.add(src.id);
|
||||||
|
}
|
||||||
|
TestingSystemPass getJsonsPass = new TestingSystemPass() {
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Получить информацию о задачах исходных пакетов";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void ServerAction() throws Exception {
|
||||||
|
Command(new ServerExchangeUnit_2021(ServerCode.GetSapforPackagesJson, null, src_ids));
|
||||||
|
src_jsons.addAll((Vector<SapforPackage_json>) response.object);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!getJsonsPass.Do())
|
||||||
|
return false;
|
||||||
|
//--
|
||||||
|
inexistingTests = new Vector<>();
|
||||||
|
inexistingConfigurations = new Vector<>();
|
||||||
|
//--
|
||||||
|
target = new SapforPackage();
|
||||||
|
target.id = Constants.Nan;
|
||||||
|
//-
|
||||||
|
target.sender_name = Current.getAccount().name;
|
||||||
|
target.sender_address = Current.getAccount().email;
|
||||||
|
//-
|
||||||
|
target.drv = Current.getServerSapfor().call_command;
|
||||||
|
target.version = Current.getServerSapfor().version;
|
||||||
|
target.kernels = Global.properties.TestingKernels;
|
||||||
|
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||||
|
//--
|
||||||
|
target.sapforId = Current.getServerSapfor().id;
|
||||||
|
//--
|
||||||
|
target.kernels = Global.properties.TestingKernels;
|
||||||
|
target.needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||||
|
//--
|
||||||
|
target.package_json = new SapforPackage_json();
|
||||||
|
///-------------------------------
|
||||||
|
target.package_json.kernels = target.kernels;
|
||||||
|
target.package_json.sapfor_drv = target.drv;
|
||||||
|
//--
|
||||||
|
//- заполнение testing_set
|
||||||
|
for (SapforPackage_json srcPackage : src_jsons) {
|
||||||
|
//--
|
||||||
|
for (SapforTestingSet_json src : srcPackage.testingSets) {
|
||||||
|
SapforTestingSet_json dst = cloneTestingSet(src);
|
||||||
|
//--
|
||||||
|
Vector<SapforTask> new_tasks = target.getActualTestingSetTasks(dst);
|
||||||
|
if (!new_tasks.isEmpty()){
|
||||||
|
target.package_json.testingSets.add(dst);
|
||||||
|
target.package_json.tasks.addAll(new_tasks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
target.tasksCount = target.package_json.tasks.size();
|
||||||
|
target.testsNames = String.join(";", target.package_json.getTestsNames());
|
||||||
|
//--
|
||||||
|
for (String test_id : inexistingTests) {
|
||||||
|
System.out.println("Тест " + test_id + " не найден!");
|
||||||
|
}
|
||||||
|
for (String configiration_id : inexistingConfigurations) {
|
||||||
|
System.out.println("Конфигурация " + configiration_id + " не найдена!");
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
return inexistingTests.isEmpty() && inexistingConfigurations.isEmpty() ||
|
||||||
|
UI.Question(
|
||||||
|
(inexistingTests.isEmpty() ? "" : (inexistingTests.size() + " тестов отсутствует;")) +
|
||||||
|
(inexistingConfigurations.isEmpty() ? "" : (inexistingConfigurations.size() + " конфигураций отсутствует;")) +
|
||||||
|
"Будет добавлено " + target.package_json.tasks.size() + " задач. Продолжить"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
// Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
|
|
||||||
// target.saveJson();
|
|
||||||
Global.testingServer.db.sapforPackages.Data.put(target.id, target);
|
Global.testingServer.db.sapforPackages.Data.put(target.id, target);
|
||||||
|
//--
|
||||||
|
Utils.CheckAndCleanDirectory(target.getLocalWorkspace());
|
||||||
|
target.saveJson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user