создание пакета из нескольких старых

This commit is contained in:
2024-03-08 01:17:54 +03:00
parent e7c8810291
commit b792cf80b8
6 changed files with 194 additions and 144 deletions

View File

@@ -17,6 +17,7 @@ import TestingSystem.Common.Test.TestType;
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
import TestingSystem.DVM.DVMPackage.DVMPackage;
import TestingSystem.DVM.DVMTestingPlanner;
import TestingSystem.SAPFOR.Json.SapforPackage_json;
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
@@ -249,6 +250,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Print("Заменить код тестов");
ReplaceTestsCodes();
break;
case GetSapforPackagesJson:
Print("Получить информацию о задачах пакетов SAPFOR");
GetSapforPackagesJson();
break;
default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
}
@@ -623,5 +628,20 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
//-
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;
}
}

View File

@@ -5,10 +5,12 @@ import Common.Global;
import Common.Utils.Utils;
import TestingSystem.Common.TestingPackage.TestingPackage;
import TestingSystem.SAPFOR.Json.SapforPackage_json;
import TestingSystem.SAPFOR.Json.SapforTestingSet_json;
import TestingSystem.SAPFOR.SapforTask.SapforTask;
import com.sun.org.glassfish.gmbal.Description;
import java.io.File;
import java.util.Vector;
public class SapforPackage extends TestingPackage<SapforPackage_json> {
@Description("DEFAULT ''")
public String testsNames = "";//имена тестов через ; для отображения
@@ -42,4 +44,19 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
saveJson();
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;
}
}