FileDocCategorySizeDatePackage
HTTPListenerConfigTest.javaAPI DocGlassfish v2 API7302Fri May 04 22:23:54 BST 2007com.sun.enterprise.management.config

HTTPListenerConfigTest

public final class HTTPListenerConfigTest extends ConfigMgrTestBase

Fields Summary
static final String
ADDRESS
static final String
DEF_VIRTUAL_SERVER
static final String
SERVER_NAME
static final Map
OPTIONAL
Constructors Summary
public HTTPListenerConfigTest()

	
	
		OPTIONAL.put( PropertiesAccess.PROPERTY_PREFIX + "xyz", "abc");
		OPTIONAL.put( HTTPListenerConfigKeys.ENABLED_KEY, Boolean.FALSE);
		OPTIONAL.put( HTTPListenerConfigKeys.ACCEPTOR_THREADS_KEY, new Integer(4 ) );
		//OPTIONAL.put( HTTPListenerConfigKeys.BLOCKING_ENABLED_KEY, "false" );
		//OPTIONAL.put( HTTPListenerConfigKeys.REDIRECT_PORT_KEY, "9081" );
		OPTIONAL.put( HTTPListenerConfigKeys.XPOWERED_BY_KEY, Boolean.TRUE );
		//OPTIONAL.put( HTTPListenerConfigKeys.FAMILY_KEY, HTTPListenerConfigFamilyValues.INET );
	
	
Methods Summary
protected final com.sun.appserv.management.config.AMXConfigcreateProgeny(java.lang.String name, java.util.Map options)

	    // this is incorrect code-on purpose-to test backward compatibility with Maps
	    // that aren't of type <String,String>
	    final Map<String,String> optional   = TypeCast.asMap( OPTIONAL );
	    assert( ! MapUtil.isAllStrings( optional ) );
	    
		final Map<String,String>	allOptions	= MapUtil.newMap( options, optional );
	    assert( ! MapUtil.isAllStrings( allOptions ) );
		
		final	int	port	= 31000 + (name.hashCode() % 31000);
		
	    final HTTPListenerConfig	config	= 
	    	getHTTPService().createHTTPListenerConfig(name,
	    		ADDRESS, port, DEF_VIRTUAL_SERVER, SERVER_NAME, allOptions );
	    
	    return( config );
	
protected final com.sun.appserv.management.config.HTTPServiceConfiggetHTTPService()

		return getConfigConfig().getHTTPServiceConfig();
	
com.sun.appserv.management.config.HTTPServiceConfiggetHTTPServiceConfig()

		return( getConfigConfig( ).getHTTPServiceConfig() );
	
protected com.sun.appserv.management.base.ContainergetProgenyContainer()

		return getHTTPService();
	
protected java.lang.StringgetProgenyJ2EEType()

		return XTypes.HTTP_LISTENER_CONFIG;
	
protected java.lang.StringgetProgenyTestName()

		return( "HTTPListenerConfigMgrTest-test-listener" );
	
protected voidremoveProgeny(java.lang.String name)

		getHTTPService().removeHTTPListenerConfig( name );
	
public voidtestCreateSSL()

    	final Map<String,String>	options	=
    	    Collections.unmodifiableMap( MapUtil.newMap(
    		new String[]
    		{
    			CLIENT_AUTH_ENABLED_KEY, "false",
    			SSL_2_ENABLED_KEY, "true",
    			SSL_3_ENABLED_KEY, "true",
    			SSL_2_CIPHERS_KEY, "+rc4,-rc4export,-rc2,-rc2export,+idea,+des,+desede3",
    			SSL3_TLS_CIPHERS_KEY,
    			    "+rsa_rc4_128_md5,+rsa3des_sha,+rsa_des_sha,-rsa_rc4_40_md5" +
    			    "-rsa_rc2_40_md5,-rsa_null_md5,-rsa_des_56_sha,-rsa_rc4_56_sha",
    			TLS_ENABLED_KEY, "true",
    			TLS_ROLLBACK_ENABLED_KEY, "true",
    		}
    		));
    		
	    if ( ! checkNotOffline( "testCreateSSL" ) )
	    {
	        return;
	    }
	    
		final String	NAME	= "HTTPListenerConfigMgr-listener-for-testCreateSSL";
		
		try
		{
			removeEx( NAME );
			final HTTPListenerConfig	newListener	=
				(HTTPListenerConfig)createProgeny( NAME, null );
			assert newListener != null;
			
			// verify that the new listener is present
			final Map<String,HTTPListenerConfig>	listeners	=
			    getHTTPService().getHTTPListenerConfigMap();
			final HTTPListenerConfig listener = listeners.get(  NAME  );
			assert listener != null;
			assert listener == newListener;
			
			final String	CERT_NICKNAME	= NAME + "Cert";
			
			final SSLConfig ssl = listener.createSSLConfig( CERT_NICKNAME, options);
			assert ssl != null;
			assert ssl.getCertNickname().equals( CERT_NICKNAME );
			
			listener.removeSSLConfig();
		}
		finally
		{
			remove( NAME );
		}
	
public voidtestGetHTTPListeners()

		final HTTPServiceConfig	httpService	=
			getConfigConfig( ).getHTTPServiceConfig();
		
		final Map<String,HTTPListenerConfig> proxies	= httpService.getHTTPListenerConfigMap();
		
		for( final String listenerName : proxies.keySet() )
		{
			final HTTPListenerConfig	listener	= (HTTPListenerConfig)
				proxies.get( listenerName );
				
			listener.getEnabled();
		}