рефакторинг команд ssh
v++ динамическая смена названия прохода Анализ Кода
This commit is contained in:
15
.idea/workspace.xml
generated
15
.idea/workspace.xml
generated
@@ -8,6 +8,21 @@
|
|||||||
<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 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$/src/Common/UI/Menus_2023/MainMenuBar/MainMenuBar.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/MainMenuBar/MainMenuBar.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/MainMenuBar/TransformationsMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/MainMenuBar/TransformationsMenu.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Common/UI/Menus_2023/PassControl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/UI/Menus_2023/PassControl.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/RemoteTaskSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Tasks/Supervisor/Remote/RemoteTaskSupervisor.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/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.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/Visual_DVM_2021/Passes/All/CheckAccount.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CheckAccount.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteSingleCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteSingleCommand.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SPF_GetArrayDistribution.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SPF_GetArrayDistribution.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SPF_GetArrayDistributionOnlyAnalysis.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SPF_GetArrayDistributionOnlyAnalysis.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/UpdateSetting.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.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" />
|
||||||
|
|||||||
@@ -55,14 +55,13 @@ public class MainMenuBar extends VisualiserMenuBar {
|
|||||||
//-
|
//-
|
||||||
setPreferredSize(new Dimension(0, 30));
|
setPreferredSize(new Dimension(0, 30));
|
||||||
//---
|
//---
|
||||||
/*
|
/*
|
||||||
add(new MenuBarButton() {
|
add(new MenuBarButton() {
|
||||||
{
|
{
|
||||||
setIcon("/icons/Apply.png");
|
setIcon("/icons/Apply.png");
|
||||||
setToolTipText("Test");
|
setToolTipText("Test");
|
||||||
addActionListener(e -> {
|
addActionListener(e -> {
|
||||||
// Pass_2021.passes.get(PassCode_2021.TestPass).Do();
|
Pass_2021.passes.get(PassCode_2021.TestPass).Do();
|
||||||
Current.getFile().form.SwitchGraphs(false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class TransformationsMenu extends VisualiserMenu {
|
|||||||
add(new PassesSubMenu("Циклы", "/icons/Menu/Loops.png",
|
add(new PassesSubMenu("Циклы", "/icons/Menu/Loops.png",
|
||||||
Sapfor.getLoopsTransformationsCodes()));
|
Sapfor.getLoopsTransformationsCodes()));
|
||||||
addSeparator();
|
addSeparator();
|
||||||
add(new PassesSubMenu("Вставка директив приватизации", "/icons/Menu/Privates.png",
|
add(new PassesSubMenu("Приватные переменные", "/icons/Menu/Privates.png",
|
||||||
Sapfor.getPrivatesTransformationsCodes()));
|
Sapfor.getPrivatesTransformationsCodes()));
|
||||||
addSeparator();
|
addSeparator();
|
||||||
add(new PassesSubMenu("Процедуры", "/icons/Menu/Functions.png",
|
add(new PassesSubMenu("Процедуры", "/icons/Menu/Functions.png",
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ public interface PassControl {
|
|||||||
void setEnabled(boolean flag);
|
void setEnabled(boolean flag);
|
||||||
void setVisible(boolean flag);
|
void setVisible(boolean flag);
|
||||||
void setToolTipText(String text);
|
void setToolTipText(String text);
|
||||||
|
void setText(String text);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void AbortTask() throws Exception {
|
protected void AbortTask() throws Exception {
|
||||||
pass.user.connection.ShellCommand("kill -2 " + task.PID);
|
pass.user.connection.Command("kill -2 " + task.PID);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void CalculatePerformanceTime() throws Exception {
|
protected void CalculatePerformanceTime() throws Exception {
|
||||||
|
|||||||
@@ -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 = 1086;
|
version = 1088;
|
||||||
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());
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
|||||||
if (subscriber.mailOn>0){
|
if (subscriber.mailOn>0){
|
||||||
checkedTargets.add(email);
|
checkedTargets.add(email);
|
||||||
}
|
}
|
||||||
}
|
}else checkedTargets.add(email); //если почта не зарегана значит это мейл с регистрацией.
|
||||||
}
|
}
|
||||||
message_in.targets = checkedTargets;
|
message_in.targets = checkedTargets;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,10 +181,8 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void PackageStart() throws Exception {
|
protected void PackageStart() throws Exception {
|
||||||
user.connection.ShellCommand("ulimit -s unlimited"); // нужно, для запуска сишной части.
|
|
||||||
///--
|
|
||||||
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(" ", "nohup", Utils.DQuotes(getPlanner()), Utils.DQuotes(user.workspace), Utils.DQuotes(packageRemoteWorkspace.full_name), Utils.DQuotes(testingPackage.kernels), Utils.DQuotes(testingPackage.drv), "&");
|
||||||
user.connection.ShellCommand(plannerStartCommand);
|
user.connection.CommandNoRead("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");
|
||||||
while (!user.connection.Exists(STARTED)) {
|
while (!user.connection.Exists(STARTED)) {
|
||||||
@@ -315,7 +313,7 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
|
|||||||
@Override
|
@Override
|
||||||
protected void Kill() throws Exception {
|
protected void Kill() throws Exception {
|
||||||
if (!testingPackage.PID.isEmpty()) {
|
if (!testingPackage.PID.isEmpty()) {
|
||||||
user.connection.ShellCommand("kill -9 " + testingPackage.PID);
|
user.connection.Command("kill -9 " + testingPackage.PID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -335,7 +333,7 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
|
|||||||
if (user.connection == null) {
|
if (user.connection == null) {
|
||||||
try {
|
try {
|
||||||
user.connection = new UserConnection(machine, user);
|
user.connection = new UserConnection(machine, user);
|
||||||
Print("Соединение c " + machine.getURL() + " " + user.login + " успешно установлено.");
|
// Print("Соединение c " + machine.getURL() + " " + user.login + " успешно установлено.");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Print(ex.toString());
|
Print(ex.toString());
|
||||||
user.connection = null;
|
user.connection = null;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ 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;
|
||||||
@@ -46,6 +45,7 @@ public class UserConnection {
|
|||||||
shellChannel = (ChannelShell) session.openChannel("shell");
|
shellChannel = (ChannelShell) session.openChannel("shell");
|
||||||
in = new PipedInputStream();
|
in = new PipedInputStream();
|
||||||
out = new PipedOutputStream();
|
out = new PipedOutputStream();
|
||||||
|
/*
|
||||||
shellChannel.setInputStream(in);
|
shellChannel.setInputStream(in);
|
||||||
shellChannel.setOutputStream(out);
|
shellChannel.setOutputStream(out);
|
||||||
pin = new PipedOutputStream(in);
|
pin = new PipedOutputStream(in);
|
||||||
@@ -55,6 +55,7 @@ public class UserConnection {
|
|||||||
fromServer = new InputStreamReader(pout);
|
fromServer = new InputStreamReader(pout);
|
||||||
ShellParser.setUserName(user.login);
|
ShellParser.setUserName(user.login);
|
||||||
ShellParser.ReadInvitation(fromServer); //прочитать первое приглашение от машины.
|
ShellParser.ReadInvitation(fromServer); //прочитать первое приглашение от машины.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
public void Disconnect() {
|
public void Disconnect() {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@@ -114,6 +115,8 @@ public class UserConnection {
|
|||||||
//--
|
//--
|
||||||
//todo из за мусора результатом пользоваться в общем случае невозможно.
|
//todo из за мусора результатом пользоваться в общем случае невозможно.
|
||||||
//следует перенаправлять вывод в какой нибудь временный файл на сервере.
|
//следует перенаправлять вывод в какой нибудь временный файл на сервере.
|
||||||
|
|
||||||
|
/*
|
||||||
public String ShellCommand(String command) throws Exception {
|
public String ShellCommand(String command) throws Exception {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
pin.write((command + "\r\n").getBytes());
|
pin.write((command + "\r\n").getBytes());
|
||||||
@@ -122,6 +125,7 @@ public class UserConnection {
|
|||||||
String[] data = result.toString().split("\n");
|
String[] data = result.toString().split("\n");
|
||||||
return (data.length > 0) ? data[data.length - 1] : result.toString();
|
return (data.length > 0) ? data[data.length - 1] : result.toString();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public void getSingleFile(String src, String dst) throws Exception {
|
public void getSingleFile(String src, String dst) throws Exception {
|
||||||
sftpChannel.get(src, dst);
|
sftpChannel.get(src, dst);
|
||||||
}
|
}
|
||||||
@@ -146,7 +150,7 @@ public class UserConnection {
|
|||||||
//-
|
//-
|
||||||
public void RMDIR(String dir) throws Exception {
|
public void RMDIR(String dir) throws Exception {
|
||||||
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
|
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
|
||||||
ShellCommand("rm -rf " + Utils.DQuotes(dir));
|
Command("rm -rf " + Utils.DQuotes(dir));
|
||||||
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
|
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
|
||||||
}
|
}
|
||||||
//-
|
//-
|
||||||
@@ -237,7 +241,7 @@ 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);
|
||||||
//--
|
//--
|
||||||
ShellCommand(Utils.DQuotes(script_file.full_name) + " 1>" + Utils.DQuotes(out.full_name) + " 2>" + Utils.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);
|
return new Pair<>(out, err);
|
||||||
}
|
}
|
||||||
public void putResource(RemoteFile dstDirectory, String resource_name) throws Exception {
|
public void putResource(RemoteFile dstDirectory, String resource_name) throws Exception {
|
||||||
@@ -273,23 +277,23 @@ public class UserConnection {
|
|||||||
sftpChannel.rename(outFile.full_name, cppVersionsInfo.full_name);
|
sftpChannel.rename(outFile.full_name, cppVersionsInfo.full_name);
|
||||||
//--
|
//--
|
||||||
String[] data = out.split("\n");
|
String[] data = out.split("\n");
|
||||||
boolean cpp_17=false;
|
boolean cpp_17 = false;
|
||||||
boolean cpp_11=false;
|
boolean cpp_11 = false;
|
||||||
//определить какие есть версии.
|
//определить какие есть версии.
|
||||||
for (String version : data) {
|
for (String version : data) {
|
||||||
switch (version){
|
switch (version) {
|
||||||
case "c++17":
|
case "c++17":
|
||||||
cpp_17=true;
|
cpp_17 = true;
|
||||||
break;
|
break;
|
||||||
case "c++11":
|
case "c++11":
|
||||||
cpp_11=true;
|
cpp_11 = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cpp_17)
|
if (cpp_17)
|
||||||
res = "-std=c++17";
|
res = "-std=c++17";
|
||||||
else if (cpp_11)
|
else if (cpp_11)
|
||||||
res= "-std=c++11";
|
res = "-std=c++11";
|
||||||
RemoteFile cppFlag = new RemoteFile(scriptDirectory, "current_ccp_version");
|
RemoteFile cppFlag = new RemoteFile(scriptDirectory, "current_ccp_version");
|
||||||
writeToFile(res, cppFlag);
|
writeToFile(res, cppFlag);
|
||||||
return res;
|
return res;
|
||||||
@@ -308,10 +312,9 @@ public class UserConnection {
|
|||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
public void tryRM(RemoteFile file) throws Exception {
|
public void tryRM(RemoteFile file) throws Exception {
|
||||||
if (Exists(file)) {
|
if (Exists(file))
|
||||||
sftpChannel.rm(file.full_name);
|
sftpChannel.rm(file.full_name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//с проверкой.
|
//с проверкой.
|
||||||
public boolean tryGetSingleFileWithMaxSize(RemoteFile src, File dst, int maxSize) throws Exception {
|
public boolean tryGetSingleFileWithMaxSize(RemoteFile src, File dst, int maxSize) throws Exception {
|
||||||
if (Exists(src)) {
|
if (Exists(src)) {
|
||||||
@@ -386,7 +389,6 @@ public class UserConnection {
|
|||||||
for (RemoteFile file : to_delete)
|
for (RemoteFile file : to_delete)
|
||||||
sftpChannel.rm(file.full_name);
|
sftpChannel.rm(file.full_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@@ -397,10 +399,25 @@ public class UserConnection {
|
|||||||
execChannel.setCommand(command);
|
execChannel.setCommand(command);
|
||||||
execChannel.connect();
|
execChannel.connect();
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(execChannel.getInputStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(execChannel.getInputStream()));
|
||||||
while (in.readLine() != null) ;
|
String line = null;
|
||||||
|
while ((line = in.readLine()) != null) {
|
||||||
|
System.out.println(Utils.Brackets(line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
execChannel.disconnect();
|
||||||
|
}
|
||||||
|
public void CommandNoRead(String... commands) throws Exception {
|
||||||
|
if (commands.length > 0) {
|
||||||
|
String command = String.join("\n", commands);
|
||||||
|
execChannel = (ChannelExec) session.openChannel("exec");
|
||||||
|
execChannel.setErrStream(System.err);
|
||||||
|
execChannel.setCommand(command);
|
||||||
|
execChannel.connect();
|
||||||
execChannel.disconnect();
|
execChannel.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public String CommandWithAnswer(char end, String... commands) throws Exception {
|
public String CommandWithAnswer(char end, String... commands) throws Exception {
|
||||||
String output = "";
|
String output = "";
|
||||||
if (commands.length > 0) {
|
if (commands.length > 0) {
|
||||||
@@ -421,7 +438,10 @@ public class UserConnection {
|
|||||||
// System.out.println(Utils.Brackets(output));
|
// System.out.println(Utils.Brackets(output));
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
public void copy(RemoteFile src, RemoteFile dst) throws Exception {
|
public void copy(RemoteFile src, RemoteFile dst) throws Exception {
|
||||||
ShellCommand("cp " + Utils.DQuotes(src.full_name) + " " + Utils.DQuotes(dst.full_name));
|
ShellCommand("cp " + Utils.DQuotes(src.full_name) + " " + Utils.DQuotes(dst.full_name));
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class CheckAccount extends Pass_2021<Boolean> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected void body() throws Exception {
|
||||||
|
/*
|
||||||
switch (Current.getAccount().email){
|
switch (Current.getAccount().email){
|
||||||
case "vmk-post@yandex.ru":
|
case "vmk-post@yandex.ru":
|
||||||
case "79854210702@ya.ru":
|
case "79854210702@ya.ru":
|
||||||
@@ -42,14 +43,14 @@ public class CheckAccount extends Pass_2021<Boolean> {
|
|||||||
target = true;
|
target = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//временно. оффлайн проверка по почте
|
//временно. оффлайн проверка по почте
|
||||||
/*
|
|
||||||
target = Current.getAccount().email.equals("?") ?
|
target = Current.getAccount().email.equals("?") ?
|
||||||
(Pass_2021.passes.get(PassCode_2021.EditAccount).Do() &&
|
(Pass_2021.passes.get(PassCode_2021.EditAccount).Do() &&
|
||||||
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do()) :
|
Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do()) :
|
||||||
(Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do());
|
(Pass_2021.passes.get(PassCode_2021.CheckRegistrationOnServer).Do());
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean validate() {
|
protected boolean validate() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class RemoteSingleCommand extends CurrentConnectionPass<String> {
|
|||||||
@Override
|
@Override
|
||||||
protected void ServerAction() throws Exception {
|
protected void ServerAction() throws Exception {
|
||||||
RemoteFile file = new RemoteFile(user.connection.sftpChannel.getHome(), Utils.getDateName("out"));
|
RemoteFile file = new RemoteFile(user.connection.sftpChannel.getHome(), Utils.getDateName("out"));
|
||||||
user.connection.ShellCommand(command + " 1>" + Utils.DQuotes(file.full_name));
|
user.connection.Command(command + " 1>" + Utils.DQuotes(file.full_name));
|
||||||
if (user.connection.Exists(file)) {
|
if (user.connection.Exists(file)) {
|
||||||
target = user.connection.readFromFile(file);
|
target = user.connection.readFromFile(file);
|
||||||
user.connection.sftpChannel.rm(file.full_name);
|
user.connection.sftpChannel.rm(file.full_name);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Common.Global;
|
|||||||
import Common.UI.UI;
|
import Common.UI.UI;
|
||||||
import GlobalData.Settings.SettingName;
|
import GlobalData.Settings.SettingName;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||||
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
import Visual_DVM_2021.Passes.SapforAnalysis;
|
import Visual_DVM_2021.Passes.SapforAnalysis;
|
||||||
public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalysis {
|
public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalysis {
|
||||||
@Override
|
@Override
|
||||||
@@ -36,4 +37,8 @@ public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalys
|
|||||||
}
|
}
|
||||||
return super.canStart(args);
|
return super.canStart(args);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return code().getDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
package Visual_DVM_2021.Passes.All;
|
||||||
|
import Common.Global;
|
||||||
|
import Common.UI.Menus_2023.PassControl;
|
||||||
import Common.UI.UI;
|
import Common.UI.UI;
|
||||||
import Common.Utils.Index;
|
import Common.Utils.Index;
|
||||||
|
import GlobalData.Settings.SettingName;
|
||||||
import ProjectData.SapforData.Regions.ParallelRegion;
|
import ProjectData.SapforData.Regions.ParallelRegion;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||||
import Visual_DVM_2021.Passes.SapforAnalysis;
|
import Visual_DVM_2021.Passes.SapforAnalysis;
|
||||||
@@ -67,4 +70,13 @@ public class SPF_GetArrayDistributionOnlyAnalysis extends SapforAnalysis {
|
|||||||
UI.getMainWindow().FocusProject();
|
UI.getMainWindow().FocusProject();
|
||||||
UI.getMainWindow().getProjectWindow().FocusAnalysis();
|
UI.getMainWindow().getProjectWindow().FocusAnalysis();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return Global.db.settings.get(SettingName.MPI_PROGRAM).toBoolean()?
|
||||||
|
"Анализ кода (общая память)":"Анализ кода";
|
||||||
|
}
|
||||||
|
public void RefreshControls(){
|
||||||
|
for (PassControl control: controls)
|
||||||
|
control.setText(getDescription());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,58 +1,14 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
package Visual_DVM_2021.Passes.All;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import Visual_DVM_2021.Passes.Pass_2021;
|
import Visual_DVM_2021.Passes.PassException;
|
||||||
import org.apache.commons.io.FileUtils;
|
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
public class TestPass extends CurrentConnectionPass {
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.util.Date;
|
|
||||||
public class TestPass extends Pass_2021 {
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsAnimation() {
|
protected void ServerAction() throws Exception {
|
||||||
return super.needsAnimation();
|
String dir = "/home/testuser/jack sparrow/";
|
||||||
}
|
String command = "rm -rf " + Utils.DQuotes(dir);
|
||||||
@Override
|
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
|
||||||
protected void body() throws Exception {
|
user.connection.Command(command);
|
||||||
File file = Utils.getTempFileName("table");
|
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
|
||||||
//--
|
|
||||||
Workbook book = new HSSFWorkbook();
|
|
||||||
Sheet sheet = book.createSheet("Birthdays");
|
|
||||||
|
|
||||||
// Нумерация начинается с нуля
|
|
||||||
Row row = sheet.createRow(0);
|
|
||||||
|
|
||||||
// Мы запишем имя и дату в два столбца
|
|
||||||
// имя будет String, а дата рождения --- Date,
|
|
||||||
// формата dd.mm.yyyy
|
|
||||||
Cell name = row.createCell(0);
|
|
||||||
name.setCellValue("John");
|
|
||||||
|
|
||||||
Cell birthdate = row.createCell(1);
|
|
||||||
|
|
||||||
DataFormat format = book.createDataFormat();
|
|
||||||
CellStyle dateStyle = book.createCellStyle();
|
|
||||||
dateStyle.setDataFormat(format.getFormat("dd.mm.yyyy"));
|
|
||||||
birthdate.setCellStyle(dateStyle);
|
|
||||||
|
|
||||||
|
|
||||||
// Нумерация лет начинается с 1900-го
|
|
||||||
birthdate.setCellValue(new Date(110, 10, 10));
|
|
||||||
|
|
||||||
// Меняем размер столбца
|
|
||||||
sheet.autoSizeColumn(1);
|
|
||||||
|
|
||||||
// Записываем всё в файл
|
|
||||||
FileOutputStream stream = new FileOutputStream(file);
|
|
||||||
book.write(stream);
|
|
||||||
book.close();
|
|
||||||
stream.close();
|
|
||||||
///--
|
|
||||||
File res = new File("kek.xls");
|
|
||||||
FileUtils.copyFile(file, res);
|
|
||||||
book= null;
|
|
||||||
stream = null;
|
|
||||||
file = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ public class UpdateSetting extends Pass_2021<DBSetting> {
|
|||||||
break;
|
break;
|
||||||
case MPI_PROGRAM:
|
case MPI_PROGRAM:
|
||||||
Pass_2021.passes.get(PassCode_2021.CleanAnalyses).Do();
|
Pass_2021.passes.get(PassCode_2021.CleanAnalyses).Do();
|
||||||
|
((SPF_GetArrayDistributionOnlyAnalysis)
|
||||||
|
Pass_2021.passes.get(PassCode_2021.SPF_GetArrayDistributionOnlyAnalysis)).RefreshControls();
|
||||||
break;
|
break;
|
||||||
case SmallScreen:
|
case SmallScreen:
|
||||||
boolean small = target.toBoolean();
|
boolean small = target.toBoolean();
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ public enum PassCode_2021 {
|
|||||||
case AddTasksToSapforPackage:
|
case AddTasksToSapforPackage:
|
||||||
return "Добавить задачи в пакет SAPFOR";
|
return "Добавить задачи в пакет SAPFOR";
|
||||||
case SPF_InsertPrivateFromGUI:
|
case SPF_InsertPrivateFromGUI:
|
||||||
return "Вставка директив для нераспределяемых массивов";
|
return "Вставка директив приватизации";
|
||||||
case CreateTestFromSelectedFiles:
|
case CreateTestFromSelectedFiles:
|
||||||
return "Создать тест из выделенных файлов";
|
return "Создать тест из выделенных файлов";
|
||||||
case DownloadSapforPackage:
|
case DownloadSapforPackage:
|
||||||
|
|||||||
Reference in New Issue
Block a user