FileDocCategorySizeDatePackage
ManagedResourceIntrospectorTest.javaAPI DocGlassfish v2 API4536Fri May 04 22:25:56 BST 2007com.sun.enterprise.admin.monitor.util

ManagedResourceIntrospectorTest

public class ManagedResourceIntrospectorTest extends TestCase
Unit Test for ManagedResourceIntrospector to test appropriateness of introspection for the purposes of generating an MBeanInfo Object
author
sg112326

Fields Summary
DynamicMBean
mbean
ManagedResourceIntrospector
mri
javax.management.j2ee.statistics.Stats
stats
Constructors Summary
public ManagedResourceIntrospectorTest(String testName)
Creates a new instance of ManagedResourceIntrospectorTest

        super(testName);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        junit.textui.TestRunner.run(suite());
    
protected voidsetUp()

       
        mbean = new GeneratedMonitoringMBeanImpl();
        mri = new ManagedResourceIntrospector(mbean);
        stats = new S1ASJVMStatsImplMock();
    
public static junit.framework.Testsuite()

        TestSuite suite = new TestSuite(ManagedResourceIntrospectorTest.class);
        return suite;
    
protected voidtearDown()

        
    
public voidtestCreation()

        assertNotNull(mbean);
        assertNotNull(mri);
        assertNotNull(stats);
    
public voidtestGetAttributeInfo()

        MBeanAttributeInfo[] info = mri.getAttributeInfo(stats);
        assertNotNull(info);
        assertEquals(28, info.length);
    
public voidtestGetAttributeInfoWithNull()

        MBeanAttributeInfo[] info = mri.getAttributeInfo(null);
        this.assertNull(info);
    
public voidtestGetParameterInfo()

        Class[] paramTypes = new Class[]{java.lang.String.class, java.lang.Integer.class, 
            javax.management.j2ee.statistics.Statistic.class};
        MBeanParameterInfo[] info = mri.getParameterInfo(paramTypes);
        assertEquals(paramTypes.length, info.length);
    
public voidtestGetParameterInfoWithNull()

        Class[] paramTypes = new Class[]{};
        MBeanParameterInfo[] info = mri.getParameterInfo(paramTypes);
        assertEquals(paramTypes.length, info.length);  
    
public voidtestIntrospection()

        MBeanInfo info = mri.introspect(stats);
        assertNotNull(info);
        assertEquals(mbean.getClass().getName(), info.getClassName());