owner/src/test/java/org/aeonbits/owner/jmx/JMXMBeanTest.java
@Test
	public void testBeanHandling() throws Throwable {
		Properties props = new Properties();
		JMXConfigMutableReloadable config = ConfigFactory.create(JMXConfigMutableReloadable.class, props);
		MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
		ObjectName mbeanName = new ObjectName(
				"org.aeonbits.owner.jmx:type=testBeanHandling,id=JMXConfigMutableReloadable");
		mbs.registerMBean(config, mbeanName);
		
		assertEquals("8080", mbs.getAttribute(mbeanName, "port"));
		AttributeList attrList =  new AttributeList();
		attrList.add(new Attribute("port", "8080"));
		attrList.add(new Attribute("hostname", "http://localhost"));
		attrList.add(new Attribute("maxThreads", "42"));
		assertEquals(attrList,  mbs.getAttributes(mbeanName, new String[] { "port", "hostname", "maxThreads"}));
		
		mbs.invoke(mbeanName, "setProperty", new String[] { "port", "7878" },
				null);
		assertEquals("7878", mbs.getAttribute(mbeanName, "port"));
		assertEquals("7878", mbs.invoke(mbeanName, "getProperty", new String[] { "port"}, null));		
		
		mbs.invoke(mbeanName, "reload", null, null);
		assertEquals(attrList,  mbs.getAttributes(mbeanName, new String[] { "port", "hostname", "maxThreads"}));
	}
/*
	 * Simple test case for JMX accessible mbeans.
	 * 
	 * Registers a config of JMXConfigMutableReloadable.class
	 * under object name org.aeonbits.owner.jmx:type=testBeanHandling,id=JMXConfigMutableReloadable and
	 * tests getAttribute(s) methods and invokes setProperty actions with it.
	 */
Simple test case for JMX accessible mbeans.

Registers a config of JMXConfigMutableReloadable.class
under object name org.aeonbits.owner.jmx:type=testBeanHandling,id=JMXConfigMutableReloadable and
tests getAttribute(s) methods and invokes setProperty actions with it.
Simple test case for JMX accessible mbeans . Registers a config of JMXConfigMutableReloadable . class under object name org . aeonbits . owner . jmx : type = testBeanHandling id = JMXConfigMutableReloadable and tests getAttribute ( s ) methods and invokes setProperty actions with it .
@Test
	public void testBeanHandling() throws Throwable {
		Properties props = new Properties();
		JMXConfigMutableReloadable config = ConfigFactory.create(JMXConfigMutableReloadable.class, props);
		MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
		ObjectName mbeanName = new ObjectName(
				"org.aeonbits.owner.jmx:type=testBeanHandling,id=JMXConfigMutableReloadable");
		mbs.registerMBean(config, mbeanName);
		assertEquals("8080", mbs.getAttribute(mbeanName, "port"));
		AttributeList attrList =  new AttributeList();
		attrList.add(new Attribute("port", "8080"));
		attrList.add(new Attribute("hostname", "http://localhost"));
		attrList.add(new Attribute("maxThreads", "42"));
		assertEquals(attrList,  mbs.getAttributes(mbeanName, new String[] { "port", "hostname", "maxThreads"}));
		mbs.invoke(mbeanName, "setProperty", new String[] { "port", "7878" },
				null);
		assertEquals("7878", mbs.getAttribute(mbeanName, "port"));
		assertEquals("7878", mbs.invoke(mbeanName, "getProperty", new String[] { "port"}, null));		
		mbs.invoke(mbeanName, "reload", null, null);
		assertEquals(attrList,  mbs.getAttributes(mbeanName, new String[] { "port", "hostname", "maxThreads"}));
	}
@ Test public void testBeanHandling ( ) throws Throwable { Properties props = new Properties ( ) ; JMXConfigMutableReloadable config = ConfigFactory . create ( JMXConfigMutableReloadable . class , props ) ; MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; ObjectName mbeanName = new ObjectName ( "org.aeonbits.owner.jmx:type=testBeanHandling,id=JMXConfigMutableReloadable" ) ; mbs . registerMBean ( config , mbeanName ) ; assertEquals ( "8080" , mbs . getAttribute ( mbeanName , "port" ) ) ; AttributeList attrList = new AttributeList ( ) ; attrList . add ( new Attribute ( "port" , "8080" ) ) ; attrList . add ( new Attribute ( "hostname" , "http://localhost" ) ) ; attrList . add ( new Attribute ( "maxThreads" , "42" ) ) ; assertEquals ( attrList , mbs . getAttributes ( mbeanName , new String [ ] { "port" , "hostname" , "maxThreads" } ) ) ; mbs . invoke ( mbeanName , "setProperty" , new String [ ] { "port" , "7878" } , null ) ; assertEquals ( "7878" , mbs . getAttribute ( mbeanName , "port" ) ) ; assertEquals ( "7878" , mbs . invoke ( mbeanName , "getProperty" , new String [ ] { "port" } , null ) ) ; mbs . invoke ( mbeanName , "reload" , null , null ) ; assertEquals ( attrList , mbs . getAttributes ( mbeanName , new String [ ] { "port" , "hostname" , "maxThreads" } ) ) ; }
Simple test case for JMX accessible mbeans.
Simple test case for JMX accessible mbeans .