ночные изменения,+ исправление бага с иконкой сравнения

This commit is contained in:
2024-04-09 15:23:35 +03:00
parent 4e503d3b9b
commit 3d70efe253
11 changed files with 180 additions and 44 deletions

16
.idea/workspace.xml generated
View File

@@ -7,13 +7,17 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/icons/versions/MatchHasErrors.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/icons/versions/NotMatchHasErrors.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TasksPackageState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TasksPackageState.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Common/Utils/Validators/ShellParser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Validators/ShellParser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/RemoteCompilationSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/RemoteCompilationSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/ServerRunSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/ServerRunSupervisor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestsDatabase.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingPlanner.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/UserConnection.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/SapforPackageTreeNode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/SapforPackageTreeNode.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -91,7 +95,7 @@
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.SHOW" value="true" /> <property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.SHOW" value="true" />
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.WIDTH" value="509" /> <property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.WIDTH" value="509" />
<property name="extract.method.default.visibility" value="public" /> <property name="extract.method.default.visibility" value="public" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/icons" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/src/icons/versions" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
@@ -104,8 +108,8 @@
<recent name="controls.Trees" /> <recent name="controls.Trees" />
</key> </key>
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons" />
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\versions" /> <recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\versions" />
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons" />
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\Transformations" /> <recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\Transformations" />
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" /> <recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" /> <recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />

View File

@@ -35,7 +35,7 @@
"PerformanceAnalyzerPath": "", "PerformanceAnalyzerPath": "",
"ComponentsBackUpsCount": 10, "ComponentsBackUpsCount": 10,
"TestingKernels": 16, "TestingKernels": 16,
"AutoCheckTesting": true, "AutoCheckTesting": false,
"CheckTestingIntervalSeconds": 10, "CheckTestingIntervalSeconds": 10,
"EmailOnTestingProgress": false, "EmailOnTestingProgress": false,
"eraseTestingWorkspaces": true "eraseTestingWorkspaces": true

View File

@@ -218,7 +218,8 @@ public class ShellParser {
} }
} while (!state.equals(ShellParserState.End)); } while (!state.equals(ShellParserState.End));
} }
public static void ReadLine(InputStreamReader fromServer) { public static String ReadLine(InputStreamReader fromServer) {
StringBuilder res = new StringBuilder();
state = ShellParserState.NewLine; state = ShellParserState.NewLine;
do { do {
try { try {
@@ -229,7 +230,11 @@ public class ShellParser {
case '\r': case '\r':
break; break;
case '\n': case '\n':
return; state = ShellParserState.End;
break;
default:
res.append(c);
break;
} }
} else } else
state = ShellParserState.End; state = ShellParserState.End;
@@ -238,6 +243,31 @@ public class ShellParser {
state = ShellParserState.End; state = ShellParserState.End;
} }
} while (!state.equals(ShellParserState.End)); } while (!state.equals(ShellParserState.End));
return res.toString();
}
public static void ReadCommand(String command, InputStreamReader fromServer){
StringBuilder res = new StringBuilder();
do {
try {
if (fromServer.read(buffer) >= 0) {
c = buffer[0];
printChar();
switch (c) {
case '\r':
break;
case '\n':
break;
default:
res.append(c);
break;
}
} else
return;
} catch (Exception ex) {
Global.Log.PrintException(ex);
return;
}
} while (!res.toString().contains(command));
} }
public static String getCommandResult(InputStreamReader fromServer) { public static String getCommandResult(InputStreamReader fromServer) {
//если последняя строка ответа - кончается на приглашение, то ничего не делаем. //если последняя строка ответа - кончается на приглашение, то ничего не делаем.

View File

@@ -30,13 +30,7 @@ public class RemoteCompilationSupervisor extends RemoteTaskSupervisor<Compilatio
} }
@Override @Override
protected void StartTask() throws Exception { protected void StartTask() throws Exception {
pass.user.connection.performScriptNoWait(getRemoteProject(), getStartCommand()+" 1>PID"); task.PID = pass.user.connection.startProcess(getRemoteProject(), getStartCommand());
RemoteFile PID = getPID();
while (!pass.user.connection.Exists(PID)){
System.out.println("PID NOT FOUND");
Utils.sleep(1000);
}
task.PID = pass.user.connection.readFromFile(PID).replace("\n","").replace("\r","");
System.out.println("PID="+Utils.Brackets(task.PID)); System.out.println("PID="+Utils.Brackets(task.PID));
task.state = TaskState.Running; task.state = TaskState.Running;
} }

View File

