[MRM-1276] Selenium tests need a clean up

- fixed poor formatting in the source code (tabs, etc) following the Maven Code Style



git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@931475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marecor M. Baclay 2010-04-07 09:27:05 +00:00
parent 45100a8806
commit ddeaa798b6
24 changed files with 2250 additions and 2253 deletions

View File

@ -23,7 +23,8 @@ import org.apache.archiva.web.test.parent.AbstractArchivaTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test( groups = { "appearance" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true ) @Test( groups = { "appearance" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
public class AppearanceTest extends AbstractArchivaTest public class AppearanceTest
extends AbstractArchivaTest
{ {
public void testAddAppearanceNullValues() public void testAddAppearanceNullValues()
{ {
@ -36,7 +37,8 @@ public class AppearanceTest extends AbstractArchivaTest
@Test( dependsOnMethods = { "testAddAppearanceNullValues" } ) @Test( dependsOnMethods = { "testAddAppearanceNullValues" } )
public void testAddAppearanceValidValues() public void testAddAppearanceValidValues()
{ {
addEditAppearance( "The Apache Software Foundation" , "http://www.apache.org/" , "http://www.apache.org/images/asf_logo_wide.gifs" ); addEditAppearance( "The Apache Software Foundation", "http://www.apache.org/",
"http://www.apache.org/images/asf_logo_wide.gifs" );
assertTextPresent( "The Apache Software Foundation" ); assertTextPresent( "The Apache Software Foundation" );
} }
@ -44,7 +46,8 @@ public class AppearanceTest extends AbstractArchivaTest
public void testEditAppearance() public void testEditAppearance()
{ {
clickLinkWithText( "Edit" ); clickLinkWithText( "Edit" );
addEditAppearance( "Apache Software Foundation" , "http://www.apache.org/" , "http://www.apache.org/images/asf_logo_wide.gifs" ); addEditAppearance( "Apache Software Foundation", "http://www.apache.org/",
"http://www.apache.org/images/asf_logo_wide.gifs" );
assertTextPresent( "Apache Software Foundation" ); assertTextPresent( "Apache Software Foundation" );
} }

View File

@ -50,7 +50,9 @@ public class ArchivaAdminTest
@BeforeTest @BeforeTest
@Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } ) @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
public void initializeArchiva( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort ) throws Exception public void initializeArchiva( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost,
@Optional( "4444" ) int seleniumPort )
throws Exception
{ {
super.open( baseUrl, browser, seleniumHost, seleniumPort ); super.open( baseUrl, browser, seleniumHost, seleniumPort );
getSelenium().open( baseUrl ); getSelenium().open( baseUrl );

View File

@ -27,7 +27,6 @@ public class ArtifactManagementTest
extends AbstractArtifactManagementTest extends AbstractArtifactManagementTest
{ {
public void testAddArtifactNullValues() public void testAddArtifactNullValues()
{ {
goToAddArtifactPage(); goToAddArtifactPage();
@ -90,7 +89,8 @@ public class ArtifactManagementTest
String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" ); String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" );
addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() + "' was successfully deployed to repository 'internal'" ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" );
} }
@Test( groups = "requiresUpload" ) @Test( groups = "requiresUpload" )
@ -100,16 +100,16 @@ public class ArtifactManagementTest
String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" ); String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" );
String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" ); String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" );
addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId() );
getRepositoryId() ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() + "' was successfully deployed to repository 'internal'" ); + "' was successfully deployed to repository 'internal'" );
getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() ); getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() );
waitPage(); waitPage();
assertTextPresent( "<type>library</type>" ); assertTextPresent( "<type>library</type>" );
String basePath = String basePath =
"/archiva/repository/internal/" + groupId + "/" + artifactId + "/" + getVersion() + "/" + artifactId + "-" + "/archiva/repository/internal/" + groupId + "/" + artifactId + "/" + getVersion() + "/" + artifactId + "-"
getVersion(); + getVersion();
assertLinkPresent( ".NET Library" ); assertLinkPresent( ".NET Library" );
assertElementPresent( "//a[@href='" + basePath + ".dll']" ); assertElementPresent( "//a[@href='" + basePath + ".dll']" );
assertElementPresent( "//a[@href='" + basePath + ".pom']" ); assertElementPresent( "//a[@href='" + basePath + ".pom']" );
@ -119,7 +119,8 @@ public class ArtifactManagementTest
@Test( groups = "requiresUpload" ) @Test( groups = "requiresUpload" )
public void testAddArtifactBlockRedeployments() public void testAddArtifactBlockRedeployments()
{ {
addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(),
getRepositoryId() );
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." ); assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
} }

View File

