[jboss-jira] [JBoss JIRA] Assigned: (JBAS-6219) ManagementView.getTemplate() should return a new copy of the DeploymentTemplateInfo on every call

Scott M Stark (JIRA) jira-events at lists.jboss.org
Mon Mar 2 16:04:22 EST 2009


     [ https://jira.jboss.org/jira/browse/JBAS-6219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott M Stark reassigned JBAS-6219:
-----------------------------------

    Assignee: Ian Springer  (was: Scott M Stark)


As I mentioned on the jop-dev list, I can't get the admin-console to display the queue properties to be able to validate the scenario you describe. I have added the following jbas testcase which follows the code I see in ApplicationServerComponent.createConfigurationBasedResource as closely as possible, and it does not see the previous jndi name. Assign it back to me when the admin-console is showing this or you see a change to make in this test.

   public void testMultipleQueues() throws Exception
   {
      ManagementView managementView = getManagementView();

      Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
      // testCreateQueue1
      String jndiName = "testCreateQueue1";
      String templateName = "QueueTemplate";
      MetaValue jndiName1MV = SimpleValueSupport.wrap(jndiName);
      propValues.put("JNDIName", jndiName1MV);
      ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
      DeploymentTemplateInfo queue1Info = managementView.getTemplate(templateName);
      Map<String, ManagedProperty> testCreateQueue1Props = queue1Info.getProperties();
      log.debug("QueueTemplate#1: "+testCreateQueue1Props);
      for(String propName : testCreateQueue1Props.keySet())
      {
         ManagedProperty prop = testCreateQueue1Props.get(propName);
         assertNotNull("property " + propName + " found in template " + templateName, prop);
         log.debug("createComponentTest("+propName+") before: "+prop.getValue());
         prop.setValue(propValues.get(propName));
         log.debug("createComponentTest("+propName+") after: "+prop.getValue());
      }
      managementView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, "testCreateQueue1", queue1Info);
      managementView.process();

      // testCreateQueue2
      jndiName = "testCreateQueue2";
      MetaValue jndiName2MV = SimpleValueSupport.wrap(jndiName);
      propValues.put("JNDIName", jndiName2MV);
      // Get a fresh template info view
      DeploymentTemplateInfo queue2Info = managementView.getTemplate(templateName);
      Map<String, ManagedProperty> testCreateQueue2Props = queue2Info.getProperties();
      log.debug("QueueTemplate#2: "+testCreateQueue2Props);
      // Validate the properties don't have the previous template values
      ManagedProperty jndiNameCheck1 = testCreateQueue2Props.get("JNDIName");
      assertFalse("Fresh temmplate properties does not have previous JNDIName",
            jndiName1MV.equals(jndiNameCheck1.getValue()));
      for(String propName : testCreateQueue2Props.keySet())
      {
         ManagedProperty prop = testCreateQueue2Props.get(propName);
         assertNotNull("property " + propName + " found in template " + templateName, prop);
         log.debug(propName+" before: "+prop.getValue());
         prop.setValue(propValues.get(propName));
         log.debug(propName+" after: "+prop.getValue());
      }
      managementView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, "testCreateQueue2", queue2Info);
      managementView.process();

      // Validate the components
      managementView.reloadProfile();
      ManagedComponent queue1 = managementView.getComponent("testCreateQueue1", type);
      assertNotNull(queue1);
      assertEquals("testCreateQueue1", queue1.getName());

      ManagedComponent queue2 = managementView.getComponent("testCreateQueue2", type);
      assertNotNull(queue2);
      assertEquals("testCreateQueue2", queue2.getName());
      
   }


> ManagementView.getTemplate() should return a new copy of the DeploymentTemplateInfo on every call
> -------------------------------------------------------------------------------------------------
>
>                 Key: JBAS-6219
>                 URL: https://jira.jboss.org/jira/browse/JBAS-6219
>             Project: JBoss Application Server
>          Issue Type: Sub-task
>      Security Level: Public(Everyone can see) 
>          Components: ProfileService
>            Reporter: Ian Springer
>            Assignee: Ian Springer
>
> In our create-resource code, we do the following:
>   DeploymentTemplateInfo template = managementView.getTemplate(templateName);
>   Map<String, ManagedProperty> managedProperties = template.getProperties();
>   // Update managedProperties according to the properties the user entered in the EmbJopr UI.
>   managementView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, resourceName, template);
>   managementView.process();
> This all works fine the first time through. The problem is the next time we execute the above code using the same templateName, getTemplate(() returns the same DeploymentTemplateInfo from the previous call (with the updates we made to its managedProperties). Instead, it should return a new "fresh" DeploymentTemplateInfo object that contains only the properties from the original template.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list