++
Оптимизация анализа состояния версий пакетов сапфор
This commit is contained in:
@@ -689,6 +689,16 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
db.Update(dst);
|
||||
Utils_.bytesToFile(packed_file, dst.getJsonFile());
|
||||
}
|
||||
void ReplaceSapforPackageJson() throws Exception {
|
||||
Pair<SapforPackage, byte[]> p = (Pair<SapforPackage, byte[]>) request.object;
|
||||
SapforPackage src = p.getKey();
|
||||
byte[] packed_file = p.getValue();
|
||||
checkExistense(src.id, SapforPackage.class);
|
||||
SapforPackage dst = db.sapforPackages.get(src.id);
|
||||
dst.SynchronizeFields(src);
|
||||
db.Update(dst);
|
||||
Utils_.bytesToFile(packed_file, dst.getJsonFile());
|
||||
}
|
||||
void DetectTestsMinMaxDim() throws Exception {
|
||||
Vector<Object> keys = (Vector<Object>) request.object;
|
||||
for (Object key : keys) {
|
||||
@@ -776,6 +786,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
case ReplaceDVMPackageResults:
|
||||
ReplaceDVMPackageJson();
|
||||
break;
|
||||
case ReplaceSapforPackageResults:
|
||||
ReplaceSapforPackageJson();
|
||||
break;
|
||||
case DetectTestsMinMaxDim:
|
||||
DetectTestsMinMaxDim();
|
||||
break;
|
||||
|
||||
@@ -667,53 +667,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
}
|
||||
//--
|
||||
public void Patch() throws Exception {
|
||||
/*
|
||||
Vector<DVMCompilationOptionsSet> sets1 = new Vector<>();
|
||||
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
||||
OptionsSetJson optionsSetJson = Utils_.gson.fromJson(dvm_settings.packedCompilationOptionsJson, OptionsSetJson.class);
|
||||
for (OptionsJson optionsJson : optionsSetJson.values) {
|
||||
DVMCompilationOptionsSet set = new DVMCompilationOptionsSet(dvm_settings);
|
||||
set.options = new Vector<>();
|
||||
for (OptionJson optionJson : optionsJson.values) {
|
||||
set.options.add(new DVMCompilationOption(optionJson.name, optionJson.value));
|
||||
}
|
||||
sets1.add(set);
|
||||
}
|
||||
}
|
||||
BeginTransaction();
|
||||
for (DVMCompilationOptionsSet set : sets1) {
|
||||
Insert(set);
|
||||
|
||||
for (DVMCompilationOption option : set.options) {
|
||||
option.dvmcompilationoptionsset_id = set.id;
|
||||
Insert(option);
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
Vector<DVMEnvironmentsSet> sets = new Vector<>();
|
||||
for (DVMSettings dvm_settings : dvmSettings.Data.values()) {
|
||||
EnvironmentsSetJson environmentsSetJson = Utils_.gson.fromJson(dvm_settings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
||||
for (EnvironmentsJson environmentsJson : environmentsSetJson.values) {
|
||||
DVMEnvironmentsSet set = new DVMEnvironmentsSet(dvm_settings);
|
||||
set.environments = new Vector<>();
|
||||
for (EnvironmentJson environmentJson : environmentsJson.values) {
|
||||
set.environments.add(new DVMEnvironment(environmentJson.name, environmentJson.value));
|
||||
}
|
||||
sets.add(set);
|
||||
}
|
||||
}
|
||||
BeginTransaction();
|
||||
for (DVMEnvironmentsSet set : sets) {
|
||||
Insert(set);
|
||||
for (DVMEnvironment option : set.environments) {
|
||||
option.dvmenvironmentsset_id = set.id;
|
||||
Insert(option);
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
*/
|
||||
}
|
||||
public Vector<Pair<String, String>> getTasksParameters(DVMSettings dvmSettings_in) {
|
||||
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
||||
Vector<Pair<String, String>> res = new Vector<>();
|
||||
@@ -739,4 +692,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void Patch() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ public class SapforPackage_json implements Serializable {
|
||||
}
|
||||
return comparison_root.mismatches_count;
|
||||
}
|
||||
|
||||
public void getVersionsFiles(SapforPackage package_in) {
|
||||
//---
|
||||
//---
|
||||
|
||||
@@ -27,6 +27,8 @@ public class SapforVersion_json implements Serializable {
|
||||
public String version = "";
|
||||
@Expose
|
||||
public String description = "";
|
||||
@Expose
|
||||
public SapforVersionState state = null;
|
||||
//поля для отображения деревьев.
|
||||
public File Home = null;
|
||||
public LinkedHashMap<String, ProjectFile> files = new LinkedHashMap<>();
|
||||
@@ -39,8 +41,7 @@ public class SapforVersion_json implements Serializable {
|
||||
public SapforTask task = null; //родная задача. Нужна для построения дерева версий.
|
||||
public db_project_info project = null;
|
||||
//--
|
||||
public SapforVersionState state = null;
|
||||
public VersionComparisonState comparisonState = null;
|
||||
public VersionComparisonState comparisonState = VersionComparisonState.Unknown;
|
||||
//--
|
||||
public SapforVersion_json(String version_in, String description_in) {
|
||||
version = version_in;
|
||||
@@ -52,7 +53,6 @@ public class SapforVersion_json implements Serializable {
|
||||
}
|
||||
public void getFiles(File configurationRoot) {
|
||||
//--
|
||||
state = SapforVersionState.Empty;
|
||||
comparisonState = VersionComparisonState.Unknown;
|
||||
//--
|
||||
String relativePath = Utils_.isWindows() ? Utils_.toW(version) : version;
|
||||
@@ -70,7 +70,37 @@ public class SapforVersion_json implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
parse_out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.parse_out_file).toFile());
|
||||
parse_err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.parse_err_file).toFile());
|
||||
out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile());
|
||||
err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile());
|
||||
//--
|
||||
Vector<File> out_files = new Vector<>();
|
||||
out_files.add(parse_out.file);
|
||||
out_files.add(parse_err.file);
|
||||
out_files.add(out.file);
|
||||
out_files.add(err.file);
|
||||
}
|
||||
public void getFilesAndCheckState(File configurationRoot) {
|
||||
//--
|
||||
state = SapforVersionState.Empty;
|
||||
//--
|
||||
String relativePath = Utils_.isWindows() ? Utils_.toW(version) : version;
|
||||
Home = Paths.get(configurationRoot.getAbsolutePath(), relativePath).toFile();
|
||||
files = new LinkedHashMap<>();
|
||||
//--
|
||||
File[] files_ = Home.listFiles();
|
||||
if (files_ != null) {
|
||||
for (File file : files_) {
|
||||
if (file.isFile()) {
|
||||
ProjectFile projectFile = new ProjectFile(file);
|
||||
if (!projectFile.fileType.equals(FileType.forbidden)
|
||||
) {
|
||||
files.put(projectFile.file.getName(), projectFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!files.isEmpty())
|
||||
state = SapforVersionState.Normal;
|
||||
}
|
||||
@@ -84,7 +114,7 @@ public class SapforVersion_json implements Serializable {
|
||||
out_files.add(parse_err.file);
|
||||
out_files.add(out.file);
|
||||
out_files.add(err.file);
|
||||
|
||||
//--
|
||||
for (File file : out_files) {
|
||||
try {
|
||||
if (file.exists()) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
import _VisualDVM.TestingSystem.Common.TasksPackageState;
|
||||
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.Json.SapforVersion_json;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforPackageConfiguration.SapforPackageConfiguration;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforTask.SapforTask;
|
||||
@@ -17,6 +18,7 @@ import _VisualDVM.TestingSystem.SAPFOR.ServerSapfor.ServerSapfor;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
public int sapforId = CommonConstants.Nan; // так как сапфор на машине.
|
||||
@@ -106,8 +108,21 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
|
||||
if (!task.state.equals(TaskState.Done))
|
||||
bad++;
|
||||
else good++;
|
||||
//--
|
||||
Vector<SapforVersion_json> all_versions= new Vector<>();
|
||||
all_versions.addAll(task.versions);
|
||||
all_versions.addAll(task.variants);
|
||||
for (SapforVersion_json version_json: all_versions){
|
||||
File configurationRoot = Utils_.getFile(
|
||||
getLocalWorkspace().getAbsolutePath(),
|
||||
String.valueOf(task.set_id),
|
||||
String.valueOf(task.sapfor_configuration_id));
|
||||
version_json.getFilesAndCheckState(configurationRoot);
|
||||
}
|
||||
//--
|
||||
}
|
||||
state = (bad > 0) ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
|
||||
saveJson();
|
||||
state = ((bad > 0) ||(mismatchesCount>0)) ? TasksPackageState.DoneWithErrors : TasksPackageState.Done;
|
||||
double percent = (((double) (good)) / tasksCount) * 100.0;
|
||||
description = "Выполнено на " + ((int) percent) + "%\n" +
|
||||
"Всего задач: " + tasksCount + ", из них с ошибками " + bad;
|
||||
|
||||
@@ -130,7 +130,9 @@ public class SapforPackagesForm extends RDataSetControlForm<SapforPackage> {
|
||||
addSeparator();
|
||||
addPasses(PassCode.AbortSapforPackage);
|
||||
addSeparator();
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon, PassCode.JoinSapforTestingVersionsToGroup);
|
||||
addPasses(PassCode.CompareSapforPackageToEthalon, PassCode.JoinSapforTestingVersionsToGroup
|
||||
// PassCode.RefreshSapforPackageResults
|
||||
);
|
||||
addSeparator();
|
||||
addPasses(PassCode.DeleteSapforPackage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user