@ -81,8 +81,8 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
"." + getProperty( "ARTIFACT_PACKAGING" ) ); + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -103,8 +103,8 @@ public class AuditLogsReportTest
assertTextPresent( "If you specify an artifact ID, you must specify a group ID" ); assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
assertTextNotPresent( "Results" ); assertTextNotPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
"." + getProperty( "ARTIFACT_PACKAGING" ) ); + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextNotPresent( "Uploaded File" ); assertTextNotPresent( "Uploaded File" );
} }
@ -121,8 +121,8 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
"." + getProperty( "ARTIFACT_PACKAGING" ) ); + getProperty( "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -138,8 +138,8 @@ public class AuditLogsReportTest
String packaging = getProperty( "SNAPSHOT_PACKAGING" ); String packaging = getProperty( "SNAPSHOT_PACKAGING" );
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo ); addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version + assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version
"' was successfully deployed to repository '" + repo + "'" ); + "' was successfully deployed to repository '" + repo + "'" );
clickLinkWithText( "Logout" ); clickLinkWithText( "Logout" );
@ -154,7 +154,8 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + packaging ); assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
+ packaging );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );

View File

@ -54,17 +54,19 @@ public class BrowseTest
goToRepositoriesPage(); goToRepositoriesPage();
clickLinkWithText( "Add" ); clickLinkWithText( "Add" );
addManagedRepository( getProperty( "RELEASES_REPOSITORY" ), "Releases Repository", addManagedRepository( getProperty( "RELEASES_REPOSITORY" ), "Releases Repository",
new File( getBasedir(), "target/repository/releases" ).getPath(), "", "Maven 2.x Repository", new File( getBasedir(), "target/repository/releases" ).getPath(), "",
"0 0 * * * ?", "", "" ); "Maven 2.x Repository", "0 0 * * * ?", "", "" );
assertTextPresent( "Releases Repository" ); assertTextPresent( "Releases Repository" );
String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" ); String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
String path = "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar"; String path =
"src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
// TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well) // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
// upload a snapshot artifact to repository 'releases' // upload a snapshot artifact to repository 'releases'
addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo ); addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo );
assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo + "'" ); assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '"
+ releasesRepo + "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
@ -74,7 +76,8 @@ public class BrowseTest
// upload a snapshot artifact to repository 'snapshots' // upload a snapshot artifact to repository 'snapshots'
addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo + "'" ); assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '"
+ snapshotsRepo + "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
@ -84,7 +87,8 @@ public class BrowseTest
} }
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoPackaging ) String artifactInfoArtifactId, String artifactInfoVersion,
String artifactInfoPackaging )
{ {
clickLinkWithText( version ); clickLinkWithText( version );
assertPage( "Apache Archiva \\ Browse Repository" ); assertPage( "Apache Archiva \\ Browse Repository" );

View File

@ -67,35 +67,17 @@ public class ReportsTest
// assertTextPresent( "Statistics Report" ); // assertTextPresent( "Statistics Report" );
} }
/* @Test( dependsOnMethods = { "testRepositoryStatistics" } ) /*
public void testRepositoriesStatisticComparisonReport() * @Test( dependsOnMethods = { "testRepositoryStatistics" } ) public void
{ * testRepositoriesStatisticComparisonReport() { //goToReportsPage(); clickButtonWithValue( "-->>" , false );
//goToReportsPage(); * clickButtonWithValue( "View Statistics" ); assertTextPresent( "Statistics Report" ); } public void
clickButtonWithValue( "-->>" , false ); * testRepositoryHealthWithoutDefect() { goToReportsPage(); String groupId = getProperty( "ARTIFACT_GROUPID" );
clickButtonWithValue( "View Statistics" ); * getSelenium().type( "generateReport_groupId" , groupId ); clickButtonWithValue( "Show Report" ); assertPage(
assertTextPresent( "Statistics Report" ); * "Apache Archiva \\ Reports" ); assertTextPresent( "The operation generated an empty report." ); } public void
} * testRepositoryHealthWithoutGroupId() { goToReportsPage(); clickButtonWithValue( "Show Report" ); assertPage(
* "Apache Archiva \\ Reports" ); assertTextPresent( "The operation generated an empty report." ); //TODO As of the
public void testRepositoryHealthWithoutDefect() * creation of the tests, GroupId is not a required field in showing the reports of repository health. GroupId
{ * should be required I think. }
goToReportsPage(); */
String groupId = getProperty( "ARTIFACT_GROUPID" );
getSelenium().type( "generateReport_groupId" , groupId );
clickButtonWithValue( "Show Report" );
assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "The operation generated an empty report." );
}
public void testRepositoryHealthWithoutGroupId()
{
goToReportsPage();
clickButtonWithValue( "Show Report" );
assertPage( "Apache Archiva \\ Reports" );
assertTextPresent( "The operation generated an empty report." );
//TODO As of the creation of the tests, GroupId is not a required field in showing the reports of repository health. GroupId should be required I think.
}*/
} }

