no message
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user