добавление теста через папку.

This commit is contained in:
2023-11-20 20:17:59 +03:00
parent 0dd1bbc8f6
commit 0cfa94eba8
5 changed files with 82 additions and 11 deletions

7
.idea/workspace.xml generated
View File

@@ -8,9 +8,10 @@
<component name="ChangeListManager">
<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$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestsGroupFromSelectedVersions.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestsGroupFromSelectedVersions.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/PerformSapforTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromDirectory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CreateTestFromDirectory.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTestProject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishTestProject.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -202,7 +202,7 @@ public class db_project_info extends DBObject {
db_project_info stored_info = db.LoadOnlyProjectInfo();
if (stored_info == null) {
name = Home.getName();
description = "исходная";
description = "";
creationDate = Utils.getDateNumber(); //----------------------------------------------------------------------------->>>
db.Insert(this);
} else
@@ -222,7 +222,7 @@ public class db_project_info extends DBObject {
db_project_info stored_info = db.LoadOnlyProjectInfo();
if (stored_info == null) {
name = Home.getName();
description = "исходная";
description = "";
creationDate = Utils.getDateNumber(); //----------------------------------------------------------------------------->>>
db.Insert(this);
} else
@@ -239,7 +239,7 @@ public class db_project_info extends DBObject {
db.Disconnect();
dropLastModification();
}
//-
//-исходная
public void CreateVisualiserData() throws Exception {
CheckVisualiserDirectories();
db = new ProjectDatabase(this);
@@ -1531,7 +1531,9 @@ public class db_project_info extends DBObject {
}
public String getLocalName() {
//требует отображения рута. без него работать не будет.
if (Current.HasRoot())
return Home.getAbsolutePath().substring(Current.getRoot().Home.getParentFile().getAbsolutePath().length() + 1);
else return Home.getName();
}
public void SelectAllFiles(boolean b) {
for (DBProjectFile file : db.files.Data.values())
@@ -1549,7 +1551,7 @@ public class db_project_info extends DBObject {
getSubdirectoriesR(Home);
return !subdirectories.isEmpty();
}
public boolean checkSubdirectories(TextLog Log){
public boolean checkSubdirectories(TextLog Log) {
if (hasSubdirectories()) {
Log.Writeln_("Проект содержит вложенные папки!");
return false;

View File

@@ -351,7 +351,7 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
@Override
protected void body() throws Exception {
target.StartDate = new Date().getTime();
target.versions.add(new SapforVersion_json(target.test_description, "исходная"));
target.versions.add(new SapforVersion_json(target.test_description, ""));
for (PassCode_2021 code : sapforConfiguration_json.codes) {
if (parse()) {
if (code.equals(PassCode_2021.CreateParallelVariants))

View File

@@ -1,12 +1,25 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Global;
import Common.Utils.Files.VDirectoryChooser;
import Common.Utils.Utils;
import GlobalData.Settings.SettingName;
import ProjectData.Project.db_project_info;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
import java.io.File;
public class CreateTestFromDirectory extends Pass_2021<Test> {
db_project_info project = null;
Group group= null;
File dir;
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
@Override
public String getIconPath() {
return "/icons/OpenProject.png";
return "/icons/CreateProject.png";
}
@Override
public String getButtonText() {
@@ -16,5 +29,58 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
protected boolean needsAnimation() {
return true;
}
void restoreBrowserPath() {
String last_dir_home =
Global.db.settings.get(SettingName.ProjectsSearchDirectory).Value;
if (!last_dir_home.isEmpty())
directoryChooser.SetCurrentDirectory(last_dir_home);
}
@Override
protected boolean canStart(Object... args) throws Exception {
group = null;
project = null;
dir = null;
target = null;
//-
if (args.length == 0) {
restoreBrowserPath();
if (!Current.Check(Log, Current.Group))
return false;
group = Current.getGroup();
dir = directoryChooser.ShowDialog();
} else {
dir = (File) args[0];
group = (Group) args[1];
}
//-
if (dir == null)
return false;
//--
if (!dir.isDirectory()) {
Log.Writeln_(Utils.Brackets(dir) + "\е является папкой!");
return false;
}
//-
if (dir.getName().equals(Constants.data)) {
Log.Writeln_(Utils.Brackets(dir) + "\nявляется служебной папкой визуализатора!");
return false;
}
return Utils.validateProjectFolder(dir, Log) && Utils.containsSource(dir, true);
}
@Override
protected void performPreparation() throws Exception {
passes.get(PassCode_2021.CloseCurrentProject).Do();
}
@Override
protected void body() throws Exception {
project = new db_project_info(dir);
project.CreateVersionsTree();
project.Open();
project.Close();
}
@Override
protected void performDone() throws Exception {
super.performDone();
passes.get(PassCode_2021.PublishTest).Do(project,group);
}
}

View File

@@ -27,8 +27,10 @@ public class PublishTestProject extends TestingSystemPass<db_project_info> {
File src = new File(Global.TempDirectory, String.valueOf(test_id));
Utils.CheckAndCleanDirectory(src);
target.Clone(src, false);
//--
FileUtils.copyFile(target.db.getFile(),
Paths.get(src.getAbsolutePath(), Constants.data, target.db.getFile().getName()).toFile());
//--
//архивация.
File archive = Utils.getTempFileName(String.valueOf(test_id));
//---