FileDocCategorySizeDatePackage
LibrariesTest.javaAPI DocGlassfish v2 API4557Fri May 04 22:23:56 BST 2007com.sun.enterprise.management.config

LibrariesTest

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

Fields Summary
private final Set
READ_ONLY_LIBRARIES
private final Set
DONT_TEST_LIBRARIES
private static final String[]
TEST_LIBS
Constructors Summary
public LibrariesTest()

    
Methods Summary
public voidtestLibraries()
public void testGUIHang() { final String[] TEST_LIBS = new String[] { "/foo", "/bar" }; final ObjectName objectName = Util.newObjectName( "amx:j2eeType=X-WebModuleConfig,name=admingui" ); final WebModuleConfig cfg = getProxyFactory().getProxy( objectName ); final String[] saveLibs = cfg.getLibraries(); assert( saveLibs != null ); final String[] testLibs = ArrayUtil.newArray( saveLibs, TEST_LIBS ); try { cfg.setLibraries( testLibs ); } finally { cfg.setLibraries( saveLibs ); } }

    
             			                 	              	            	    	            	        	    	               	    	    		      	    	    	    	          	    		
	
		 
	
	
		final Set<Libraries>	all = getTestUtil().getAllAMX( Libraries.class );
		
		for( final Libraries l : all )
		{
		    final AMX   amx = (AMX)l;
		    
		    if ( DONT_TEST_LIBRARIES.contains( amx.getName() ) )
		    {
		        continue;
		    }
		    
		    final ObjectName    objectName  = Util.getObjectName( amx );

		    final String[]  saveLibs    = l.getLibraries();
		    assert( saveLibs != null );
		    
		    final String[]  testLibs    = ArrayUtil.newArray( saveLibs, TEST_LIBS );
		    try
		    {
    		    l.setLibraries( testLibs );
		    }
		    catch( Exception e )
		    {
		        if ( ! READ_ONLY_LIBRARIES.contains( ((AMX)l).getName() ) )
		        {
		        warning ("Couldn't change Libraries Attribute for " + objectName +
		            " (probably read-only, though not advertised as such)" );
		        }
		    }
		    finally
		    {
		        l.setLibraries( saveLibs );
		    }
		    
		}