FileDocCategorySizeDatePackage
OfflineDottedNamePrefixesTest.javaAPI DocGlassfish v2 API4605Fri May 04 22:24:04 BST 2007com.sun.enterprise.management.ext.offline

OfflineDottedNamePrefixesTest

public final class OfflineDottedNamePrefixesTest extends com.sun.enterprise.management.AMXTestBase

Fields Summary
private static final String
DOMAIN
private static final String
SERVER_CONFIG
Constructors Summary
public OfflineDottedNamePrefixesTest()

    
Methods Summary
private javax.management.ObjectNameON(java.lang.String objectNameString)

        return Util.newObjectName( objectNameString );
    
private java.lang.StringgetPrefix(java.lang.String objectNameString)

	
	     
	    
	
	    return getPrefix( ON( objectNameString ) );
	
private java.lang.StringgetPrefix(javax.management.ObjectName objectName)

	    final OfflineDottedNamePrefixes prefixes    =
	        OfflineDottedNamePrefixes.getInstance();
	    
	    return prefixes.getPrefix( objectName );
	
public voidtestAllAMXConfig()

	    if ( getConnection() == null )
	    {
	        warning( "testAllAMXConfig: No MBeanServerConnection, skipping test" );
	        return;
	    }
	    
	    final Set<ConfigElement> all   = getTestUtil().getAllAMX( ConfigElement.class );
	    
	    final Set<String>   missing = new HashSet<String>();
	    for( final ConfigElement config : all )
	    {
	        final ObjectName    objectName = Util.getObjectName( config );
	        final String    prefix  = getPrefix( objectName );
	        if ( prefix == null )
	        {
	            missing.add( config.getJ2EEType() );
	        }
	        else
	        {
	            //trace( prefix );
	        }
	    }
	    
	    if ( missing.size() != 0 )
	    {
	        //warning( "The following j2eeTypes do not yet have prefix support: " + NEWLINE +
	            //CollectionUtil.toString( missing, NEWLINE ) );
	    }
	
public voidtestGetInstance()

	    assert OfflineDottedNamePrefixes.getInstance() != null;
	
public voidtestGetPrefix()

	    assert( getPrefix( DOMAIN ).equals( "domain" ) );
	    assert( getPrefix( SERVER_CONFIG ).equals( "server-config" ) );
	
public voidtestIllegal()

	    try
	    {
	        assert( getPrefix( "amx:foo=bar" ) == null );
	        assert false;
	    }
	    catch( Exception e )
	    {
	    }