промежуточный. хранение инфы о конфигах, группах и тестах пакета.пока отлаживается.
This commit is contained in:
@@ -2,11 +2,16 @@ package TestingSystem.Common.TestingPackage;
|
||||
import Common.Constants;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Database.riDBObject;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import TestingSystem.DVM.Configuration.Configuration;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public abstract class TestingPackage<J> extends riDBObject {
|
||||
public String PID = "";
|
||||
public int tasksCount = 0; //Общее число задач
|
||||
@@ -22,6 +27,14 @@ public abstract class TestingPackage<J> extends riDBObject {
|
||||
public long ChangeDate = 0;
|
||||
@Description("DEFAULT 0")
|
||||
public int connectionErrosCount = 0;
|
||||
//--
|
||||
@Description("DEFAULT ''")
|
||||
public String packedConfigurations = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String packedGroups = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String packedTests = "";
|
||||
//--
|
||||
public TasksPackageState state = TasksPackageState.Draft;
|
||||
//--
|
||||
@Override
|
||||
@@ -72,4 +85,94 @@ public abstract class TestingPackage<J> extends riDBObject {
|
||||
public void destructor() {
|
||||
package_json = null;
|
||||
}
|
||||
public Vector<Configuration> getConfigurations() {
|
||||
Vector<Configuration> 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));
|
||||
return res;
|
||||
}
|
||||
public Vector<Group> getGroups() {
|
||||
Vector<Group> res = new Vector<>();
|
||||
for (int o_id : Utils.unpack(packedGroups))
|
||||
if (Global.testingServer.db.groups.containsKey(o_id))
|
||||
res.add(Global.testingServer.db.groups.get(o_id));
|
||||
return res;
|
||||
}
|
||||
public Vector<Test> getTests() {
|
||||
Vector<Test> res = new Vector<>();
|
||||
for (int o_id : Utils.unpack(packedTests))
|
||||
if (Global.testingServer.db.tests.containsKey(o_id))
|
||||
res.add(Global.testingServer.db.tests.get(o_id));
|
||||
return res;
|
||||
}
|
||||
public void printCGT() {
|
||||
try {
|
||||
System.out.println("package="+id);
|
||||
Vector<Configuration> configurations = getConfigurations();
|
||||
System.out.println("+");
|
||||
|
||||
Vector<Group> groups = getGroups();
|
||||
Vector<Test> tests = getTests();
|
||||
Vector<String> res = new Vector<>();
|
||||
res.add("конфигурации: " + configurations.size());
|
||||
for (Configuration configuration : configurations)
|
||||
res.add(configuration.description);
|
||||
|
||||
res.add("группы: " + groups.size());
|
||||
for (Group group : groups)
|
||||
res.add(group.description);
|
||||
//--
|
||||
res.add("тесты: " + tests.size());
|
||||
for (Test test : tests)
|
||||
res.add(test.description);
|
||||
//--
|
||||
res.add("-------");
|
||||
System.out.println(String.join("\n", res));
|
||||
}
|
||||
catch (Exception ex){
|
||||
System.out.println("```");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
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_));
|
||||
}
|
||||
//---
|
||||
for (Configuration configuration: new_configurations){
|
||||
String id_ = String.valueOf(configuration.id);
|
||||
if (!res.contains(id_))
|
||||
res.add(id_);
|
||||
}
|
||||
packedConfigurations= String.join("\n", res );
|
||||
System.out.println("new_configs="+res.size());
|
||||
for(String id_: res){
|
||||
System.out.println(Utils.Brackets(id_));
|
||||
}
|
||||
}
|
||||
public void addGroups(Vector<Group> new_groups){
|
||||
Vector<String> res= Utils.unpack_s(packedGroups);
|
||||
//---
|
||||
for (Group group: new_groups){
|
||||
String id_ = String.valueOf(group.id);
|
||||
if (!res.contains(id_))
|
||||
res.add(id_);
|
||||
}
|
||||
packedGroups= String.join("\n", res );
|
||||
}
|
||||
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_);
|
||||
}
|
||||
packedTests= String.join("\n", res );
|
||||
}
|
||||
//------------------------------------------------------->>>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user