реализация остановки сервера тестирования по кнопке
This commit is contained in:
@@ -8,6 +8,8 @@ import java.util.regex.Pattern;
|
||||
public class Constants {
|
||||
public static final int Nan = -1;
|
||||
public static final int planner_version = 2;
|
||||
//--
|
||||
public static final String testingSystemHomeName = "_testing_system";
|
||||
//SVN
|
||||
public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive";
|
||||
public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm";
|
||||
|
||||
@@ -50,6 +50,16 @@ public class GlobalProperties extends Properties {
|
||||
@Expose
|
||||
public int MailSocketPort = 465;
|
||||
//---
|
||||
//СВОРАЧИВАНИЕ ОБЛАСТЕЙ----------------------
|
||||
@Expose
|
||||
public boolean collapseCredentials = false;
|
||||
@Expose
|
||||
public boolean collapseFileGraphs = false;
|
||||
@Expose
|
||||
public boolean collapseFileMessages = false;
|
||||
@Expose
|
||||
public boolean collapseProjectTrees = false;
|
||||
//-------------------------------------------
|
||||
@Expose
|
||||
public String BackupWorkspace = "_sapfor_x64_backups";
|
||||
@Expose
|
||||
@@ -103,13 +113,7 @@ public class GlobalProperties extends Properties {
|
||||
@Expose
|
||||
public boolean EmailOnTestingProgress = false; //включено ли оповещение по email о результатах тестирования.
|
||||
@Expose
|
||||
public boolean collapseCredentials = false;
|
||||
@Expose
|
||||
public boolean collapseFileGraphs = false;
|
||||
@Expose
|
||||
public boolean collapseFileMessages = false;
|
||||
@Expose
|
||||
public boolean collapseProjectTrees = false;
|
||||
public boolean eraseTestingWorkspaces = true; //удалять ли рабочее пространство пакетов тестирования после его завершения.
|
||||
//-
|
||||
@Override
|
||||
public File getFile() {
|
||||
|
||||
@@ -12,37 +12,11 @@ import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class TestingBar extends VisualiserMenuBar {
|
||||
// public MenuBarButton MachineButton;
|
||||
// public MenuBarButton UserButton;
|
||||
public JLabel KernelsLabel;
|
||||
|
||||
public JButton autorefreshButton;
|
||||
JSpinner sCheckTime;
|
||||
JSpinner sKernels;
|
||||
public TestingBar() {
|
||||
/*
|
||||
add(MachineButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/icons/Machine.png");
|
||||
setFont(VisualiserFonts.TreePlain);
|
||||
setToolTipText("Машина тестирования");
|
||||
addActionListener(e -> {
|
||||
UI.getMainWindow().FocusCredentials();
|
||||
});
|
||||
}
|
||||
});
|
||||
//--
|
||||
add(UserButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/icons/User.png");
|
||||
setFont(VisualiserFonts.TreePlain);
|
||||
setToolTipText("Учетная запись машины тестирования");
|
||||
addActionListener(e -> {
|
||||
UI.getMainWindow().FocusCredentials();
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
//-
|
||||
KernelsLabel = addLabel("", "/icons/Kernels.png");
|
||||
KernelsLabel.setHorizontalTextPosition(JLabel.LEFT);
|
||||
@@ -57,8 +31,6 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
UI.MakeSpinnerRapid(sKernels, e -> {
|
||||
Global.properties.updateField("TestingKernels", sKernels.getValue());
|
||||
});
|
||||
|
||||
|
||||
addLabel(" ");
|
||||
//--
|
||||
add(new MenuBarButton() {
|
||||
@@ -112,6 +84,8 @@ public class TestingBar extends VisualiserMenuBar {
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
}
|
||||
});
|
||||
addSeparator();
|
||||
addPasses(PassCode_2021.StopTestingServer);
|
||||
}
|
||||
public void ShowAutoCheckTesting() {
|
||||
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
|
||||
@@ -242,11 +242,9 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
|
||||
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
|
||||
unzipFolderPass.Do(results_archive.getAbsolutePath(), packageLocalWorkspace.getAbsolutePath(), false);
|
||||
}
|
||||
//todo привязать это к настройкам, чтобы можно было включать/выключать удаление.
|
||||
//получили результат. теперь уничтожаем папку пакета на целевой машине.
|
||||
if (user.connection.Exists(packageRemoteWorkspace)) {
|
||||
//---
|
||||
if (Global.properties.eraseTestingWorkspaces && user.connection.Exists(packageRemoteWorkspace))
|
||||
user.connection.RMDIR(packageRemoteWorkspace.full_name);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void AnalyseResults() throws Exception {
|
||||
|
||||
52
src/Visual_DVM_2021/Passes/All/StopTestingServer.java
Normal file
52
src/Visual_DVM_2021/Passes/All/StopTestingServer.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import Visual_DVM_2021.Passes.SSH.TestingServerSSHPass;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class StopTestingServer extends TestingServerSSHPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Stop25.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
RemoteFile Home = new RemoteFile(user.connection.sftpChannel.getHome(), true);
|
||||
RemoteFile Workspace = new RemoteFile(Home, Constants.testingSystemHomeName);
|
||||
//--
|
||||
RemoteFile INTERRUPT = new RemoteFile(Workspace, Constants.INTERRUPT);
|
||||
RemoteFile ABORTED = new RemoteFile(Workspace, Constants.ABORTED);
|
||||
|
||||
//--
|
||||
System.out.println("Home="+Utils.Brackets(Home.full_name));
|
||||
System.out.println("Workspace="+Utils.Brackets(Workspace.full_name));
|
||||
|
||||
ShowMessage1("Создание файла INTERRUPT..");
|
||||
user.connection.writeToFile("+", INTERRUPT);
|
||||
ShowMessage1("Ожидание остановки сервера тестирования");
|
||||
do {
|
||||
Utils.sleep(1000);
|
||||
ShowMessage2("Проверка признака остановки..");
|
||||
} while (!user.connection.Exists(ABORTED));
|
||||
//--
|
||||
RemoteFile AbortLog = new RemoteFile(Workspace, Constants.ABORTED+
|
||||
"_by_"+
|
||||
Current.getAccount().email+
|
||||
"_"+
|
||||
new Date().toString()
|
||||
);
|
||||
user.connection.writeToFile("+", AbortLog);
|
||||
user.connection.sftpChannel.rename(ABORTED.full_name, AbortLog.full_name);
|
||||
System.out.println("Done");
|
||||
}
|
||||
}
|
||||
@@ -322,11 +322,15 @@ public enum PassCode_2021 {
|
||||
CompareDVMRunTasks,
|
||||
CompareSapforPackages,
|
||||
CreateDVMPackageFromCurrentProject,
|
||||
//--
|
||||
StopTestingServer
|
||||
;
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case Undefined:
|
||||
return "?";
|
||||
case StopTestingServer:
|
||||
return "Остановить серверный компонент тестирования";
|
||||
case CreateDVMPackageFromCurrentProject:
|
||||
return "Тестировать текущий проект";
|
||||
case CompareSapforPackages:
|
||||
|
||||
18
src/Visual_DVM_2021/Passes/SSH/TestingServerSSHPass.java
Normal file
18
src/Visual_DVM_2021/Passes/SSH/TestingServerSSHPass.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package Visual_DVM_2021.Passes.SSH;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
public class TestingServerSSHPass extends ConnectionPass {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void Connect() throws Exception {
|
||||
machine = new Machine("alex", Global.properties.ServerAddress,Global.properties.ServerUserSHHPort,MachineType.Server);
|
||||
user = new User(Global.properties.ServerUserName, "mprit_2011");
|
||||
super.Connect();
|
||||
}
|
||||
}
|
||||
BIN
src/icons/Stop25.png
Normal file
BIN
src/icons/Stop25.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user