no message

This commit is contained in:
2024-10-07 22:04:09 +03:00
parent 7fac84740d
commit 17c0bf7eb3
103 changed files with 560 additions and 491 deletions

View File

@@ -33,7 +33,7 @@ public class MachineProcess extends DBObject {
userName = p.user_name;
userPassword = p.user_password;
userWorkspace = p.user_workspace;
testingSystemRoot = Global.Home;
testingSystemRoot = CommonUtils.Home;
serverName = Global.testingServer.name;
id = Utils.getDateName(machineAddress + "_" + machinePort + "_" + userName);
}
@@ -86,7 +86,7 @@ public class MachineProcess extends DBObject {
InetAddress localAddress = InetAddress.getByName(Global.properties.ServerAddress);
local = localAddress.getHostAddress().equals(address.getHostAddress());
} catch (Exception ex) {
Global.Log.PrintException(ex);
CommonUtils.MainLog.PrintException(ex);
}
return local;
}
@@ -96,7 +96,7 @@ public class MachineProcess extends DBObject {
File workspace = getWorkspace();
Utils.CheckAndCleanDirectory(workspace);
//копирование визуализатора
File src = new File(Global.Home, "TestingSystem.jar");
File src = new File(CommonUtils.Home, "TestingSystem.jar");
File supervisor = new File(workspace, "VisualSapfor.jar");
FileUtils.copyFile(src, supervisor);
//создание настроек

View File

@@ -1,11 +1,11 @@
package TestingSystem.Common.Test;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
import _VisualDVM.Global;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import ProjectData.Files.FileState;
import ProjectData.Files.FileType;
import ProjectData.Files.ProjectFile;
@@ -94,7 +94,7 @@ public class Test extends riDBObject {
if (testArchive.exists())
FileUtils.forceDelete(testArchive);
//--
Utils.unpackFile(project_archive_bytes, tmpArchive); // распаковка байтов.
CommonUtils.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
//--
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
if (!unzipFolderPass.Do(

View File

@@ -188,7 +188,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
//---
public TestingPlanner(){}
public TestingPlanner(String... args) {
Global.isWindows = System.getProperty("os.name").startsWith("Windows");
CommonUtils.isWindows = System.getProperty("os.name").startsWith("Windows");
//---
String machineAddress = args[0];
int machinePort = Integer.parseInt(args[1]);
@@ -197,9 +197,9 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
String userWorkspace = args[4];
String testingSystemRoot = args[5];
serverName = args[6];
supervisorHome = new File(Global.Home); //при инициализации это текущая папка.
supervisorHome = new File(CommonUtils.Home); //при инициализации это текущая папка.
//---
Global.Log = new Loggable() {
CommonUtils.MainLog = new Loggable() {
@Override
public String getLogHomePath() {
return supervisorHome.getAbsolutePath();
@@ -209,9 +209,9 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
return Current.mode.toString();
}
};
Global.Log.ClearLog();
CommonUtils.MainLog.ClearLog();
//--
Global.Home = testingSystemRoot;
CommonUtils.Home = testingSystemRoot;
Global.CheckTestingSystemDirectories();
//---
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
@@ -222,7 +222,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
Print("userName=" + CommonUtils.Brackets(userName));
Print("userPassword=" + CommonUtils.Brackets(userPassword));
Print("userWorkspace=" + CommonUtils.Brackets(userWorkspace));
Print("root=" + CommonUtils.Brackets(Global.Home));
Print("root=" + CommonUtils.Brackets(CommonUtils.Home));
Print("serverName=" + serverName);
Print("=====");
//----

View File

@@ -192,14 +192,14 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
test_id = Integer.parseInt(request.arg);
if (db.tests.containsKey(test_id)) {
test = db.tests.get(test_id);
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.packFile(test.getArchive()));
response = new ServerExchangeUnit_2021(ServerCode.OK, "", CommonUtils.fileToBytes(test.getArchive()));
} else
throw new RepositoryRefuseException("Теста с именем " + request.arg + " не существует");
break;
case ReceiveTestsDatabase:
Print("Получить базу данных тестов");
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = Utils.packFile(db.getFile());
response.object = CommonUtils.fileToBytes(db.getFile());
break;
//---
case RefreshDVMTests:
@@ -422,7 +422,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
File workspace = dvmPackage.getLocalWorkspace();
File results_zip = new File(workspace, "results.zip");
File package_json = dvmPackage.getJsonFile();
response.object = new Pair(Utils.packFile(results_zip), Utils.packFile(package_json));
response.object = new Pair(CommonUtils.fileToBytes(results_zip), CommonUtils.fileToBytes(package_json));
}
private void DownloadDVMPackages() throws Exception {
Vector<Integer> ids = (Vector<Integer>) request.object;
@@ -434,7 +434,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
File workspace = dvmPackage.getLocalWorkspace();
File results_zip = new File(workspace, "results.zip");
File package_json = dvmPackage.getJsonFile();
res.add(new Pair<>(dvmPackage_id, new Pair(Utils.packFile(results_zip), Utils.packFile(package_json))));
res.add(new Pair<>(dvmPackage_id, new Pair(CommonUtils.fileToBytes(results_zip), CommonUtils.fileToBytes(package_json))));
}
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = res;
@@ -450,7 +450,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
ZipFolderPass zipFolderPass = new ZipFolderPass();
zipFolderPass.Do(workspace.getAbsolutePath(), results_zip.getAbsolutePath());
if (results_zip.exists())
response.object = Utils.packFile(results_zip);
response.object = CommonUtils.fileToBytes(results_zip);
else
throw new RepositoryRefuseException("Не удалось заархивировать пакет тестирования SAPFOR с ключом " + sapforPackage_id);
}

View File

@@ -1,5 +1,5 @@
package TestingSystem.Common.ThreadsPlanner;
import _VisualDVM.Global;
import Common.Utils.CommonUtils;
import Common.Utils.InterruptThread;
import org.apache.commons.io.FileUtils;
@@ -12,7 +12,7 @@ public abstract class ThreadsPlanner {
try {
Interrupt();
} catch (Exception exception) {
Global.Log.PrintException(exception);
CommonUtils.MainLog.PrintException(exception);
}
System.exit(0);
return null;
@@ -51,20 +51,20 @@ public abstract class ThreadsPlanner {
}
//--
public void Start() {
Global.Log.Print("Planner started");
CommonUtils.MainLog.Print("Planner started");
try {
//--
while (!waitingThreads.isEmpty() || !activeThreads.isEmpty()) {
Global.Log.Print(getThreadsSummary());
CommonUtils.MainLog.Print(getThreadsSummary());
checkActiveThreads();
tryStartThreads();
Thread.sleep(wait_ms);
}
//--
} catch (Exception exception) {
Global.Log.PrintException(exception);
CommonUtils.MainLog.PrintException(exception);
} finally {
Global.Log.Print("Planner finished");
CommonUtils.MainLog.Print("Planner finished");
finalize();
}
}
@@ -84,7 +84,7 @@ public abstract class ThreadsPlanner {
activeThreads.removeAll(toExclude);
//--
double progress = ((double)done_threads/threads.size())*100.0;
Global.Log.Print("done_threads="+done_threads+";all_threads="+threads.size()+";progress="+progress);
CommonUtils.MainLog.Print("done_threads="+done_threads+";all_threads="+threads.size()+";progress="+progress);
File progress_file = new File("progress");
try {
FileUtils.writeStringToFile(progress_file, String.valueOf(((int)progress)));