@Test
public void testRegistry()
        throws InterruptedException, IOException, InstanceNotFoundException, MBeanException,
        AttributeNotFoundException, ReflectionException, InvalidAttributeValueException {

  JmxTest testObj = new JmxTest();
  Properties props = new Properties();
  props.setProperty("propKey", "propvalue");
  Registry.export("caca", "maca", props);
  Registry.export("test", "Test", props, testObj);
  Registry.registerMBean("test2", "TestClassic", new org.spf4j.jmx.Test());
  Map<String, Object> map = new HashMap<>();
  map.put("isCrap", Boolean.TRUE);
  map.put("a.crap", Boolean.FALSE);
  map.put("isNonsense", "bla");
  map.put("", "bla");
  Registry.export("testMap", "map", map, testObj);
        Thread.sleep(300000);
  Client.setAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "booleanFlag", Boolean.TRUE);
  Client.setAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "propKey", "caca");
  Object ret = Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "booleanFlag");
  Assert.assertEquals(Boolean.TRUE, ret);
  String prop = (String) Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "propKey");
  Assert.assertEquals("caca", prop);
  Assert.assertEquals("caca", props.get("propKey"));
  CompositeData cd = (CompositeData) Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "columnDef");
  LOG.debug("CD={}", cd);
  Assert.assertEquals("bla", cd.get("name"));
  CompositeData cd2 = (CompositeData) Client.callOperation("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "getColumnDef", "bubu");
  LOG.debug("CD2={}", cd2);
  Assert.assertEquals("bubu", cd2.get("name"));
  CompositeData cd3 = (CompositeData) Client.callOperation("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "echo", cd2);
  LOG.debug("CD3={}", cd3);
  Assert.assertEquals("bubu", cd3.get("name"));
  Client.callOperation("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "print", 3, Boolean.TRUE, "caca", cd2);
  Client.setAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "stringVal", "bla bla");
  Object ret2 = Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
          "test", "Test", "stringVal");
  Assert.assertEquals("bla bla", ret2);
  try {
    Client.setAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi",
            "test", "Test", "doubleVal", 0.0);
    Assert.fail();
  } catch (RuntimeMBeanException e) {
    Throwables.writeTo(e, System.err, Throwables.PackageDetail.SHORT);
  }
        Thread.sleep(1000000000);
}