diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6d152ccf..4f4789d0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,6 +9,7 @@
+
diff --git a/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java b/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java
index 92ba3b0c..4ce01788 100644
--- a/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java
+++ b/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java
@@ -17,6 +17,7 @@ import _VisualDVM.TestingSystem.Common.Test.Test;
import com.sun.org.glassfish.gmbal.Description;
import javax.swing.*;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Vector;
public class Configuration extends riDBObject {
@@ -115,7 +116,6 @@ public class Configuration extends riDBObject {
}
return flag;
}
-
public boolean tryUpdateSettings(Settings settings) {
ConfigurationCache unpacked = new ConfigurationCache(this);
for (SettingsJson settingsJson : unpacked.settingsJson.array) {
@@ -147,7 +147,23 @@ public class Configuration extends riDBObject {
ConfigurationCache unpacked = new ConfigurationCache(this);
List actualTests = new Vector<>();
for (TestJson testJson : unpacked.testsJson.array) {
- if (testJson.id == test.id)
+ if (testJson.id==test.id)
+ flag = true;
+ else actualTests.add(testJson);
+ }
+ if (flag) {
+ unpacked.testsJson.array = actualTests;
+ packedTestsJson = Utils_.gson.toJson(unpacked.testsJson);
+ }
+ return flag;
+ }
+
+ public boolean tryDeleteTests(LinkedHashMap tests) {
+ boolean flag = false;
+ ConfigurationCache unpacked = new ConfigurationCache(this);
+ List actualTests = new Vector<>();
+ for (TestJson testJson : unpacked.testsJson.array) {
+ if (tests.containsKey(testJson.id))
flag = true;
else actualTests.add(testJson);
}
diff --git a/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java b/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java
index 63486286..834b5725 100644
--- a/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java
+++ b/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java
@@ -1,10 +1,12 @@
package _VisualDVM.TestingSystem.Common.Test;
import Common.Database.Tables.iDBTable;
+import Common.Utils.Vector_;
import Common.Visual.DataSetControlForm;
import _VisualDVM.TestingSystem.Common.Group.Group;
import _VisualDVM.TestingSystem.Common.Test.UI.TestsForm;
import javax.swing.*;
+import java.util.LinkedHashMap;
import java.util.Vector;
public class TestDBTable extends iDBTable {
public TestDBTable() {
@@ -49,4 +51,18 @@ public class TestDBTable extends iDBTable {
}
return selectedTests.isEmpty() ? allTests : selectedTests;
}
+
+ /*
+ public LinkedHashMap getGroupTests(Group group){
+
+
+ Vector res = new Vector<>();
+ for (Test test: Data.values()){
+ if (test.group_id==group.id){
+ res.add(test);
+ }
+ }
+ return res;
+ }
+ */
}
\ No newline at end of file
diff --git a/src/_VisualDVM/TestingSystem/Common/TestingServer.java b/src/_VisualDVM/TestingSystem/Common/TestingServer.java
index 1af5e8af..58b4e7e5 100644
--- a/src/_VisualDVM/TestingSystem/Common/TestingServer.java
+++ b/src/_VisualDVM/TestingSystem/Common/TestingServer.java
@@ -144,7 +144,6 @@ public class TestingServer extends RepositoryServer {
Utils_.forceDeleteWithCheck(test.getArchive());
Utils_.forceDeleteWithCheck(test.getServerPath());
//--
- //-
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
if (dvmConfiguration.tryDeleteTest(test)) {
db.Update(dvmConfiguration);
@@ -156,32 +155,31 @@ public class TestingServer extends RepositoryServer {
}
}
//--
- } else if (object instanceof Group) {
+ }
+ else if (object instanceof Group) {
Group group = (Group) object;
- Vector tests = new Vector<>();
- for (Test group_test : db.tests.Data.values()) {
- if (group_test.group_id == group.id)
- tests.add(group_test);
- }
- for (Test group_test : tests) {
- db.Delete(group_test);
- Utils_.forceDeleteWithCheck(group_test.getArchive());
- Utils_.forceDeleteWithCheck(group_test.getServerPath());
- }
+ LinkedHashMap groupTests = db.getMapByFKi(group, Test.class);
//--
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
if (dvmConfiguration.tryDeleteGroup(group)) {
- //todo удалить все тесты связанные с группой из конфигурации
+ dvmConfiguration.tryDeleteTests(groupTests);
db.Update(dvmConfiguration);
}
}
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
if (sapforConfiguration.tryDeleteGroup(group)) {
- //todo удалить все тесты связанные с группой из конфигурации
+ sapforConfiguration.tryDeleteTests(groupTests);
db.Update(sapforConfiguration);
}
}
//--
+ for (Test group_test : groupTests.values()) {
+ db.Delete(group_test);
+ Utils_.forceDeleteWithCheck(group_test.getArchive());
+ Utils_.forceDeleteWithCheck(group_test.getServerPath());
+ }
+
+ //--
} else if (object instanceof ServerSapfor) {
Utils_.forceDeleteWithCheck(
new File(