промежуточный. добавление кнопки публикации тестового сервера. она выполняет остановку сервера, замену его на текущий файл jar, и запускает заново
This commit is contained in:
@@ -9,14 +9,16 @@ import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.User.User;
|
||||
|
||||
import java.util.Date;
|
||||
public class TestingServerSSHPass extends ConnectionPass {
|
||||
public abstract class RepositoryServerSSHPass extends ConnectionPass {
|
||||
protected abstract String getServerFileName();
|
||||
protected abstract String getServerHomeName();
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
//--
|
||||
protected RemoteFile userHome;
|
||||
protected RemoteFile testingHome;
|
||||
protected RemoteFile serverHome;
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
@@ -24,22 +26,23 @@ public class TestingServerSSHPass extends ConnectionPass {
|
||||
@Override
|
||||
public void Connect() throws Exception {
|
||||
userHome = null;
|
||||
testingHome = null;
|
||||
serverHome = null;
|
||||
//--
|
||||
machine = new Machine("alex", Global.properties.ServerAddress, Global.properties.ServerUserSHHPort, MachineType.Server);
|
||||
user = new User(Global.properties.ServerUserName, "mprit_2011");
|
||||
super.Connect();
|
||||
//--
|
||||
userHome = new RemoteFile(user.connection.sftpChannel.getHome(), true);
|
||||
testingHome = new RemoteFile(userHome, Constants.testingSystemHomeName);
|
||||
serverHome = new RemoteFile(userHome, getServerHomeName());
|
||||
//-
|
||||
System.out.println("userHome=" + Utils.Brackets(userHome.full_name));
|
||||
System.out.println("testingHome=" + Utils.Brackets(testingHome.full_name));
|
||||
System.out.println("testingHome=" + Utils.Brackets(serverHome.full_name));
|
||||
}
|
||||
//--
|
||||
protected void StartServer() throws Exception {
|
||||
user.connection.performScript(testingHome, "nohup java -jar TestingSystem.jar &");
|
||||
RemoteFile StartLog = new RemoteFile(testingHome, Constants.STARTED +
|
||||
user.connection.performScript(serverHome, "nohup java -jar " + getServerFileName()+
|
||||
" &");
|
||||
RemoteFile StartLog = new RemoteFile(serverHome, Constants.STARTED +
|
||||
"_by_" +
|
||||
Current.getAccount().email +
|
||||
"_" +
|
||||
@@ -48,9 +51,9 @@ public class TestingServerSSHPass extends ConnectionPass {
|
||||
user.connection.writeToFile("+", StartLog);
|
||||
//--
|
||||
RemoteFile[] files = new RemoteFile[]{
|
||||
new RemoteFile(testingHome, Constants.script),
|
||||
new RemoteFile(testingHome, Constants.out_file),
|
||||
new RemoteFile(testingHome, Constants.err_file)
|
||||
new RemoteFile(serverHome, Constants.script),
|
||||
new RemoteFile(serverHome, Constants.out_file),
|
||||
new RemoteFile(serverHome, Constants.err_file)
|
||||
};
|
||||
//-
|
||||
for (RemoteFile file : files) {
|
||||
@@ -59,8 +62,8 @@ public class TestingServerSSHPass extends ConnectionPass {
|
||||
}
|
||||
protected void ShutdownServer() throws Exception {
|
||||
//--
|
||||
RemoteFile INTERRUPT = new RemoteFile(testingHome, Constants.INTERRUPT);
|
||||
RemoteFile ABORTED = new RemoteFile(testingHome, Constants.ABORTED);
|
||||
RemoteFile INTERRUPT = new RemoteFile(serverHome, Constants.INTERRUPT);
|
||||
RemoteFile ABORTED = new RemoteFile(serverHome, Constants.ABORTED);
|
||||
//--
|
||||
ShowMessage1("Создание файла INTERRUPT..");
|
||||
user.connection.writeToFile("+", INTERRUPT);
|
||||
@@ -72,7 +75,7 @@ public class TestingServerSSHPass extends ConnectionPass {
|
||||
//--
|
||||
ShowMessage2("");
|
||||
ShowMessage1("Журнализация");
|
||||
RemoteFile AbortLog = new RemoteFile(testingHome, Constants.ABORTED +
|
||||
RemoteFile AbortLog = new RemoteFile(serverHome, Constants.ABORTED +
|
||||
"_by_" +
|
||||
Current.getAccount().email +
|
||||
"_" +
|
||||
Reference in New Issue
Block a user