Author: olamy
Date: Mon Sep 19 12:41:29 2011
New Revision: 1172595

URL: http://svn.apache.org/viewvc?rev=1172595&view=rev
Log:
fix some selenium tests

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml 
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml Mon 
Sep 19 12:41:29 2011
@@ -40,7 +40,7 @@
     <!-- TODO: review how appropriate the memory settings are - should work 
with less -->
     <cargo.jvm.args>-Xmx512m -XX:MaxPermSize=256m</cargo.jvm.args>
     <seleniumPluginVersion>2.0</seleniumPluginVersion>
-    <selenium-server.version>2.5.0</selenium-server.version>
+    <selenium-server.version>2.6.0</selenium-server.version>
   </properties>
 
   <dependencies>

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
 Mon Sep 19 12:41:29 2011
@@ -37,21 +37,25 @@ public class AppearanceTest
     @Test( dependsOnMethods = { "testAddAppearanceEmptyValues" } )
     public void testAddAppearanceInvalidValues()
     {
+        goToAppearancePage();
+        clickLinkWithText( "Edit" );
         addEditAppearance( "<>~+[ ]'\"", "/home/user/abcXYZ0129._/\\~:?!&=-<> 
~+[ ]'\"",
                            "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"", 
false );
         assertTextPresent(
             "Organisation name must only contain alphanumeric characters, 
white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), 
ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), 
colons(:), tildes(~), and dashes(-)." );
         assertTextPresent( "You must enter a URL" );
