aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-19 12:41:29 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-19 12:41:29 +0000
commit98db72a675e2fc4a6c0eccbd17846d26a60fbb0f (patch)
treedf69616e2c0593048a8d9458ddb41761d8f9eccc /archiva-modules/archiva-web
parent39f4b78d4f786fddcae4e7fe0bc23274c23c1610 (diff)
downloadarchiva-98db72a675e2fc4a6c0eccbd17846d26a60fbb0f.tar.gz
archiva-98db72a675e2fc4a6c0eccbd17846d26a60fbb0f.zip
fix some selenium tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1172595 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java19
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java15
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java242
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java4
6 files changed, 163 insertions, 121 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
index 625160d0d..51be7ae3f 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
@@ -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>
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
index 199bb3774..9f7ec1450 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AppearanceTest.java
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
index 94d5cdad3..b189456df 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
index 751b99788..66b2e2f79 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
index 3c3739832..917110842 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryTest.java
@@ -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" );
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
index 3ebe5cec6..15e799e9a 100644
--- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/XSSSecurityTest.java
@@ -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()