public boolean isReadyForConnections() { return isRunning(); } }
public MysqldResourceI newMysqldResource(File base, File data, String version) { return new MysqldResourceTestImpl(base, data, fakeRunningMysqlds); } }
@Override public void start(String threadName, Map mysqldArgs) { start(threadName, mysqldArgs, false); }
public MysqldResourceI newMysqldResource(File base) { this.baseDir = base; MysqldResourceI newMysqldResourceI = new MysqldResourceTestImpl(); resources.add(newMysqldResourceI); return newMysqldResourceI; } }
public boolean isReadyForConnections() { return isRunning(); }
public void start(String threadName, Map mysqldArgs) { start(threadName, mysqldArgs, false); }
public void testSetAttribute() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); try { myBean.setAttribute(new Attribute("bogus", "werid")); fail(); } catch (AttributeNotFoundException e) { assertTrue(e.getMessage(), e.getMessage().indexOf("bogus") >= 0); } }
@Override public boolean isReadyForConnections() { return isRunning(); }
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 testPassOptionsMapToMysqld() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); options.put("baz", "wiz"); options.put("datadir", "/bogus/dir"); options.put("help", ""); MysqldResourceI mysqld = new MysqldResourceTestImpl(options); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean(mysqld); myBean.setAttribute(new Attribute("foo", "changed")); assertTrue(myBean.attributesToOpionMap().containsKey("foo")); assertEquals(1, myBean.attributesToOpionMap().size()); myBean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); assertEquals("changed", mysqld.getServerOptions().get("foo")); }
public void testGetAttributeList() 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 attributeList = myBean.getAttributes(new String[] { "foo", "datadir" }); assertEquals(2, attributeList.size()); Attribute att = (Attribute) attributeList.get(0); assertEquals("foo", att.getName()); assertEquals("bar", att.getValue()); }
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 testPassOptionsMapToMysqld() throws Exception { Map options = new HashMap(); options.put("foo", "bar"); options.put("baz", "wiz"); options.put("datadir", "/bogus/dir"); options.put("help", ""); MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, options, new HashMap()); SimpleMysqldDynamicMBean myBean = new SimpleMysqldDynamicMBean( new TestFactory(mysqld)); myBean.setAttribute(new Attribute("foo", "changed")); assertTrue(myBean.attributesToOpionMap().containsKey("foo")); assertEquals(1, myBean.attributesToOpionMap().size()); myBean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); assertEquals("changed", mysqld.getServerOptions().get("foo")); }
public void testSetAttribute() 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)); try { myBean.setAttribute(new Attribute("bogus", "werid")); fail(); } catch (AttributeNotFoundException e) { assertTrue(e.getMessage(), e.getMessage().indexOf("bogus") >= 0); } }
public void testGetAttributeList() 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 attributeList = myBean.getAttributes(new String[] { "foo", "datadir" }); assertEquals(2, attributeList.size()); Attribute att = (Attribute) attributeList.get(0); assertEquals("foo", att.getName()); assertEquals("bar", att.getValue()); }
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 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 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 testAutoStart() throws Exception { MysqldResourceI mysqld = new MysqldResourceTestImpl(null, null, new HashMap()); MysqldDynamicMBean myBean = new MysqldDynamicMBean(new TestFactory( mysqld)); assertFalse(mysqld.isRunning()); String autostart = SimpleMysqldDynamicMBean.AUTOSTART_ATTR; String str_true = Boolean.TRUE.toString(); myBean.setAttribute(new Attribute(autostart, str_true)); assertTrue(mysqld.isRunning()); assertFalse(mysqld.getServerOptions().containsKey(autostart)); } }
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()); }