public void testAutoStart() throws Exception { MysqldResourceI mysqld = new MysqldResourceTestImpl(); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); assertFalse(mysqld.isRunning()); String autostart = SimpleMysqldDynamicMBean.AUTOSTART_ATTR; String str_true = Boolean.TRUE.toString(); myBean.setAttribute(new Attribute(autostart, str_true)); assertFalse(mysqld.isRunning()); assertFalse(mysqld.getServerOptions().containsKey(autostart)); }
public void testAutoStart() throws Exception { MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); assertFalse(mysqld.isRunning()); String autostart = SimpleMysqldDynamicMBean.AUTOSTART_ATTR; String str_true = Boolean.TRUE.toString(); myBean.setAttribute(new Attribute(autostart, str_true)); assertFalse(mysqld.isRunning()); assertFalse(mysqld.getServerOptions().containsKey(autostart)); }
public void testFreezeAttributes() { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isWritable()); myBean.freezeAttributes(); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertFalse(atts[0].isWritable()); }
public void testFreezeAttributes() { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isWritable()); myBean.freezeAttributes(); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertFalse(atts[0].isWritable()); }
public void testAttributesFrozenWhenRunning() throws ReflectionException { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isWritable()); myBean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertFalse(atts[0].isWritable()); myBean.invoke(SimpleMysqldDynamicMBean.STOP_METHOD, null, null); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertTrue(atts[0].isWritable()); } }
public void testAttributesFrozenWhenRunning() throws ReflectionException { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); MBeanInfo info = myBean.getMBeanInfo(); MBeanAttributeInfo[] atts = info.getAttributes(); assertTrue(atts[0].isWritable()); myBean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertFalse(atts[0].isWritable()); myBean.invoke(SimpleMysqldDynamicMBean.STOP_METHOD, null, null); info = myBean.getMBeanInfo(); atts = info.getAttributes(); assertTrue(atts[0].isWritable()); } }
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()); }