no message
This commit is contained in:
18
src/TestingSystem/Common/Configuration.java
Normal file
18
src/TestingSystem/Common/Configuration.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package TestingSystem.Common;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.riDBObject;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Configuration extends riDBObject {
|
||||
public int maxtime = 300; //лимит времени пуска задачи, входящей в пакет тестов
|
||||
//--
|
||||
public String getFlags(){return "";}
|
||||
public Vector<String> getFlagsArray(){return new Vector<>();}
|
||||
//--
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
Configuration c = (Configuration) src;
|
||||
maxtime = c.maxtime;
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ import Common.Database.DBObject;
|
||||
import Common.Database.riDBObject;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import TestingSystem.Common.Configuration;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.DVM.Configuration.Configuration;
|
||||
import TestingSystem.DVM.Configuration.DVMConfiguration;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
@@ -108,11 +109,11 @@ public abstract class TestingPackage<J> extends riDBObject {
|
||||
public void destructor() {
|
||||
package_json = null;
|
||||
}
|
||||
public Vector<Configuration> getConfigurations() {
|
||||
Vector<Configuration> res = new Vector<>();
|
||||
public Vector<DVMConfiguration> getConfigurations() {
|
||||
Vector<DVMConfiguration> res = new Vector<>();
|
||||
for (int o_id : Utils.unpack(packedConfigurations))
|
||||
if (Global.testingServer.db.configurations.containsKey(o_id))
|
||||
res.add(Global.testingServer.db.configurations.get(o_id));
|
||||
if (Global.testingServer.db.dvm_configurations.containsKey(o_id))
|
||||
res.add(Global.testingServer.db.dvm_configurations.get(o_id));
|
||||
return res;
|
||||
}
|
||||
public Vector<Group> getGroups() {
|
||||
@@ -160,44 +161,34 @@ public abstract class TestingPackage<J> extends riDBObject {
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void addConfigurations(Vector<Configuration> new_configurations) {
|
||||
Vector<String> res = Utils.unpack_s(packedConfigurations);
|
||||
//---
|
||||
System.out.println("old_configs " + res.size());
|
||||
for (String id_ : res) {
|
||||
System.out.println(Utils.Brackets(id_));
|
||||
}
|
||||
//---
|
||||
//------------------------------------------------------->>>
|
||||
public void saveConfigurations(Vector<? extends Configuration> new_configurations) {
|
||||
Vector<String> res = new Vector<>();
|
||||
Vector<String> names = new Vector<>();
|
||||
for (Configuration configuration : new_configurations) {
|
||||
String id_ = String.valueOf(configuration.id);
|
||||
if (!res.contains(id_))
|
||||
res.add(id_);
|
||||
res.add(String.valueOf(configuration.id));
|
||||
names.add(configuration.description);
|
||||
}
|
||||
packedConfigurations = String.join("\n", res);
|
||||
System.out.println("new_configs=" + res.size());
|
||||
for (String id_ : res) {
|
||||
System.out.println(Utils.Brackets(id_));
|
||||
}
|
||||
configurationsNames = String.join(";", names);
|
||||
configurationsCount = new_configurations.size();
|
||||
}
|
||||
public void addGroups(Vector<Group> new_groups) {
|
||||
Vector<String> res = Utils.unpack_s(packedGroups);
|
||||
//---
|
||||
public void saveGroups(Vector<Group> new_groups) {
|
||||
Vector<String> res = new Vector<>();
|
||||
Vector<String> names = new Vector<>();
|
||||
for (Group group : new_groups) {
|
||||
String id_ = String.valueOf(group.id);
|
||||
if (!res.contains(id_))
|
||||
res.add(id_);
|
||||
res.add(String.valueOf(group.id));
|
||||
names.add(group.description);
|
||||
}
|
||||
packedGroups = String.join("\n", res);
|
||||
groupsNames = String.join(";", names);
|
||||
groupsCount = new_groups.size();
|
||||
}
|
||||
public void addTests(Vector<Test> new_tests) {
|
||||
Vector<String> res = Utils.unpack_s(packedTests);
|
||||
//---
|
||||
for (Test test : new_tests) {
|
||||
String id_ = String.valueOf(test.id);
|
||||
if (!res.contains(id_))
|
||||
res.add(id_);
|
||||
}
|
||||
public void saveTests(Vector<Test> new_tests) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (Test test : new_tests)
|
||||
res.add(String.valueOf(test.id));
|
||||
packedTests = String.join("\n", res);
|
||||
testsCount = new_tests.size();
|
||||
}
|
||||
//------------------------------------------------------->>>
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
|
||||
ServerCommand(ServerCode.DeleteObjectByPK, new Pair(TestingPackageToKill.class, ptk_id));
|
||||
} else {
|
||||
//--
|
||||
System.out.println(testingPackage.id+":"+testingPackage.state.getDescription());
|
||||
switch (testingPackage.state) {
|
||||
case TestsSynchronize:
|
||||
TestsSynchronize();
|
||||
|
||||
@@ -54,7 +54,9 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
+ "\nТест будет удален"
|
||||
);
|
||||
}
|
||||
} else if (object instanceof DVMPackage) {
|
||||
}
|
||||
/*
|
||||
else if (object instanceof DVMPackage) {
|
||||
DVMPackage dvmPackage = (DVMPackage) object;
|
||||
//--
|
||||
Utils.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
|
||||
@@ -62,11 +64,26 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
dvmPackage.saveJson();
|
||||
dvmPackage.package_json = null; // объект больше не нужен.
|
||||
//--
|
||||
} else if (object instanceof SapforPackage) {
|
||||
}
|
||||
*/
|
||||
else if (object instanceof SapforPackage) {
|
||||
((SapforPackage) object).init();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterEditAction(DBObject object) throws Exception {
|
||||
if (object instanceof DVMPackage) {
|
||||
DVMPackage dvmPackage = (DVMPackage) object;
|
||||
if (dvmPackage.state == TasksPackageState.Inactive) {//если json не null, требуется его перезапись
|
||||
if (dvmPackage.package_json != null) {
|
||||
Utils.CheckAndCleanDirectory(dvmPackage.getLocalWorkspace());
|
||||
dvmPackage.saveJson();
|
||||
dvmPackage.package_json = null; // объект больше не нужен.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof Test) {
|
||||
Test test = (Test) object;
|
||||
|
||||
@@ -8,7 +8,6 @@ import Repository.Component.Sapfor.Sapfor;
|
||||
import Repository.RepositoryRefuseException;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.Group.GroupsDBTable;
|
||||
import TestingSystem.Common.MachineProcess.MachineProcessSet;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.Common.Test.TestDBTable;
|
||||
import TestingSystem.Common.TestingPackageToKill.TestingPackagesToKillDBTable;
|
||||
@@ -25,19 +24,17 @@ import TestingSystem.SAPFOR.ServerSapfor.ServerSapforState;
|
||||
import TestingSystem.SAPFOR.ServerSapfor.ServerSapforsDBTable;
|
||||
import Visual_DVM_2021.Passes.All.ZipFolderPass;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import com.sun.corba.se.spi.activation.Server;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class TestsDatabase extends SQLiteDatabase {
|
||||
|
||||
public ConfigurationDBTable configurations;
|
||||
public ConfigurationDBTable dvm_configurations;
|
||||
public TestDBTable tests;
|
||||
public GroupsDBTable groups;
|
||||
public DVMPackageDBTable dvmPackages;
|
||||
@@ -57,7 +54,7 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
addTable(configurations = new ConfigurationDBTable());
|
||||
addTable(dvm_configurations = new ConfigurationDBTable());
|
||||
addTable(groups = new GroupsDBTable());
|
||||
addTable(tests = new TestDBTable());
|
||||
addTable(dvmPackages = new DVMPackageDBTable());
|
||||
@@ -306,6 +303,6 @@ public class TestsDatabase extends SQLiteDatabase {
|
||||
public void UnselectAllGTC(){
|
||||
groups.CheckAll(false);
|
||||
tests.CheckAll(false);
|
||||
configurations.CheckAll(false);
|
||||
dvm_configurations.CheckAll(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user