no message

This commit is contained in:
2023-12-18 00:04:44 +03:00
parent 86c6c4700e
commit ed2222c163
8 changed files with 92 additions and 16 deletions

13
.idea/workspace.xml generated
View File

@@ -7,13 +7,14 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DownloadSapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTasks/DVMRunTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTasks/DVMRunTask.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTasks/DVMTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTasks/DVMTask.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPackage/TestingPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingPlanner.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteDVMPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DeleteDVMPackage.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforPackage/SapforPackage.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DownloadDVMPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/DownloadDVMPackage.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/PassCode_2021.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/DeleteTestingPackages.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/DeleteTestingPackages.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -76,5 +76,5 @@ public enum ServerCode {
SapforPackageNeedsKill, SapforPackageNeedsKill,
UpdateActiveSapforPackages, UpdateActiveSapforPackages,
DownloadDVMPackage, DownloadDVMPackage,
DownloadDVMPackages; DownloadDVMPackages, DownloadSapforPackage;
} }

View File

@@ -46,6 +46,9 @@ public abstract class TestingPackage<J> extends riDBObject {
public File getLocalWorkspace() { public File getLocalWorkspace() {
return new File(getHomeDirectory(), String.valueOf(id)); return new File(getHomeDirectory(), String.valueOf(id));
} }
public boolean isLoaded() {
return new File(getLocalWorkspace(), Constants.LOADED).exists();
}
//------------------------ //------------------------
@Description("IGNORED") @Description("IGNORED")
public J package_json = null; public J package_json = null;

View File

@@ -223,6 +223,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Print("Загрузить пакеты DVM"); Print("Загрузить пакеты DVM");
DownloadDVMPackages(); DownloadDVMPackages();
break; break;
case DownloadSapforPackage:
Print("Загрузить пакет SAPFOR");
DownloadSapforPackage();
break;
default: default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code); throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
} }
@@ -452,4 +456,18 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
response = new ServerExchangeUnit_2021(ServerCode.OK); response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = res; response.object = res;
} }
private void DownloadSapforPackage() throws Exception {
int sapforPackage_id = (int) request.object;
if (!db.sapforPackages.containsKey(sapforPackage_id))
throw new RepositoryRefuseException("Не найдено пакета тестирования SAPFOR с ключом " + sapforPackage_id);
response = new ServerExchangeUnit_2021(ServerCode.OK);
SapforPackage sapforPackage = db.sapforPackages.get(sapforPackage_id);
File workspace = sapforPackage.getLocalWorkspace();
File results_zip = Utils.getTempFileName("results");
ZipFolderPass zipFolderPass = new ZipFolderPass();
zipFolderPass.Do(workspace.getAbsolutePath(), results_zip.getAbsolutePath());
if (results_zip.exists())
response.object = Utils.packFile(results_zip);
else throw new RepositoryRefuseException("Не удалось заархивировать пакет тестирования SAPFOR с ключом "+ sapforPackage_id);
}
} }

View File

@@ -39,7 +39,4 @@ public class SapforPackage extends TestingPackage<SapforTasksPackage_json> {
public File getHomeDirectory() { public File getHomeDirectory() {
return Global.SapforPackagesDirectory; return Global.SapforPackagesDirectory;
} }
public boolean isLoaded() {
return false;
}
} }

View File

@@ -0,0 +1,56 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Global;
import Common.Utils.Utils;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
import TestingSystem.Common.TasksPackageState;
import TestingSystem.SAPFOR.SapforPackage.SapforPackage;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.Date;
public class DownloadSapforPackage extends Pass_2021<SapforPackage> {
@Override
protected boolean needsAnimation() {
return true;
}
File loaded;
byte[] packed;
@Override
protected boolean canStart(Object... args) throws Exception {
target = (SapforPackage) args[0];
if (!target.state.equals(TasksPackageState.Done)){
Log.Writeln_("Возможно загрузить только завершенный пакет.");
return false;
}
int id = target.id;
loaded = new File(target.getLocalWorkspace(), Constants.LOADED);
if (!loaded.exists()){
Pass_2021 pass = new TestingSystemPass() {
@Override
public String getDescription() {
return "Скачивание";
}
@Override
protected void ServerAction() throws Exception {
Command(new ServerExchangeUnit_2021(ServerCode.DownloadSapforPackage, "",id));
packed = (byte[]) response.object;
}
};
return pass.Do();
};
return false;
}
@Override
protected void body() throws Exception {
File workspace = target.getLocalWorkspace();
File archive = Utils.getTempFileName(String.valueOf(target.id));
Utils.unpackFile(packed,archive);
passes.get(PassCode_2021.UnzipFolderPass).Do(archive.getAbsolutePath(), Global.SapforPackagesDirectory.getAbsolutePath());
FileUtils.writeStringToFile(loaded, new Date().toString());
}
}

View File

@@ -308,14 +308,17 @@ public enum PassCode_2021 {
AbortSapforPackage, AbortSapforPackage,
DownloadDVMPackage, DownloadDVMPackage,
DownloadDVMPackages, DownloadDVMPackages,
DownloadSapforPackage,
//-> //->
TestPass; TestPass;
public String getDescription() { public String getDescription() {
switch (this) { switch (this) {
case Undefined: case Undefined:
return "?"; return "?";
case DownloadSapforPackage:
return "Синхронизация пакета SAPFOR";
case DownloadDVMPackages: case DownloadDVMPackages:
return "Загрузить пакеты задач DVM"; return "Синхронизация пакетов задач DVM";
case AbortSapforPackage: case AbortSapforPackage:
return "Прервать пакет тестирования SAPFOR"; return "Прервать пакет тестирования SAPFOR";
case StartSapforPackage: case StartSapforPackage:

View File

@@ -33,7 +33,6 @@ public class SapforPackagesComparisonForm {
//-->> //-->>
protected SapforPackage object = null; protected SapforPackage object = null;
//-->> //-->>
// protected DataSet<String, SapforTaskResult> packageTasks;
protected SapforTasksPackageTree Body; protected SapforTasksPackageTree Body;
public JScrollPane treeScroll = null; public JScrollPane treeScroll = null;
//--->> //--->>
@@ -63,19 +62,18 @@ public class SapforPackagesComparisonForm {
} }
} }
public void ApplyObject() { public void ApplyObject() {
/*
//--- //---Загрузка
RemoveObject(); RemoveObject();
//--- //---
TextLog log = new TextLog(); TextLog log = new TextLog();
if (Current.Check(log, Current.SapforPackage)) { if (Current.Check(log, Current.SapforPackage)) {
object = Current.getSapforPackage(); object = Current.getSapforPackage();
if (object.isLoaded() || (Pass_2021.passes.get(PassCode_2021.DownloadSapforPackage).Do(object))) { if (object.isLoaded() || (Pass_2021.passes.get(PassCode_2021.DownloadSapforPackage).Do(object))) {
showObject(); // showObject();
} }
} else } else
UI.Info(log.toString()); UI.Info(log.toString());
*/
} }
public void Show() throws Exception { public void Show() throws Exception {
} }