protected Object inner() throws Exception { return getAttribute(key); } };
public void testSetAttributes() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); options.put("baz", "wiz"); options.put("datadir", "/bogus/dir"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); AttributeList list = new AttributeList(); list.add(new Attribute("foo", "changed")); list.add(new Attribute("datadir", "/changed/dir")); myBean.setAttributes(list); assertEquals("changed", myBean.getAttribute("foo")); assertEquals("wiz", myBean.getAttribute("baz")); assertEquals("/changed/dir", myBean.getAttribute("datadir")); }
public void testSetAttributes() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); options.put("baz", "wiz"); options.put("datadir", "/bogus/dir"); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); AttributeList list = new AttributeList(); list.add(new Attribute("foo", "changed")); list.add(new Attribute("datadir", "/changed/dir")); myBean.setAttributes(list); assertEquals("changed", myBean.getAttribute("foo")); assertEquals("wiz", myBean.getAttribute("baz")); assertEquals("/changed/dir", myBean.getAttribute("datadir")); }
public void testGetAttribute() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); assertEquals("bar", myBean.getAttribute("foo")); try { myBean.getAttribute("b0gus"); fail(); } catch (AttributeNotFoundException e) { assertTrue(e.getMessage().indexOf("b0gus") >= 0); } }
public void testGetAttribute() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); assertEquals("bar", myBean.getAttribute("foo")); try { myBean.getAttribute("b0gus"); fail(); } catch (AttributeNotFoundException e) { assertTrue(e.getMessage().indexOf("b0gus") >= 0); } }
public void testGetAgentVersion() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); String verAttName = myBean.versionAttributeName(); String expected = "$Id: " + new Str().shortClassName(myBean); String beanVersion = (String) myBean.getAttribute(verAttName); new TestUtil().assertContainsIgnoreCase(beanVersion, expected); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isReadable()); assertTrue(atts[0].isWritable()); assertFalse(atts[0].isIs()); assertTrue(atts[1].isReadable()); assertTrue(atts[1].isWritable()); assertFalse(atts[1].isIs()); assertTrue(atts[2].isReadable()); assertFalse(atts[2].isWritable()); assertFalse(atts[2].isIs()); }
public void testGetAgentVersion() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); String verAttName = myBean.versionAttributeName(); String expected = "$Id: " + new ClassUtil().shortName(myBean); String beanVersion = (String) myBean.getAttribute(verAttName); new TestUtil().assertContainsIgnoreCase(beanVersion, expected); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isReadable()); assertTrue(atts[0].isWritable()); assertFalse(atts[0].isIs()); assertTrue(atts[1].isReadable()); assertTrue(atts[1].isWritable()); assertFalse(atts[1].isIs()); assertTrue(atts[2].isReadable()); assertFalse(atts[2].isWritable()); assertFalse(atts[2].isIs()); }