]> source.dussan.org Git - archiva.git/commitdiff
fix some selenium tests
authorOlivier Lamy <olamy@apache.org>
Mon, 19 Sep 2011 12:41:29 +0000 (12:41 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 19 Sep 2011 12:41:29 +0000 (12:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1172595 13f79535-47bb-0310-9956-ffa450edef68

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

index 625160d0db5feac5e94b36af562f17e497440306..51be7ae3f0c949b012769224442c79ca4a001bfc 100644 (file)
@@ -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>
index 199bb3774ece978cf939d86c3b7eac59e06610bb..9f7ec1450462f81928a5d11300876c2a97bf1b57 100644 (file)
@@ -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 );
index 94d5cdad3167f852b6f2126aa58e25a01439b80b..b189456df0abc64d6c9995d8bc35e2a0664f47a5 100644 (file)
@@ -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" );
index 751b9978813e0b855e7728a2fe648e2390774064..66b2e2f79da51600f90403873d5e945f08e39bac 100644 (file)
@@ -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" );
index 3c3739832260b5f2193617607fd576e78cc3ffc0..917110842d554eadf74360f9b6882a3152bbc4a8 100644 (file)
@@ -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", false );
+        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", 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 = { "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 = { "testAddManagedRepoBlankValues" } )
+    @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" );
index 3ebe5cec618a478fea947028343083d9a8ee5e80..15e799e9a7d3960b68ec68c9852caf9e219fe8ae 100644 (file)
@@ -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()