сборка сапфора для тестирования пользователем

This commit is contained in:
2023-10-03 15:07:17 +03:00
parent 6372fce1ac
commit 2deecd47bf
26 changed files with 571 additions and 253 deletions

View File

@@ -1,6 +1,18 @@
package Common.Constants;
import GlobalData.Machine.Machine;
import GlobalData.Machine.MachineType;
import GlobalData.User.User;
import java.util.regex.Pattern;
public class Constants {
public static final int Nan = -1;
//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";
public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor";
//--
public static final String LOADED = "LOADED";
//--
//https://losst.ru/komandy-terminala-linux
public static String[] linux_system_commands = new String[]{
//<editor-fold desc="все линуксовые команды. их МНОГО">
@@ -339,8 +351,8 @@ public class Constants {
"zypper"
//</editor-fold>
};
public static final int Nan = -1;
public static char toStrike = (char) 822;
public static char boop = (char) 7;
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
public static char[] forbidden_file_name_characters = new char[]{
@@ -356,4 +368,6 @@ public class Constants {
//все запретные символы через пробел.
public static String all_forbidden_characters_string = "";
public static String aborted = "ABORTED";
public static final Machine repository_machine = new Machine("Ubuntu", "alex-freenas.ddns.net", 23, MachineType.Server);
public static final User repository_user = new User("testuser", "mprit_2011", "");
}

View File

@@ -33,6 +33,7 @@ import java.util.LinkedHashMap;
public enum Current {
Undefined,
//--
ServerSapfor,
SapforScenario,
SapforEtalonTaskResult,//самый левый пакет
SapforTaskResult,
@@ -388,9 +389,17 @@ public enum Current {
public static SapforTestingSystem.SapforScenario.SapforScenario getSapforScenario() {
return (SapforTestingSystem.SapforScenario.SapforScenario) get(Current.SapforScenario);
}
public static boolean HasServerSapfor() {
return get(Current.ServerSapfor) != null;
}
public static SapforTestingSystem.ServerSapfor.ServerSapfor getServerSapfor() {
return (SapforTestingSystem.ServerSapfor.ServerSapfor) get(Current.ServerSapfor);
}
//--------------------------------------------
public String getDescription() {
switch (this) {
case ServerSapfor:
return "тестовая версия SAPFOR";
case SapforScenario:
return "сценарий SAPFOR";
case SapforProfile:

View File

@@ -88,6 +88,7 @@ public class Global {
public static File PerformanceAnalyzerDirectory;
public static File DataBackUpsDirectory;
public static File PackagesDirectory;
public static File SapforsDirectory;
//------------------------------------------------------------------
public static Visualiser visualiser = null;
public static Visualizer_2 visualizer_2 = null;
@@ -143,6 +144,7 @@ public class Global {
Utils.CheckDirectory(TestsDirectory = Paths.get(Home, Tests).toFile());
Utils.CheckDirectory(RepoDirectory = Paths.get(Home, Repo).toFile());
Utils.CheckDirectory(PackagesDirectory = Paths.get(Home, Packages).toFile());
Utils.CheckDirectory(SapforsDirectory = Paths.get(Home, "Sapfors").toFile());
}
public static void CreateLog() {
Log = new Loggable() {

View File

@@ -3,7 +3,7 @@ import Common.UI.Menus_2023.DataMenuBar;
import Visual_DVM_2021.Passes.PassCode_2021;
public class RemoteSapforsMenuBar extends DataMenuBar {
public RemoteSapforsMenuBar() {
super("SAPFOR", PassCode_2021.InstallRemoteSapfor,
super("SAPFOR",
PassCode_2021.AddSapfor,
PassCode_2021.EditSapfor,
PassCode_2021.DeleteSapfor);

View File

@@ -0,0 +1,8 @@
package Common.UI.Menus_2023.ServerSapforsBar;
import Common.UI.Menus_2023.DataMenuBar;
import Visual_DVM_2021.Passes.PassCode_2021;
public class ServerSapforsBar extends DataMenuBar {
public ServerSapforsBar() {
super("SAPFOR", PassCode_2021.InstallServerSapfor);
}
}

View File

@@ -22,6 +22,7 @@ import Common.UI.Menus_2023.SapforConfigurationsMenuBar.SapforConfigurationsMenu
import Common.UI.Menus_2023.SapforScenariosBar.SapforScenariosBar;
import Common.UI.Menus_2023.SapforTasksMenuBar.SapforTasksMenuBar;
import Common.UI.Menus_2023.SapforTasksPackagesBar.SapforTasksPackagesBar;
import Common.UI.Menus_2023.ServerSapforsBar.ServerSapforsBar;
import Common.UI.Menus_2023.SubscribersMenuBar.SubscribersMenuBar;
import Common.UI.Menus_2023.TasksPackagesMenuBar.TasksPackagesMenuBar;
import Common.UI.Menus_2023.TestRunTasksMenuBar.TestRunTasksMenuBar;
@@ -71,6 +72,7 @@ import Repository.BugReport.BugReportsDBTable;
import Repository.Component.UI.ComponentsForm;
import Repository.Subscribes.SubsribersDBTable;
import SapforTestingSystem.SapforScenario.SapforScenariosDBTable;
import SapforTestingSystem.ServerSapfor.ServerSapforsDBTable;
import TestingSystem.Configuration.UI.ConfigurationDBTable;
import TestingSystem.Group.GroupsDBTable;
import SapforTestingSystem.SapforConfiguration.SapforConfigurationDBTable;
@@ -248,6 +250,7 @@ public class UI {
menuBars.put(VariantsSet.class, new VariantsMenuBar());
menuBars.put(SubsribersDBTable.class, new SubscribersMenuBar());
menuBars.put(SapforProfilesDBTable.class, new DataMenuBar("профили", PassCode_2021.SaveProfile, PassCode_2021.EditProfile, PassCode_2021.ApplyProfile,PassCode_2021.DeleteProfile));
menuBars.put(ServerSapforsDBTable.class, new ServerSapforsBar());
//---->>
}
public static void CreateWindows() {

View File

@@ -1,4 +1,5 @@
package Common.Utils.Validators;
import Common.Constants.Constants;
import Common.Global;
import Common.Utils.Utils;
@@ -79,7 +80,7 @@ public class ShellParser {
test = test.toLowerCase();
state = test.endsWith(userName.toLowerCase()) ? ShellParserState.MachineName : ShellParserState.Skip;
invitationBuilder.append(c);
} else if (isNameCharacter()||(c=='['))
} else if (isNameCharacter() || (c == '['))
invitationBuilder.append(c);
else
state = ShellParserState.Skip;
@@ -132,13 +133,14 @@ public class ShellParser {
userName = userName_in;
}
public static void printChar() {
int code = c;
if ((!return_active) || (c == '\n')) {
System.out.print(c == '\r' ? ("\\r") :
(c=='\n'? "\\n\n":c));
if (isCommandSymbol())
System.out.print(Utils.RBrackets(code));
if (c != Constants.boop) {
int code = c;
if ((!return_active) || (c == '\n')) {
System.out.print(c == '\r' ? ("\\r") :
(c == '\n' ? "\\n\n" : c));
if (isCommandSymbol())
System.out.print(Utils.RBrackets(code));
}
}
}
public static void ReadInvitation(InputStreamReader fromServer) {
@@ -172,7 +174,7 @@ public class ShellParser {
break;
}
}
// System.out.println(Utils.Brackets(state));
// System.out.println(Utils.Brackets(state));
// }
} else
state = ShellParserState.End;

View File

@@ -1,10 +1,10 @@
package GlobalData.Machine;
import Common.Constants.Constants;
import Common.Database.iDBObject;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.Compiler.Compiler;
import GlobalData.User.User;
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
import java.util.LinkedHashMap;
public class Machine extends iDBObject {
@@ -24,7 +24,7 @@ public class Machine extends iDBObject {
return type.equals(MachineType.Local) ? name : (address + ":" + port);
}
public String getFullDescription() {
return this.equals(ConnectionPass.rep_machine) ? "Репозиторий визуализатора" : "Машина по адресу " + Utils.Brackets(getURL());
return this.equals(Constants.repository_machine) ? "Репозиторий визуализатора" : "Машина по адресу " + Utils.Brackets(getURL());
}
public LinkedHashMap<Integer, Compiler> getCompilers() {
return Global.db.getMapByFKi(this, Compiler.class);

View File

@@ -1,8 +0,0 @@
package GlobalData.SVN;
public class 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";
public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor";
//--
public static final String LOADED = "LOADED";
}

View File

@@ -65,5 +65,7 @@ public enum ServerCode {
//--
CheckURLRegistered,
DVMConvertProject,
SetRole, OLD
SetRole,
InstallSapforForTesting,
OLD
}

View File

@@ -54,9 +54,9 @@ public class SapforTestingPlanner extends ThreadsPlanner {
try {
System.out.println("Запись результатов");
Utils.jsonToFile(results_json, new File(Global.Home, "results"));
// System.out.println("Очистка служебных файлов"); очистку проводить извне чтобы удалялись джарники и ехе
System.out.println("Очистка служебных файлов");
//тут же и строить версии.
//Utils.deleteFilesByExtensions(new File(Global.Home),"proj","dep", "txt", "bat", "sh", "exe", "jar");
Utils.deleteFilesByExtensions(new File(Global.Home),"proj","dep", "bat");
System.out.println("Нажмите любую клавишу для выхода...");
System.in.read();
} catch (Exception e) {

View File

@@ -0,0 +1,33 @@
package SapforTestingSystem.ServerSapfor;
import Common.Database.iDBObject;
import Common.Utils.Utils;
import ProjectData.LanguageName;
import com.sun.org.glassfish.gmbal.Description;
import java.util.Date;
public class ServerSapfor extends iDBObject {
//--------------------------------------------------------------------->>>
@Description("IGNORE")
public static String version_command = "-ver";//команда запроса версии компилятора.
@Description("IGNORE")
public static String help_command = "-help";// команда запроса help
//--------------------------------------------------------------------->>>
public LanguageName languageName = LanguageName.fortran;
public String home_path = ""; //домашняя папка.
public String call_command = ""; //полная команда вызова.
public String version = "?";
public long buildDate = 0;
public Date getBuildDate() {
return new Date(buildDate);
}
//--
public ServerSapfor() {
}
@Override
public String toString() {
return call_command;
}
public String getVersionCommand() {
return Utils.DQuotes(call_command) + " " + version_command;
}
}

View File

@@ -0,0 +1,121 @@
package SapforTestingSystem.ServerSapfor;
import Common.Current;
import Common.Database.iDBTable;
import Common.UI.DataSetControlForm;
import Common.UI.Tables.TableRenderers;
public class ServerSapforsDBTable extends iDBTable<ServerSapfor> {
public ServerSapforsDBTable() {
super(ServerSapfor.class);
}
@Override
public String getSingleDescription() {
return "SAPFOR";
}
@Override
public String getPluralDescription() {
return "SAPFOR";
}
@Override
public Current CurrentName() {
return Current.ServerSapfor;
}
@Override
public String[] getUIColumnNames() {
return new String[]{"версия", "дата сборки"};
}
@Override
public Object getFieldAt(ServerSapfor object, int columnIndex) {
switch (columnIndex) {
case 1:
return object.version;
case 2:
return object.getBuildDate();
}
return null;
}
@Override
protected DataSetControlForm createUI() {
return new DataSetControlForm(this) {
@Override
protected void AdditionalInitColumns() {
//columns.get(0).setVisible(false);
columns.get(2).setRenderer(TableRenderers.RendererDate);
}
};
}
//---
/*
@Override
public DBObjectDialog<RemoteSapfor, RemoteSapforFields> getDialog() {
return new DBObjectDialog<RemoteSapfor, RemoteSapforFields>(RemoteSapforFields.class) {
@Override
public void validateFields() {
//<editor-fold desc="расположение">
String home = fields.tfHome.getText();
if (!home.isEmpty()) {
if (home.startsWith("/")) {
if (Utils.ContainsCyrillic(home))
Log.Writeln("Расположение системы SAPFOR не может содержать кириллицу");
else {
new PathValidator(home, "Расположение системы SAPFOR", Log).Validate();
}
} else
Log.Writeln("Расположение системы SAPFOR может быть либо пустой строкой, либо путём к файлу");
}
//</editor-fold>
//<editor-fold desc="команда вызова">
String call_command = fields.tfCallCommand.getText();
if (call_command.isEmpty()) Log.Writeln("Команда вызова системы SAPFOR не может быть пустой");
else if (Utils.ContainsCyrillic(call_command))
Log.Writeln("Команда вызова системы SAPFOR не может содержать кириллицу");
else {
switch (call_command.charAt(0)) {
case ' ':
Log.Writeln("Команда вызова системы SAPFOR не может начинаться с пробела.");
break;
case '/':
if (call_command.endsWith("/"))
Log.Writeln("Каталог не может быть указан в качестве команды.");
else new PathValidator(call_command, "Команда вызова системы SAPFOR", Log).Validate();
break;
default:
//это команда.
//самое опасное место. теоретически тут можно ввести любую команду ОС, в том числе rm -rf
if (call_command.contains(" "))
Log.Writeln("Прямая команда вызова системы SAPFOR не может содержать пробелы");
if (!call_command.contains("+") && Utils.ContainsForbiddenName(call_command))
Log.Writeln("Прямая команда вызова системы SAPFOR содержит запрещённые символы");
else {
if (Utils.isLinuxSystemCommand(call_command))
Log.Writeln(Utils.DQuotes(call_command) + " является системной командой Linux");
}
break;
}
}
//</editor-fold>
}
@Override
public void fillFields() {
fields.tfDescription.setText(Result.description);
fields.tfCallCommand.setText(Result.call_command);
fields.tfHome.setText(Result.home_path);
UI.TrySelect(fields.cbLanguageName, Result.languageName);
fields.tfVersion.setText(Result.version);
fields.events_on = true;
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.description = fields.tfDescription.getText();
Result.call_command = fields.tfCallCommand.getText();
Result.home_path = fields.tfHome.getText();
Result.languageName = (LanguageName) fields.cbLanguageName.getSelectedItem();
Result.version = fields.tfVersion.getText();
}
@Override
public int getDefaultHeight() {
return 300;
}
};
*/
}

View File

@@ -9,10 +9,13 @@ import GlobalData.Tasks.TaskState;
import GlobalData.User.User;
import ProjectData.LanguageName;
import ProjectData.Project.db_project_info;
import Repository.Component.Component;
import Repository.Component.Sapfor.Sapfor_F;
import Repository.RepositoryRefuseException;
import Repository.RepositoryServer;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import SapforTestingSystem.ServerSapfor.ServerSapfor;
import TestingSystem.Group.Group;
import TestingSystem.Group.GroupInterface;
import TestingSystem.Tasks.TestCompilationTask;
@@ -23,6 +26,7 @@ import TestingSystem.TasksPackageToKill.TasksPackageToKill;
import TestingSystem.Test.Test;
import TestingSystem.Test.TestInterface;
import TestingSystem.Test.TestType;
import Visual_DVM_2021.Passes.All.BuildComponent;
import Visual_DVM_2021.Passes.All.DownloadRepository;
import Visual_DVM_2021.Passes.All.UnzipFolderPass;
import Visual_DVM_2021.Passes.All.ZipFolderPass;
@@ -195,10 +199,151 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}
//--->>
@Override
protected void startAdditionalThreads() {
testingThread.start();
}
protected TestingPlanner testingPlanner = new TestingPlanner();
protected Thread testingThread = new Thread(() -> testingPlanner.Perform());
//------>>>
public static boolean checkTasks = false;
//--
public static void switchTimer(boolean on) {
if (on)
TimerOn();
else
TimerOff();
}
public static int checkIntervalSecond = 10;
public static Timer checkTimer = null;
public static void TimerOn() {
checkTasks = true;
checkTimer = new Timer(checkIntervalSecond * 1000, e -> {
Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
});
checkTimer.start();
}
public static void TimerOff() {
System.out.println("timer off");
if (checkTimer != null)
checkTimer.stop();
checkTasks = false;
}
public static void ResetTimer() {
TimerOff();
TimerOn();
}
//->>
Group ConvertDirectoryToGroup(File src, LanguageName languageName, TestType testType) throws Exception {
Group object = new Group();
//->>
object.description = src.getName();
object.language = languageName;
object.type = testType;
//-->>
//->>
File[] testsFiles = src.listFiles(pathname ->
pathname.isFile()
&& !pathname.getName().equals("settings")
&& !pathname.getName().equals("test-analyzer.sh")
&& Utils.getExtension(pathname).startsWith(languageName.getDVMCompile()));
;
if (testsFiles != null) {
for (File testFile : testsFiles)
object.testsFiles.put(testFile.getName(), Utils.packFile(testFile));
}
//->>
return object;
}
//->>
public Vector<Group> getRepoGroupsInfo() throws Exception {
Vector<Group> groups = new Vector<>();
File testsSrc = Paths.get(
Global.RepoDirectory.getAbsolutePath(),
"dvm", "tools", "tester", "trunk", "test-suite").toFile();
LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c};
for (LanguageName languageName : supportedLanguages) {
for (TestType testType : TestType.values()) {
File groupsSrc = null;
switch (testType) {
case Correctness:
String languageSrcName = null;
switch (languageName) {
case fortran:
languageSrcName = "Fortran";
break;
case c:
languageSrcName = "C";
break;
}
if (languageSrcName != null) {
groupsSrc = Paths.get(testsSrc.getAbsolutePath(), "Correctness", languageSrcName).toFile();
File[] groupsDirs = groupsSrc.listFiles(File::isDirectory);
if (groupsDirs != null) {
for (File groupDir : groupsDirs)
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType));
}
}
break;
case Performance:
File groupDir = Paths.get(testsSrc.getAbsolutePath(), "Performance").toFile();
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType));
break;
}
}
}
groups.sort(Comparator.comparing(o -> o.description));
return groups;
}
public ServerSapfor InstallSapforForTesting() throws Exception {
Sapfor_F sapfor_f = new Sapfor_F();
//--->>
DownloadRepository downloadRepository = new DownloadRepository(){
@Override
public PassCode_2021 code() {
return PassCode_2021.DownloadRepository;
}
@Override
protected boolean needsAnimation() {
return false;
}
};
BuildComponent buildComponent = new BuildComponent() {
@Override
public PassCode_2021 code() {
return PassCode_2021.BuildComponent;
}
@Override
protected boolean needsAnimation() {
return false;
}
@Override
protected PassCode_2021 necessary() {
return null; //тут схема с проходами не работает. возможно для сервера сделать урезанный список?
}
@Override
protected boolean canStart(Object... args) throws Exception {
target = (Component) args[0];
return true;
}
};
if (!downloadRepository.Do())
throw new RepositoryRefuseException("Не удалось загрузить репозиторий.");
if (!buildComponent.Do(sapfor_f))
throw new RepositoryRefuseException("Не удалось собрать версию SAPFOR.");
//-->>
//реализовать локально. вернуть готовый объект.
return null;
}
@Override
protected void Session() throws Exception {
DBObject dbObject = null;
Test test = null;
switch (code) {
case InstallSapforForTesting:
Print("Установка SAPFOR для тестирования");
InstallSapforForTesting();
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
case SynchronizeTests:
//временный проход. синхронизирует тесты на заданной машине, с сервера.
Print("Синхронизация тестов");
@@ -350,100 +495,4 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
}
}
@Override
protected void startAdditionalThreads() {
testingThread.start();
}
protected TestingPlanner testingPlanner = new TestingPlanner();
protected Thread testingThread = new Thread(() -> testingPlanner.Perform());
//------>>>
public static boolean checkTasks = false;
//--
public static void switchTimer(boolean on) {
if (on)
TimerOn();
else
TimerOff();
}
public static int checkIntervalSecond = 10;
public static Timer checkTimer = null;
public static void TimerOn() {
checkTasks = true;
checkTimer = new Timer(checkIntervalSecond * 1000, e -> {
Pass_2021.passes.get(PassCode_2021.ActualizePackages).Do();
});
checkTimer.start();
}
public static void TimerOff() {
System.out.println("timer off");
if (checkTimer != null)
checkTimer.stop();
checkTasks = false;
}
public static void ResetTimer() {
TimerOff();
TimerOn();
}
//->>
Group ConvertDirectoryToGroup(File src, LanguageName languageName, TestType testType) throws Exception {
Group object = new Group();
//->>
object.description = src.getName();
object.language = languageName;
object.type = testType;
//-->>
//->>
File[] testsFiles = src.listFiles(pathname ->
pathname.isFile()
&& !pathname.getName().equals("settings")
&& !pathname.getName().equals("test-analyzer.sh")
&& Utils.getExtension(pathname).startsWith(languageName.getDVMCompile()));
;
if (testsFiles != null) {
for (File testFile : testsFiles)
object.testsFiles.put(testFile.getName(), Utils.packFile(testFile));
}
//->>
return object;
}
//->>
public Vector<Group> getRepoGroupsInfo() throws Exception {
Vector<Group> groups = new Vector<>();
File testsSrc = Paths.get(
Global.RepoDirectory.getAbsolutePath(),
"dvm", "tools", "tester", "trunk", "test-suite").toFile();
LanguageName[] supportedLanguages = new LanguageName[]{LanguageName.fortran, LanguageName.c};
for (LanguageName languageName : supportedLanguages) {
for (TestType testType : TestType.values()) {
File groupsSrc = null;
switch (testType) {
case Correctness:
String languageSrcName = null;
switch (languageName) {
case fortran:
languageSrcName = "Fortran";
break;
case c:
languageSrcName = "C";
break;
}
if (languageSrcName != null) {
groupsSrc = Paths.get(testsSrc.getAbsolutePath(), "Correctness", languageSrcName).toFile();
File[] groupsDirs = groupsSrc.listFiles(File::isDirectory);
if (groupsDirs != null) {
for (File groupDir : groupsDirs)
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType));
}
}
break;
case Performance:
File groupDir = Paths.get(testsSrc.getAbsolutePath(), "Performance").toFile();
groups.add(ConvertDirectoryToGroup(groupDir, languageName, testType));
break;
}
}
}
groups.sort(Comparator.comparing(o -> o.description));
return groups;
}
}

View File

@@ -1,11 +1,12 @@
package TestingSystem;
import Common.Database.SQLITE.SQLiteDatabase;
import GlobalData.Settings.SettingName;
import SapforTestingSystem.SapforConfiguration.SapforConfigurationDBTable;
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
import SapforTestingSystem.ServerSapfor.ServerSapforsDBTable;
import TestingSystem.Configuration.UI.ConfigurationDBTable;
import TestingSystem.Group.GroupsDBTable;
import TestingSystem.MachineMaxKernels.MachineMaxKernelsDBTable;
import SapforTestingSystem.SapforConfiguration.SapforConfigurationDBTable;
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommandsDBTable;
import TestingSystem.TSetting.TSetting;
import TestingSystem.TSetting.TSettingsDBTable;
import TestingSystem.Test.TestDBTable;
@@ -20,7 +21,8 @@ public class TestsDatabase extends SQLiteDatabase {
//--
public SapforConfigurationDBTable sapforConfigurations;
public SapforConfigurationCommandsDBTable sapforConfigurationCommands;
//
public ServerSapforsDBTable serverSapfors;
//
//--
public TestsDatabase() {
super(Paths.get(System.getProperty("user.dir"), "Data", TasksDatabase.tests_db_name + ".sqlite").toFile());
@@ -35,6 +37,7 @@ public class TestsDatabase extends SQLiteDatabase {
//-
addTable(sapforConfigurations = new SapforConfigurationDBTable());
addTable(sapforConfigurationCommands = new SapforConfigurationCommandsDBTable());
addTable(serverSapfors = new ServerSapforsDBTable());
}
@Override
public void Init() throws Exception {
@@ -50,7 +53,6 @@ public class TestsDatabase extends SQLiteDatabase {
Update(setting);
return res;
}
public long IncSapforMaxTaskId() throws Exception {
TSetting setting = settings.get(SettingName.SapforTaskMaxId);
long res = setting.value;

View File

@@ -31,7 +31,7 @@ public class BuildComponent extends ProcessPass<Component> {
ShowMessage1("Сборка " + target.getComponentType().getDescription());
PerformScript(target.getAssemblyCommand());
if (!target.getAssemblyFile().exists())
throw new PassException("Сборка не найдена");
throw new PassException("Сборка не найдена");
Files.copy(target.getAssemblyFile().toPath(),
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
if (!target.getNewFile().exists())

View File

@@ -1,14 +1,13 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.SVN.SVN;
import Visual_DVM_2021.Passes.ProcessPass;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class DownloadRepository extends ProcessPass {
File dvmHome;
File sapforHome;
@Override
@@ -20,23 +19,23 @@ public class DownloadRepository extends ProcessPass {
return true;
}
private void synchronize(String src, File dst) throws Exception {
File loadedFile = Paths.get(dst.getAbsolutePath(), SVN.LOADED).toFile();
File loadedFile = Paths.get(dst.getAbsolutePath(), Constants.LOADED).toFile();
if (loadedFile.exists()) {
PerformScript("cd " +
dst.getAbsolutePath() +
"\nsvn update " + SVN.REPOSITORY_AUTHENTICATION + "\n");
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
} else {
Utils.CleanDirectory(dst);
PerformScript("cd Repo\nsvn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
FileUtils.write(loadedFile, "+");
}
}
@Override
protected void body() throws Exception {
ShowProgress(2, 0, true);
synchronize(SVN.DVM_REPOSITORY, dvmHome);
synchronize(Constants.DVM_REPOSITORY, dvmHome);
ShowProgress(2, 1, true);
synchronize(SVN.SAPFOR_REPOSITORY, sapforHome);
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
ShowProgress(2, 2, true);
}
}

View File

@@ -1,93 +0,0 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.Machine.MachineType;
import GlobalData.RemoteFile.RemoteFile;
import GlobalData.RemoteSapfor.RemoteSapfor;
import GlobalData.SVN.SVN;
import ProjectData.LanguageName;
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
public class InstallRemoteSapfor extends CurrentConnectionPass<RemoteSapfor> {
boolean result;
String version_text;
@Override
public String getIconPath() {
return "/icons/DownloadAll.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected boolean canStart(Object... args) {
result = false;
version_text = "";
target = null;
if (super.canStart(args)) {
if (Current.getMachine().type.equals(MachineType.Server)) {
return true;
} else
Log.Writeln_("Установка системы SAPFOR разрешена только на одиночном сервере.");
}
return false;
}
@Override
protected void ServerAction() throws Exception {
RemoteFile repo = new RemoteFile(user.workspace, "repo");
tryMKDir(repo);
ShowMessage1("Синхронизация ветви DVM...");
ShellCommand(
"cd " + Utils.DQuotes(repo.full_name),
"svn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + SVN.DVM_REPOSITORY + "\n"
);
ShowMessage1("Синхронизация ветви SAPFOR...");
ShellCommand(
"cd " + Utils.DQuotes(repo.full_name),
"svn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + SVN.SAPFOR_REPOSITORY + "\n"
);
RemoteFile repoSapforHome = new RemoteFile(repo.full_name + "/sapfor/experts/Sapfor_2017/_bin", true);
ShowMessage1("Сборка SAPFOR...");
ShellCommand(
"cd " + Utils.DQuotes(repoSapforHome.full_name),
"cmake ../",
"make -j 4"
);
result = Exists(repoSapforHome.full_name, "Sapfor_F");
if (result) {
//создать папку. Для того чтобы скопировать из репозитория.
RemoteFile sapforHome = new RemoteFile(user.workspace, Utils.getDateName("sapfor"));
tryMKDir(sapforHome);
RemoteFile repoSapforBin = new RemoteFile(repoSapforHome, "Sapfor_F");
RemoteFile sapforBin = new RemoteFile(sapforHome, "Sapfor_F");
copy(repoSapforBin, sapforBin);
target = new RemoteSapfor();
target.description = "";
target.home_path = sapforHome.full_name;
target.call_command = sapforBin.full_name;
target.languageName = LanguageName.fortran;
target.machine_id = Current.getMachine().id;
ParseVersion();
}
}
public void ParseVersion() throws Exception {
String raw = ShellCommand(target.getVersionCommand());
String[] data = raw.split(" ");
if (data.length >= 4)
target.version = data[3].replace(",", "");
}
@Override
protected boolean validate() {
return result;
}
@Override
protected void performDone() throws Exception {
super.performDone();
Global.db.Insert(target);
}
@Override
protected void showDone() throws Exception {
super.showDone();
Global.db.remoteSapfors.ShowUI(target.getPK());
}
}

View File

@@ -0,0 +1,114 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.RemoteFile.RemoteFile;
import ProjectData.LanguageName;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import SapforTestingSystem.ServerSapfor.ServerSapfor;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
import Visual_DVM_2021.Passes.TestingSystemPass;
import java.util.Date;
public class InstallServerSapfor extends ConnectionPass<Object> {
boolean result;
ServerSapfor serverSapfor;
String version_text;
@Override
public String getIconPath() {
return "/icons/DownloadAll.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
public void Connect() throws Exception {
machine = Constants.repository_machine;
user = Constants.repository_user;
super.Connect();
}
@Override
protected boolean canStart(Object... args) {
result = false;
version_text = "";
serverSapfor = null;
return true;
}
@Override
protected boolean needsInitialize() {
return false;
}
@Override
protected void ServerAction() throws Exception {
RemoteFile testingSystemHome = new RemoteFile(sftpChannel.pwd(), "testing_system", true);
RemoteFile repo = new RemoteFile(testingSystemHome.full_name, "Repo", true);
RemoteFile repoSapforHome = new RemoteFile(repo.full_name + "/sapfor/experts/Sapfor_2017/_bin", true);
//-->>
ShowMessage1("Синхронизация ветви DVM...");
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.DVM_REPOSITORY + "\n");
ShowMessage1("Синхронизация ветви SAPFOR...");
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.SAPFOR_REPOSITORY + "\n");
ShowMessage1("Сборка SAPFOR...");
ShellCommand("cd " + Utils.DQuotes(repoSapforHome.full_name), "cmake ../", "make -j 4");
result = Exists(repoSapforHome.full_name, "Sapfor_F");
if (result) {
RemoteFile sapforsDirectory = new RemoteFile(testingSystemHome.full_name, "Sapfors", true);
//создать папку. Для того чтобы скопировать из репозитория.
RemoteFile sapforHome = new RemoteFile(sapforsDirectory.full_name, Utils.getDateName("sapfor"));
tryMKDir(sapforHome);
RemoteFile repoSapforBin = new RemoteFile(repoSapforHome, "Sapfor_F");
RemoteFile sapforBin = new RemoteFile(sapforHome, "Sapfor_F");
copy(repoSapforBin, sapforBin);
//-->>>
serverSapfor = new ServerSapfor();
serverSapfor.home_path = sapforHome.full_name;
serverSapfor.call_command = sapforBin.full_name;
serverSapfor.languageName = LanguageName.fortran;
serverSapfor.buildDate = new Date().getTime();
///--->>
String raw = ShellCommand(serverSapfor.getVersionCommand());
String[] data = raw.split(" ");
if (data.length >= 4) serverSapfor.version = data[3].replace(",", "");
//---
result = new TestingSystemPass() {
@Override
public String getDescription() {
return "Публикация тестовой версии";
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", serverSapfor));
}
}.Do();
}
}
@Override
protected boolean validate() {
return result;
}
@Override
protected void performFinish() throws Exception {
super.performFinish();
passes.get(PassCode_2021.SynchronizeTests).Do();
}
@Override
protected void showDone() throws Exception {
super.showDone();
Global.testingServer.db.serverSapfors.ui_.Show(serverSapfor.getPK());
}
}
/*
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import SapforTestingSystem.ServerSapfor.ServerSapfor;
import Visual_DVM_2021.Passes.TestingSystemPass;
public class InstallServerSapfor extends TestingSystemPass<ServerSapfor> {
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.InstallSapforForTesting));
}
}
*/

View File

@@ -2,6 +2,7 @@ package Visual_DVM_2021.Passes;
public enum PassCode_2021 {
Undefined,
//-
InstallServerSapfor,
SaveProfile,
ApplyProfile,
EditProfile,
@@ -294,7 +295,6 @@ public enum PassCode_2021 {
AddSapfor,
EditSapfor,
DeleteSapfor,
InstallRemoteSapfor,
//--
PublishSapforConfiguration,
EditSapforConfiguration,
@@ -311,6 +311,8 @@ public enum PassCode_2021 {
switch (this) {
case Undefined:
return "?";
case InstallServerSapfor:
return "Собрать актуальную версию SAPFOR";
case CompareSapforPackages:
return "Сравнение пакетов задач SAPFOR";
case EditProfile:
@@ -379,8 +381,6 @@ public enum PassCode_2021 {
return "Редактировать конфигурацию тестирования SAPFOR на сервере";
case DeleteSapforConfiguration:
return "Удалить выбранные конфигурации тестирования SAPFOR на сервере";
case InstallRemoteSapfor:
return "Установить систему SAPFOR";
case AddSapfor:
return "Добавление SAPFOR";
case EditSapfor:

View File

@@ -2,7 +2,6 @@ package Visual_DVM_2021.Passes.SSH;
import Common.Utils.Utils;
import Common.Utils.Validators.ShellParser;
import GlobalData.Machine.Machine;
import GlobalData.Machine.MachineType;
import GlobalData.RemoteFile.RemoteFile;
import GlobalData.User.User;
import ProjectData.Project.db_project_info;
@@ -40,7 +39,6 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
public static final String projects = "projects";
public static final String compilers = "compilers";
public static final String tests = "tests";
public static Machine rep_machine = new Machine("Ubuntu", "alex-freenas.ddns.net", 23, MachineType.Undefined);
public Machine machine = null;
public User user = null;
//тут как в WinScp - 2 независимых канала. один для файлов. другой для команд.

View File

@@ -870,28 +870,26 @@
<properties/>
<border type="none"/>
<children>
<splitpane id="d917c" binding="SC59">
<splitpane id="fd5c0" binding="SC63">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="200" height="200"/>
</grid>
</constraints>
<properties>
<dividerLocation value="450"/>
<dividerLocation value="200"/>
<dividerSize value="3"/>
</properties>
<border type="none"/>
<children>
<grid id="43138" layout-manager="BorderLayout" hgap="0" vgap="0">
<grid id="71344" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<splitpane position="left"/>
</constraints>
<properties>
<minimumSize width="300" height="100"/>
</properties>
<properties/>
<border type="none"/>
<children>
<grid id="4efae" binding="sapforConfigurationsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<grid id="3f38c" binding="serverSapforsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
@@ -899,21 +897,57 @@
</grid>
</children>
</grid>
<grid id="40870" layout-manager="BorderLayout" hgap="0" vgap="0">
<grid id="75d3f" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<splitpane position="right"/>
</constraints>
<properties>
<minimumSize width="300" height="0"/>
</properties>
<properties/>
<border type="none"/>
<children>
<grid id="e7342" binding="sapforConfigurationCommandsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<splitpane id="3edb9" binding="SC59">
<constraints border-constraint="Center"/>
<properties/>
<properties>
<dividerLocation value="450"/>
<dividerSize value="3"/>
</properties>
<border type="none"/>
<children/>
</grid>
<children>
<grid id="c8c41" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<splitpane position="left"/>
</constraints>
<properties>
<minimumSize width="300" height="100"/>
</properties>
<border type="none"/>
<children>
<grid id="f3493" binding="sapforConfigurationsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
<grid id="a6851" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<splitpane position="right"/>
</constraints>
<properties>
<minimumSize width="300" height="0"/>
</properties>
<border type="none"/>
<children>
<grid id="25242" binding="sapforConfigurationCommandsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</splitpane>
</children>
</grid>
</children>

View File

@@ -43,9 +43,10 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
public JSplitPane SC56;
public JSplitPane SC57;
public JSplitPane SC58;
public JSplitPane SC59;
public JSplitPane SC19;
public JSplitPane SC62;
public JSplitPane SC63;
public JSplitPane SC59;
//-
//---
private JPanel machinesPanel;
@@ -88,6 +89,7 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
private JLabel sapforTasksLabel;
private JPanel groupsBackground;
private JPanel sapforScenariosPanel;
private JPanel serverSapforsPanel;
private JPanel testsRunTasksBackground;
private JCheckBox filterFinished;
private JButton bTest;
@@ -150,8 +152,10 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
//--
Global.testingServer.db.sapforConfigurations.mountUI(sapforConfigurationsPanel);
Global.testingServer.db.sapforConfigurationCommands.mountUI(sapforConfigurationCommandsPanel);
Global.testingServer.db.serverSapfors.mountUI(serverSapforsPanel);
Global.db.sapforScenarios.mountUI(sapforScenariosPanel);
Global.db.sapforTasksPackages.mountUI(sapforPackagesPanel);
//Global.db.sapforTasks.mountUI(sapforTasksPanel);
// Global.testingServer.account_db.sapforTasksPackages.mountUI(sapforPackagesPanel);
// Global.testingServer.account_db.sapforTasks.mountUI(sapforTasksPanel);
@@ -185,9 +189,9 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
Global.testingServer.db.configurations.ShowUI();
Global.testingServer.db.groups.ShowUI();
Global.testingServer.account_db.packages.ShowUI();
Global.testingServer.db.serverSapfors.ShowUI();
Global.testingServer.db.sapforConfigurations.ShowUI();
Global.db.sapforScenarios.ShowUI();
// Global.db.sapforTasksPackages.ShowUI();
}
//-
@Override

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Visual_DVM_2021.UI.Main.buffer">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="BorderLayout" hgap="0" vgap="0">
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Visual_DVM_2021.UI.Main.buffer_">
<grid id="27dc6" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="20" width="0" height="641"/>
<xy x="20" y="20" width="0" height="400"/>
</constraints>
<properties/>
<border type="none"/>

View File

@@ -1,5 +1,4 @@
package Visual_DVM_2021.UI.Main;
import javax.swing.*;
public class buffer {
private JPanel panel1;
public class buffer_ {
}