View File

@ -47,7 +47,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_0", "**/*.zip" ); setFieldValue( "newpattern_0", "**/*.zip" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
} }
@Test( dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } ) @Test( dependsOnMethods = { "testAddArtifactFileType_ExistingValue" } )
@ -71,7 +72,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_1", "**/*-" ); setFieldValue( "newpattern_1", "**/*-" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
} }
@Test( dependsOnMethods = { "testAddAutoRemove_ExistingValue" } ) @Test( dependsOnMethods = { "testAddAutoRemove_ExistingValue" } )
@ -95,7 +97,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_2", "" ); setFieldValue( "newpattern_2", "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Unable to process blank pattern." );
} }
@Test( dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } ) @Test( dependsOnMethods = { "testAddIgnoredArtifacts_NullValue" } )
@ -103,7 +106,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_2", "**/*.sh" ); setFieldValue( "newpattern_2", "**/*.sh" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
} }
@Test( dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } ) @Test( dependsOnMethods = { "testAddIgnoredArtifacts_ExistingValue" } )
@ -128,7 +132,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_3", "" ); setFieldValue( "newpattern_3", "" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Unable to process blank pattern." );
} }
@Test( dependsOnMethods = { "testAddIndexableContent_NullValue" } ) @Test( dependsOnMethods = { "testAddIndexableContent_NullValue" } )
@ -136,7 +141,8 @@ public class RepositoryScanningTest
{ {
setFieldValue( "newpattern_3", "**/*.xml" ); setFieldValue( "newpattern_3", "**/*.xml" );
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" ); clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." ); Assert.assertEquals( getSelenium().getText( "//span[@class='errorMessage']" ),
"Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
} }
@Test( dependsOnMethods = { "testAddIndexableContent_ExistingValue" } ) @Test( dependsOnMethods = { "testAddIndexableContent_ExistingValue" } )

View File

@ -30,7 +30,8 @@ public class RepositoryTest
{ {
goToRepositoriesPage(); goToRepositoriesPage();
getSelenium().open( "/archiva/admin/addRepository.action" ); getSelenium().open( "/archiva/admin/addRepository.action" );
addManagedRepository( "managedrepo1", "Managed Repository Sample 1" , getRepositoryDir() + "repository/" , "", "Maven 2.x Repository", "0 0 * * * ?", "", "" ); addManagedRepository( "managedrepo1", "Managed Repository Sample 1", getRepositoryDir() + "repository/", "",
"Maven 2.x Repository", "0 0 * * * ?", "", "" );
clickButtonWithValue( "Save" ); clickButtonWithValue( "Save" );
assertTextPresent( "Managed Repository Sample 1" ); assertTextPresent( "Managed Repository Sample 1" );
assertRepositoriesPage(); assertRepositoriesPage();
@ -81,7 +82,8 @@ public class RepositoryTest
{ {
goToRepositoriesPage(); goToRepositoriesPage();
getSelenium().open( "/archiva/admin/addRepository.action" ); getSelenium().open( "/archiva/admin/addRepository.action" );
addManagedRepository( "managedrepo", "Managed Repository Sample" , getRepositoryDir() + "local-repo/", "", "Maven 2.x Repository", "0 0 * * * ?", "", "" ); addManagedRepository( "managedrepo", "Managed Repository Sample", getRepositoryDir() + "local-repo/", "",
"Maven 2.x Repository", "0 0 * * * ?", "", "" );
clickButtonWithValue( "Save" ); clickButtonWithValue( "Save" );
assertTextPresent( "Managed Repository Sample" ); assertTextPresent( "Managed Repository Sample" );
} }
@ -115,14 +117,16 @@ public class RepositoryTest
@Test( dependsOnMethods = { "testAddRemoteRepoNullValues" } ) @Test( dependsOnMethods = { "testAddRemoteRepoNullValues" } )
public void testAddRemoteRepositoryNullIdentifier() public void testAddRemoteRepositoryNullIdentifier()
{ {
addRemoteRepository( "" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" ); addRemoteRepository( "", "Remote Repository Sample", "http://repository.codehaus.org/org/codehaus/mojo/", "",
"", "", "Maven 2.x Repository" );
assertTextPresent( "You must enter a repository identifier." ); assertTextPresent( "You must enter a repository identifier." );
} }
@Test( dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } ) @Test( dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } )
public void testAddRemoteRepoNullName() public void testAddRemoteRepoNullName()
{ {
addRemoteRepository( "remoterepo" , "" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" ); addRemoteRepository( "remoterepo", "", "http://repository.codehaus.org/org/codehaus/mojo/", "", "", "",
"Maven 2.x Repository" );
assertTextPresent( "You must enter a repository name." ); assertTextPresent( "You must enter a repository name." );
} }
@ -137,7 +141,8 @@ public class RepositoryTest
public void testAddRemoteRepoValidValues() public void testAddRemoteRepoValidValues()
{ {
getSelenium().open( "/archiva/admin/addRemoteRepository.action" ); getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" ); addRemoteRepository( "remoterepo", "Remote Repository Sample",
"http://repository.codehaus.org/org/codehaus/mojo/", "", "", "", "Maven 2.x Repository" );
assertTextPresent( "Remote Repository Sample" ); assertTextPresent( "Remote Repository Sample" );
} }

