public void inner() throws Exception { setAttribute(att); } }.exec();
public void inner() throws Exception { setAttribute(att); } }.exec();
public synchronized void setAttribute(Attribute attribute) throws AttributeNotFoundException { super.setAttribute(attribute); if (attribute.getName().equals(AUTOSTART_ATTR)) { Object val = attribute.getValue().toString().toLowerCase(); if (val.equals(Boolean.TRUE.toString())) { invokeStart(); } } }
public synchronized void setAttribute(Attribute attribute) throws AttributeNotFoundException { super.setAttribute(attribute); if (attribute.getName().equals(AUTOSTART_ATTR)) { Object val = attribute.getValue().toString().toLowerCase(); if (val.equals(Boolean.TRUE.toString())) { invokeStart(); } } }
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 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); } }
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 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(); 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)); }
MysqldResourceI.PORT)); bean.setAttribute(new Attribute(MysqldResourceI.PORT, port)); bean.setAttribute(new Attribute(MysqldResourceI.DATADIR, dataDir .getPath())); bean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null);
public void testEverything() throws Exception { agent = new MysqldDynamicMBeanTestAgent("mysql"); String url = "jdbc:mysql:///test" + "?" + NonRegisteringDriver.PROPERTIES_TRANSFORM_KEY + "=" + ConnectorMXJPropertiesTransform.class.getName(); bean = new MysqldDynamicMBean(); MysqldResourceI mysqldResource = bean.getMysqldResource(); // mysqldResource.setKillDelay(3000); agent.addBean("mysql", "MySQL1", bean); assertEquals(false, mysqldResource.isRunning()); String port = "" + new TestUtil().testPort(); assertEquals("3306", mysqldResource.getServerOptions().get( MysqldResourceI.PORT)); bean.setAttribute(new Attribute(MysqldResourceI.PORT, port)); bean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); int i = 0; while (++i < 100) { if (mysqldResource.isRunning()) { break; } threads.pause(50); } assertTrue("still not started: " + i, mysqldResource.isRunning()); assertEquals(port, mysqldResource.getServerOptions().get( MysqldResourceI.PORT)); new TestUtil().assertConnectViaJDBC(url); }
public void testEverything() throws Exception { agent = new MysqldDynamicMBeanTestAgent("mysql"); String url = "jdbc:mysql:///test" + "?" + NonRegisteringDriver.PROPERTIES_TRANSFORM_KEY + "=" + ConnectorMXJPropertiesTransform.class.getName(); bean = new MysqldDynamicMBean(); bean.getMysqldResource().setKillDelay(testUtil.testKillDelay()); agent.addBean("mysql", "MySQL1", bean); assertEquals(false, bean.getMysqldResource().isRunning()); String port = "" + testUtil.testPort(); assertEquals("3306", bean.getMysqldResource().getServerOptions().get( MysqldResourceI.PORT)); bean.setAttribute(new Attribute(MysqldResourceI.PORT, port)); bean.invoke(SimpleMysqldDynamicMBean.START_METHOD, null, null); int i = 0; while (++i < 100) { if (bean.getMysqldResource().isRunning()) { break; } threads.pause(50); } assertTrue("still not started: " + i, bean.getMysqldResource() .isRunning()); assertEquals(port, bean.getMysqldResource().getServerOptions().get( MysqldResourceI.PORT)); new TestUtil().assertConnectViaJDBC(url); }