/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.framework.extra;

import java.util.Arrays;

import junit.framework.TestCase;
import org.jfox.framework.Component;
import org.jfox.framework.ComponentMeta;
import org.jfox.framework.Registry;
import org.jfox.framework.management.TestManagementComponent;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class ManagementComponentMetaTest extends TestCase {
    Registry registry;
    ComponentMeta meta;

    public void setUp() throws Exception {
        super.setUp();
        registry = Registry.getInstance();
        meta = registry.registerComponent(TestManagementComponent.class);
    }

    public void testGetComponentInstance() throws Exception {
        Component comp = meta.getComponentInstance();
        assertTrue(comp instanceof Managable);
    }

    public void testManagementInfo() throws Exception {
        Component comp = meta.getComponentInstance();
        Managable mcomp = (Managable) comp;
        ManagementInfo minfo = mcomp.getManagementInfo();
        ManagementOperationInfo[] infos = minfo.getAllManagementOperationInfos();
        System.out.println(Arrays.asList(infos));
    }

    public void tearDown() throws Exception {
        super.tearDown();
    }

}