View File

@ -69,7 +69,8 @@ public class SearchTest
public void testSearchExistingArtifactUsingAdvancedSearchArtifactId() public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
{ {
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, getProperty( "REPOSITORYID" ), null, null ); searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null,
getProperty( "REPOSITORYID" ), null, null );
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" ); assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( "test" ); assertLinkPresent( "test" );
@ -77,7 +78,8 @@ public class SearchTest
public void testSearchExistingArtifactUsingAdvancedSearchGroupId() public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
{ {
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null, null ); searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null,
null );
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" ); assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( "test" ); assertLinkPresent( "test" );
@ -92,4 +94,3 @@ public class SearchTest
assertLinkNotPresent( "test" ); assertLinkNotPresent( "test" );
} }
} }

View File

@ -227,32 +227,18 @@ public class UserRolesTest
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
} }
/*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } ) /*
public void testUserWithRepoManagerSnapshotsRole() * @Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } ) public void
{ * testUserWithRepoManagerSnapshotsRole() { username = getProperty("REPOMANAGER_SNAPSHOTS_USERNAME"); fullname =
username = getProperty("REPOMANAGER_SNAPSHOTS_USERNAME"); * getProperty("REPOMANAGER_SNAPSHOTS_FULLNAME"); createUser(username, fullname, getUserEmail(),
fullname = getProperty("REPOMANAGER_SNAPSHOTS_FULLNAME"); * getUserRolePassword(), true); clickLinkWithText( username ); clickLinkWithText( "Edit Roles" );
* checkResourceRoleWithValue( fullname ); clickButtonWithValue( "Submit" ); clickLinkWithText("Logout");
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true); * login(username, getUserRolePassword()); changePassword( getUserRolePassword(), getUserRoleNewPassword()); // this
clickLinkWithText( username ); * section will be removed if issue from redback after changing password will be fixed. getSelenium().goBack();
clickLinkWithText( "Edit Roles" ); * clickLinkWithText("Logout"); //assertTextPresent("You are already logged in."); login(username,
checkResourceRoleWithValue( fullname ); * getUserRoleNewPassword()); assertLeftNavMenuWithRole( fullname ); clickLinkWithText("Logout"); login(
clickButtonWithValue( "Submit" ); * getAdminUsername() , getAdminPassword() ); }
*/
clickLinkWithText("Logout");
login(username, getUserRolePassword());
changePassword( getUserRolePassword(), getUserRoleNewPassword());
// this section will be removed if issue from redback after changing password will be fixed.
getSelenium().goBack();
clickLinkWithText("Logout");
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
login( getAdminUsername() , getAdminPassword() );
}*/
@Test( dependsOnMethods = { "testUserWithRepoManagerInternalRole" } ) @Test( dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
public void testUserWithRepoObserverInternalRole() public void testUserWithRepoObserverInternalRole()
@ -281,30 +267,16 @@ public class UserRolesTest
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
} }
/*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } ) /*
public void testUserWithRepoObserverSnapshotsRole() * @Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } ) public void
{ * testUserWithRepoObserverSnapshotsRole() { username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" ); fullname =
username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" ); * getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" ); createUser(username, fullname, getUserEmail(),
fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" ); * getUserRolePassword(), true); clickLinkWithText( username ); clickLinkWithText( "Edit Roles" );
* checkResourceRoleWithValue( fullname ); clickButtonWithValue( "Submit" ); clickLinkWithText("Logout");
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true); * login(username, getUserRolePassword()); changePassword( getUserRolePassword(), getUserRoleNewPassword()); // this
clickLinkWithText( username ); * section will be removed if issue from redback after changing password will be fixed. getSelenium().goBack();
clickLinkWithText( "Edit Roles" ); * clickLinkWithText("Logout"); //assertTextPresent("You are already logged in."); login(username,
checkResourceRoleWithValue( fullname ); * getUserRoleNewPassword()); assertLeftNavMenuWithRole( fullname ); clickLinkWithText("Logout"); login(
clickButtonWithValue( "Submit" ); * getAdminUsername() , getAdminPassword() ); }
*/
clickLinkWithText("Logout");
login(username, getUserRolePassword());
changePassword( getUserRolePassword(), getUserRoleNewPassword());
// this section will be removed if issue from redback after changing password will be fixed.
getSelenium().goBack();
clickLinkWithText("Logout");
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
login( getAdminUsername() , getAdminPassword() );
}*/
} }

