обновлены проходы создания группы из папки, и теста из папки. Осталось обновить загрузку тестов из репозитория, там тоже задействована размерность.
This commit is contained in:
@@ -1,77 +1,69 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
package Visual_DVM_2021.Passes.All;
|
||||||
import Common.Constants;
|
import Common.Constants;
|
||||||
|
import Common.Current;
|
||||||
import Common.Utils.Files.VDirectoryChooser;
|
import Common.Utils.Files.VDirectoryChooser;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import TestingSystem.Common.Group.Group;
|
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.Pass_2021;
|
||||||
|
import Visual_DVM_2021.Passes.PublishTests;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
public class CreateGroupFromDirectory extends Pass_2021<Group> {
|
import java.util.Arrays;
|
||||||
|
public class CreateGroupFromDirectory extends PublishTests {
|
||||||
File dir = null;
|
File dir = null;
|
||||||
File[] files = null;
|
|
||||||
int group_id ;
|
|
||||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки группы");
|
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки группы");
|
||||||
@Override
|
@Override
|
||||||
public String getIconPath() {
|
public String getIconPath() {
|
||||||
return "/icons/CreateProject.png";
|
return "/icons/OpenProject.png";
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getButtonText() {
|
protected boolean getGroup() {
|
||||||
return "";
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected boolean needsAnimation() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
|
||||||
dir = null;
|
dir = null;
|
||||||
files = null;
|
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||||
target = null;
|
|
||||||
group_id = Constants.Nan;
|
|
||||||
//-
|
|
||||||
dir = directoryChooser.ShowDialog();
|
dir = directoryChooser.ShowDialog();
|
||||||
//-
|
|
||||||
if (dir == null)
|
if (dir == null)
|
||||||
return false;
|
return false;
|
||||||
|
else
|
||||||
|
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, dir.getParent());
|
||||||
//--
|
//--
|
||||||
if (!dir.isDirectory()) {
|
if (!dir.isDirectory()) {
|
||||||
Log.Writeln_(Utils.Brackets(dir) + "\nне является папкой!");
|
Log.Writeln_(Utils.Brackets(dir) + "\nне является папкой!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//-
|
//--
|
||||||
if (dir.getName().equals(Constants.data)) {
|
if (dir.getName().equals(Constants.data)) {
|
||||||
Log.Writeln_(Utils.Brackets(dir) + "\nявляется служебной папкой визуализатора!");
|
Log.Writeln_(Utils.Brackets(dir) + "\nявляется служебной папкой визуализатора!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
files = dir.listFiles(File::isDirectory);
|
//--
|
||||||
if (files == null) {
|
if (!Utils.validateProjectFile(dir, Log)) {
|
||||||
Log.Writeln_("Ошибка при получении списка папок");
|
Log.Writeln_("Имя папки " + Utils.Brackets(dir.getName()) + " содержит запрещённые символы " + Constants.all_forbidden_characters_string + ", или кириллицу.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (files.length == 0) {
|
//--
|
||||||
Log.Writeln_("В выбранной папке не найдено ни одной папки");
|
if (passes.get(PassCode_2021.PublishGroup).Do(dir.getName().toUpperCase())){
|
||||||
return false;
|
group = Current.getGroup();
|
||||||
}
|
|
||||||
PublishGroup pass = (PublishGroup) passes.get(PassCode_2021.PublishGroup);
|
|
||||||
if (pass.Do(dir.getName().toUpperCase())) {
|
|
||||||
group_id = (int) pass.pk;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void body() throws Exception {
|
protected boolean findFiles() {
|
||||||
/*
|
File[] files_ = dir.listFiles(File::isDirectory);
|
||||||
for (File file : files) {
|
if (files_ == null) {
|
||||||
ShowMessage1("создание проекта: "+file.getName());
|
Log.Writeln_("Ошибка при получении списка подпапок");
|
||||||
passes.get(PassCode_2021.CreateTestFromDirectory).Do(file, group_id);
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
if (files_.length == 0) {
|
||||||
}
|
Log.Writeln_("В выбранной папке не найдено ни одной папки");
|
||||||
@Override
|
return false;
|
||||||
protected void performFinish() throws Exception {
|
}
|
||||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
files.addAll(Arrays.asList(files_));
|
||||||
|
System.out.println(files.size());
|
||||||
|
for (File file: files){
|
||||||
|
System.out.println(file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import TestingSystem.Common.Group.Group;
|
|||||||
import TestingSystem.Common.Test.Test;
|
import TestingSystem.Common.Test.Test;
|
||||||
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.Pass_2021;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
@@ -26,11 +27,11 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean needsAnimation() {
|
protected boolean needsAnimation() {
|
||||||
return from_directory_chooser;
|
return true;
|
||||||
}
|
}
|
||||||
Group group = null;
|
Group group = null;
|
||||||
File dir = null;
|
File dir = null;
|
||||||
boolean from_directory_chooser=false;
|
boolean from_directory_chooser = false;
|
||||||
Vector<ProjectFile> project_files = new Vector<>();
|
Vector<ProjectFile> project_files = new Vector<>();
|
||||||
@Override
|
@Override
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
@@ -42,7 +43,7 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
dir = directoryChooser.ShowDialog();
|
dir = directoryChooser.ShowDialog();
|
||||||
group = Current.getGroup();
|
group = Current.getGroup();
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
if (from_directory_chooser) Log.Writeln_("Папка не выбрана.");
|
Log.Writeln_("Папка не выбрана.");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, dir.getParent());
|
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, dir.getParent());
|
||||||
@@ -62,21 +63,23 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
int other_project_files = 0;
|
int other_project_files = 0;
|
||||||
//---
|
//---
|
||||||
if (dir.getName().equalsIgnoreCase(Constants.data)) {
|
if (dir.getName().equalsIgnoreCase(Constants.data)) {
|
||||||
if (from_directory_chooser)
|
Log.Writeln_("Папка " + Utils.Brackets(dir) + " является служебной папкой визуализатора.");
|
||||||
Log.Writeln_("Папка " + Utils.Brackets(dir) + " является служебной папкой визуализатора.");
|
return false;
|
||||||
|
}
|
||||||
|
//--
|
||||||
|
if (!Utils.validateProjectFile(dir, Log)) {
|
||||||
|
Log.Writeln_("Имя папки " + Utils.Brackets(dir.getName()) + " содержит запрещённые символы " + Constants.all_forbidden_characters_string + ", или кириллицу.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
if (from_directory_chooser)
|
Log.Writeln_("Не удалось получить список файлов для папки " + Utils.Brackets(dir) + ".");
|
||||||
Log.Writeln_("Не удалось получить список файлов для папки " + Utils.Brackets(dir) + ".");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (!Utils.validateProjectFile(file, Log)) {
|
if (!Utils.validateProjectFile(file, Log)) {
|
||||||
if (from_directory_chooser)
|
Log.Writeln_("Имя файла " + Utils.Brackets(file.getName()) + " содержит запрещённые символы " + Constants.all_forbidden_characters_string + ", или кириллицу.");
|
||||||
Log.Writeln_("Имя файла " + Utils.Brackets(file.getName()) + " содержит запрещённые символы " + Constants.all_forbidden_characters_string + ", или кириллицу.");
|
|
||||||
bad++;
|
bad++;
|
||||||
}
|
}
|
||||||
if (file.isDirectory() && !file.getName().equalsIgnoreCase(Constants.data)) {
|
if (file.isDirectory() && !file.getName().equalsIgnoreCase(Constants.data)) {
|
||||||
@@ -103,20 +106,18 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
if (subdirs > 0) {
|
if (subdirs > 0) {
|
||||||
if (from_directory_chooser) Log.Writeln_("Папка " + Utils.Brackets(dir) + " содержит вложенные подпапки.");
|
Log.Writeln_("Папка " + Utils.Brackets(dir) + " содержит вложенные подпапки.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bad > 0) {
|
if (bad > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (fortran_programs == 0) {
|
if (fortran_programs == 0) {
|
||||||
if (from_directory_chooser)
|
Log.Writeln_("Папка не содержит ни одной программы на языке " + group.language.getDescription() + ".");
|
||||||
Log.Writeln_("Папка не содержит ни одной программы на языке " + group.language.getDescription() + ".");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (other_project_files > 0) {
|
if (other_project_files > 0) {
|
||||||
if (from_directory_chooser)
|
Log.Writeln_("Папка содержит файлы, не являющиеся программами на языке FORTRAN, или заголовочными.");
|
||||||
Log.Writeln_("Папка содержит файлы, не являющиеся программами на языке FORTRAN, или заголовочными.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//-----
|
//-----
|
||||||
@@ -141,11 +142,13 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
//--
|
//--
|
||||||
db_project_info project = target.packCode(dir); //создание копии папки, и архивация.
|
db_project_info project = target.packCode(dir); //создание копии папки, и архивация.
|
||||||
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
||||||
|
File sapfor_copy = Utils.getTempFileName("SAPFOR");
|
||||||
|
FileUtils.copyFile(Current.getSapfor().getFile(), sapfor_copy);
|
||||||
ShowMessage2("Синтаксический анализ");
|
ShowMessage2("Синтаксический анализ");
|
||||||
if (Sapfor.parse(Current.getSapfor().getFile(), project.Home, Current.getSapfor().getConsoleFlags())
|
if (Sapfor.parse(sapfor_copy, project.Home, Current.getSapfor().getConsoleFlags())
|
||||||
) {
|
) {
|
||||||
ShowMessage2("Определение размерности");
|
ShowMessage2("Определение размерности");
|
||||||
if (Sapfor.analysis(Current.getSapfor().getFile(), project.Home,
|
if (Sapfor.analysis(sapfor_copy, project.Home,
|
||||||
PassCode_2021.SPF_GetMaxMinBlockDistribution,
|
PassCode_2021.SPF_GetMaxMinBlockDistribution,
|
||||||
Current.getSapfor().getConsoleFlags())) {
|
Current.getSapfor().getConsoleFlags())) {
|
||||||
for (String line : Sapfor.outputLines) {
|
for (String line : Sapfor.outputLines) {
|
||||||
@@ -162,7 +165,6 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
|||||||
} else {
|
} else {
|
||||||
Log.Writeln_("Не удалось выполнить синтаксический анализ проекта " + Utils.Brackets(dir.getName()));
|
Log.Writeln_("Не удалось выполнить синтаксический анализ проекта " + Utils.Brackets(dir.getName()));
|
||||||
}
|
}
|
||||||
//todo получить значение из файла вывода анализа.
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean validate() {
|
protected boolean validate() {
|
||||||
|
|||||||
@@ -1,94 +1,44 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
package Visual_DVM_2021.Passes.All;
|
||||||
import Common.Constants;
|
|
||||||
import Common.Current;
|
import Common.Current;
|
||||||
import Common.Global;
|
import Common.Global;
|
||||||
import Common.UI.UI;
|
|
||||||
import Common.Utils.Utils;
|
|
||||||
import ProjectData.Project.db_project_info;
|
import ProjectData.Project.db_project_info;
|
||||||
import TestingSystem.Common.Test.Test;
|
import Visual_DVM_2021.Passes.PublishTests;
|
||||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
||||||
import Visual_DVM_2021.Passes.Pass_2021;
|
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class CreateTestsGroupFromSelectedVersions extends Pass_2021<Vector<db_project_info>> {
|
public class CreateTestsGroupFromSelectedVersions extends PublishTests {
|
||||||
int group_id;
|
Vector<db_project_info> versions = new Vector<>();
|
||||||
int test_id;
|
|
||||||
Vector<Test> tests = new Vector<>();
|
|
||||||
@Override
|
|
||||||
protected boolean needsAnimation() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public String getIconPath() {
|
public String getIconPath() {
|
||||||
return "/icons/Publish.png";
|
return "/icons/Publish.png";
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String getButtonText() {
|
protected boolean getGroup() {
|
||||||
return "";
|
if (Current.Check(Log, Current.Group)) {
|
||||||
|
group = Current.getGroup();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
protected boolean findFiles() {
|
||||||
group_id = Constants.Nan;
|
|
||||||
test_id = Constants.Nan;
|
|
||||||
tests = new Vector<>();
|
|
||||||
if (!Current.getAccount().CheckRegistered(Log))
|
|
||||||
return false;
|
|
||||||
if (!Global.versions_multiselection) {
|
if (!Global.versions_multiselection) {
|
||||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
|
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Current.Check(Log, Current.Group)) {
|
versions = new Vector<>();
|
||||||
return false;
|
Current.getRoot().getSelectedVersions(versions);
|
||||||
}
|
if (versions.size() == 0) {
|
||||||
target = new Vector<>();
|
|
||||||
group_id = Current.getGroup().id;
|
|
||||||
Current.getRoot().getSelectedVersions(target);
|
|
||||||
if (target.size() == 0) {
|
|
||||||
Log.Writeln_("Не отмечено ни одной версии.");
|
Log.Writeln_("Не отмечено ни одной версии.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Current.getProject().hasSubdirectories()) {
|
for (db_project_info version : versions)
|
||||||
Log.Writeln_("Запрещено добавлять тестовые проекты, содержащие подпапки!");
|
files.add(version.Home);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
|
if (!Current.getAccount().CheckRegistered(Log))
|
||||||
return false;
|
return false;
|
||||||
}
|
return super.canStart(args);
|
||||||
String cp_info = "";
|
|
||||||
if (Current.HasProject()) {
|
|
||||||
for (db_project_info version : target) {
|
|
||||||
if (version.Home.getAbsolutePath().equals(Current.getProject().Home.getAbsolutePath())) {
|
|
||||||
cp_info = "Текущий проект будет закрыт.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return UI.Question("В текущую группу " + Utils.Brackets(Current.getGroup().description) +
|
|
||||||
"\nбудет добавлено " + target.size() + " тестов.\n" + cp_info +
|
|
||||||
"\nПродолжить");
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void showPreparation() throws Exception {
|
|
||||||
UI.testingBar.ShowAutoCheckTesting();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void body() throws Exception {
|
|
||||||
ShowMessage1("Создание тестов");
|
|
||||||
CreateTestFromDirectory createTestFromDirectory = (CreateTestFromDirectory) passes.get(PassCode_2021.CreateTestFromDirectory);
|
|
||||||
PublishTests publishTests = (PublishTests) passes.get(PassCode_2021.PublishTests);
|
|
||||||
for (db_project_info vizTestProject : target) {
|
|
||||||
ShowMessage2(vizTestProject.name);
|
|
||||||
if (createTestFromDirectory.Do(vizTestProject.Home, Current.getGroup())) {
|
|
||||||
tests.add(createTestFromDirectory.target);
|
|
||||||
} else break;
|
|
||||||
}
|
|
||||||
System.out.println("tests created " + tests.size());
|
|
||||||
ShowMessage1("Публикация тестов");
|
|
||||||
publishTests.Do(tests);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void performFinish() throws Exception {
|
|
||||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void FocusResult() {
|
|
||||||
UI.getMainWindow().FocusTests();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package Visual_DVM_2021.Passes.All;
|
|
||||||
import Repository.Server.ServerCode;
|
|
||||||
import Repository.Server.ServerExchangeUnit_2021;
|
|
||||||
import TestingSystem.Common.Test.Test;
|
|
||||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
|
||||||
|
|
||||||
import java.util.Vector;
|
|
||||||
public class PublishTests extends TestingSystemPass<Vector<Test>> {
|
|
||||||
@Override
|
|
||||||
protected boolean needsAnimation() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected boolean canStart(Object... args) throws Exception {
|
|
||||||
target = (Vector<Test>) args[0];
|
|
||||||
return target != null && !target.isEmpty();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void ServerAction() throws Exception {
|
|
||||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObjects, null, target));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -298,7 +298,6 @@ public enum PassCode_2021 {
|
|||||||
AbortTaskPackage,
|
AbortTaskPackage,
|
||||||
//--
|
//--
|
||||||
CreateGroupFromDirectory,
|
CreateGroupFromDirectory,
|
||||||
PublishTests,
|
|
||||||
CreateTestFromDirectory,
|
CreateTestFromDirectory,
|
||||||
//->
|
//->
|
||||||
TestPass;
|
TestPass;
|
||||||
@@ -308,8 +307,6 @@ public enum PassCode_2021 {
|
|||||||
return "?";
|
return "?";
|
||||||
case CreateTestFromDirectory:
|
case CreateTestFromDirectory:
|
||||||
return "Создать тест из папки";
|
return "Создать тест из папки";
|
||||||
case PublishTests:
|
|
||||||
return "Опубликовать тесты";
|
|
||||||
case SPF_RemoveOmpDirectives:
|
case SPF_RemoveOmpDirectives:
|
||||||
return "Удаление Open MP директив";
|
return "Удаление Open MP директив";
|
||||||
case CreateGroupFromDirectory:
|
case CreateGroupFromDirectory:
|
||||||
|
|||||||
73
src/Visual_DVM_2021/Passes/PublishTests.java
Normal file
73
src/Visual_DVM_2021/Passes/PublishTests.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
package Visual_DVM_2021.Passes;
|
||||||
|
import Common.UI.UI;
|
||||||
|
import Common.Utils.Utils;
|
||||||
|
import Repository.Server.ServerCode;
|
||||||
|
import Repository.Server.ServerExchangeUnit_2021;
|
||||||
|
import TestingSystem.Common.Group.Group;
|
||||||
|
import TestingSystem.Common.Test.Test;
|
||||||
|
import Visual_DVM_2021.Passes.All.CreateTestFromDirectory;
|
||||||
|
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Vector;
|
||||||
|
public abstract class PublishTests extends TestingSystemPass<Vector<Test>> {
|
||||||
|
@Override
|
||||||
|
public String getButtonText() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected boolean needsAnimation() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
protected Group group;
|
||||||
|
protected Vector<File> files;
|
||||||
|
protected abstract boolean getGroup();
|
||||||
|
protected abstract boolean findFiles();
|
||||||
|
@Override
|
||||||
|
protected boolean canStart(Object... args) throws Exception {
|
||||||
|
target = new Vector<>();
|
||||||
|
files = new Vector<>();
|
||||||
|
//--------------------------
|
||||||
|
group = null;
|
||||||
|
if (!getGroup()) return false;
|
||||||
|
if (group == null) {
|
||||||
|
Log.Writeln_("Группа не выбрана.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
files = new Vector<>();
|
||||||
|
if (!findFiles()) return false;
|
||||||
|
if (files.isEmpty()) {
|
||||||
|
Log.Writeln_("Не найдено ни одной папки для формирования теста.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
CreateTestFromDirectory createTestFromDirectory = (CreateTestFromDirectory) passes.get(PassCode_2021.CreateTestFromDirectory);
|
||||||
|
//---
|
||||||
|
for (File file : files) {
|
||||||
|
if (createTestFromDirectory.Do(file, group))
|
||||||
|
target.add(createTestFromDirectory.target);
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
if (target.isEmpty()) {
|
||||||
|
Log.Writeln_("Не удалось создать ни одного теста.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//---
|
||||||
|
return UI.Question("В группу " + Utils.Brackets(group.description) +
|
||||||
|
"\nбудет добавлено " + target.size() + " тестов.\nПродолжить");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void ServerAction() throws Exception {
|
||||||
|
Command(new ServerExchangeUnit_2021(ServerCode.PublishObjects, null, target));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void performFinish() throws Exception {
|
||||||
|
super.performFinish();
|
||||||
|
passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void FocusResult() {
|
||||||
|
UI.getMainWindow().FocusTests();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user