сообщение R204
This commit is contained in:
2024-04-13 20:09:26 +03:00
parent 97a26f7a0e
commit 5d09ae430c
12 changed files with 172 additions and 87 deletions

View File

@@ -35,22 +35,6 @@ import java.io.File;
import java.nio.file.Paths;
import java.util.*;
public class TestingServer extends RepositoryServer<TestsDatabase> {
/*
@Override
protected void beforePublishAction(DBObject object) throws Exception {
if (object instanceof Group) {
Group group = (Group) object;
if (db.groups.containsGroupWithDescription(group.description))
throw new RepositoryRefuseException("Уже существует группа с описанием " +
Utils.Brackets(group.description.toLowerCase()));
} else if (object instanceof Test) {
Test test = (Test) object;
if (db.tests.containsTestWithDescription(test.description))
throw new RepositoryRefuseException("Уже существует тест с описанием " +
Utils.Brackets(test.description.toLowerCase()));
}
}
*/
@Override
public void afterPublishAction(DBObject object) throws Exception {
if (object instanceof Test) {
@@ -141,12 +125,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}
});
//------>>>
//------>>>
public static Timer checkTimer = null;
public static void TimerOn() {
System.out.println("timer on");
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
// Pass_2021.passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
});
checkTimer.start();
@@ -165,23 +147,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Test test;
int test_id;
switch (code) {
case EmailSapforAssembly:
/*
Print("Сообщить о сборке SAPFOR для пользователя " + request.arg);
Vector<String> assembly_info = (Vector<String>) request.object;
File out = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.out_file).toFile();
File err = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.err_file).toFile();
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
EmailMessage message = new EmailMessage(
"Выполнена сборка системы SAPFOR",
"Версия: " + assembly_info.get(0) + "\n" + "Статус: " + assembly_info.get(1),
targets
);
Email(message, out, err);
response = new ServerExchangeUnit_2021(ServerCode.OK);
*/
break;
//------------------------------------------->>
case DownloadTest:
Print("Отправить клиенту тест " + request.arg);
test_id = Integer.parseInt(request.arg);
@@ -258,11 +223,14 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Print("Получить первые активные пакеты задач DVM на машинах");
GetFirstActiveDVMPackagesByMachines();
break;
case GetFirstActiveDVMPackageForMachineURL:
Print("Получить первый активный пакет задач DVM на машине с адресом");
GetFirstActiveDVMPackageForMachineURL();
break;
default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
}
}
//->>
Pair<Group, Vector<File>> ConvertDirectoryToGroup(File src, LanguageName languageName, TestType
testType, Account account) throws Exception {
@@ -343,6 +311,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = db.getFirstActiveDVMPackagesCopies();
}
private void GetFirstActiveDVMPackageForMachineURL() {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = db.getFirstActiveDVMPackagesCopiesForMachineURL(request.arg);
}
private void GetFirstActiveSapforPackages() throws Exception {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = db.getFirstActiveSapforPackagesCopies();