Author: shawkins
Date: 2011-08-24 21:22:57 -0400 (Wed, 24 Aug 2011)
New Revision: 3424
Modified:
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
Log:
TEIID-1727 fix for removeVDB
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-24
17:35:13 UTC (rev 3423)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2011-08-25
01:22:57 UTC (rev 3424)
@@ -134,6 +134,13 @@
return this.mergedVDB;
}
+ public boolean hasChildVdb(VDBKey child) {
+ if (this.children != null) {
+ return this.children.containsKey(child);
+ }
+ return false;
+ }
+
private VDBMetaData buildVDB() {
VDBMetaData newMergedVDB = new VDBMetaData();
newMergedVDB.setName(this.vdb.getName());
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-24
17:35:13 UTC (rev 3423)
+++ branches/7.4.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2011-08-25
01:22:57 UTC (rev 3424)
@@ -270,7 +270,13 @@
if (removed != null) {
// if this VDB was part of another VDB; then remove them.
for (CompositeVDB other:this.vdbRepo.values()) {
- other.removeChild(key);
+ if (other.hasChildVdb(key)) {
+ notifyRemove(other.getVDB().getName(), other.getVDB().getVersion());
+
+ other.removeChild(key);
+
+ notifyAdd(other.getVDB().getName(), other.getVDB().getVersion());
+ }
}
notifyRemove(key.getName(), key.getVersion());
return true;
Modified: branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
---
branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-24
17:35:13 UTC (rev 3423)
+++
branches/7.4.x/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2011-08-25
01:22:57 UTC (rev 3424)
@@ -149,8 +149,13 @@
@Test public void testRemoveChild() throws Exception {
CompositeVDB vdb = createCompositeVDB(RealMetadataFactory.exampleBQTStore(),
"bqt");
- vdb.removeChild(new VDBKey("foo", 1));
+ VDBKey child = new VDBKey("foo", 1);
+ vdb.removeChild(child);
assertNotNull(vdb.getVDB());
+ assertFalse(vdb.hasChildVdb(child));
+ vdb.addChild(createCompositeVDB(RealMetadataFactory.example1Store(),
"foo"));
+ assertTrue(vdb.hasChildVdb(child));
+ assertNotNull(vdb.getVDB());
}
}
Show replies by date