no message
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package _VisualDVM.TestingSystem.Common;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.Passes.All.DownloadRepository;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
@@ -31,9 +33,7 @@ import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsComma
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforTestingPlanner;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
|
||||
import _VisualDVM.Passes.All.DownloadRepository;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -45,8 +45,39 @@ import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
public String name = "?";
|
||||
public static MachineProcessSet machinesProcesses = new MachineProcessSet();
|
||||
//------>>>
|
||||
public static Timer checkTimer = null;
|
||||
public String name = "?";
|
||||
DVMTestingChecker dvmTestingChecker = new DVMTestingChecker();
|
||||
SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||
//--
|
||||
protected Thread testingThread = new Thread(() -> {
|
||||
while (true) {
|
||||
dvmTestingChecker.Perform();
|
||||
sapforTestingPlanner.Perform();
|
||||
Utils_.sleep(5000);
|
||||
}
|
||||
});
|
||||
public TestingServer() {
|
||||
super(TestsDatabase.class);
|
||||
name = Utils_.getDateName("testingServer");
|
||||
System.out.println("ServerName=" + Utils_.Brackets(name));
|
||||
}
|
||||
public static void TimerOn() {
|
||||
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
|
||||
Global.mainModule.getPass(PassCode.ActualizePackages).Do();
|
||||
});
|
||||
checkTimer.start();
|
||||
}
|
||||
public static void TimerOff() {
|
||||
if (checkTimer != null)
|
||||
checkTimer.stop();
|
||||
}
|
||||
public static void ResetTimer() {
|
||||
TimerOff();
|
||||
TimerOn();
|
||||
}
|
||||
@Override
|
||||
public void afterPublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
@@ -94,7 +125,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
((ServerSapfor) object).home_path
|
||||
)
|
||||
);
|
||||
} else if (object instanceof DVMPackage) {
|
||||
} else if (object instanceof DVMPackage) {
|
||||
DVMPackage dvmPackage = (DVMPackage) object;
|
||||
File workspace = dvmPackage.getLocalWorkspace();
|
||||
Utils_.forceDeleteWithCheck(workspace);
|
||||
@@ -106,7 +137,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
SapforSettings sapforSettings = (SapforSettings) object;
|
||||
Vector<SapforSettingsCommand> commands = new Vector<>();
|
||||
for (SapforSettingsCommand command : db.sapforSettingsCommands.Data.values()) {
|
||||
if (command.sapforsettings_id== sapforSettings.id)
|
||||
if (command.sapforsettings_id == sapforSettings.id)
|
||||
commands.add(command);
|
||||
}
|
||||
for (SapforSettingsCommand command : commands) {
|
||||
@@ -124,11 +155,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
throw new RepositoryRefuseException("Актуальная версия SAPFOR " + max_installed_version + " уже установлена");
|
||||
}
|
||||
}
|
||||
public TestingServer() {
|
||||
super(TestsDatabase.class);
|
||||
name = Utils_.getDateName("testingServer");
|
||||
System.out.println("ServerName=" + Utils_.Brackets(name));
|
||||
}
|
||||
//основа
|
||||
@Override
|
||||
public int getPort() {
|
||||
@@ -139,32 +165,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
protected void startAdditionalThreads() {
|
||||
testingThread.start();
|
||||
}
|
||||
DVMTestingChecker dvmTestingChecker = new DVMTestingChecker();
|
||||
SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||
//--
|
||||
protected Thread testingThread = new Thread(() -> {
|
||||
while (true) {
|
||||
dvmTestingChecker.Perform();
|
||||
sapforTestingPlanner.Perform();
|
||||
Utils_.sleep(5000);
|
||||
}
|
||||
});
|
||||
//------>>>
|
||||
public static Timer checkTimer = null;
|
||||
public static void TimerOn() {
|
||||
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
|
||||
Global.mainModule.getPass(PassCode.ActualizePackages).Do();
|
||||
});
|
||||
checkTimer.start();
|
||||
}
|
||||
public static void TimerOff() {
|
||||
if (checkTimer != null)
|
||||
checkTimer.stop();
|
||||
}
|
||||
public static void ResetTimer() {
|
||||
TimerOff();
|
||||
TimerOn();
|
||||
}
|
||||
@Override
|
||||
protected void Session() throws Exception {
|
||||
Test test;
|
||||
@@ -178,7 +178,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
EmailMessage message = Log.isEmpty() ?
|
||||
new EmailMessage(
|
||||
"Запущено автоматическое тестирование версии " + request.arg + " системы SAPFOR",
|
||||
"Пакет "+ Utils_.Brackets(autoPackage.id), new Vector<>()) :
|
||||
"Пакет " + Utils_.Brackets(autoPackage.id), new Vector<>()) :
|
||||
new EmailMessage(
|
||||
"Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR",
|
||||
Log.toString(),
|
||||
@@ -296,7 +296,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
&& !pathname.getName().equals("settings")
|
||||
&& !pathname.getName().equals("test-analyzer.sh")
|
||||
&& Utils_.getExtension(pathname).startsWith(languageName.getDVMCompile()));
|
||||
;
|
||||
if (files != null) {
|
||||
groupFiles = new Vector<>(Arrays.asList(files));
|
||||
groupFiles.sort(Comparator.comparing(File::getName));
|
||||
@@ -488,7 +487,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
File json = dvmPackage.getJsonFile();
|
||||
if (!json.exists())
|
||||
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач DVM " + Utils_.Brackets(package_id));
|
||||
jsons.add((DVMPackage_json) Utils_.jsonFromFile(json, DVMPackage_json.class));
|
||||
jsons.add(Utils_.jsonFromFile(json, DVMPackage_json.class));
|
||||
}
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = jsons;
|
||||
@@ -503,7 +502,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
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));
|
||||
jsons.add(Utils_.jsonFromFile(json, SapforPackage_json.class));
|
||||
}
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = jsons;
|
||||
@@ -614,8 +613,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
account.email = Constants.MailAddress;
|
||||
//-
|
||||
int sapforId = Integer.parseInt(request.arg);
|
||||
System.out.println("Sapfor_id = "+request.arg);
|
||||
|
||||
System.out.println("Sapfor_id = " + request.arg);
|
||||
if (!db.serverSapfors.containsKey(sapforId)) {
|
||||
Log.Writeln_("Версия SAPFOR " + sapforId + " не существует.");
|
||||
return null;
|
||||
@@ -646,6 +644,5 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
//--
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user