[jboss-cvs] JBossAS SVN: r86054 - in branches/Branch_5_x: server/src/etc/conf/default/bootstrap and 14 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 18 11:38:28 EDT 2009


Author: emuckenhuber
Date: 2009-03-18 11:38:28 -0400 (Wed, 18 Mar 2009)
New Revision: 86054

Added:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRemoveHandler.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
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/persistenceformat/support/
   branches/Branch_5_x/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml
Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
   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/ManagedObjectPeristenceHandler.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
   branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java
   branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java
   branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java
   branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
   branches/Branch_5_x/testsuite/imports/sections/profileservice.xml
Log:
[JBAS-6227] local-ds managed component remove test.

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -145,9 +145,6 @@
    private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();   
    /** The root deployments to resolve the deployment name. */
    private List<String> rootDeployments = new ArrayList<String>();
-
-   @Deprecated
-   private Map<String, ProfileKey> deploymentsToProfile = new HashMap<String, ProfileKey>();
    
    /** The state mappings. */
    private Map<String, String> stateMappings = new HashMap<String, String>();
@@ -276,7 +273,6 @@
       this.unresolvedRefs.clear();
       this.lastModified.clear();
       this.rootDeployments.clear();
-      this.deploymentsToProfile.clear();
    }
    
    protected void loadProfiles(boolean trace)
@@ -361,9 +357,11 @@
       }
       managedDeployments.put(name, md);
       
-      // TODO this mapping should not be needed
+      // Associate profile with the deployment
       if(profile != null)
-         deploymentsToProfile.put(name, profile);
+      {
+         md.setAttachment(ProfileKey.class.getName(), profile);
+      }
 
       // Add root deployments
       if(level == 0)
@@ -877,8 +875,7 @@
       HashSet<ManagedDeployment> mds = new HashSet<ManagedDeployment>();
       for(String name : names)
       {
-         ProfileDeployment ctx = getProfileDeployment(name);
-         ManagedDeployment md = getManagedDeployment(ctx);
+         ManagedDeployment md = getDeployment(name);
          mds.add(md);
       }
       return mds;
@@ -1132,12 +1129,15 @@
       {
          // Look at the children
          // TODO - support more levels of nested deployments ?
-         for(ManagedDeployment child : compMD.getChildren())
+         if(compMD.getChildren() != null && compMD.getChildren().isEmpty() == false)
          {
-            if(serverComp != null)
-               break;
-            
-            serverComp = child.getComponent(comp.getName());
+            for(ManagedDeployment child : compMD.getChildren())
+            {
+               if(serverComp != null)
+                  break;
+               
+               serverComp = child.getComponent(comp.getName());
+            }            
          }
       }
       if(serverComp == null)
