FileDocCategorySizeDatePackage
AppserverConnectionSourceTest.javaAPI DocGlassfish v2 API4731Fri May 04 22:23:54 BST 2007com.sun.enterprise.management.client

AppserverConnectionSourceTest

public final class AppserverConnectionSourceTest extends com.sun.enterprise.management.AMXTestBase
Tests AppserverConnectionSource. Note that no actual connect test can be done through normal junit tests since there is no host/port available and no guarantee of a running server. All other aspects can be tested.

Fields Summary
Constructors Summary
public AppserverConnectionSourceTest()

	
Methods Summary
private com.sun.appserv.management.client.AppserverConnectionSourcecreate(java.lang.String protocol)

		return( new AppserverConnectionSource( protocol, "localhost", 9999, "admin", "admin123", null) );
	
public static com.sun.enterprise.management.CapabilitiesgetCapabilities()

	    return getOfflineCapableCapabilities( false );
	
private static voidtestConnect(java.lang.String host, int port, java.lang.String protocol, java.lang.String user, java.lang.String password)

		final AppserverConnectionSource	source	=
			new AppserverConnectionSource( protocol, host, port, user, password, null);
		
		source.getMBeanServerConnection( true );
		
	
public voidtestConnect()

		final String	host		= (String)getEnvValue( "HOST" );
		final String	port		= (String)getEnvValue( "PORT" );
		final String	protocol	= (String)getEnvValue( "PROTOCOL" );
		final String	user		= (String)getEnvValue( "USER" );
		final String	password	= (String)getEnvValue( "PASSWORD" );
		
		if ( host == null || port == null || protocol == null ||
			user == null || password == null ||
			! AppserverConnectionSource.isSupportedProtocol( protocol ) )
		{
			trace( "AppserverConnectionSourceTest: skipped connect test; missing config:" +
				"host = " + host +
				", port = " + port +
				", protocol = " + protocol  +
				", user = " + user  +
				", password = " + password );
		}
		else
		{
			testConnect( host, new Integer( port ).intValue(), protocol, user, password );
		}
	
public voidtestCreateIllegal()

		try
		{
			create( "jmxmp" );
		}
		catch( IllegalArgumentException e )
		{
			// good
		}
	
public voidtestCreateRMI()

		create( AppserverConnectionSource.PROTOCOL_RMI );
	
public voidtestCreateS1ASHTTP()

		create( AppserverConnectionSource.PROTOCOL_HTTP );
	
public voidtestToString()

		create( AppserverConnectionSource.PROTOCOL_RMI ).toString();
		create( AppserverConnectionSource.PROTOCOL_HTTP ).toString();