удаление инфы о тестах при удалении группы из конфиги
This commit is contained in:
1
.idea/workspace.xml
generated
1
.idea/workspace.xml
generated
@@ -9,6 +9,7 @@
|
|||||||
<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 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/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Configuration/Configuration.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/Test/TestDBTable.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import _VisualDVM.TestingSystem.Common.Test.Test;
|
|||||||
import com.sun.org.glassfish.gmbal.Description;
|
import com.sun.org.glassfish.gmbal.Description;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class Configuration extends riDBObject {
|
public class Configuration extends riDBObject {
|
||||||
@@ -115,7 +116,6 @@ public class Configuration extends riDBObject {
|
|||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryUpdateSettings(Settings settings) {
|
public boolean tryUpdateSettings(Settings settings) {
|
||||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||||
for (SettingsJson settingsJson : unpacked.settingsJson.array) {
|
for (SettingsJson settingsJson : unpacked.settingsJson.array) {
|
||||||
@@ -147,7 +147,23 @@ public class Configuration extends riDBObject {
|
|||||||
ConfigurationCache unpacked = new ConfigurationCache(this);
|
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||||
List<TestJson> actualTests = new Vector<>();
|
List<TestJson> actualTests = new Vector<>();
|
||||||
for (TestJson testJson : unpacked.testsJson.array) {
|
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<Integer, Test> tests) {
|
||||||
|
boolean flag = false;
|
||||||
|
ConfigurationCache unpacked = new ConfigurationCache(this);
|
||||||
|
List<TestJson> actualTests = new Vector<>();
|
||||||
|
for (TestJson testJson : unpacked.testsJson.array) {
|
||||||
|
if (tests.containsKey(testJson.id))
|
||||||
flag = true;
|
flag = true;
|
||||||
else actualTests.add(testJson);
|
else actualTests.add(testJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package _VisualDVM.TestingSystem.Common.Test;
|
package _VisualDVM.TestingSystem.Common.Test;
|
||||||
import Common.Database.Tables.iDBTable;
|
import Common.Database.Tables.iDBTable;
|
||||||
|
import Common.Utils.Vector_;
|
||||||
import Common.Visual.DataSetControlForm;
|
import Common.Visual.DataSetControlForm;
|
||||||
import _VisualDVM.TestingSystem.Common.Group.Group;
|
import _VisualDVM.TestingSystem.Common.Group.Group;
|
||||||
import _VisualDVM.TestingSystem.Common.Test.UI.TestsForm;
|
import _VisualDVM.TestingSystem.Common.Test.UI.TestsForm;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class TestDBTable extends iDBTable<Test> {
|
public class TestDBTable extends iDBTable<Test> {
|
||||||
public TestDBTable() {
|
public TestDBTable() {
|
||||||
@@ -49,4 +51,18 @@ public class TestDBTable extends iDBTable<Test> {
|
|||||||
}
|
}
|
||||||
return selectedTests.isEmpty() ? allTests : selectedTests;
|
return selectedTests.isEmpty() ? allTests : selectedTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public LinkedHashMap<Integer,Test> getGroupTests(Group group){
|
||||||
|
|
||||||
|
|
||||||
|
Vector<Test> res = new Vector<>();
|
||||||
|
for (Test test: Data.values()){
|
||||||
|
if (test.group_id==group.id){
|
||||||
|
res.add(test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
Utils_.forceDeleteWithCheck(test.getArchive());
|
Utils_.forceDeleteWithCheck(test.getArchive());
|
||||||
Utils_.forceDeleteWithCheck(test.getServerPath());
|
Utils_.forceDeleteWithCheck(test.getServerPath());
|
||||||
//--
|
//--
|
||||||
//-
|
|
||||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||||
if (dvmConfiguration.tryDeleteTest(test)) {
|
if (dvmConfiguration.tryDeleteTest(test)) {
|
||||||
db.Update(dvmConfiguration);
|
db.Update(dvmConfiguration);
|
||||||
@@ -156,32 +155,31 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
} else if (object instanceof Group) {
|
}
|
||||||
|
else if (object instanceof Group) {
|
||||||
Group group = (Group) object;
|
Group group = (Group) object;
|
||||||
Vector<Test> tests = new Vector<>();
|
LinkedHashMap<Integer, Test> groupTests = db.getMapByFKi(group, Test.class);
|
||||||
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());
|
|
||||||
}
|
|
||||||
//--
|
//--
|
||||||
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
for (DVMConfiguration dvmConfiguration : db.dvmConfigurations.Data.values()) {
|
||||||
if (dvmConfiguration.tryDeleteGroup(group)) {
|
if (dvmConfiguration.tryDeleteGroup(group)) {
|
||||||
//todo удалить все тесты связанные с группой из конфигурации
|
dvmConfiguration.tryDeleteTests(groupTests);
|
||||||
db.Update(dvmConfiguration);
|
db.Update(dvmConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
for (SapforConfiguration sapforConfiguration : db.sapforConfigurations.Data.values()) {
|
||||||
if (sapforConfiguration.tryDeleteGroup(group)) {
|
if (sapforConfiguration.tryDeleteGroup(group)) {
|
||||||
//todo удалить все тесты связанные с группой из конфигурации
|
sapforConfiguration.tryDeleteTests(groupTests);
|
||||||
db.Update(sapforConfiguration);
|
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) {
|
} else if (object instanceof ServerSapfor) {
|
||||||
Utils_.forceDeleteWithCheck(
|
Utils_.forceDeleteWithCheck(
|
||||||
new File(
|
new File(
|
||||||
|
|||||||
Reference in New Issue
Block a user