@@ -1197,7 +1197,62 @@
    
    public void removeComponent(ManagedComponent comp) throws Exception
    {
-      // FIXME
+      //
+      ManagedDeployment md = comp.getDeployment();
+
+      // Get the parent
+      while( md.getParent() != null )
+         md = md.getParent();
+         
+      String name = md.getName();
+      ProfileDeployment profileDeployment = getProfileDeployment(name);
+      if( profileDeployment == null )
+      {
+         formatter.applyPattern(i18n.getString("ManagementView.NoSuchDeploymentException")); //$NON-NLS-1$
+         Object[] args = {name};
+         String msg = formatter.format(args);
+         throw new NoSuchDeploymentException(msg);
+      }
+      
+      // Apply the managed properties to the server ManagedDeployment/ManagedComponent
+      ManagedDeployment compMD = managedDeployments.get(md.getName());
+      log.debug("updateComponent, deploymentName="+name+": "+compMD);
+      
+      ManagedComponent serverComp = null;
+      // Find the managed component again
+      if(comp.getDeployment().getParent() == null)
+      {
+         serverComp = compMD.getComponent(comp.getName());
+      }
+      else
+      {
+         // Look at the children
+         // TODO - support more levels of nested deployments ?
+         if(compMD.getChildren() != null && compMD.getChildren().isEmpty() == false)
+         {
+            for(ManagedDeployment child : compMD.getChildren())
+            {
+               if(serverComp != null)
+                  break;
+               
+               serverComp = child.getComponent(comp.getName());
+            }            
+         }
+      }
+      if(serverComp == null)
+      {
+         log.debug("Name: "+comp.getName()+" does not map to existing ManagedComponet in ManagedDeployment: "+md.getName()
+               + ", components: "+compMD.getComponents());
+         formatter.applyPattern(i18n.getString("ManagementView.InvalidComponentName")); //$NON-NLS-1$
+         Object[] args = {comp.getName(), md.getName()};
+         String msg = formatter.format(args);
+         throw new IllegalArgumentException(msg);
+      }
+      
+      //
+      log.debug("remove component: " + comp + ", deployment: "+ profileDeployment);
+      // Remove
+      this.store.removeComponent(profileDeployment, serverComp);
    }
 
    /**
@@ -1440,9 +1495,15 @@
       return mainDeployer.getManagedDeployment(ctx.getName());
    }
    
+   private ProfileKey getProfileKeyForDeployemnt(String name) throws NoSuchDeploymentException
+   {
+      ManagedDeployment md = getDeployment(name);
+      return md.getAttachment(ProfileKey.class);
+   }
+   
    private Profile getProfileForDeployment(String name) throws Exception
    {
-      ProfileKey key = this.deploymentsToProfile.get(name);
+      ProfileKey key = getProfileKeyForDeployemnt(name);
       if(key == null)
          throw new NoSuchDeploymentException("No associated profile found for deployment:" + name);
       

Modified: branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-03-18 15:38:28 UTC (rev 86054)
@@ -89,6 +89,7 @@
 		<constructor><parameter><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
 		<property name="mainDeployer"><inject bean="MainDeployer" /></property>
 		<property name="serializer"><inject bean="AttachmentsSerializer" /></property>
+		<property name="metaDataFilter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
 	</bean>
 
 	<bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer">

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -39,24 +39,33 @@
    /**
     * Get the uri where the attachments are stored.
     * 
-    * @return the attachment store root.
+    * @return the attachment store root
     */
    URI getAttachmentStoreRoot();
    
    /**
     * Persist the changes of the managed component.
     * 
-    * @param deployment the profile deployment.
-    * @param comp the managed component.
+    * @param deployment the profile deployment
+    * @param comp the managed component
     * @throws Exception
     */
    void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
    
    /**
+    * Remove a component from the persisted attachment.
+    * 
+    * @param deployment the profile deployment
+    * @param comp the managed componenbt
+    * @throws Exception
+    */
+   void removeComponent(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
+   
+   /**
     * Create the deployment with the persisted attachments.
     * 
-    * @param deployment the profile deployment.
-    * @return the mc deployment.
+    * @param deployment the profile deployment
+    * @return the mc deployment
     * @throws Exception
     */
    Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception;

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-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedGenericOverrideHandler.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -21,11 +21,21 @@
  */ 
 package org.jboss.system.server.profileservice.persistence;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
 import java.util.Stack;
+import java.util.WeakHashMap;
 
+import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.config.plugins.property.PropertyConfiguration;
+import org.jboss.config.spi.Configuration;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedProperty;
@@ -34,7 +44,12 @@
 import org.jboss.metatype.api.values.CollectionValue;
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.InstanceFactory;
 import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.plugins.values.ListInstanceFactory;
+import org.jboss.metatype.plugins.values.SetInstanceFactory;
+import org.jboss.metatype.plugins.values.SortedSetInstanceFactory;
+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.PersistedProperty;
@@ -48,9 +63,45 @@
 public class ManagedGenericOverrideHandler extends ManagedObjectOverride
 {
 
+   /** The instance factory builders */
+   private Map<Class<?>, InstanceFactory<?>> instanceFactoryMap = new WeakHashMap<Class<?>, InstanceFactory<?>>();
+   
    /** The merging stack. */
    private Stack<MergingProperties> properties = new Stack<MergingProperties>();
    
+   /** The configuration */
+   private static Configuration configuration;
+
+   static
+   {
+      configuration = AccessController.doPrivileged(new PrivilegedAction<Configuration>()
+      {
+         public Configuration run()
+         {
+            return new PropertyConfiguration();
+         }
+      });
+   }
+   
+   public ManagedGenericOverrideHandler()
+   {
+      // set default collection instance factories
+      setInstanceFactory(List.class, ListInstanceFactory.INSTANCE);
+      setInstanceFactory(Set.class, SetInstanceFactory.INSTANCE);
+      setInstanceFactory(SortedSet.class, SortedSetInstanceFactory.INSTANCE);
+   }
+   
+   public <T> void setInstanceFactory(Class<T> clazz, InstanceFactory<T> factory)
+   {
+      synchronized(instanceFactoryMap)
+      {
+         if (factory == null)
+            instanceFactoryMap.remove(clazz);
+         else
+            instanceFactoryMap.put(clazz, factory);
+      }
+   }
+   
    @Override
    protected void processProperty(ManagedProperty property, PersistedProperty propertyElement, Object attachment,
          boolean trace) throws Throwable
@@ -125,13 +176,24 @@
 //         if(overrideMetaType.getElementType().equals(GENERIC_PERSISTED_VALUE_TYPE) == false)
 //            throw new IllegalStateException("Wrong generic value type: " + overrideMetaType.getElementType());
          
+         
          // Extract the information
          MergingProperties item = this.properties.peek();
          PropertyInfo propertyInfo = item.getPropertyInfo();
          Object attachment = item.getAttachment();
-
+         
+         if(propertyInfo.isWritable() == false)
+         {
+            log.debug("Ignoring not writable property: " + propertyInfo);
+            return null;
+         }
+         
          // Extract original collection
          Collection<?> c = (Collection<?>) propertyInfo.get(attachment);
+         // Skip
+         if(c == null || c.isEmpty())
+            return null;
+         
 
          // This should not happen
          if(c.size() < override.getSize())
@@ -140,11 +202,15 @@
          Iterator<?> rawIterator = c.iterator();
          Iterator<MetaValue> originalIterator = original.iterator();
          Iterator<MetaValue> overrideIterator = override.iterator();
+
+         // Create a new collection        
+         BeanInfo beanInfo = configuration.getBeanInfo(propertyInfo.getType());
+         Collection newCollection = (Collection) createNewInstance(beanInfo);
          
          while (rawIterator.hasNext())
          {
             // The raw object
-            rawIterator.next();
+            Object o = rawIterator.next();
             
             // Skip generic values which are not annotated
             GenericValue originalGeneric = (GenericValue) originalIterator.next();
@@ -155,19 +221,24 @@
             
             // Skip not annotated managed objects
             if(originalGeneric.getValue() == null)
+            {
+               newCollection.add(o);
                continue;
+            }
 
-            // TODO Remove a ManagedObject
+            // Remove a ManagedObject
             ModificationInfo modificationInfo = overrideGenericValue.getModificationInfo(); 
             if(modificationInfo != null && modificationInfo == ModificationInfo.REMOVED)
             {
-               rawIterator.remove();
                continue;
             }
             
             // process the generic value
             processGenericValue(originalGeneric, overrideGenericValue, trace);
+            
+            newCollection.add(o);
          }
+         propertyInfo.set(attachment, newCollection);
          
          // This does not need to get populated
          return null;
@@ -179,6 +250,21 @@
       }
    }
    
