Dale LaBossiere created QUARKS-155:
--------------------------------------

             Summary: ControlService impls - need to enhance JsonControlService?
                 Key: QUARKS-155
                 URL: https://issues.apache.org/jira/browse/QUARKS-155
             Project: Quarks
          Issue Type: Task
            Reporter: Dale LaBossiere


JMXControlService allows multiple mbeans (of a different type) registered for a 
single ``<type,alias,id>``.  The code below passes.

When tweaked to use the JsonControlService it throws an ISE as noted in the 
comments below.

Which behavior is correct?  Does JsonControlService need to be enhanced?

```
    @Test
    public void testMultiBeanSameId() throws Exception {
      
        ControlService cs = new JMXControlService(DOMAIN, new Hashtable<>());
        // ControlService cs = new JsonControlService();
        
        MyControlX myControlX = new MyControlX();
        MyControlY myControlY = new MyControlY();
        String type = "stream";
        String id = "a";
        String alias = "myStream";
        String controlIdX = cs.registerControl(type, id, alias, 
MyControlXMBean.class, myControlX);
        // following registerControl throws ISE when using JsonControlService 
as its
        // limited to a single registration for a <type,alias> pair.
        // note: it ignores the id.
        String controlIdY = cs.registerControl(type, id, alias, 
MyControlYMBean.class, myControlY);
        assertTrue(controlIdX, !controlIdX.equals(controlIdY));
        assertTrue(cs.getControl(type, alias, MyControlXMBean.class) instanceof 
MyControlXMBean);
        assertTrue(cs.getControl(type, alias, MyControlYMBean.class) instanceof 
MyControlYMBean);
        cs.unregister(controlIdX);
        cs.unregister(controlIdY);
    }
``` 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to