no message

This commit is contained in:
2024-10-11 00:00:30 +03:00
parent a11b7711f7
commit f317ab1aa1
341 changed files with 1866 additions and 1688 deletions

View File

@@ -1,6 +1,6 @@
package _VisualDVM.TestingSystem.DVM;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Machine.Machine;
@@ -56,35 +56,35 @@ public class UserConnection {
try {
in.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (out != null) {
try {
out.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (pin != null) {
try {
pin.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (pout != null) {
try {
pout.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (fromServer != null) {
try {
fromServer.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (sftpChannel != null) sftpChannel.disconnect();
@@ -119,7 +119,7 @@ public class UserConnection {
if ((maxSize == 0) || getFileKBSize(src.full_name) <= maxSize) {
getSingleFile(src.full_name, dst.getAbsolutePath());
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils_.Brackets(src.full_name));
}
}
public void putSingleFile(File src, RemoteFile dst) throws Exception {
@@ -132,8 +132,8 @@ public class UserConnection {
//-
public void RMDIR(String dir) throws Exception {
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
Command("rm -rf " + CommonUtils.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + CommonUtils.DQuotes(dir));
Command("rm -rf " + Utils_.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + Utils_.DQuotes(dir));
}
//-
public void SynchronizeSubDirsR(File local_dir, RemoteFile remote_dir) throws Exception {
@@ -240,9 +240,9 @@ public class UserConnection {
sftpChannel.rm(file.full_name);
}
//--
writeToFile("cd " + CommonUtils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
writeToFile("cd " + Utils_.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
//--
Command(CommonUtils.DQuotes(script_file.full_name) + " 1>" + CommonUtils.DQuotes(out.full_name) + " 2>" + CommonUtils.DQuotes(err.full_name));
Command(Utils_.DQuotes(script_file.full_name) + " 1>" + Utils_.DQuotes(out.full_name) + " 2>" + Utils_.DQuotes(err.full_name));
return new Pair<>(out, err);
}
public void putResource(RemoteFile dstDirectory, String resource_name) throws Exception {
@@ -252,7 +252,7 @@ public class UserConnection {
}
boolean compileModule(RemoteFile modulesDirectory, String module_name) throws Exception {
String flags = module_name.equals("planner") ? getAvailibleCPPStandard(modulesDirectory) : "";
String command = "g++ -O3 " + flags + " " + CommonUtils.DQuotes(module_name + ".cpp") + " -o " + CommonUtils.DQuotes(module_name);
String command = "g++ -O3 " + flags + " " + Utils_.DQuotes(module_name + ".cpp") + " -o " + Utils_.DQuotes(module_name);
RemoteFile binary = new RemoteFile(modulesDirectory, module_name);
//--
if (Exists(binary))
@@ -322,7 +322,7 @@ public class UserConnection {
getSingleFile(src.full_name, dst.getAbsolutePath());
return true;
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils_.Brackets(src.full_name));
}
}
return false;
@@ -399,7 +399,7 @@ public class UserConnection {
BufferedReader in = new BufferedReader(new InputStreamReader(execChannel.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(CommonUtils.Brackets(line));
System.out.println(Utils_.Brackets(line));
}
}
execChannel.disconnect();
@@ -437,35 +437,35 @@ public class UserConnection {
try {
in.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (out != null) {
try {
out.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (pin != null) {
try {
pin.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (pout != null) {
try {
pout.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (fromServer != null) {
try {
fromServer.close();
} catch (Exception exception) {
CommonUtils.MainLog.PrintException(exception);
Utils_.MainLog.PrintException(exception);
}
}
if (shellChannel != null) shellChannel.disconnect();
@@ -481,21 +481,21 @@ public class UserConnection {
public void waitForFileCreation(RemoteFile file) throws Exception {
while (!Exists(file)) {
System.out.println(file.full_name + " NOT FOUND");
CommonUtils.sleep(1000);
Utils_.sleep(1000);
}
}
public void waitForFileFree(RemoteFile file) throws Exception {
while (!Busy(file)) {
System.out.println(file.full_name + " PERMISSION DENIED");
CommonUtils.sleep(1000);
Utils_.sleep(1000);
}
}
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
commands_.add("cd " + CommonUtils.DQuotes(directory.full_name));
commands_.add("cd " + Utils_.DQuotes(directory.full_name));
for (int i = 0; i < commands.length; ++i) {
if (i == commands.length - 1) {
commands_.add(commands[i] + " 1>" + CommonUtils.DQuotes(outFileName));
commands_.add(commands[i] + " 1>" + Utils_.DQuotes(outFileName));
} else {
commands_.add(commands[i]);
}
@@ -504,7 +504,7 @@ public class UserConnection {
if (Exists(script_file))
sftpChannel.rm(script_file.full_name);
writeToFile(String.join("\n", commands_), script_file);
String start_command = CommonUtils.DQuotes(script_file.full_name);
String start_command = Utils_.DQuotes(script_file.full_name);
//--
RemoteFile outFile = new RemoteFile(directory, outFileName);
if (Exists(outFile))