v++
Массовое определение размерности тестов
This commit is contained in:
@@ -381,6 +381,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Print("Заменить json DVM пакета");
|
||||
ReplaceDVMPackageJson();
|
||||
break;
|
||||
case DetectTestsMinMaxDim:
|
||||
Print("Определить размерность тестов");
|
||||
DetectTestsMinMaxDim();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
@@ -805,7 +809,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
task.test_description,
|
||||
versionProject.getName()
|
||||
);
|
||||
versions.put(String.join("_", name_parts),versionProject);
|
||||
versions.put(String.join("_", name_parts), versionProject);
|
||||
paths.add(versionProject.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
@@ -814,11 +818,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Vector<Test> tests = new Vector<>();
|
||||
for (String description : versions.keySet()) {
|
||||
File src = versions.get(description);
|
||||
File [] files = src.listFiles(pathname -> !pathname.isDirectory());
|
||||
if (files!=null && files.length>0){
|
||||
File[] files = src.listFiles(pathname -> !pathname.isDirectory());
|
||||
if (files != null && files.length > 0) {
|
||||
//--
|
||||
Vector<String> filesNames = new Vector<>();
|
||||
for (File file: files)
|
||||
for (File file : files)
|
||||
filesNames.add(file.getName());
|
||||
//--
|
||||
Test test = new Test();
|
||||
@@ -848,9 +852,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
//определение размерности тестов
|
||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||
if (serverSapfor!=null){
|
||||
if (serverSapfor != null) {
|
||||
File sapfor_copy = Sapfor.getTempCopy(new File(serverSapfor.call_command));
|
||||
for (Test test: tests){
|
||||
for (Test test : tests) {
|
||||
try {
|
||||
Sapfor.getMinMaxDim(sapfor_copy, test.getServerPath(), test);
|
||||
db.Update(test);
|
||||
@@ -859,26 +863,55 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
);
|
||||
File visualiser_data = new File(test.getServerPath(), Constants.data);
|
||||
FileUtils.forceDelete(visualiser_data);
|
||||
}
|
||||
catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
//-"sh"
|
||||
}
|
||||
private void ReplaceDVMPackageJson() throws Exception{
|
||||
response= new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
private void ReplaceDVMPackageJson() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
Pair<DVMPackage, byte[]> p = (Pair<DVMPackage, byte[]>) request.object;
|
||||
DVMPackage src = p.getKey();
|
||||
byte[] packed_file = p.getValue();
|
||||
//todo написать стандартное исключение на несуществование объекта с ключом
|
||||
if (!db.dvmPackages.containsKey(src.id))
|
||||
throw new RepositoryRefuseException("не существует пакета с ключом "+src.id);
|
||||
throw new RepositoryRefuseException("не существует пакета с ключом " + src.id);
|
||||
DVMPackage dst = db.dvmPackages.get(src.id);
|
||||
dst.SynchronizeFields(src);
|
||||
db.Update(dst);
|
||||
Utils_.bytesToFile(packed_file, dst.getJsonFile());
|
||||
}
|
||||
private void DetectTestsMinMaxDim() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
Vector<Object> keys = (Vector<Object>) request.object;
|
||||
for (Object key : keys) {
|
||||
if (!db.tests.containsKey(key))
|
||||
throw new RepositoryRefuseException("не существует пакета с ключом " + key);
|
||||
}
|
||||
//определение размерности тестов
|
||||
ServerSapfor serverSapfor = db.serverSapfors.getLastDoneVersion();
|
||||
if (serverSapfor != null) {
|
||||
File sapfor_copy = Sapfor.getTempCopy(new File(serverSapfor.call_command));
|
||||
for (Object key : keys) {
|
||||
Test test = db.tests.get(key);
|
||||
Group group = db.groups.get(test.group_id);
|
||||
if (group.language.equals(LanguageName.fortran)) {
|
||||
try {
|
||||
Sapfor.getMinMaxDim(sapfor_copy, test.getServerPath(), test);
|
||||
db.Update(test);
|
||||
Utils.deleteFilesByExtensions(test.getServerPath(),
|
||||
"proj", "dep", "jar"
|
||||
);
|
||||
File visualiser_data = new File(test.getServerPath(), Constants.data);
|
||||
FileUtils.forceDelete(visualiser_data);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user