@@ -16,13 +16,9 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
String res = "./run"; String res = "./run";
String env = String.join(" ", Current.getRunConfiguration().getEnvList()); String env = String.join(" ", Current.getRunConfiguration().getEnvList());
if (!env.isEmpty()) res = env + " " + res; if (!env.isEmpty()) res = env + " " + res;
pass.user.connection.performScriptNoWait(getRemoteProject(), "ulimit -s unlimited", res+" 1>PID"); //--
RemoteFile PID = getPID(); task.PID = pass.user.connection.startProcess(getRemoteProject(),
while (!pass.user.connection.Exists(PID)){ "ulimit -s unlimited", res);
System.out.println("PID NOT FOUND");
Utils.sleep(1000);
}
task.PID = pass.user.connection.readFromFile(PID).replace("\n","").replace("\r","");
System.out.println("PID="+Utils.Brackets(task.PID)); System.out.println("PID="+Utils.Brackets(task.PID));
task.state = TaskState.Running; task.state = TaskState.Running;
} }

View File

@@ -62,7 +62,7 @@ public class Visualiser extends Component {
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html //http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
@Override @Override
public void GetVersionInfo() { public void GetVersionInfo() {
version = 1092; version = 1093;
String pattern = "MMM dd yyyy HH:mm:ss"; String pattern = "MMM dd yyyy HH:mm:ss";
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH); DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
date_text = df.format(getClassBuildTime()); date_text = df.format(getClassBuildTime());

View File

@@ -181,7 +181,29 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
} }
@Override @Override
protected void PackageStart() throws Exception { protected void PackageStart() throws Exception {
String plannerStartCommand = String.join(" ", "nohup", Utils.DQuotes(getPlanner()), Utils.DQuotes(user.workspace), Utils.DQuotes(packageRemoteWorkspace.full_name), Utils.DQuotes(testingPackage.kernels), Utils.DQuotes(testingPackage.drv), "&"); String plannerStartCommand = String.join(" ",
Utils.DQuotes(getPlanner()),
Utils.DQuotes(user.workspace),
Utils.DQuotes(packageRemoteWorkspace.full_name),
Utils.DQuotes(testingPackage.kernels),
Utils.DQuotes(testingPackage.drv));
testingPackage.PID = user.connection.startProcess(packageRemoteWorkspace,
"ulimit -s unlimited", plannerStartCommand);
System.out.println("PID="+Utils.Brackets(testingPackage.PID));
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
while (!user.connection.Exists(STARTED)) {
Print("waiting for package start...");
Utils.sleep(1000);
}
/*
String plannerStartCommand = String.join(" ", "nohup",
Utils.DQuotes(getPlanner()),
Utils.DQuotes(user.workspace),
Utils.DQuotes(packageRemoteWorkspace.full_name),
Utils.DQuotes(testingPackage.kernels),
Utils.DQuotes(testingPackage.drv), "&");
user.connection.CommandNoWait("ulimit -s unlimited",plannerStartCommand); user.connection.CommandNoWait("ulimit -s unlimited",plannerStartCommand);
RemoteFile PID = new RemoteFile(packageRemoteWorkspace, "PID"); RemoteFile PID = new RemoteFile(packageRemoteWorkspace, "PID");
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED"); RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
@@ -192,6 +214,7 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
if (user.connection.Exists(PID)) { if (user.connection.Exists(PID)) {
testingPackage.PID = user.connection.readFromFile(PID); testingPackage.PID = user.connection.readFromFile(PID);
} }
*/
} }
@Override @Override
protected boolean CheckNextState() throws Exception { protected boolean CheckNextState() throws Exception {

View File

@@ -2,6 +2,7 @@ package TestingSystem.DVM;
import Common.Constants; import Common.Constants;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import Common.Utils.Validators.ShellParser;
import GlobalData.Machine.Machine; import GlobalData.Machine.Machine;
import GlobalData.RemoteFile.RemoteFile; import GlobalData.RemoteFile.RemoteFile;
import GlobalData.User.User; import GlobalData.User.User;
@@ -42,20 +43,6 @@ public class UserConnection {
sftpChannel.connect(); sftpChannel.connect();
//--> //-->
//создать канал для команд //создать канал для команд
shellChannel = (ChannelShell) session.openChannel("shell");
in = new PipedInputStream();
out = new PipedOutputStream();
/*
shellChannel.setInputStream(in);
shellChannel.setOutputStream(out);
pin = new PipedOutputStream(in);
pout = new PipedInputStream(out);
shellChannel.connect();
//-
fromServer = new InputStreamReader(pout);
ShellParser.setUserName(user.login);
ShellParser.ReadInvitation(fromServer); //прочитать первое приглашение от машины.
*/
} }
public void Disconnect() { public void Disconnect() {
if (in != null) { if (in != null) {
@@ -103,7 +90,6 @@ public class UserConnection {
sftpChannel = null; sftpChannel = null;
shellChannel = null; shellChannel = null;
execChannel = null; execChannel = null;
jsch = null;
session = null; session = null;
//--- //---
in = null; in = null;
@@ -112,6 +98,7 @@ public class UserConnection {
pin = null; pin = null;
pout = null; pout = null;
fromServer = null; fromServer = null;
jsch = null;
System.gc(); System.gc();
} }
//-- //--
@@ -393,8 +380,6 @@ public class UserConnection {
public void Command(String... commands) throws Exception { public void Command(String... commands) throws Exception {
if (commands.length > 0) { if (commands.length > 0) {
String command = String.join("\n", commands); String command = String.join("\n", commands);
// UI.Print(DebugPrintLevel.Session, command);
// UI.Print(DebugPrintLevel.Session, "Creating Exec Channel.");
execChannel = (ChannelExec) session.openChannel("exec"); execChannel = (ChannelExec) session.openChannel("exec");
execChannel.setErrStream(System.err); execChannel.setErrStream(System.err);
execChannel.setCommand(command); execChannel.setCommand(command);
@@ -425,4 +410,102 @@ public class UserConnection {
writeToFile("cd " + Utils.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);
CommandNoWait(Utils.DQuotes(script_file.full_name)); CommandNoWait(Utils.DQuotes(script_file.full_name));
} }
//-----
public void ShellConnect() throws Exception {
shellChannel = (ChannelShell) session.openChannel("shell");
in = new PipedInputStream();
out = new PipedOutputStream();
//--
shellChannel.setInputStream(in);
shellChannel.setOutputStream(out);
pin = new PipedOutputStream(in);
pout = new PipedInputStream(out);
shellChannel.connect();
//-
fromServer = new InputStreamReader(pout);
/*
ShellParser.setUserName(user.login);
ShellParser.ReadInvitation(fromServer); //прочитать первое приглашение от машины.
*/
}
public void ShellDisconnect() throws Exception {
if (in != null) {
try {
in.close();
} catch (Exception exception) {
Global.Log.PrintException(exception);
}
}
if (out != null) {
try {
out.close();
} catch (Exception exception) {
Global.Log.PrintException(exception);
}
}
if (pin != null) {
try {
pin.close();
} catch (Exception exception) {
Global.Log.PrintException(exception);
}
}
if (pout != null) {
try {
pout.close();
} catch (Exception exception) {
Global.Log.PrintException(exception);
}
}
if (fromServer != null) {
try {
fromServer.close();
} catch (Exception exception) {
Global.Log.PrintException(exception);
}
}
if (shellChannel != null) shellChannel.disconnect();
//--
in = null;
out = null;
pin = null;
pout = null;
fromServer = null;
shellChannel = null;
System.gc();
}
public void ShellCommandNoWait(String command) throws Exception {
ShellConnect();
pin.write(("nohup " + command + " &\r\n").getBytes());
ShellParser.ReadCommand(command, fromServer); //команда
System.out.println("+++++++++++++++++");
ShellParser.ReadCommand(command, fromServer); //эхо
ShellDisconnect();
}
public String startProcess(RemoteFile directory, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
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>PID");
} else {
commands_.add(commands[i]);
}
}
RemoteFile script_file = new RemoteFile(directory, Constants.script);
if (Exists(script_file))
sftpChannel.rm(script_file.full_name);
writeToFile(String.join("\n", commands_), script_file);
String start_command = Utils.DQuotes(script_file.full_name);
//--
RemoteFile PID = new RemoteFile(directory, "PID");
ShellConnect();
pin.write(("nohup " + start_command + " &\r\n").getBytes());
while (!Exists(PID)){
System.out.println("PID NOT FOUND");
Utils.sleep(1000);
}
ShellDisconnect();
return readFromFile(PID).replace("\n","").replace("\r","");
}
} }

View File

@@ -1,10 +1,16 @@
package TestingSystem.SAPFOR.SapforTasksPackage.UI; package TestingSystem.SAPFOR.SapforTasksPackage.UI;
import Common.Global;
import Common.UI.UI;
import javax.swing.*; import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Objects;
public abstract class SapforPackageTreeNode extends DefaultMutableTreeNode { public abstract class SapforPackageTreeNode extends DefaultMutableTreeNode {
public ImageIcon getIcon() { public ImageIcon getIcon() {
ImageIcon res = new ImageIcon(Objects.requireNonNull(getClass().getResource("/icons/versions/" + getImageKey() + ".png"))); ImageIcon res = new ImageIcon((getClass().getResource("/icons/versions/" + getImageKey() + ".png")));
if (res==null) {
Global.Log.Print("/icons/versions/" + getImageKey() + ".png=NULL");
// res= new ImageIcon((getClass().getResource("/icons/versions/Version.png")));
}
return (getImageKey() != null) ? res : null; return (getImageKey() != null) ? res : null;
} }
public abstract String getImageKey(); public abstract String getImageKey();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB