/*
 * Copyright (c) 2012 Tripwire, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *  o Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *  o Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.jmxdatamart.JMXTestServer;

import com.sun.jmx.interceptor.DefaultMBeanServerInterceptor;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.io.FileWriter;
import javax.management.Attribute;
import javax.management.MBeanAttributeInfo;
import org.jmxdatamart.Extractor.*;

/**
 *
 * @author Binh Tran <mynameisbinh@gmail.com>
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {

        RandomValueDynamicMBean dmb = new RandomValueDynamicMBean();
        dmb.addAttribute("Car", Car.class.toString(), "a Car", true, true, false);
        dmb.setAttribute(new Attribute("Car", new Car("123", "234", 3, 2)));
        
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName on = new ObjectName("org.jmxdatamart.jmxtestserver:type=randomDMBean");
        mbs.registerMBean(dmb, on);
    }
}

@@ -1416,70 +1416,8 @@
 r;%0A%0A
-import com.sun.jmx.interceptor.DefaultMBeanServerInterceptor;%0A
 impo
@@ -1563,87 +1563,8 @@
 er;%0A
-import javax.management.Attribute;%0Aimport javax.management.MBeanAttributeInfo;%0A
 impo
@@ -1811,226 +1811,411 @@
     
-RandomValueDynamicMBean d
+TestBean tb = new TestBean();%0A        MBeanServer 
 mb
+s
  = 
-new RandomValueDynamicMBean();%0A        dmb.addAttribute(%22Car%22, Car.class.toString(), %22a Car%22, true, true, false);%0A        dmb.setAttribute(new Attribute(%22Car%22, new Car(%22123%22, %22234%22, 3, 2))
+ManagementFactory.getPlatformMBeanServer();%0A        ObjectName mbeanName = new ObjectName(%22com.personal.JMXTestServer:type=TestBean%22);%0A        mbs.registerMBean(tb, mbeanName);%0A%0A        FileWriter writer = new FileWriter(System.getProperty(%22user.dir%22) + %22/JMXTestServer.txt%22);%0A        writer.write(%22Start exporting on %22 + new java.util.Date()+%22%5Cn%22
 );%0A 
@@ -2221,16 +2221,21 @@
         
+try %7B
 %0A       
@@ -2239,196 +2239,425 @@
     
-MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();%0A        ObjectName on = new ObjectName(%22org.jmxdatamart.jmxtestserver:type=randomDMBean%22);%0A        mbs.registerMBean(dmb, on);
+    while (true) %7B%0A                tb.randomize();%0A                System.out.println(tb.toString());%0A                writer.write(tb.toString()+%22%5Cn%22);%0A                writer.flush();%0A                Thread.sleep(2000);%0A            %7D%0A        %7D%0A        catch (Exception e)%7B%0A            System.err.println(e.getStackTrace());%0A            System.exit(1);%0A        %7D%0A        finally %7B%0A            writer.close();%0A        %7D
 %0A   

Revert commit: Not a bug.