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

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;
}
}