Рефакторинг конструкторов объектов тестирования.
This commit is contained in:
@@ -3,13 +3,19 @@ import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Global;
|
||||
import Common.UI.VisualCache.DVMConfigurationCache;
|
||||
import Common.UI.VisualCache.VisualCaches;
|
||||
import GlobalData.Account.Account;
|
||||
import GlobalData.Compiler.Compiler;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.User.User;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import TestingSystem.DVM.DVMSettings.DVMSettings;
|
||||
import TestingSystem.DVM.DVMTasks.DVMCompilationTask;
|
||||
import TestingSystem.DVM.DVMTasks.DVMRunTask;
|
||||
|
||||
@@ -27,7 +33,12 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
//---
|
||||
public DVMPackage() {
|
||||
}
|
||||
public DVMPackage(Account account, Machine machine, User user, Compiler compiler, int kernels_in){
|
||||
public DVMPackage(Account account,
|
||||
Machine machine,
|
||||
User user,
|
||||
Compiler compiler,
|
||||
Vector<DVMConfiguration> configurations,
|
||||
int neeedsEmail_in) {
|
||||
id = Constants.Nan;
|
||||
//-
|
||||
sender_name = account.name;
|
||||
@@ -44,12 +55,29 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
drv = compiler.call_command;
|
||||
version = compiler.getVersionInfo();
|
||||
//-
|
||||
kernels = kernels_in; //Global.properties.TestingKernels;
|
||||
needsEmail = Global.properties.EmailOnTestingProgress ? 1 : 0;
|
||||
//--
|
||||
package_json = new DVMPackage_json();
|
||||
needsEmail = neeedsEmail_in;
|
||||
//--
|
||||
state = TasksPackageState.Queued;
|
||||
//--
|
||||
for (DVMConfiguration configuration : configurations)
|
||||
kernels = Math.max(configuration.kernels, kernels);
|
||||
//-
|
||||
tasksCount = 0;
|
||||
Vector<DVMCompilationTask> compilationTasks = new Vector<DVMCompilationTask>();
|
||||
for (DVMConfiguration configuration : configurations) {
|
||||
DVMConfigurationCache cache = (DVMConfigurationCache) VisualCaches.GetCache(configuration);
|
||||
for (Group group : cache.getGroups()) {
|
||||
for (Test test : cache.getGroupTests(group)) {
|
||||
for (DVMSettings dvmSettings : cache.getSettings()) {
|
||||
DVMCompilationTask compilationTask = new DVMCompilationTask(configuration, dvmSettings, group, test, kernels);
|
||||
compilationTasks.add(compilationTask);
|
||||
tasksCount += compilationTask.runTasks.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package_json = new DVMPackage_json(compilationTasks);
|
||||
saveConfigurationsAsJson(configurations);
|
||||
}
|
||||
@Override
|
||||
public Class getJsonClass() {
|
||||
@@ -83,25 +111,8 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address))&&
|
||||
(!DVMPackageDBTable.filterActive || state.isActive() );
|
||||
}
|
||||
public void saveTasks(Vector<DVMCompilationTask> tasks, int allTasksCount){
|
||||
tasksCount=allTasksCount;
|
||||
//--
|
||||
package_json=new DVMPackage_json();
|
||||
DVMPackage_json json = package_json;
|
||||
//инициализируем идентификаторы задач.
|
||||
for (DVMCompilationTask compilationTask : tasks) {
|
||||
//--
|
||||
compilationTask.id = json.getMaxTaskId();
|
||||
//-
|
||||
for (DVMRunTask runTask : compilationTask.runTasks) {
|
||||
runTask.id = json.getMaxTaskId();
|
||||
runTask.dvmcompilationtask_id = compilationTask.id;
|
||||
}
|
||||
}
|
||||
json.compilationTasks.addAll(tasks);
|
||||
return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
|
||||
(!DVMPackageDBTable.filterActive || state.isActive());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user