continuum-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marecor Baclay <mbac...@g2ix.com>
Subject Re: svn commit: r917845 - /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java
Date Tue, 02 Mar 2010 03:38:07 GMT
On 3/2/2010 11:31 AM, Brett Porter wrote:
> I think these can be simplified:
>
> String INSTALL_TOOL_JDK_PATH = isWindows() ? getEscapeProperty( "INSTALL_TOOL_JDK_PATH"
) :  getProperty( "INSTALL_TOOL_JDK_PATH" );
>
> You don't need to duplicate the other calls that are identical, or attempt to detect
Mac/Unix (the tests would currently do nothing on the change the os.name didn't match, like
maybe on FreeBSD or Solaris).
>
> You could perhaps further simplify it by removing getEscapeProperty though. How does
the filtered value in testng.properties look in Windows? Is it using single \ instead of \\
after being filtered and the property loader treats that as an escape instead of an \ ? If
that is the case, try setting the maven-resources-plugin to v2.4.2 and see if it helps.
>
> - Brett
>
>
>    

Ah ok. Thanks Brett. Will do the change! :-)
--
Cora
> On 02/03/2010, at 1:49 PM, mbaclay@apache.org wrote:
>
>    
>> Author: mbaclay
>> Date: Tue Mar  2 02:49:38 2010
>> New Revision: 917845
>>
>> URL: http://svn.apache.org/viewvc?rev=917845&view=rev
>> Log:
>> [CONTINUUM-2474] Fix selenium failing test in windows
>> - added a check on OS being used (failing test that appears in InstallationTest in
windows)
>>
>>
>> Modified:
>>     continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java
>>
>> Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java
>> URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java?rev=917845&r1=917844&r2=917845&view=diff
>> ==============================================================================
>> --- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java
(original)
>> +++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/InstallationTest.java
Tue Mar  2 02:49:38 2010
>> @@ -33,18 +33,37 @@
>>      public void testAddJdkToolWithoutBuildEnvirotment()
>>      {
>>          String INSTALL_TOOL_JDK_NAME = getProperty( "INSTALL_TOOL_JDK_NAME" );
>> -        String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH"
);
>> -        goToAddInstallationTool();
>> -        addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, true );
>> +		if(isWindows())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, true );
>> +		}
>> +		else if(isMac() || isUnix())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, true );
>> +		}
>>      }
>>
>>      public void testAddMavenToolWithBuildEnvirotment()
>>      {
>>          String INSTALL_TOOL_MAVEN_NAME = getProperty( "INSTALL_TOOL_MAVEN_NAME"
);
>> -        String INSTALL_TOOL_MAVEN_PATH = getEscapeProperty( "INSTALL_TOOL_MAVEN_PATH"
);
>> -        goToAddInstallationTool();
>> -        addInstallation( INSTALL_TOOL_MAVEN_NAME, "Maven 2", INSTALL_TOOL_MAVEN_PATH,
true, true, true );
>> -        // TODO: Validate build envirotment
>> +        if(isWindows())
>> +		{
>> +			String INSTALL_TOOL_MAVEN_PATH = getProperty( "INSTALL_TOOL_MAVEN_PATH" );
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_MAVEN_NAME, "Maven 2", INSTALL_TOOL_MAVEN_PATH,
true, true, true );
>> +			// TODO: Validate build envirotment
>> +		}
>> +		else if(isMac() || isUnix())
>> +		{
>> +			String INSTALL_TOOL_MAVEN_PATH = getEscapeProperty( "INSTALL_TOOL_MAVEN_PATH"
);
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_MAVEN_NAME, "Maven 2", INSTALL_TOOL_MAVEN_PATH,
true, true, true );
>> +			// TODO: Validate build envirotment
>> +		}
>>      }
>>
>>      public void testAddInstallationVariableWithBuildEnvirotment()
>> @@ -100,10 +119,20 @@
>>      public void testAddDuplicatedInstallationTool()
>>      {
>>          String INSTALL_TOOL_JDK_NAME = getProperty( "INSTALL_TOOL_JDK_NAME" );
>> -        String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH"
);
>> -        goToAddInstallationTool();
>> -        addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, false );
>> -        assertTextPresent( "Installation name already exists" );
>> +		if(isWindows())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, false );
>> +			assertTextPresent( "Installation name already exists" );
>> +		}
>> +		else if(isMac() || isUnix())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			goToAddInstallationTool();
>> +			addInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, false,
true, false );
>> +			assertTextPresent( "Installation name already exists" );
>> +		}
>>      }
>>
>>      @Test( dependsOnMethods = { "testAddInstallationVariableWithBuildEnvirotment"
} )
>> @@ -121,12 +150,24 @@
>>      public void testEditInstallationTool()
>>      {
>>          String INSTALL_TOOL_JDK_NAME = getProperty( "INSTALL_TOOL_JDK_NAME" );
>> -        String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH"
);
>> -        String newName = "new_name";
>> -        goToEditInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH,
true );
>> -        editInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true, true );
>> -        goToEditInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true );
>> -        editInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, true,
true );
>> +		if(isWindows())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			String newName = "new_name";
>> +			goToEditInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, true
);
>> +			editInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true, true );
>> +			goToEditInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true );
>> +			editInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, true,
true );
>> +		}
>> +		else if(isMac() || isUnix())
>> +		{
>> +			String INSTALL_TOOL_JDK_PATH = getEscapeProperty( "INSTALL_TOOL_JDK_PATH" );
>> +			String newName = "new_name";
>> +			goToEditInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, true
);
>> +			editInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true, true );
>> +			goToEditInstallation( newName, "JDK", INSTALL_TOOL_JDK_PATH, true );
>> +			editInstallation( INSTALL_TOOL_JDK_NAME, "JDK", INSTALL_TOOL_JDK_PATH, true,
true );
>> +		}
>>      }
>>
>>      @Test( dependsOnMethods = { "testAddInstallationVariableWithBuildEnvirotment"
} )
>> @@ -157,4 +198,22 @@
>>          String INSTALL_VAR_NAME = getProperty( "INSTALL_VAR_NAME" );
>>          removeInstallation( INSTALL_VAR_NAME );
>>      }
>> +	
>> +	public static boolean isWindows()
>> +	{
>> +		String os = System.getProperty("os.name").toLowerCase();
>> +		return (os.indexOf( "win" )>= 0);
>> +	}
>> +
>> +	public static boolean isMac()
>> +	{
>> +		String os = System.getProperty("os.name").toLowerCase();
>> +		return (os.indexOf( "mac" )>= 0);
>> +	}
>> +
>> +	public static boolean isUnix()
>> +	{
>> +		String os = System.getProperty("os.name").toLowerCase();
>> +		return (os.indexOf( "nix")>=0 || os.indexOf( "nux")>=0);
>> +	}
>> }
>>
>>
>>      
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
>
>
>
>    


Mime
View raw message