обновлены проходы создания группы из папки, и теста из папки. Осталось обновить загрузку тестов из репозитория, там тоже задействована размерность.
This commit is contained in:
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