[jboss-cvs] JBossAS SVN: r87605 - in branches/Branch_5_x: testsuite/src/main/org/jboss/test/profileservice/override/restart/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 21 00:34:41 EDT 2009


Author: scott.stark at jboss.org
Date: 2009-04-21 00:34:41 -0400 (Tue, 21 Apr 2009)
New Revision: 87605

Modified:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractManagedObjectPersistencePlugin.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/LocalDSRemoveOverrideUnitTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java
Log:
JBAS-6227, keep track of the removed managed component name 

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractManagedObjectPersistencePlugin.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractManagedObjectPersistencePlugin.java	2009-04-21 04:08:21 UTC (rev 87604)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractManagedObjectPersistencePlugin.java	2009-04-21 04:34:41 UTC (rev 87605)
@@ -79,6 +79,7 @@
    public PersistedManagedObject createPersistedManagedObject(ManagedObject mo)
    {
       PersistedManagedObject persisted = new PersistedManagedObject();
+      persisted.setOriginalName(mo.getName());
       return createPersistedManagedObject(persisted, mo);
    }
    

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java	2009-04-21 04:08:21 UTC (rev 87604)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java	2009-04-21 04:34:41 UTC (rev 87605)
@@ -24,6 +24,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -52,6 +53,7 @@
 import org.jboss.reflect.spi.ClassInfo;
 import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
 import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
 import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
 
 /**
@@ -203,6 +205,23 @@
          if(c.size() < override.getSize())
             throw new IllegalStateException("c.size() < override.getSize()");
          
+         // First identify the names of removed components
+         HashSet<String> removedNames = new HashSet<String>();
+         for (MetaValue mv : override)
+         {
+            // Extract the generic information
+            GenericValue overrideGeneric = (GenericValue) mv;
+            PersistedGenericValue overrideGenericValue = (PersistedGenericValue) overrideGeneric.getValue();
+            PersistedManagedObject pmo = overrideGenericValue.getManagedObject();
+            if (pmo.getModificationInfo() != ModificationInfo.REMOVED)
+               continue;
+            String name = overrideGenericValue.getManagedObject().getName();
+            if (name == null)
+               name = overrideGenericValue.getManagedObject().getOriginalName();
+            if (name != null)
+               removedNames.add(name);
+         }
+
          Iterator<?> rawIterator = c.iterator();
          Iterator<MetaValue> originalIterator = original.iterator();
          Iterator<MetaValue> overrideIterator = override.iterator();
@@ -210,7 +229,7 @@
          // Create a new collection        
          BeanInfo beanInfo = configuration.getBeanInfo(propertyInfo.getType());
          Collection newCollection = (Collection) createNewInstance(beanInfo);
-         
+
          while (rawIterator.hasNext())
          {
             // The raw object
@@ -230,11 +249,15 @@
                continue;
             }
             // Remove a ManagedObject
-            if(overrideGenericValue.hasModificationFlag(ModificationInfo.REMOVED))
+            Object og = originalGeneric.getValue();
+            if ((og instanceof ManagedObject))
             {
-               continue;
+               ManagedObject originalMO = (ManagedObject) og;
+               String name = originalMO.getName();
+               if(removedNames.contains(name))
+                  continue;
             }
-            
+
             // process the generic value
             processGenericValue(originalGeneric, overrideGenericValue, trace);
             

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/LocalDSRemoveOverrideUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/LocalDSRemoveOverrideUnitTestCase.java	2009-04-21 04:08:21 UTC (rev 87604)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/LocalDSRemoveOverrideUnitTestCase.java	2009-04-21 04:34:41 UTC (rev 87605)
@@ -27,8 +27,9 @@
 import org.jboss.test.profileservice.override.test.AbstractProfileServiceTest;
 
 /**
+ * Run after LocalDSRemoveTestCase to validate that the removal of the
+ * ProfileServiceTestRemoveDataSource has occurred.
  * 
- * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java	2009-04-21 04:08:21 UTC (rev 87604)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java	2009-04-21 04:34:41 UTC (rev 87605)
@@ -26,6 +26,8 @@
 import org.jboss.managed.api.ManagedComponent;
 
 /**
+ * Run before the LocalDSRemoveOverrideUnitTestCase
+ * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */




More information about the jboss-cvs-commits mailing list