v++
сообщение R204
This commit is contained in:
12
.idea/workspace.xml
generated
12
.idea/workspace.xml
generated
@@ -7,7 +7,19 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" 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$/src/Common/Current.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Current.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Global.java" 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/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/ProjectData/Messages/Message.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Messages/Message.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/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.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/Visual_DVM_2021/Passes/All/TestPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/TestPass.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -480,6 +480,7 @@ public enum Current {
|
||||
Normal,
|
||||
Server,
|
||||
Testing,
|
||||
Package
|
||||
Package,
|
||||
MachineQueue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package Common;
|
||||
import Common.Database.DataSet;
|
||||
import Repository.Component.ComponentsMenuBar;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Account.Account;
|
||||
import GlobalData.Account.AccountRole;
|
||||
import GlobalData.GlobalDatabase;
|
||||
import GlobalData.Settings.DBSetting;
|
||||
import GlobalData.Settings.SettingName;
|
||||
@@ -15,8 +12,9 @@ import Repository.Component.Sapfor.MessagesServer;
|
||||
import Repository.Component.Sapfor.Sapfor_F;
|
||||
import Repository.Component.Sapfor.TransformationPermission;
|
||||
import Repository.Server.ComponentsServer;
|
||||
import TestingSystem.SAPFOR.PackageModeSupervisor;
|
||||
import TestingSystem.Common.TestingServer;
|
||||
import TestingSystem.DVM.MachineQueueSupervisor;
|
||||
import TestingSystem.SAPFOR.PackageModeSupervisor;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.UI.Interface.Loggable;
|
||||
@@ -140,7 +138,7 @@ public class Global {
|
||||
Utils.CheckDirectory(SapforsDirectory = Paths.get(Home, "Sapfors").toFile());
|
||||
Utils.CheckDirectory(SapforPackagesDirectory = Paths.get(Home, "SapforPackages").toFile());
|
||||
}
|
||||
public static void CreateLog() {
|
||||
public static void CreateLogAtComponentsPath() {
|
||||
Log = new Loggable() {
|
||||
@Override
|
||||
public String getLogHomePath() {
|
||||
@@ -153,6 +151,19 @@ public class Global {
|
||||
};
|
||||
Log.ClearLog();
|
||||
}
|
||||
public static void CreateLogAtHome() {
|
||||
Log = new Loggable() {
|
||||
@Override
|
||||
public String getLogHomePath() {
|
||||
return Home;
|
||||
}
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return Current.mode.toString();
|
||||
}
|
||||
};
|
||||
Log.ClearLog();
|
||||
}
|
||||
//-
|
||||
public static void FinishApplication() {
|
||||
try {
|
||||
@@ -248,7 +259,7 @@ public class Global {
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.getName().contains(Constants.old_tests_db_name)) {
|
||||
System.out.println("found "+Utils.Brackets(file.getAbsolutePath()));
|
||||
System.out.println("found " + Utils.Brackets(file.getAbsolutePath()));
|
||||
try {
|
||||
Utils.forceDeleteWithCheck(file);
|
||||
} catch (Exception ex) {
|
||||
@@ -262,7 +273,7 @@ public class Global {
|
||||
isWindows = System.getProperty("os.name").startsWith("Windows");
|
||||
removeOldDatabases();
|
||||
CheckVisualiserDirectories();
|
||||
CreateLog();
|
||||
CreateLogAtComponentsPath();
|
||||
//-
|
||||
visualizer_2 = new Visualizer_2(port);
|
||||
visualizer_2.Connect();
|
||||
@@ -348,7 +359,7 @@ public class Global {
|
||||
public static void ServerMode() throws Exception {
|
||||
isWindows = false;
|
||||
CheckServerDirectories();
|
||||
CreateLog();
|
||||
CreateLogAtComponentsPath();
|
||||
componentsServer = new ComponentsServer();
|
||||
componentsServer.ActivateDB();
|
||||
componentsServer.Start();
|
||||
@@ -357,30 +368,20 @@ public class Global {
|
||||
public static void TestingSystemMode() throws Exception {
|
||||
isWindows = false;
|
||||
CheckTestingSystemDirectories();
|
||||
CreateLog();
|
||||
CreateLogAtComponentsPath();
|
||||
testingServer = new TestingServer();
|
||||
testingServer.ActivateDB();
|
||||
testingServer.Start();
|
||||
System.exit(0);
|
||||
}
|
||||
//режим запуска пакета Сапфор
|
||||
public static void PackageMode() throws Exception {
|
||||
isWindows = System.getProperty("os.name").startsWith("Windows");
|
||||
Log = new Loggable() {
|
||||
@Override
|
||||
public String getLogHomePath() {
|
||||
return Home;
|
||||
}
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return "Package";
|
||||
}
|
||||
};
|
||||
Log.ClearLog();
|
||||
CreateLogAtHome();
|
||||
PackageModeSupervisor planner = new PackageModeSupervisor();
|
||||
planner.Start();
|
||||
}
|
||||
//---
|
||||
//---
|
||||
public static void Init(String... args) {
|
||||
System.out.println("VisualSapfor.jar started..");
|
||||
Home = System.getProperty("user.dir"); //если Linux, дает без слеша в конце !!!
|
||||
@@ -403,6 +404,11 @@ public class Global {
|
||||
case Package:
|
||||
PackageMode();
|
||||
break;
|
||||
case MachineQueue:
|
||||
CreateLogAtHome();
|
||||
MachineQueueSupervisor supervisor = new MachineQueueSupervisor(args);
|
||||
supervisor.Start();
|
||||
break;
|
||||
case Undefined:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,8 +65,7 @@ public class MainMenuBar extends VisualiserMenuBar {
|
||||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
//---
|
||||
*/
|
||||
ShowProject(false);
|
||||
}
|
||||
public void ShowUpdatesIcon() {
|
||||
|
||||
@@ -75,17 +75,3 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
//ищем GCOV
|
||||
if (task.getRunConfiguration().needsGCOV()) {
|
||||
pass.ShellCommand("cd " + Utils.DQuotes(getRemoteProject().full_name),
|
||||
"gcov *.gcda -p"
|
||||
);
|
||||
project.CreateGCOVDirs();
|
||||
Vector<RemoteFile> gcov_results = pass.getFilesByExtensions(getRemoteProject(), "gcov");
|
||||
for (RemoteFile gcov_file : gcov_results) {
|
||||
File local_gcov = Paths.get(project.getGCOVDirectory().getAbsolutePath(),
|
||||
gcov_file.name.replace("#", "\\")).toFile();
|
||||
pass.getSingleFile(gcov_file.full_name, local_gcov.getAbsolutePath());
|
||||
}
|
||||
*/
|
||||
@@ -349,6 +349,8 @@ public class Message extends FileObject {
|
||||
codedMessages.put("R151", "Пустые области распараллеливания не допускаются.");
|
||||
//3022
|
||||
codedMessages.put("R171", "Невозможно определить правила выравнивания для массива '%s'.");
|
||||
//3024
|
||||
codedMessages.put("R204", "Пересечение памяти массивов препятствует распараллеливанию цикла");
|
||||
//4001
|
||||
//---TODO ошибки из SAGE
|
||||
//4002
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
version = 1095;
|
||||
version = 1096;
|
||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||
date_text = df.format(getClassBuildTime());
|
||||
|
||||
@@ -82,6 +82,6 @@ public enum ServerCode {
|
||||
GetDVMPackagesJson,
|
||||
GetSapforPackagesJson,
|
||||
GetFirstsActiveDVMPackages,
|
||||
Ping
|
||||
;
|
||||
Ping,
|
||||
GetFirstActiveDVMPackageForMachineURL;
|
||||
}
|
||||
|
||||
@@ -35,22 +35,6 @@ import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
/*
|
||||
@Override
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof Group) {
|
||||
Group group = (Group) object;
|
||||
if (db.groups.containsGroupWithDescription(group.description))
|
||||
throw new RepositoryRefuseException("Уже существует группа с описанием " +
|
||||
Utils.Brackets(group.description.toLowerCase()));
|
||||
} else if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
if (db.tests.containsTestWithDescription(test.description))
|
||||
throw new RepositoryRefuseException("Уже существует тест с описанием " +
|
||||
Utils.Brackets(test.description.toLowerCase()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void afterPublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
@@ -141,12 +125,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
});
|
||||
//------>>>
|
||||
//------>>>
|
||||
public static Timer checkTimer = null;
|
||||
public static void TimerOn() {
|
||||
System.out.println("timer on");
|
||||
checkTimer = new Timer(Global.properties.CheckTestingIntervalSeconds * 1000, e -> {
|
||||
// Pass_2021.passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
|
||||
Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
|
||||
});
|
||||
checkTimer.start();
|
||||
@@ -165,23 +147,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Test test;
|
||||
int test_id;
|
||||
switch (code) {
|
||||
case EmailSapforAssembly:
|
||||
/*
|
||||
Print("Сообщить о сборке SAPFOR для пользователя " + request.arg);
|
||||
Vector<String> assembly_info = (Vector<String>) request.object;
|
||||
File out = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.out_file).toFile();
|
||||
File err = Paths.get(Global.RepoDirectory.getAbsolutePath(), Constants.SAPFOR_REPOSITORY_BIN, Constants.err_file).toFile();
|
||||
Vector<String> targets = new Vector<>(Arrays.asList(Global.admins_mails));
|
||||
EmailMessage message = new EmailMessage(
|
||||
"Выполнена сборка системы SAPFOR",
|
||||
"Версия: " + assembly_info.get(0) + "\n" + "Статус: " + assembly_info.get(1),
|
||||
targets
|
||||
);
|
||||
Email(message, out, err);
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
*/
|
||||
break;
|
||||
//------------------------------------------->>
|
||||
case DownloadTest:
|
||||
Print("Отправить клиенту тест " + request.arg);
|
||||
test_id = Integer.parseInt(request.arg);
|
||||
@@ -258,11 +223,14 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Print("Получить первые активные пакеты задач DVM на машинах");
|
||||
GetFirstActiveDVMPackagesByMachines();
|
||||
break;
|
||||
case GetFirstActiveDVMPackageForMachineURL:
|
||||
Print("Получить первый активный пакет задач DVM на машине с адресом");
|
||||
GetFirstActiveDVMPackageForMachineURL();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
}
|
||||
|
||||
//->>
|
||||
Pair<Group, Vector<File>> ConvertDirectoryToGroup(File src, LanguageName languageName, TestType
|
||||
testType, Account account) throws Exception {
|
||||
@@ -343,6 +311,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getFirstActiveDVMPackagesCopies();
|
||||
}
|
||||
private void GetFirstActiveDVMPackageForMachineURL() {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getFirstActiveDVMPackagesCopiesForMachineURL(request.arg);
|
||||
}
|
||||
private void GetFirstActiveSapforPackages() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getFirstActiveSapforPackagesCopies();
|
||||
|
||||
@@ -27,6 +27,7 @@ import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -232,4 +233,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
}
|
||||
public DVMPackage getFirstActiveDVMPackagesCopiesForMachineURL(String arg) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
71
src/TestingSystem/DVM/MachineQueueSupervisor.java
Normal file
71
src/TestingSystem/DVM/MachineQueueSupervisor.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package TestingSystem.DVM;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Vector;
|
||||
public class MachineQueueSupervisor {
|
||||
//--
|
||||
Machine machine = null;
|
||||
User user = null;
|
||||
//--
|
||||
DVMPackage testingPackage = null; //текущий пакет.
|
||||
//--
|
||||
protected int getSleepMillis() {
|
||||
return 2000;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
|
||||
TestingSystemPass<Object> pass = new TestingSystemPass<Object>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(code_in, arg, object_in));
|
||||
target = response.object;
|
||||
}
|
||||
};
|
||||
if (!pass.Do()) throw new PassException("Ошибка взаимодействия с сервером " + code_in);
|
||||
return pass.target;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, Serializable object_in) throws Exception {
|
||||
return ServerCommand(code_in, "", object_in);
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in) throws Exception {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
//--
|
||||
public MachineQueueSupervisor(String... args) {
|
||||
Global.isWindows = System.getProperty("os.name").startsWith("Windows");
|
||||
//---
|
||||
String machineAddress = args[0];
|
||||
int machinePort = Integer.parseInt(args[1]);
|
||||
String userName = args[2];
|
||||
String userPassword = args[3];
|
||||
String userWorkspace = args[4];
|
||||
//---
|
||||
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
|
||||
user = new User(userName, userPassword, userWorkspace);
|
||||
//---
|
||||
}
|
||||
public void Start() {
|
||||
try {
|
||||
testingPackage = null;
|
||||
testingPackage = (DVMPackage) ServerCommand(ServerCode.GetFirstActiveDVMPackageForMachineURL, machine.getURL(), null);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,46 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.GlobalProperties;
|
||||
import Common.Utils.Utils;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
||||
public class TestPass extends CurrentConnectionPass {
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Vector;
|
||||
public class TestPass extends Pass_2021 {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
String dir = "/home/testuser/jack sparrow/";
|
||||
String command = "rm -rf " + Utils.DQuotes(dir);
|
||||
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
|
||||
user.connection.Command(command);
|
||||
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
|
||||
protected void body() throws Exception {
|
||||
/*
|
||||
File workspace = new File("E:\\Workspace");
|
||||
Utils.CheckAndCleanDirectory(workspace);
|
||||
//копирование визуализатора
|
||||
File supervisor = new File(workspace, "VisualSapfor.jar");
|
||||
//
|
||||
FileUtils.copyFile(Global.visualiser.getFile(), supervisor);
|
||||
//создание настроек
|
||||
GlobalProperties properties = new GlobalProperties();
|
||||
properties.Mode = Current.Mode.DVMPackage;
|
||||
Utils.jsonToFile(properties, new File(workspace, "properties"));
|
||||
Vector<String> args = new Vector<>();
|
||||
args.add(Utils.DQuotes("dvm.keldysh.ru"));
|
||||
args.add(Utils.DQuotes("2222"));
|
||||
args.add(Utils.DQuotes("dvmuser1"));
|
||||
args.add(Utils.DQuotes("nkat_2023"));
|
||||
args.add(Utils.DQuotes("/home/dvmuser1/visual_sapfor_workspace_1711108722"));
|
||||
args.add("777");
|
||||
args.add(String.valueOf(TasksPackageState.TestsSynchronize));
|
||||
//подготовка пакетного режима. Запустит его уже очередь.
|
||||
Utils.createScript(workspace, workspace,
|
||||
"start",
|
||||
"java -jar VisualSapfor.jar "+ String.join(" ", args));
|
||||
*/
|
||||
byte[] localIp = InetAddress.getLocalHost().getAddress();
|
||||
InetAddress address = InetAddress.getByName("alex-freenas.ddns.net");
|
||||
System.out.println(address);
|
||||
//java определить по адресу сервера совпадает ли он с локальным
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user