+   @SuppressWarnings("deprecation")
+   protected Object createNewInstance(BeanInfo beanInfo) throws Throwable
+   {
+      ClassInfo classInfo = beanInfo.getClassInfo();
+      if (classInfo.isInterface())
+      {
+         InstanceFactory<?> instanceFactory = instanceFactoryMap.get(classInfo.getType());
+         if (instanceFactory == null)
+            throw new IllegalArgumentException("Cannot instantiate interface BeanInfo, missing InstanceFactory: " + classInfo);
+
+         return instanceFactory.instantiate(beanInfo);
+      }
+      return beanInfo.newInstance();
+   }
+   
    public static class MergingProperties
    {
       /** The attachment. */
@@ -210,5 +296,5 @@
          return propertyElement;
       }
    }
-   
+
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectPeristenceHandler.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -158,7 +158,7 @@
          properties.add(propertyElement);
       }
    }
-   
+
    /**
     * Create the persisted property.
     * 
@@ -263,7 +263,7 @@
     * @param value the enum value
     * @return the enum xml meta data
     */
-   private PersistedEnumValue createEnumValue(EnumValue value)
+   protected PersistedEnumValue createEnumValue(EnumValue value)
    {
       PersistedEnumValue persistedValue = new PersistedEnumValue();
       persistedValue.setValue(value.getValue());
@@ -276,7 +276,7 @@
     * @param value the simple value
     * @return the simple xml meta data
     */
-   private PersistedSimpleValue createSimpleValue(SimpleValue value)
+   protected PersistedSimpleValue createSimpleValue(SimpleValue value)
    {
       PersistedSimpleValue persistedValue = new PersistedSimpleValue();
       persistedValue.setValue(convertSimple2String(value));
@@ -289,7 +289,7 @@
     * @param value the collection value
     * @return the collection xml meta data
     */
-   private PersistedCollectionValue createCollectionValue(CollectionValue value)
+   protected PersistedCollectionValue createCollectionValue(CollectionValue value)
    {
       PersistedCollectionValue collection = new PersistedCollectionValue();
       for(MetaValue child : value.getElements())
@@ -306,7 +306,7 @@
     * @param value the generic value
     * @return the generic xml meta data
     */
-   private PersistedGenericValue createGenericValue(GenericValue value)
+   protected PersistedGenericValue createGenericValue(GenericValue value)
    {
       //
       PersistedGenericValue generic = new PersistedGenericValue();
@@ -332,7 +332,7 @@
     * @param value the array value
     * @return
     */
-   private PersistedArrayValue createArrayValue(ArrayValue value, ArrayMetaType metaType)
+   protected PersistedArrayValue createArrayValue(ArrayValue value, ArrayMetaType metaType)
    {
       //
       PersistedArrayValue array = new PersistedArrayValue();
@@ -393,7 +393,7 @@
     * @param metaType the composite meta type
     * @return the persistence composite xml meta data
     */
-   private PersistedCompositeValue createCompositeValue(CompositeValue value, CompositeMetaType metaType)
+   protected PersistedCompositeValue createCompositeValue(CompositeValue value, CompositeMetaType metaType)
    {
       //
       PersistedCompositeValue composite = new PersistedCompositeValue();
@@ -424,7 +424,7 @@
     * @param value the table value
     * @return the persistence table xml meta data
     */
-   private PersistedTableValue createTableValue(TableValue value)
+   protected PersistedTableValue createTableValue(TableValue value)
    {
       PersistedTableValue table = new PersistedTableValue();
       // Fix the entries
@@ -443,7 +443,7 @@
       return table;
    }
 
-   private PersistedValue createPropertiesValue(PropertiesMetaValue value)
+   protected PersistedValue createPropertiesValue(PropertiesMetaValue value)
    {
       PersistedPropertiesValue properties = new PersistedPropertiesValue();
       List<PersistedPair> pairs = properties.getEntries();

Added: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRemoveHandler.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRemoveHandler.java	                        (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectRemoveHandler.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.system.server.profileservice.persistence;
+
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
+import org.jboss.system.server.profileservice.persistence.xml.PersistedGenericValue;
+
+/**
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedObjectRemoveHandler extends ManagedObjectPeristenceHandler
+{
+
+   /** The item to remove. */
+   private ManagedCommon removeItem = null;
+   
+   public ManagedObjectRemoveHandler(ManagedCommon removeItem)
+   {
+      if(removeItem == null)
+         throw new IllegalArgumentException("Null component to remove.");
+      this.removeItem = removeItem;
+   }
+   
+   @Override
+   protected PersistedGenericValue createGenericValue(GenericValue value)
+   {
+      Object o = value.getValue();
+      if(o instanceof ManagedObject)
+      {
+         ManagedObject mo = (ManagedObject) o;
+         if(mo.getName() == removeItem.getName())
+         {
+            PersistedGenericValue v = new PersistedGenericValue();
+            v.setModificationInfo(ModificationInfo.REMOVED);
+            return v;            
+         }
+      }
+      return super.createGenericValue(value);
+   }
+  
+}

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/AbstractPersisitedValue.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -45,4 +45,12 @@
       this.info = info;
    }
    
+   public boolean hasModificationFlag(ModificationInfo info)
+   {
+      if(info == null)
+         return false;
+      
+      return this.info.equals(info);
+   }
+   
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedManagedObject.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -43,6 +43,10 @@
 @XmlRootElement(name = MANAGED_OBJECT_ELEMENT_NAME)
 public class PersistedManagedObject extends AbstractElement
 {
+   
+   /** The original name. */
+   private String originalName;
+   
    /** The template name. */
    private String templateName;
    
@@ -75,6 +79,17 @@
       this.templateName = templateName;
    }
    
+   @XmlElement(name = "orignal-name")
+   public String getOriginalName()
+   {
+      return originalName;
+   }
+   
+   public void setOriginalName(String originalName)
+   {
+      this.originalName = originalName;
+   }
+   
    @XmlElementWrapper(name="properties")
    @XmlElement(name = "property")
    public List<PersistedProperty> getProperties()

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedSimpleValue.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -93,6 +93,14 @@
       this.info = info;
    }
    
+   public boolean hasModificationFlag(ModificationInfo info)
+   {
+      if(info == null)
+         return false;
+      
+      return this.info.equals(info);
+   }
+   
    @XmlValue 
    public String getValue()
    {

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/PersistedValue.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -45,5 +45,14 @@
     */
    void setModificationInfo(ModificationInfo info);
    
+   
+   /**
+    * Check the modificationInfo.
+    * 
+    * @param info the modification info.
+    * @return this.info.equals(info);
+    */
+   boolean hasModificationFlag(ModificationInfo info);
+   
 }
 

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -58,8 +58,10 @@
 import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaData;
 import org.jboss.system.server.profileservice.attachments.RepositoryAttachmentMetaDataFactory;
 import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
+import org.jboss.system.server.profileservice.persistence.ManagedObjectRemoveHandler;
 import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
 import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
 
 /**
  * The AbstractAttachmentStore updates and restores the persisted attachments.
@@ -81,12 +83,15 @@
    /** The MainDeployerStructure. */
    protected MainDeployerStructure mainDeployer;
    
+   /** The virutal file filter. */
+   private VirtualFileFilter metaDataFilter;
+   
    /** The metadata name */
    public static final String METADATA_NAME = "metadata";
    
    /** The managed object persistence handler. */
    private static final ManagedObjectPeristenceHandler handler = new ManagedObjectPeristenceHandler();
-   
+
    /** The logger. */
    private static final Logger log = Logger.getLogger(AbstractAttachmentStore.class);
    
@@ -134,6 +139,16 @@
       this.serializer = serializer;
    }
    
+   public VirtualFileFilter getMetaDataFilter()
+   {
+      return metaDataFilter;
+   }
+   
+   public void setMetaDataFilter(VirtualFileFilter metaDataFilter)
+   {
+      this.metaDataFilter = metaDataFilter;
+   }
+   
    public Deployment createMCDeployment(ProfileDeployment profileDeployment) throws Exception
    {
       if(profileDeployment.getRoot() == null)
@@ -222,15 +237,85 @@
       throws IOException
    {
       boolean attach = true;
-      if(metaData.getLastModified() < root.getLastModified())
+      long lastModified = metaData.getLastModified();
+      // Check exploded directories.
+      // TODO recursive checks
+      if(root.isLeaf() == true && root.isArchive() == false)
       {
-         attach = false;
+         DeploymentStructureMetaData structure = metaData.getDeploymentStructure();
+         if(checkMetaDataModifications(root, structure, lastModified) == false)
+            return false;
       }
-      // TODO check metaData locations
+      else
+      {
+         if(lastModified < root.getLastModified())
+         {
+            return false;
+         }         
+      }
       return attach;
    }
    
+   
+   protected boolean checkMetaDataModifications(VirtualFile root, DeploymentStructureMetaData structure, long lastModified)
+   {
+      if(structure == null)
+         return true;
+
+      List<String> metaDataPaths = structure.getMetaDataPaths();
+      if(metaDataPaths != null && metaDataPaths.isEmpty() == false)
+      {
+         for(String path : metaDataPaths)
+         {
+            try
+            {
+               VirtualFile vf = root.getChild(path);
+               if(vf != null)
+               {
+                  List<VirtualFile> children = vf.getChildren(metaDataFilter);
+                  if(children != null && children.isEmpty() == false)
+                  {
+                     for(VirtualFile child : children)
+                     {
+                        if(lastModified < child.getLastModified())
+                           return false;
+                     }
+                  }
+               }
+            }
+            catch(Exception e)
+            {
+               log.debug("Failed to check deployment modifications, ignoring persisted information.");
+               return false;
+            }
+         }            
+      }
+      return true;
+   }
+   
    /**
+    * Remove a component will flag this component as removed and will therefore not
+    * be restored after a restart.
+    * 
+    * @param deployment the profile deployment
+    * @param comp the managed component
+    * @throws Exception
+    */
+   public void removeComponent(ProfileDeployment deployment, ManagedComponent comp)
+      throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("Null deployment.");
+      if(comp == null)
+         throw new IllegalArgumentException("Null managed component.");
+      
+      // Create the remove handler
+      ManagedObjectRemoveHandler removeHandler = new ManagedObjectRemoveHandler(comp);
+      updateDeployment(deployment, comp, removeHandler);
+   }
+   
+   
+   /**
     * Persist the updated metadata for a managedComponent and generate a metadata describing
     * the repository, if it does not exist already.
     * 
@@ -242,9 +327,24 @@
    public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp)
       throws Exception
    {
-      if(deployment ==  null)
-         throw new IllegalArgumentException("ProfileDeployment may not be null.");
+      if(comp == null)
+         return;
       
+      // Update deployment
+      updateDeployment(deployment, comp, handler);      
+   }
+   
+   
+   public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp, ManagedObjectPeristenceHandler persistenceHandler)
+      throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("Null deployment.");
+      if(comp == null)
+         throw new IllegalArgumentException("Null managed component.");
+      if(persistenceHandler == null)
+         throw new IllegalArgumentException("Null persistence handler.");
+      
       if(deployment.getRoot() == null)
       {
          // TODO
@@ -334,8 +434,11 @@
          // Is attachmentName the same as the className ?
          attachment.setName(attachmentName);
          attachment.setClassName(managedObject.getAttachment().getClass().getName());
-         // Set attachment, this is transient - as it will get persisted in it's own file.
-         attachment.setAttachment(managedObject);
+         
+         // Create the persistence information and add it as a transient attachment
+         PersistedManagedObject persistedMO = createPersistedMetaData(managedObject, persistenceHandler);
+         attachment.setAttachment(persistedMO);
+         
          // Update lastModified
          currentContextMetaData.setLastModified(lastModified);
       }
@@ -347,7 +450,8 @@
       savedMetaData.setLastModified(lastModified);
       
       // Save the repository meta data
-      this.serializer.saveAttachment(getMetaDataPathName(deploymentPath), savedMetaData);
+      this.serializer.saveAttachment(getMetaDataPathName(deploymentPath), savedMetaData);      
+      
    }
    
    /**
@@ -421,9 +525,8 @@
             if(attachment.getAttachment() == null)
                continue;
             
-            // Create xml meta data for persistence.
-            ManagedObject mo = (ManagedObject) attachment.getAttachment();
-            PersistedManagedObject root = createPersistedMetaData(mo);
+            // Get the xml for the persisted attachment
+            PersistedManagedObject root = (PersistedManagedObject) attachment.getAttachment();
             
             String attachmentPath = deploymentPath + attachment.getName();
             // Serialize the attachment
@@ -449,9 +552,10 @@
     * create the xml meta data for persisting the managed object.
     * 
     * @param mo the managed object.
+    * @param handler the persistence handler
     * @return the xml metadata.
     */
-   protected PersistedManagedObject createPersistedMetaData(ManagedObject mo)
+   protected PersistedManagedObject createPersistedMetaData(ManagedObject mo, ManagedObjectPeristenceHandler handler)
    {
       // Return
       return handler.createPersistenceMetaData(mo);
@@ -569,7 +673,7 @@
       if(deployment == null)
          throw new IllegalStateException("Null deployment.");
       
-      // deployment URI toString
+      // deployment URI 
       String pathName = deployment.getRoot().toURI().toString();
       String fileName = deployment.getRoot().getName();
       // Generate hash

Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/remove/test/RemoveGenericValueUnitTestCase.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -24,13 +24,13 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.jboss.managed.api.ManagedCommon;
 import org.jboss.managed.api.ManagedObject;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.system.server.profileservice.persistence.ManagedGenericOverrideHandler;
-import org.jboss.system.server.profileservice.persistence.ManagedObjectPeristenceHandler;
-import org.jboss.system.server.profileservice.persistence.xml.ModificationInfo;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedCollectionValue;
+import org.jboss.system.server.profileservice.persistence.ManagedObjectRemoveHandler;
 import org.jboss.system.server.profileservice.persistence.xml.PersistedManagedObject;
-import org.jboss.system.server.profileservice.persistence.xml.PersistedProperty;
 import org.jboss.test.server.profileservice.persistence.support.GenericSupportMetaData;
 import org.jboss.test.server.profileservice.persistence.support.SimpleGenericMetaData;
 import org.jboss.test.server.profileservice.persistence.test.AbstractPersistenceFormatTest;
@@ -49,24 +49,23 @@
 
    public void test() throws Throwable
    {
+      ManagedObject mo = createTestMO();
 
-      ManagedObject mo = createTestMO();
+      CollectionValue c = (CollectionValue) mo.getProperty("list").getValue();
+      assertNotNull(c);
+      GenericValue g = (GenericValue) c.iterator().next();
+      assertNotNull(g);
+      ManagedCommon removeItem = (ManagedCommon) g.getValue();
       
-      ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
-      PersistedManagedObject moElement = persistence.createPersistenceMetaData(mo);
+      ManagedObjectRemoveHandler removeHandler = new ManagedObjectRemoveHandler(removeItem);
+      
+      PersistedManagedObject moElement = restore(mo, removeHandler);
       assertNotNull(moElement);
-      
-      // Remove
-      PersistedProperty p = moElement.getProperties().get(0);
-      PersistedCollectionValue collection = (PersistedCollectionValue) p.getValue(); 
-      assertNotNull(collection);
-      collection.getValue(0).setModificationInfo(ModificationInfo.REMOVED);
-      
+
       // Restore
       ManagedGenericOverrideHandler handler = new ManagedGenericOverrideHandler();
       ManagedObject restored = handler.update(createTestMetaData(), moElement);
 
-      
       // Check meta data
       GenericSupportMetaData md = (GenericSupportMetaData) restored.getAttachment();
       assertNotNull(md);
@@ -74,9 +73,10 @@
       SimpleGenericMetaData parent2 = md.getList().get(0);
       assertEquals("parent2", parent2.getString());
       assertNotNull(parent2.getChild());
-      assertEquals("child2", parent2.getChild().getString());      
+      assertEquals("child2", parent2.getChild().getString());
+      
    }
-
+   
    private ManagedObject createTestMO()
    {
       return getMOF().initManagedObject(createTestMetaData(), null);

Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/support/GenericSupportMetaData.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -21,6 +21,7 @@
  */ 
 package org.jboss.test.server.profileservice.persistence.support;
 
+import java.util.Collections;
 import java.util.List;
 
 import org.jboss.managed.api.annotation.ManagementObject;
@@ -39,7 +40,7 @@
    @ManagementProperty(managed = true)
    public List<SimpleGenericMetaData> getList()
    {
-      return list;
+      return Collections.unmodifiableList(list);
    }
    
    public void setList(List<SimpleGenericMetaData> list)

Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/persistence/test/AbstractPersistenceFormatTest.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -153,9 +153,15 @@
    
    protected PersistedManagedObject restore(ManagedObject mo) throws Exception
    {
+      ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
+      return restore(mo, persistence);
+   }
+   
+   protected PersistedManagedObject restore(ManagedObject mo, ManagedObjectPeristenceHandler persistence) throws Exception
+   {
       PersistedManagedObject moElement = new PersistedManagedObject();
-      
-      ManagedObjectPeristenceHandler persistence = new ManagedObjectPeristenceHandler();
+
+      // Process
       persistence.processManagedObject(moElement, mo);
       
       File file = File.createTempFile("test", null);

Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -54,6 +54,12 @@
       else
          return factory.createVFSDeployment(deployment.getRoot());
    }
+   
+   public void removeComponent(ProfileDeployment deployment, ManagedComponent comp) throws Exception
+   {
+      // FIXME removeComponent
+      
+   }
 
    public void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception
    {

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -153,7 +153,8 @@
             ObjectName mbean = md.getObjectName();
             try
             {
-               value = getMbeanServer().getAttribute(mbean, name);
+               if(getMbeanServer() != null)
+                  value = getMbeanServer().getAttribute(mbean, name);
             }
             catch (AttributeNotFoundException e)
             {

Modified: branches/Branch_5_x/testsuite/imports/sections/profileservice.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/sections/profileservice.xml	2009-03-18 15:02:23 UTC (rev 86053)
+++ branches/Branch_5_x/testsuite/imports/sections/profileservice.xml	2009-03-18 15:38:28 UTC (rev 86054)
@@ -57,6 +57,9 @@
          </zipfileset>
       </jar>
 
+      <copy tofile="${build.lib}/profileservice-remove-ds.xml"
+               file="${build.resources}/profileservice/override/profileservice-remove-ds.xml"/>
+
       <copy tofile="${build.lib}/profileservice-test-ds.xml"
          file="${build.resources}/profileservice/override/profileservice-test-ds.xml"/>
          

Added: 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	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/restart/test/LocalDSRemoveOverrideUnitTestCase.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.test.profileservice.override.restart.test;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.test.profileservice.override.test.AbstractProfileServiceTest;
+
+/**
+ * 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalDSRemoveOverrideUnitTestCase extends AbstractProfileServiceTest
+{
+
+   public LocalDSRemoveOverrideUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test() throws Exception
+   {
+      try
+      {
+         ManagementView mgtView = getManagementView();
+         
+         //
+         ComponentType locaDSType = new ComponentType("DataSource", "LocalTx");
+         ManagedComponent test1 = mgtView.getComponent("ProfileServiceTestDataSource1", locaDSType);
+         assertNotNull(test1);
+         ManagedComponent remove = mgtView.getComponent("ProfileServiceTestRemoveDataSource", locaDSType);
+         assertNull(remove);
+         ManagedComponent test2 = mgtView.getComponent("ProfileServiceTestDataSource2", locaDSType);
+         assertNotNull(test2);  
+      }
+      finally
+      {
+         // Undeploy
+         undeployPackage(new String[] { "profileservice-remove-ds.xml" });         
+      }
+   }
+   
+}
+

Added: 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	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java	2009-03-18 15:38:28 UTC (rev 86054)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.test.profileservice.override.test;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalDSRemoveTestCase extends AbstractProfileServiceTest
+{
+
+   public LocalDSRemoveTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void test() throws Exception
+   {
+      
+      String repositoryNames[] = deployPackage("profileservice-remove-ds.xml");
+      assertNotNull(repositoryNames);
+
+      ManagementView mgtView = getManagementView();
+      
+      //
+      ComponentType locaDSType = new ComponentType("DataSource", "LocalTx");
+      ManagedComponent test1 = mgtView.getComponent("ProfileServiceTestDataSource1", locaDSType);
+      assertNotNull(test1);
+      ManagedComponent remove = mgtView.getComponent("ProfileServiceTestRemoveDataSource", locaDSType);
+      assertNotNull(remove);
+      ManagedComponent test2 = mgtView.getComponent("ProfileServiceTestDataSource2", locaDSType);
+      assertNotNull(test2);  
+      // Remove
+      mgtView.removeComponent(remove);
+      mgtView.process();
+      
+   }
+   
+   
+}
+

Added: branches/Branch_5_x/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml	2009-03-18 15:38:28 UTC (rev 86054)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+   <local-tx-datasource>
+      <jndi-name>ProfileServiceTestDataSource1</jndi-name>
+      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+      <driver-class>org.hsqldb.jdbcDriver</driver-class>
+      <user-name>sa</user-name>
+      <password></password>
+      <min-pool-size>5</min-pool-size>
+      <max-pool-size>20</max-pool-size>
+      <idle-timeout-minutes>0</idle-timeout-minutes>
+      <security-domain>HsqlDbRealm</security-domain>
+      <prepared-statement-cache-size>32</prepared-statement-cache-size>
+      <metadata>
+         <type-mapping>Hypersonic SQL</type-mapping>
+      </metadata>
+   </local-tx-datasource>
+
+   <local-tx-datasource>
+      <jndi-name>ProfileServiceTestRemoveDataSource</jndi-name>
+      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+      <driver-class>org.hsqldb.jdbcDriver</driver-class>
+      <user-name>sa</user-name>
+      <password></password>
+      <min-pool-size>5</min-pool-size>
+      <max-pool-size>20</max-pool-size>
+      <idle-timeout-minutes>0</idle-timeout-minutes>
+      <security-domain>HsqlDbRealm</security-domain>
+      <prepared-statement-cache-size>32</prepared-statement-cache-size>
+      <metadata>
+         <type-mapping>Hypersonic SQL</type-mapping>
+      </metadata>
+   </local-tx-datasource>
+
+   <local-tx-datasource>
+      <jndi-name>ProfileServiceTestDataSource2</jndi-name>
+      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+      <driver-class>org.hsqldb.jdbcDriver</driver-class>
+      <user-name>sa</user-name>
+      <password></password>
+      <min-pool-size>5</min-pool-size>
+      <max-pool-size>20</max-pool-size>
+      <idle-timeout-minutes>0</idle-timeout-minutes>
+      <security-domain>HsqlDbRealm</security-domain>
+      <prepared-statement-cache-size>32</prepared-statement-cache-size>
+      <metadata>
+         <type-mapping>Hypersonic SQL</type-mapping>
+      </metadata>
+   </local-tx-datasource>
+
+</datasources>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list