View File

@ -45,7 +45,8 @@ public class VirtualRepositoryTest
public void testAddRepositoryToRepositoryGroup() public void testAddRepositoryToRepositoryGroup()
{ {
addRepositoryToRepositoryGroup( "testing", "internal" ); addRepositoryToRepositoryGroup( "testing", "internal" );
Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ), "internal" ); Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ),
"internal" );
// clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" ); // clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" );
// getSelenium().goBack(); // getSelenium().goBack();
} }
@ -67,10 +68,8 @@ public class VirtualRepositoryTest
assertTextPresent( "No Repository Groups Defined." ); assertTextPresent( "No Repository Groups Defined." );
} }
/*@Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } ) /*
public void testCheckRepositoryGroup() * @Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } ) public void testCheckRepositoryGroup() {
{ * clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" ); getSelenium().goBack(); }
clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" ); */
getSelenium().goBack();
}*/
} }

View File

@ -96,8 +96,7 @@ public class XPathExpressionUtil
* @param columnValues the values to be matched in each column, element column is included * @param columnValues the values to be matched in each column, element column is included
* @return * @return
*/ */
public static String getColumnElement( String element, int elementIndex, String elementValue, public static String getColumnElement( String element, int elementIndex, String elementValue, String[] columnValues )
String[] columnValues )
{ {
return getColumnElement( element, elementIndex, elementValue, "TEXT", columnValues ); return getColumnElement( element, elementIndex, elementValue, "TEXT", columnValues );
} }
@ -111,8 +110,7 @@ public class XPathExpressionUtil
* @param columnValues the values to be matched in each column, element column is included * @param columnValues the values to be matched in each column, element column is included
* @return * @return
*/ */
public static String getImgColumnElement( String element, int elementIndex, String imageName, public static String getImgColumnElement( String element, int elementIndex, String imageName, String[] columnValues )
String[] columnValues )
{ {
return getColumnElement( element, elementIndex, imageName, IMG, columnValues ); return getColumnElement( element, elementIndex, imageName, IMG, columnValues );
} }
@ -160,8 +158,7 @@ public class XPathExpressionUtil
} }
/** /**
* expression for acquiring the table row that matches all column values with the same order * expression for acquiring the table row that matches all column values with the same order as the list
* as the list
* *
* @param columnValues the matched list of columnValues * @param columnValues the matched list of columnValues
* @return * @return

View File

@ -28,6 +28,7 @@ public abstract class AbstractArchivaTest
extends AbstractSeleniumTest extends AbstractSeleniumTest
{ {
protected String username; protected String username;
protected String fullname; protected String fullname;
public String getUserEmail() public String getUserEmail()
@ -180,12 +181,9 @@ public abstract class AbstractArchivaTest
assertTextPresent( "Roles Matrix" ); assertTextPresent( "Roles Matrix" );
} }
/* //User Role /*
public void goToUserRolesPage() * //User Role public void goToUserRolesPage() { clickLinkWithText( "User Roles" ); assertUserRolesPage(); }
{ */
clickLinkWithText( "User Roles" );
assertUserRolesPage();
}*/
public void assertUserRolesPage() public void assertUserRolesPage()
{ {
@ -193,7 +191,8 @@ public abstract class AbstractArchivaTest
assertTextPresent( "[Admin] User Roles" ); assertTextPresent( "[Admin] User Roles" );
assertTextPresent( "Username" ); assertTextPresent( "Username" );
assertTextPresent( "Full Name" ); assertTextPresent( "Full Name" );
String userRoles = "Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal"; String userRoles =
"Guest,Registered User,System Administrator,User Administrator,Global Repository Observer,Global Repository Manager,Repository Observer,Repository Manager,internal";
String[] arrayRole = userRoles.split( "," ); String[] arrayRole = userRoles.split( "," );
for ( String userroles : arrayRole ) for ( String userroles : arrayRole )
assertTextPresent( userroles ); assertTextPresent( userroles );
@ -213,7 +212,8 @@ public abstract class AbstractArchivaTest
createUser( userName, fullName, email, password, password, valid ); createUser( userName, fullName, email, password, password, valid );
} }
private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword, boolean valid ) private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword,
boolean valid )
{ {
// login( getAdminUsername() , getAdminPassword() ); // login( getAdminUsername() , getAdminPassword() );
clickLinkWithText( "User Management" ); clickLinkWithText( "User Management" );
@ -325,17 +325,22 @@ public abstract class AbstractArchivaTest
// User Roles // User Roles
public void assertUserRoleCheckBoxPresent( String value ) public void assertUserRoleCheckBoxPresent( String value )
{ {
getSelenium() .isElementPresent("xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value + "']"); getSelenium().isElementPresent(
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='"
+ value + "']" );
} }
public void assertResourceRolesCheckBoxPresent(String value) { public void assertResourceRolesCheckBoxPresent( String value )
{
getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" ); getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
} }
public void checkUserRoleWithValue( String value ) public void checkUserRoleWithValue( String value )
{ {
assertUserRoleCheckBoxPresent( value ); assertUserRoleCheckBoxPresent( value );
getSelenium().click( "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value + "']"); getSelenium().click(
"xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='"
+ value + "']" );
} }
public void checkResourceRoleWithValue( String value ) public void checkResourceRoleWithValue( String value )
@ -344,8 +349,8 @@ public abstract class AbstractArchivaTest
getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" ); getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
} }
public void changePassword( String oldPassword, String newPassword )
public void changePassword(String oldPassword, String newPassword) { {
assertPage( "Apache Archiva \\ Change Password" ); assertPage( "Apache Archiva \\ Change Password" );
setFieldValue( "existingPassword", oldPassword ); setFieldValue( "existingPassword", oldPassword );
setFieldValue( "newPassword", newPassword ); setFieldValue( "newPassword", newPassword );
@ -372,7 +377,8 @@ public abstract class AbstractArchivaTest
public void assertLeftNavMenuWithRole( String role ) public void assertLeftNavMenuWithRole( String role )
{ {
if ( role.equals( "Guest" ) || role.equals( "Registered User" ) || role.equals( "Global Repository Observer" ) || role.equals( "Repository Observer - internal" ) || role.equals( "Repository Observer - snapshots" ) ) if ( role.equals( "Guest" ) || role.equals( "Registered User" ) || role.equals( "Global Repository Observer" )
|| role.equals( "Repository Observer - internal" ) || role.equals( "Repository Observer - snapshots" ) )
{ {
assertTextPresent( "Search" ); assertTextPresent( "Search" );
assertLinkPresent( "Find Artifact" ); assertLinkPresent( "Find Artifact" );
@ -388,7 +394,8 @@ public abstract class AbstractArchivaTest
assertLinkPresent( "User Roles" ); assertLinkPresent( "User Roles" );
assertLinkNotPresent( "Repositories" ); assertLinkNotPresent( "Repositories" );
} }
else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository Manager - internal" ) || role.equals( "Repository Manager - snapshots" ) ) else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository Manager - internal" )
|| role.equals( "Repository Manager - snapshots" ) )
{ {
assertTextPresent( "Search" ); assertTextPresent( "Search" );
assertLinkPresent( "Find Artifact" ); assertLinkPresent( "Find Artifact" );
@ -400,12 +407,14 @@ public abstract class AbstractArchivaTest
else else
{ {
assertTextPresent( "Search" ); assertTextPresent( "Search" );
String navMenu = "Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning"; String navMenu =
"Find Artifact,Browse,Reports,User Management,User Roles,Appearance,Upload Artifact,Delete Artifact,Repository Groups,Repositories,Proxy Connectors,Legacy Support,Network Proxies,Repository Scanning";
String[] arrayMenu = navMenu.split( "," ); String[] arrayMenu = navMenu.split( "," );
for ( String navmenu : arrayMenu ) for ( String navmenu : arrayMenu )
assertLinkPresent( navmenu ); assertLinkPresent( navmenu );
} }
} }
// Find Artifact // Find Artifact
public void goToFindArtifactPage() public void goToFindArtifactPage()
{ {
@ -433,7 +442,8 @@ public abstract class AbstractArchivaTest
public void assertAppearancePage() public void assertAppearancePage()
{ {
assertPage( "Apache Archiva \\ Configure Appearance" ); assertPage( "Apache Archiva \\ Configure Appearance" );
String appearance = "Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL"; String appearance =
"Appearance,Organization Details,The logo in the top right of the screen is controlled by the following settings.,Organization Information,Name,URL,Logo URL";
String[] arrayAppearance = appearance.split( "," ); String[] arrayAppearance = appearance.split( "," );
for ( String appear : arrayAppearance ) for ( String appear : arrayAppearance )
assertTextPresent( appear ); assertTextPresent( appear );
@ -535,8 +545,8 @@ public abstract class AbstractArchivaTest
assertTextPresent( "Remote Repositories" ); assertTextPresent( "Remote Repositories" );
} }
public void addManagedRepository( String identifier, String name, String directory, String indexDirectory, String type, String cron, public void addManagedRepository( String identifier, String name, String directory, String indexDirectory,
String daysOlder, String retentionCount ) String type, String cron, String daysOlder, String retentionCount )
{ {
// goToRepositoriesPage(); // goToRepositoriesPage();
// clickLinkWithText( "Add" ); // clickLinkWithText( "Add" );

View File

@ -86,7 +86,8 @@ public abstract class AbstractArtifactManagementTest
assertLinkPresent( "Add" ); assertLinkPresent( "Add" );
} }
public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version, String classifier, String type) public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version,
String classifier, String type )
{ {
assertAddLegacyArtifactPathPage(); assertAddLegacyArtifactPathPage();
setFieldValue( "legacyArtifactPath.path", path ); setFieldValue( "legacyArtifactPath.path", path );
@ -103,7 +104,8 @@ public abstract class AbstractArtifactManagementTest
assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" ); assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
assertTextPresent( "Admin: Add Legacy Artifact Path" ); assertTextPresent( "Admin: Add Legacy Artifact Path" );
assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." ); assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
String element = "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type"; String element =
"addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
String[] arrayElement = element.split( "," ); String[] arrayElement = element.split( "," );
for ( String arrayelement : arrayElement ) for ( String arrayelement : arrayElement )
assertElementPresent( arrayelement ); assertElementPresent( arrayelement );

View File

@ -142,14 +142,17 @@ public abstract class AbstractRepositoryTest
{ {
assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" ); assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
assertTextPresent( "Admin: Add Proxy Connector" ); assertTextPresent( "Admin: Add Proxy Connector" );
String proxy = "Network Proxy*:,Managed Repository*:,Remote Repository*:,Policies:,Return error when:,On remote error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties have been set.,Black List:,No black list patterns have been set.,White List:,No white list patterns have been set."; String proxy =
"Network Proxy*:,Managed Repository*:,Remote Repository*:,Policies:,Return error when:,On remote error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties have been set.,Black List:,No black list patterns have been set.,White List:,No white list patterns have been set.";
String[] arrayProxy = proxy.split( "," ); String[] arrayProxy = proxy.split( "," );
for ( String arrayproxy : arrayProxy ) for ( String arrayproxy : arrayProxy )
assertTextPresent( arrayproxy ); assertTextPresent( arrayproxy );
/*String proxyElements = "addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry"; /*
String[] arrayProxyElements = proxyElements.split( "," ); * String proxyElements =
for ( String arrayproxyelements : arrayProxyElements ) * "addProxyConnector_connector_proxyId,addProxyConnector_connector_sourceRepoId,addProxyConnector_connector_targetRepoId,policy_propagate-errors-on-update,policy_propagate-errors,policy_releases,policy_snapshots,policy_checksum,policy_cache-failures,propertiesEntry,propertiesValue,blackListEntry,whiteListEntry"
assertTextPresent( arrayproxyelements );*/ * ; String[] arrayProxyElements = proxyElements.split( "," ); for ( String arrayproxyelements :
* arrayProxyElements ) assertTextPresent( arrayproxyelements );
*/
assertButtonWithValuePresent( "Add Property" ); assertButtonWithValuePresent( "Add Property" );
assertButtonWithValuePresent( "Add Pattern" ); assertButtonWithValuePresent( "Add Pattern" );
assertButtonWithValuePresent( "Add Proxy Connector" ); assertButtonWithValuePresent( "Add Proxy Connector" );
@ -206,7 +209,8 @@ public abstract class AbstractRepositoryTest
assertButtonWithValuePresent( "Save Network Proxy" ); assertButtonWithValuePresent( "Save Network Proxy" );
} }
public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username, String password ) public void addNetworkProxy( String identifier, String protocol, String hostname, String port, String username,
String password )
{ {
// goToNetworkProxiesPage(); // goToNetworkProxiesPage();
clickLinkWithText( "Add Network Proxy" ); clickLinkWithText( "Add Network Proxy" );
@ -245,7 +249,8 @@ public abstract class AbstractRepositoryTest
String[] arrayRemote = remote.split( "," ); String[] arrayRemote = remote.split( "," );
for ( String arrayremote : arrayRemote ) for ( String arrayremote : arrayRemote )
assertTextPresent( arrayremote ); assertTextPresent( arrayremote );
String remoteElements = "addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_username,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout"; String remoteElements =
"addRemoteRepository_repository_id,addRemoteRepository_repository_name,addRemoteRepository_repository_url,addRemoteRepository_repository_username,addRemoteRepository_repository_password,addRemoteRepository_repository_timeout,addRemoteRepository_repository_layout";
String[] arrayRemoteElements = remoteElements.split( "," ); String[] arrayRemoteElements = remoteElements.split( "," );
for ( String arrayremotelement : arrayRemoteElements ) for ( String arrayremotelement : arrayRemoteElements )
assertElementPresent( arrayremotelement ); assertElementPresent( arrayremotelement );
@ -261,7 +266,8 @@ public abstract class AbstractRepositoryTest
assertButtonWithValuePresent( "Cancel" ); assertButtonWithValuePresent( "Cancel" );
} }
public void addRemoteRepository( String identifier, String name, String url, String username, String password, String timeout, String type ) public void addRemoteRepository( String identifier, String name, String url, String username, String password,
String timeout, String type )
{ {
// goToRepositoriesPage(); // goToRepositoriesPage();
assertAddRemoteRepository(); assertAddRemoteRepository();
@ -329,25 +335,31 @@ public abstract class AbstractRepositoryTest
assertPage( "Apache Archiva \\ Administration - Repository Scanning" ); assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
assertTextPresent( "Administration - Repository Scanning" ); assertTextPresent( "Administration - Repository Scanning" );
assertTextPresent( "Repository Scanning - File Types" ); assertTextPresent( "Repository Scanning - File Types" );
String artifactsTypes = "**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip"; String artifactsTypes =
"**/*.pom,**/*.jar,**/*.ear,**/*.war,**/*.car,**/*.sar,**/*.mar,**/*.rar,**/*.dtd,**/*.tld,**/*.tar.gz,**/*.tar.bz2,**/*.zip";
String[] arrayArtifactTypes = artifactsTypes.split( "," ); String[] arrayArtifactTypes = artifactsTypes.split( "," );
for ( int i = 0; i < arrayArtifactTypes.length; i++ ) for ( int i = 0; i < arrayArtifactTypes.length; i++ )
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table."+i+".0"), arrayArtifactTypes[i]); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[1]/table." + i + ".0" ),
arrayArtifactTypes[i] );
String autoremove = "**/*.bak,**/*~,**/*-"; String autoremove = "**/*.bak,**/*~,**/*-";
String[] arrayAutoremove = autoremove.split( "," ); String[] arrayAutoremove = autoremove.split( "," );
for ( int i = 0; i < arrayAutoremove.length; i++ ) for ( int i = 0; i < arrayAutoremove.length; i++ )
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table."+i+".0"), arrayAutoremove[i]); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[2]/table." + i + ".0" ),
arrayAutoremove[i] );
String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**"; String ignored = "**/.htaccess,**/KEYS,**/*.rb,**/*.sh,**/.svn/**,**/.DAV/**";
String[] arrayIgnored = ignored.split( "," ); String[] arrayIgnored = ignored.split( "," );
for ( int i = 0; i < arrayIgnored.length; i++ ) for ( int i = 0; i < arrayIgnored.length; i++ )
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table."+i+".0"), arrayIgnored[i]); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[3]/table." + i + ".0" ),
arrayIgnored[i] );
String indexableContent = "**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld"; String indexableContent =
"**/*.txt,**/*.TXT,**/*.block,**/*.config,**/*.pom,**/*.xml,**/*.xsd,**/*.dtd,**/*.tld";
String[] arrayIndexableContent = indexableContent.split( "," ); String[] arrayIndexableContent = indexableContent.split( "," );
for ( int i = 0; i < arrayIndexableContent.length; i++ ) for ( int i = 0; i < arrayIndexableContent.length; i++ )
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table."+i+".0"), arrayIndexableContent[i]); Assert.assertEquals( getSelenium().getTable( "//div[@id='contentArea']/div/div[4]/table." + i + ".0" ),
arrayIndexableContent[i] );
} }
// /////////////////////////////////////////// // ///////////////////////////////////////////

View File

@ -53,8 +53,8 @@ public abstract class AbstractSearchTest
clickButtonWithValue( "Search" ); clickButtonWithValue( "Search" );
} }
public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version, String repositoryId, public void searchForArtifactAdvancedSearch( String groupId, String artifactId, String version,
String className, String rowCount ) String repositoryId, String className, String rowCount )
{ {
goToSearchPage(); goToSearchPage();

View File

@ -39,7 +39,8 @@ import org.testng.Assert;
* @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $ * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $
*/ */
public abstract class AbstractSeleniumTest { public abstract class AbstractSeleniumTest
{
public static String baseUrl; public static String baseUrl;
@ -113,7 +114,6 @@ public abstract class AbstractSeleniumTest {
return value; return value;
} }
/** /**
* Close selenium session. Called from AfterSuite method of sub-class * Close selenium session. Called from AfterSuite method of sub-class
*/ */