no message

This commit is contained in:
2023-12-18 00:04:44 +03:00
parent 86c6c4700e
commit ed2222c163
8 changed files with 92 additions and 16 deletions

View File

@@ -46,6 +46,9 @@ public abstract class TestingPackage<J> extends riDBObject {
public File getLocalWorkspace() {
return new File(getHomeDirectory(), String.valueOf(id));
}
public boolean isLoaded() {
return new File(getLocalWorkspace(), Constants.LOADED).exists();
}
//------------------------
@Description("IGNORED")
public J package_json = null;

View File

@@ -223,6 +223,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Print("Загрузить пакеты DVM");
DownloadDVMPackages();
break;
case DownloadSapforPackage:
Print("Загрузить пакет SAPFOR");
DownloadSapforPackage();
break;
default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
}
@@ -452,4 +456,18 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = res;
}
private void DownloadSapforPackage() throws Exception {
int sapforPackage_id = (int) request.object;
if (!db.sapforPackages.containsKey(sapforPackage_id))
throw new RepositoryRefuseException("Не найдено пакета тестирования SAPFOR с ключом " + sapforPackage_id);
response = new ServerExchangeUnit_2021(ServerCode.OK);
SapforPackage sapforPackage = db.sapforPackages.get(sapforPackage_id);
File workspace = sapforPackage.getLocalWorkspace();
File results_zip = Utils.getTempFileName("results");
ZipFolderPass zipFolderPass = new ZipFolderPass();
zipFolderPass.Do(workspace.getAbsolutePath(), results_zip.getAbsolutePath());
if (results_zip.exists())
response.object = Utils.packFile(results_zip);
else throw new RepositoryRefuseException("Не удалось заархивировать пакет тестирования SAPFOR с ключом "+ sapforPackage_id);
}
}

View File

@@ -39,7 +39,4 @@ public class SapforPackage extends TestingPackage<SapforTasksPackage_json> {
public File getHomeDirectory() {
return Global.SapforPackagesDirectory;
}
public boolean isLoaded() {
return false;
}
}