[jboss-cvs] JBossAS SVN: r87490 - in branches/Branch_5_x: system-jmx/src/main/org/jboss/system/deployers/managed and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 17 07:49:02 EDT 2009


Author: emuckenhuber
Date: 2009-04-17 07:49:02 -0400 (Fri, 17 Apr 2009)
New Revision: 87490

Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
[JBAS-6799] fix empty securityConfig handling.

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-04-17 11:19:45 UTC (rev 87489)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-04-17 11:49:02 UTC (rev 87490)
@@ -1199,14 +1199,18 @@
          
          if (componentName != null && policy.equals(ActivationPolicy.IMMEDIATE))
          {
-            // FIXME
+            // FIXME the MetaMapper unwrapping should be handled by the RuntimeDispatcher
             MetaMapper mapper = ctxProp.getTransientAttachment(MetaMapper.class);
             if(mapper != null)
             {
                Object o = mapper.unwrapMetaValue(metaValue);
-               if(o instanceof Serializable)
+               GenericMetaType generic = new GenericMetaType(metaValue.getMetaType().getTypeName(), "generic value wrapper");
+               if(o == null)
                {
-                  GenericMetaType generic = new GenericMetaType(metaValue.getMetaType().getTypeName(), "generic value wrapper");
+                  metaValue = new GenericValueSupport(generic, null);
+               }
+               else if(o instanceof Serializable)
+               {
                   metaValue = new GenericValueSupport(generic, (Serializable) o);
                }
             }

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-04-17 11:19:45 UTC (rev 87489)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2009-04-17 11:49:02 UTC (rev 87490)
@@ -22,6 +22,7 @@
 package org.jboss.system.deployers.managed;
 
 import java.io.Serializable;
+import java.lang.reflect.Type;
 import java.util.HashMap;
 import java.util.List;
 
@@ -292,8 +293,10 @@
          // Look for a MetaMapper
          MetaType propertyType = property.getMetaType();
          MetaMapper metaMapper = property.getTransientAttachment(MetaMapper.class);
+         Type mappedType = null; 
          if(metaMapper != null)
          {
+            mappedType = metaMapper.mapToType();
             plainValue = metaMapper.unwrapMetaValue(value);
          }
          else
@@ -310,7 +313,7 @@
                ServiceAttributeMetaData attr = new ServiceAttributeMetaData();
                attr.setName(aname);
                md.addAttribute(attr);
-               if(plainValue instanceof Element)
+               if(mappedType != null && mappedType.equals(Element.class))
                {
                   attributeValue = new ServiceElementValueMetaData();
                }
@@ -331,7 +334,8 @@
             }
             else if (attributeValue instanceof ServiceElementValueMetaData)
             {
-               ((ServiceElementValueMetaData) attributeValue).setElement((Element) plainValue);
+               if(plainValue != null)
+                  ((ServiceElementValueMetaData) attributeValue).setElement((Element) plainValue);
             }
             else if (attributeValue instanceof ServiceDependencyValueMetaData)
             {

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java	2009-04-17 11:19:45 UTC (rev 87489)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java	2009-04-17 11:49:02 UTC (rev 87490)
@@ -130,17 +130,26 @@
       // update security Config
       ManagedComponent queue = mgtView.getComponent("testQueueTemplate", type);
       assertNotNull(queue);
-      assertEquals("testQueueTemplate", queue.getName());
+      assertEquals("testQueueTemplate", queue.getName()); 
       
+      // Test with a empty value
+      queue.getProperty("securityConfig").setValue(new MapCompositeValueSupport(new HashMap<String, MetaValue>(), securityConfType));
+      mgtView.updateComponent(queue);
+      
+      //
+      mgtView = getManagementView();
+      queue = mgtView.getComponent("testQueueTemplate", type);
+      
       Map<String, MetaValue> values = new HashMap<String, MetaValue>();
       values.put("admin", createCompositeValue(true, true, true));
       values.put("publisher", createCompositeValue(true, true, false));
       values.put("user", createCompositeValue(false, false, false));
-      MapCompositeValueSupport map = new MapCompositeValueSupport(values, securityConfType);
+      MapCompositeValueSupport map= new MapCompositeValueSupport(values, securityConfType);
 
+      // Test a normal value 
       queue.getProperty("securityConfig").setValue(map);
       mgtView.updateComponent(queue);
-      
+
       mgtView = getManagementView();
       queue = mgtView.getComponent("testQueueTemplate", type);
       MapCompositeValueSupport securityConfig = (MapCompositeValueSupport) queue.getProperty("securityConfig").getValue();
@@ -148,10 +157,12 @@
       
       securityConfig.remove("publisher");
       
+      // Test remove
       mgtView.updateComponent(queue);
       securityConfig = (MapCompositeValueSupport) queue.getProperty("securityConfig").getValue();
       assertNotNull(securityConfig);
       assertNull(securityConfig.get("publisher"));
+      
    }
    
 

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java	2009-04-17 11:19:45 UTC (rev 87489)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java	2009-04-17 11:49:02 UTC (rev 87490)
@@ -442,6 +442,7 @@
       String jndiName = getName();
       propValues.put("name", SimpleValueSupport.wrap(jndiName));
       propValues.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+      propValues.put("clustered", SimpleValueSupport.wrap(true));
       // Security config
       Map<String, MetaValue> values = new HashMap<String, MetaValue>();
       values.put("admin", createCompositeValue(true, true, true));




More information about the jboss-cvs-commits mailing list