2 Replies Latest reply on May 19, 2009 3:10 AM by starksm64

    ManagedObject nameType not used in keys

    brian.stansberry

      I've been trying to figure out why the ClusterPartitionManagedObjectTestCase is failing[1]. Started failing about 10 days ago.

      Problem is 2 beans (HAPartition and DistributedReplicantManager) in the same hapartition-jboss-beans.xml have the same MO name, which is the -g value, by default DefaultPartition. They have different nameType values, so their full names are different, but the full names aren't used in a critical place.

      Traced the problem to this in KernelDeploymentManagedObjectCreator.build(...):

       // The component managed objects need to be in the root map
       ManagedObject compMO = (ManagedObject) gv.getValue();
       // Use the ManagedObject name if it's not the same as the attachmentName
       String managedObjectName = compUnit.getName();
       if(compMO != null && compMO.getAttachmentName() != null)
       {
       managedObjectName = compMO.getAttachmentName().equals(compMO.getName()) ?
       compUnit.getName() : compMO.getName();
       }
       // Add the managed object
       managedObjects.put(managedObjectName, compMO);


      The "managedObjectName" that is the key in the map is just the plain MO.name, not qualified by the nameType. As a result the DistributedReplicantManager replaces the HAPartition in the map, so there is no HAPartition ManagedComponent visible and the test fails. (The map ends up being passed to ManagedDeploymentImpl's c'tor.)

      From my review, I don't see any reason this map key couldn't be name/nameType; i.e. I don't see it breaking anything. Looking at the usage of ManagedDeployment in my AS workspace:

      1) No one uses public Set getManagedObjectNames();
      2) There are a couple calls to public Map<String, ManagedObject> getManagedObjects(); but they just use the values, other than logging the keys.

      3) Drat! Just found that in a couple places AbstractAttachmentStore passes ManagedObject.getName() as the param to public ManagedObject getManagedObject(String name); So that would have to be changed. :(


      I could try to hack around this, but I really don't want to. The hacks would be too ugly. So I'm just going to push out the JIRA for this https://jira.jboss.org/jira/browse/JBAS-6094.

      [1] http://hudson.qa.jboss.com/hudson/view/JBoss%20AS/job/JBoss-AS-5.1.x-testSuite-sun15/297/testReport/org.jboss.test.cluster.defaultcfg.test/ClusterPartitionManagedObjectsTestCase(Default-udp)/testHAPartition/