-        //assertXpathCount( "//tr errorfor='saveAppearance_organisationUrl'", 
1 );
-        assertXpathCount( "//span[@class='errorMessage/text()='You must enter 
a URL']", 1 );
+
+        assertXpathCount( "//span[@class='errorMessage'/text()='You must enter 
a URL']", 1 );
         assertTextPresent( "You must enter a URL for your logo" );
-        assertXpathCount( "//span[@class='errorMessage/text()='You must enter 
a URL for your logo']", 1 );
+        assertXpathCount( "//span[@class='errorMessage'/text()='You must enter 
a URL for your logo']", 1 );
 
     }
 
     @Test( dependsOnMethods = { "testAddAppearanceInvalidValues" } )
     public void testAddAppearanceInvalidOrganisationName()
     {
+        goToAppearancePage();
+        clickLinkWithText( "Edit" );
         addEditAppearance( "<>~+[ ]'\"", "http://www.apache.org/";, 
"http://www.apache.org/images/asf_logo_wide.gifs";,
                            false );
         assertTextPresent(
@@ -61,15 +65,18 @@ public class AppearanceTest
     @Test( dependsOnMethods = { "testAddAppearanceInvalidOrganisationName" } )
     public void testAddAppearanceInvalidOrganisationUrl()
     {
+        goToAppearancePage();
         addEditAppearance( "The Apache Software Foundation", 
"/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"",
                            "http://www.apache.org/images/asf_logo_wide.gifs";, 
false );
         assertTextPresent( "You must enter a URL" );
-        assertXpathCount( "//span[@class='errorMessage/text()='You must enter 
a URL']", 1 );
+        assertXpathCount( "//span[@class='errorMessage'/text()='You must enter 
a URL']", 1 );
     }
 
     @Test( dependsOnMethods = { "testAddAppearanceInvalidOrganisationUrl" } )
     public void testAddAppearanceInvalidOrganisationLogo()
     {
+        goToAppearancePage();
+        clickLinkWithText( "Edit" );
         addEditAppearance( "The Apache Software Foundation", 
"http://www.apache.org/";,
                            "/home/user/abcXYZ0129._/\\~:?!&=-<> ~+[ ]'\"", 
false );
         assertTextPresent( "You must enter a URL" );
@@ -79,6 +86,8 @@ public class AppearanceTest
     @Test( dependsOnMethods = { "testAddAppearanceInvalidOrganisationLogo" } )
     public void testAddAppearanceValidValues()
     {
+        goToAppearancePage();
+        clickLinkWithText( "Edit" );
         addEditAppearance( "The Apache Software Foundation", 
"http://www.apache.org/";,
                            "http://www.apache.org/images/asf_logo_wide.gifs";, 
true );
         assertTextPresent( "The Apache Software Foundation" );
@@ -87,6 +96,8 @@ public class AppearanceTest
     @Test( dependsOnMethods = { "testAddAppearanceValidValues" } )
     public void testEditAppearance()
     {
+        goToAppearancePage();
+
         clickLinkWithText( "Edit" );
         addEditAppearance( "Apache Software Foundation", 
"http://www.apache.org/";,
                            "http://www.apache.org/images/asf_logo_wide.gifs";, 
true );

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
 Mon Sep 19 12:41:29 2011
@@ -71,7 +71,7 @@ public class BrowseTest
         clickLinkWithText( "Add" );
         addManagedRepository( getProperty( "RELEASES_REPOSITORY" ), "Releases 
Repository",
                               new File( getBasedir(), 
"target/repository/releases" ).getPath(), "",
-                              "Maven 2.x Repository", "0 0 * * * ?", "", "" );
+                              "Maven 2.x Repository", "0 0 * * * ?", "", "", 
true );
         assertTextPresent( "Releases Repository" );
 
         String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
 Mon Sep 19 12:41:29 2011
@@ -46,7 +46,8 @@ public class LoginTest
         goToLoginPage();
         setFieldValue( "loginForm_username", "badUsername" );
         getSelenium().click( "loginSubmit" );
-        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        waitPage();
         assertElementPresent( "//ul[@class=\'errorMessage\']" );
         //assertTextPresent( "You have entered an incorrect username and/or 
password" );
     }
@@ -58,7 +59,8 @@ public class LoginTest
         setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         setFieldValue( "loginForm_password", "badPassword" );
         getSelenium().click( "loginSubmit" );
-        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        waitPage();
         //assertTextPresent( "You have entered an incorrect username and/or 
password" );
         //<ul class="errorMessage"><li><span>
         assertElementPresent( "//ul[@class=\'errorMessage\']" );
@@ -70,7 +72,8 @@ public class LoginTest
         goToLoginPage();
         setFieldValue( "loginForm_password", "password" );
         getSelenium().click( "loginSubmit" );
-        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        waitPage();
         //assertTextPresent( "User Name is required" );
         assertElementPresent( "//tr[@errorFor=\'loginForm_username\']");
     }
@@ -81,7 +84,8 @@ public class LoginTest
         goToLoginPage();
         setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         getSelenium().click( "loginSubmit" );
-        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        waitPage();
         //assertTextPresent( "You have entered an incorrect username and/or 
password" );
         assertElementPresent( "//ul[@class=\'errorMessage\']" );
     }
@@ -93,7 +97,8 @@ public class LoginTest
         setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         setFieldValue( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
         getSelenium().click( "loginSubmit" );
-        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        //getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        waitPage();
         //assertTextPresent( "Logout" );
         assertElementPresent( "logoutLink" );
         //assertTextPresent( "Edit Details" );

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
 Mon Sep 19 12:41:29 2011
@@ -31,106 +31,125 @@ public class RepositoryTest
         goToRepositoriesPage();
         getSelenium().open( "/archiva/admin/addRepository.action" );
         addManagedRepository( "managedrepo1", "Managed Repository Sample 1", 
getRepositoryDir() + "repository/", "",
-                              "Maven 2.x Repository", "0 0 * * * ?", "", "" );
+                              "Maven 2.x Repository", "0 0 * * * ?", "", "", 
true );
         clickButtonWithValue( "Save" );
         assertTextPresent( "Managed Repository Sample 1" );
         assertRepositoriesPage();
     }
 
-    @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
+    @Test( dependsOnMethods = { "testAddManagedRepoValidValues" } )
     public void testAddManagedRepoInvalidValues()
     {
         goToRepositoriesPage();
-        getSelenium().open( "/archiva/admin/addRepository.action" );   ;
-        addManagedRepository( "<> \\/~+[ ]'\"", "<>\\~+[]'\"" , "<> ~+[ ]'\"" 
, "<> ~+[ ]'\"", "Maven 2.x Repository", "", "-1", "101" );
-        assertTextPresent( "Identifier must only contain alphanumeric 
characters, underscores(_), dots(.), and dashes(-)." );
-        assertTextPresent( "Directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-        assertTextPresent( "Repository Name must only contain alphanumeric 
characters, white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
-        assertTextPresent( "Index directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-        assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100.");
-        assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0.");
+        getSelenium().open( "/archiva/admin/addRepository.action" );
+        ;
+        addManagedRepository( "<> \\/~+[ ]'\"", "<>\\~+[]'\"", "<> ~+[ ]'\"", 
"<> ~+[ ]'\"", "Maven 2.x Repository", "",
+                              "-1", "101", false );
+        assertTextPresent(
+            "Identifier must only contain alphanumeric characters, 
underscores(_), dots(.), and dashes(-)." );
+        assertTextPresent(
+            "Directory must only contain alphanumeric characters, equals(=), 
question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), 
back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and 
dashes(-)." );
+        assertTextPresent(
+            "Repository Name must only contain alphanumeric characters, 
white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
+        assertTextPresent(
+            "Index directory must only contain alphanumeric characters, 
equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
+        assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100." );
+        assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0." );
         assertTextPresent( "Invalid cron expression." );
     }
 
-    @Test(dependsOnMethods = { "testAddManagedRepoInvalidValues" } )
-       public void testAddManagedRepoInvalidIdentifier()
-       {
-               addManagedRepository( "<> \\/~+[ ]'\"", "name" , "/home" , 
"/.index", "Maven 2.x Repository", "0 0 * * * ?", "1", "1" );
-               assertTextPresent( "Identifier must only contain alphanumeric 
characters, underscores(_), dots(.), and dashes(-)." );
-       }
-
-       @Test(dependsOnMethods = { "testAddManagedRepoInvalidIdentifier" } )
-       public void testAddManagedRepoInvalidRepoName()
-       {
-               addManagedRepository( "identifier", "<>\\~+[]'\"" , "/home" , 
"/.index", "Maven 2.x Repository", "0 0 * * * ?", "1", "1" );
-               assertTextPresent( "Repository Name must only contain 
alphanumeric characters, white-spaces(' '), forward-slashes(/), 
open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and 
dashes(-)." );
-       }
-
-       @Test(dependsOnMethods = { "testAddManagedRepoInvalidRepoName" } )
-       public void testAddManagedRepoInvalidDirectory()
-       {
-               addManagedRepository( "identifier", "name" , "<> ~+[ ]'\"" , 
"/.index", "Maven 2.x Repository", "0 0 * * * ?", "1", "1" );
-               assertTextPresent( "Directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-       }
-
-       @Test(dependsOnMethods = { "testAddManagedRepoInvalidDirectory" } )
-       public void testAddManagedRepoInvalidIndexDir()
-       {
-               addManagedRepository( "identifier", "name" , "/home" , "<> ~+[ 
]'\"", "Maven 2.x Repository", "0 0 * * * ?", "1", "1" );
-               assertTextPresent( "Index directory must only contain 
alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), 
ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), 
colons(:), tildes(~), and dashes(-)." );
-       }
-
-    @Test(dependsOnMethods = { "testAddManagedRepoInvalidIndexDir" } )
-       public void testAddManagedRepoInvalidRetentionCount()
-       {
-               addManagedRepository( "identifier", "name" , "/home" , 
"/.index", "Maven 2.x Repository", "0 0 * * * ?", "1", "101" );
-               assertTextPresent( "Repository Purge By Retention Count needs 
to be between 1 and 100." );
-       }
-
-    @Test(dependsOnMethods = { "testAddManagedRepoInvalidRetentionCount" } )
-       public void testAddManagedRepoInvalidDaysOlder()
-       {
-               addManagedRepository( "identifier", "name" , "/home" , 
"/.index", "Maven 2.x Repository", "0 0 * * * ?", "-1", "1" );
-               assertTextPresent( "Repository Purge By Days Older Than needs 
to be larger than 0." );
-       }
-
-       @Test(dependsOnMethods = { "testAddManagedRepoInvalidDaysOlder" } )
-       public void testAddManagedRepoBlankValues()
-       {
-               goToRepositoriesPage();
-               getSelenium().open( "/archiva/admin/addRepository.action" );    
;
-               addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", 
"", "", "" );
-               assertTextPresent( "You must enter a repository identifier." );
-               assertTextPresent( "You must enter a repository name." );
-               assertTextPresent( "You must enter a directory." );
-               assertTextPresent( "Invalid cron expression." );
-       }
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidValues" } )
+    public void testAddManagedRepoInvalidIdentifier()
+    {
+        addManagedRepository( "<> \\/~+[ ]'\"", "name", "/home", "/.index", 
"Maven 2.x Repository", "0 0 * * * ?", "1",
+                              "1", false );
+        assertTextPresent(
+            "Identifier must only contain alphanumeric characters, 
underscores(_), dots(.), and dashes(-)." );
+    }
 
-    @Test(dependsOnMethods = { "testAddManagedRepoBlankValues" } )
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidIdentifier" } )
+    public void testAddManagedRepoInvalidRepoName()
+    {
+        addManagedRepository( "identifier", "<>\\~+[]'\"", "/home", "/.index", 
"Maven 2.x Repository", "0 0 * * * ?",
+                              "1", "1", false );
+        assertTextPresent(
+            "Repository Name must only contain alphanumeric characters, 
white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidRepoName" } )
+    public void testAddManagedRepoInvalidDirectory()
+    {
+        addManagedRepository( "identifier", "name", "<> ~+[ ]'\"", "/.index", 
"Maven 2.x Repository", "0 0 * * * ?",
+                              "1", "1", false );
+        assertTextPresent(
+            "Directory must only contain alphanumeric characters, equals(=), 
question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), 
back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and 
dashes(-)." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidDirectory" } )
+    public void testAddManagedRepoInvalidIndexDir()
+    {
+        addManagedRepository( "identifier", "name", "/home", "<> ~+[ ]'\"", 
"Maven 2.x Repository", "0 0 * * * ?", "1",
+                              "1", false );
+        assertTextPresent(
+            "Index directory must only contain alphanumeric characters, 
equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidIndexDir" } )
+    public void testAddManagedRepoInvalidRetentionCount()
+    {
+        addManagedRepository( "identifier", "name", "/home", "/.index", "Maven 
2.x Repository", "0 0 * * * ?", "1",
+                              "101", true );
+        assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidRetentionCount" } )
+    public void testAddManagedRepoInvalidDaysOlder()
+    {
+        addManagedRepository( "identifier", "name", "/home", "/.index", "Maven 
2.x Repository", "0 0 * * * ?", "-1",
+                              "1", true );
+        assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoInvalidDaysOlder" } )
+    public void testAddManagedRepoBlankValues()
+    {
+        goToRepositoriesPage();
+        getSelenium().open( "/archiva/admin/addRepository.action" );
+
+        addManagedRepository( "", "", "", "", "Maven 2.x Repository", "", "", 
"", false );
+        assertTextPresent( "You must enter a repository identifier." );
+        assertTextPresent( "You must enter a repository name." );
+        assertTextPresent( "You must enter a directory." );
+        assertTextPresent( "Invalid cron expression." );
+    }
+
+    @Test( dependsOnMethods = { "testAddManagedRepoBlankValues" } )
     public void testAddManagedRepoNoIdentifier()
     {
-        addManagedRepository( "", "name", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "" );
+        addManagedRepository( "", "name", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "", false );
         assertTextPresent( "You must enter a repository identifier." );
     }
 
     @Test( dependsOnMethods = { "testAddManagedRepoNoIdentifier" } )
     public void testAddManagedRepoNoRepoName()
     {
-        addManagedRepository( "identifier", "", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "" );
+        addManagedRepository( "identifier", "", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "",
+                              false );
         assertTextPresent( "You must enter a repository name." );
     }
 
     @Test( dependsOnMethods = { "testAddManagedRepoNoRepoName" } )
     public void testAddManagedRepoNoDirectory()
     {
-        addManagedRepository( "identifier", "name", "", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "" );
+        addManagedRepository( "identifier", "name", "", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "", "",
+                              false );
         assertTextPresent( "You must enter a directory." );
     }
 
     @Test( dependsOnMethods = { "testAddManagedRepoNoDirectory" } )
     public void testAddManagedRepoNoCron()
     {
-        addManagedRepository( "identifier", "name", "/home", "/.index", "Maven 
2.x Repository", "", "", "" );
+        addManagedRepository( "identifier", "name", "/home", "/.index", "Maven 
2.x Repository", "", "", "", true );
         assertTextPresent( "Invalid cron expression." );
     }
 
@@ -140,64 +159,70 @@ public class RepositoryTest
         goToRepositoriesPage();
         getSelenium().open( "/archiva/admin/addRepository.action" );
         addManagedRepository( "managedrepo", "Managed Repository Sample", 
getRepositoryDir() + "local-repo/", "",
-                              "Maven 2.x Repository", "0 0 * * * ?", "", "" );
+                              "Maven 2.x Repository", "0 0 * * * ?", "", "", 
true );
         clickButtonWithValue( "Save" );
         assertTextPresent( "Managed Repository Sample" );
     }
 
-    @Test(dependsOnMethods = { "testAddManagedRepoForEdit" } )
+    @Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
     public void testEditManagedRepoInvalidValues()
-       {
-               editManagedRepository("<>\\~+[]'\"" , "<> ~+[ ]'\"" , "<> ~+[ 
]'\"", "Maven 2.x Repository", "", "-1", "101");
-        assertTextPresent( "Directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-               assertTextPresent( "Repository Name must only contain 
alphanumeric characters, white-spaces(' '), forward-slashes(/), 
open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and 
dashes(-)." );
-        assertTextPresent( "Index directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-        assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100.");
-        assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0.");
+    {
+        editManagedRepository( "<>\\~+[]'\"", "<> ~+[ ]'\"", "<> ~+[ ]'\"", 
"Maven 2.x Repository", "", "-1", "101" );
+        assertTextPresent(
+            "Directory must only contain alphanumeric characters, equals(=), 
question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), 
back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and 
dashes(-)." );
+        assertTextPresent(
+            "Repository Name must only contain alphanumeric characters, 
white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
+        assertTextPresent(
+            "Index directory must only contain alphanumeric characters, 
equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
+        assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100." );
+        assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0." );
         assertTextPresent( "Invalid cron expression." );
-       }
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidValues" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidValues" } )
     public void testEditManagedRepoInvalidRepoName()
-       {
-        editManagedRepository("<>\\~+[]'\"" , "/home" , "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1");
-        assertTextPresent( "Repository Name must only contain alphanumeric 
characters, white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
-       }
+    {
+        editManagedRepository( "<>\\~+[]'\"", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1" );
+        assertTextPresent(
+            "Repository Name must only contain alphanumeric characters, 
white-spaces(' '), forward-slashes(/), open-parenthesis('('), 
close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." );
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidRepoName" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidRepoName" } )
     public void testEditManagedRepoInvalidDirectory()
-       {
-        editManagedRepository("name" , "<> ~+[ ]'\"" , "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1");
-        assertTextPresent( "Directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-       }
+    {
+        editManagedRepository( "name", "<> ~+[ ]'\"", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1" );
+        assertTextPresent(
+            "Directory must only contain alphanumeric characters, equals(=), 
question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), 
back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and 
dashes(-)." );
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidDirectory" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidDirectory" } )
     public void testEditManagedRepoInvalidIndexDir()
-       {
-        editManagedRepository("name" , "/home" , "<> ~+[ ]'\"", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1");
-        assertTextPresent( "Index directory must only contain alphanumeric 
characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
-       }
+    {
+        editManagedRepository( "name", "/home", "<> ~+[ ]'\"", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "1" );
+        assertTextPresent(
+            "Index directory must only contain alphanumeric characters, 
equals(=), question-marks(?), exclamation-points(!), ampersands(&), 
forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), 
tildes(~), and dashes(-)." );
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidIndexDir" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidIndexDir" } )
     public void testEditManagedRepoInvalidCron()
-       {
-        editManagedRepository("name" , "/home" , "/.index", "Maven 2.x 
Repository", "", "1", "1");
+    {
+        editManagedRepository( "name", "/home", "/.index", "Maven 2.x 
Repository", "", "1", "1" );
         assertTextPresent( "Invalid cron expression." );
-       }
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidCron" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidCron" } )
     public void testEditManagedRepoInvalidRetentionCount()
-       {
-        editManagedRepository("name" , "/home" , "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "101");
+    {
+        editManagedRepository( "name", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "1", "101" );
         assertTextPresent( "Repository Purge By Retention Count needs to be 
between 1 and 100." );
-       }
+    }
 
-    @Test(dependsOnMethods = { "testEditManagedRepoInvalidRetentionCount" } )
+    @Test( dependsOnMethods = { "testEditManagedRepoInvalidRetentionCount" } )
     public void testEditManagedRepoInvalidDaysOlder()
-       {
-        editManagedRepository("name" , "/home" , "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "-1", "1");
+    {
+        editManagedRepository( "name", "/home", "/.index", "Maven 2.x 
Repository", "0 0 * * * ?", "-1", "1" );
         assertTextPresent( "Repository Purge By Days Older Than needs to be 
larger than 0." );
-       }
+    }
 
     // TODO
     @Test( dependsOnMethods = { "testEditManagedRepoInvalidDaysOlder" } )
@@ -247,9 +272,10 @@ public class RepositoryTest
         addRemoteRepository( "remoterepo", "Remote Repository Sample", "", "", 
"", "", "Maven 2.x Repository" );
         assertTextPresent( "You must enter a url." );
     }
-    
+
     @Test( dependsOnMethods = { "testAddRemoteRepoNullURL" } )
-    public void testAddProxyConnectorValidValues() throws Exception
+    public void testAddProxyConnectorValidValues()
+        throws Exception
     {
         getSelenium().open( "/archiva/admin/addProxyConnector.action" );
         addProxyConnector( "(direct connection)", "internal", "remoterepo" );

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java?rev=1172595&r1=1172594&r2=1172595&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
 Mon Sep 19 12:41:29 2011
@@ -160,7 +160,7 @@ public class XSSSecurityTest
         getSelenium().open( "/archiva/admin/addRepository.action" );
         addManagedRepository( "test\"><script>alert('xss')</script>", 
"test\"><script>alert('xss')</script>",
                               "test\"><script>alert('xss')</script>", 
"test\"><script>alert('xss')</script>",
-                              "Maven 2.x Repository", "", "-1", "101" );
+                              "Maven 2.x Repository", "", "-1", "101", true );
         // xss inputs are blocked by validation.
         assertTextPresent(
             "Identifier must only contain alphanumeric characters, 
underscores(_), dots(.), and dashes(-)." );
@@ -185,7 +185,7 @@ public class XSSSecurityTest
         assertTextPresent(
             "Organisation name must only contain alphanumeric characters, 
white-spaces(' '), equals(=), question-marks(?), exclamation-points(!), 
ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), 
colons(:), tildes(~), and dashes(-)." );
         assertTextPresent( "You must enter a URL" );
-        assertXpathCount( "//span[@class='errorMessage' and text()='You must 
enter a URL']", 2 );
+        assertXpathCount( "//span[@class='errorMessage'/text()='You must enter 
a URL']", 2 );
     }
 
     public void testEditAppearanceImmunityToCrossSiteScriptingRendering()


Reply via email to