--- /dev/null
+e391148b557852624203d657b1e41085
\ No newline at end of file
--- /dev/null
+76a2f2eacbccb422c7a42ae22ab2a627f7d33b46
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>searchGroup</groupId>
+ <artifactId>searchArtifactId</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>searchArtifactId</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+e2e05fa5402d165ef455f7c6e793535a
\ No newline at end of file
--- /dev/null
+4f18ae89b60c727ed1b0046f18ba0a4edc6b7cbe
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+ <groupId>searchGroup</groupId>
+ <artifactId>searchArtifactId</artifactId>
+ <versioning>
+ <release>1.0</release>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20140126133747</lastUpdated>
+ </versioning>
+</metadata>
--- /dev/null
+c124fd7ce60fd49acbe3cda525f93975
\ No newline at end of file
--- /dev/null
+4a9424a71b8b6ebc85ad548f0e68d20bdf15f07d
\ No newline at end of file
+++ /dev/null
-ea7dea9244b2a0975cfa117dc34fe18e
\ No newline at end of file
+++ /dev/null
-1039566ff5361d07eccd1243c45929b96441c7d6
\ No newline at end of file
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>test</groupId>
- <artifactId>test</artifactId>
- <packaging>jar</packaging>
- <version>1.0</version>
- <name>test</name>
- <url>http://maven.apache.org</url>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-<distributionManagement>
-<repository>
- <id>test</id>
-<url>file://localhost/Users/brett/scm/archiva/archiva/archiva-modules/archiva-web/archiva-webapp-test/src/test/it-resources/appserver-base/data/repositories/internal</url>
-</repository>
-</distributionManagement>
-</project>
+++ /dev/null
-f80c7c493716de649a99db00cd2ff34c
\ No newline at end of file
+++ /dev/null
-4b95c6fa09d1e02efdb69129f53f025e33bc8958
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
- <groupId>test</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <versioning>
- <versions>
- <version>1.0</version>
- </versions>
- <lastUpdated>20100114015837</lastUpdated>
- </versioning>
-</metadata>
+++ /dev/null
-dab1b8c2475fe839f387ceaef0d82b30
\ No newline at end of file
+++ /dev/null
-4e5b414d5419121ef75131cb52235a9abbf2095a
\ No newline at end of file
--- /dev/null
+3f01a41f9beb52c19553bd675c00777d
\ No newline at end of file
--- /dev/null
+8f74238687dd8d4d4d5a238dff836349f44a8a0b
\ No newline at end of file
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>test</groupId>
+ <artifactId>testExisting</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>testExisting</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+48c2a0b28513ff1076640040c5b53595
\ No newline at end of file
--- /dev/null
+e70f597ca808a93027d0b527c7f0ce5d06cbbadf
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+ <groupId>test</groupId>
+ <artifactId>testExisting</artifactId>
+ <versioning>
+ <release>1.0</release>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20140126134048</lastUpdated>
+ </versioning>
+</metadata>
--- /dev/null
+dcb219263cc293060cc1f44a170a2c74
\ No newline at end of file
--- /dev/null
+5f0d0f86a8bdd4ca756117414204cd6ee44de0b3
\ No newline at end of file
*/
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test(groups = { "appearance" }, dependsOnGroups = "login", sequential = true)
+@Test(groups = { "appearance" }, sequential = true)
public class AppearanceTest
extends AbstractArchivaTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
public void testAddAppearanceEmptyValues()
{
goToAppearancePage();
+++ /dev/null
-package org.apache.archiva.web.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-@Test( groups = { "about" }, alwaysRun = true )
-public class ArchivaAdminTest
- extends AbstractArchivaTest
-{
-
- @Override
- @AfterTest
- public void close()
- throws Exception
- {
- super.close();
- }
-
- @Override
- @BeforeSuite
- public void open()
- throws Exception
- {
- super.open();
- }
-
- @BeforeTest
- @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
- public void initializeArchiva( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort ) throws Exception
- {
- super.open( baseUrl, browser, seleniumHost, seleniumPort );
- getSelenium().open( baseUrl );
- String title = getSelenium().getTitle();
- if ( title.endsWith( "Create Admin User" ) )
- {
- assertCreateAdmin();
- String fullname = getProperty( "ADMIN_FULLNAME" );
- String username = getProperty( "ADMIN_USERNAME" );
- String mail = getProperty( "ADMIN_EMAIL" );
- String password = getProperty( "ADMIN_PASSWORD" );
- submitAdminData( fullname, mail, password );
- assertUserLoggedIn( username );
- submit();
- clickLinkWithText( "Logout" );
- }
- }
-
-}
*/
import org.apache.archiva.web.test.parent.AbstractArtifactManagementTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "artifactmanagement" }, dependsOnGroups = "login" )
+@Test( groups = { "artifactmanagement" } )
public class ArtifactManagementTest
extends AbstractArtifactManagementTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
-
- public void testAddArtifactNullValues()
+ public void tearDown()
+ {
+ deleteArtifact( getGroupId(), "testAddArtifactValidValues", getVersion(), getRepositoryId() );
+ }
+
+ public void testAddArtifactNullValues()
{
goToAddArtifactPage();
clickButtonWithValue( "Submit" );
@Test(groups = "requiresUpload")
public void testAddArtifactValidValues()
{
- addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Artifact 'test:testAddArtifactValidValues:1.0' was successfully deployed to repository 'internal'" );
}
@Test(groups = "requiresUpload")
public void testAddArtifactBlockRedeployments()
{
- addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId() , getProperty( "ARTIFACT_ARTIFACTID" ), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
}
* under the License.
*/
-import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.apache.archiva.web.test.parent.AbstractArtifactManagementTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "auditlogsreport" }, dependsOnGroups = {"login", "artifactmanagement", "userroles"} )
+@Test( groups = { "auditlogsreport" } )
public class AuditLogsReportTest
- extends AbstractArchivaTest
+ extends AbstractArtifactManagementTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ addArtifact( getGroupId(), "testAudit", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ }
+
private void goToAuditLogReports()
{
getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
}
-
+
private void assertAuditLogsReportPage()
- {
+ {
assertPage( "Apache Archiva \\ Audit Log Report" );
assertTextPresent( "Audit Log Report" );
-
+
assertElementPresent( "repository" );
assertElementPresent( "groupId" );
assertElementPresent( "artifactId" );
assertElementPresent( "rowCount" );
assertButtonWithValuePresent( "View Audit Log" );
}
-
+
@Test
public void testAuditLogsReport()
{
- goToAuditLogReports();
+ goToAuditLogReports();
assertAuditLogsReportPage();
assertTextPresent( "Latest Events" );
}
-
+
@Test
public void testViewAuditLogsNoDataFound()
{
- goToAuditLogReports();
+ goToAuditLogReports();
assertAuditLogsReportPage();
-
+
setFieldValue( "groupId", "non.existing" );
submit();
-
- assertPage( "Apache Archiva \\ Audit Log Report" );
+
+ assertPage( "Apache Archiva \\ Audit Log Report" );
assertTextPresent( "Results" );
assertTextPresent( "No audit logs found." );
- }
-
+ }
+
// TODO: add test for adding via WebDAV
@Test (groups = "requiresUpload")
public void testViewAuditLogsDataFound()
{
- goToAuditLogReports();
+ goToAuditLogReports();
assertAuditLogsReportPage();
-
+
selectValue( "repository", "internal" );
setFieldValue( "groupId", "test" );
submit();
-
+
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
+ assertTextPresent( "testAudit-1.0.jar" );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
}
-
+
// TODO: add test for adding via WebDAV
@Test ( groups = "requiresUpload")
public void testViewAuditLogsOnlyArtifactIdIsSpecified()
{
- goToAuditLogReports();
+ goToAuditLogReports();
assertAuditLogsReportPage();
-
+
selectValue( "repository", "internal" );
setFieldValue( "artifactId", "test" );
submit();
-
+
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
+ assertTextPresent( "testAudit-1.0.jar" );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
}
-
+
// TODO: add test for adding via WebDAV
@Test (groups = "requiresUpload")
public void testViewAuditLogsForAllRepositories()
{
- goToAuditLogReports();
+ goToAuditLogReports();
assertAuditLogsReportPage();
-
+
selectValue( "repository", "all" );
submit();
-
+
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
+ assertTextPresent( "testAudit-1.0.jar" );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
}
-
+
@Test (groups = "requiresUpload")
public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
{
String version = getProperty( "SNAPSHOT_VERSION" );
String repo = getProperty( "SNAPSHOT_REPOSITORYID" );
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 +
- "' was successfully deployed to repository '" + repo + "'" );
-
- clickLinkWithText( "Logout" );
-
- login( getProperty( "REPOMANAGER_INTERNAL_USERNAME" ), getUserRoleNewPassword() );
+ "' was successfully deployed to repository '" + repo + "'" );
+
+ goToUserManagementPage();
+ String username = "testAuditUser";
+ if ( !isLinkPresent( username ) )
+ {
+ createUserWithRole( username, "Repository Manager - internal", getUserEmail(), getUserRolePassword() );
+
+ logout();
+ login( username, getUserRolePassword() );
+ changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+ }
+ else
+ {
+ logout();
+ login( username, getUserRoleNewPassword() );
+ }
goToAuditLogReports();
assertAuditLogsReportPage();
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( "testAddArtifactValidValues-1.0.jar" );
+ assertTextPresent( "testAudit-1.0.jar" );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
assertTextNotPresent( artifactId + "-" + version + "." + packaging );
clickLinkWithText( "Logout" );
- login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
+ loginAsAdmin();
}
-
+
@Test ( groups = "requiresUpload")
public void testViewAuditLogsReportForGroupId()
{
String packaging = getProperty("PACKAGING");
String repositoryId = getProperty("REPOSITORYID");
String expectedArtifact = getProperty("AUDITLOG_EXPECTED_ARTIFACT");
-
+
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId );
-
+
goToAuditLogReports();
-
+
selectValue( "repository", repositoryId );
setFieldValue( "groupId", groupId );
submit();
-
+
assertAuditLogsReportPage();
assertTextPresent( expectedArtifact );
assertTextPresent( repositoryId );
import org.apache.archiva.web.test.parent.AbstractBrowseTest;
import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "browse" }, dependsOnGroups = {"login","artifactmanagement"} )
+@Test( groups = { "browse" } )
public class BrowseTest
extends AbstractBrowseTest
{
-
- public void testBrowseArtifact()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testBrowseArtifact()
{
goToBrowsePage();
assertBrowsePage();
{
goToBrowsePage();
assertBrowsePage();
- clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
+ clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
assertPage( "Apache Archiva \\ Browse Repository" );
assertTextPresent( "Artifacts" );
}
*/
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
/**
* Test all actions affected with CSRF security issue.
*/
-@Test( groups = { "csrf" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "csrf" }, sequential = true )
public class CSRFSecurityTest
extends AbstractArchivaTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
public void testCSRFDeleteRepository()
{
getSelenium().open( baseUrl );
*/
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "database" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "database" }, sequential = true )
public class DatabaseTest
extends AbstractRepositoryTest
{
- public void testUpdateCron_NullValue()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testUpdateCron_NullValue()
{
goToDatabasePage();
setFieldValue( "database_cron" , "");
*/
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "findartifact" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "findartifact" }, sequential = true )
public class FindArtifactTest
extends AbstractArchivaTest
{
- public void testFindArtifactNullValues()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testFindArtifactNullValues()
{
goToFindArtifactPage();
clickButtonWithValue( "Search" );
*/
import org.apache.archiva.web.test.parent.AbstractArtifactManagementTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "legacysupport" }, dependsOnGroups = "login", sequential = true )
-public class LegacySupportTest
+@Test( groups = { "legacysupport" }, sequential = true )
+public class LegacySupportTest
extends AbstractArtifactManagementTest
{
- public void testAddLegacyArtifact_NullValues()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testAddLegacyArtifact_NullValues()
{
goToLegacySupportPage();
clickLinkWithText( "Add" );
* @version $Id$
*/
-@Test ( groups = { "login" }, dependsOnGroups = "about")
+@Test ( groups = { "login" } )
public class LoginTest
extends AbstractArchivaTest
{
@Test( dependsOnMethods = { "testWithBadUsername" }, alwaysRun = true )
public void testWithBadPassword()
{
- goToLoginPage();
- getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
- getSelenium().type( "loginForm_password", "badPassword" );
- getSelenium().click( "loginForm__login" );
- getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ login( getProperty( "ADMIN_USERNAME" ), "badPassword", false, "Login Page" );
assertTextPresent( "You have entered an incorrect username and/or password" );
}
@Test( groups = { "loginSuccess" }, dependsOnMethods = { "testWithEmptyPassword" }, alwaysRun = true )
public void testWithCorrectUsernamePassword()
{
- goToLoginPage();
- getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
- getSelenium().type( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
- getSelenium().click( "loginForm__login" );
- getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+ loginAsAdmin();
assertTextPresent( "Edit Details" );
assertTextPresent( "Logout" );
assertTextPresent( getProperty( "ADMIN_USERNAME" ) );
}
-
- @BeforeTest
- public void open()
- throws Exception
- {
- super.open();
- }
-
- @Override
- @AfterTest
- public void close()
- throws Exception
- {
- super.close();
- }
}
*/
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "networkproxies" }, dependsOnGroups = {"login","virtualrepository"})
+@Test( groups = { "networkproxies" })
public class NetworkProxiesTest
extends AbstractRepositoryTest
{
- @Test
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ @Test
public void testAddNetworkProxyNullValues()
{
goToNetworkProxiesPage();
*/
import org.apache.archiva.web.test.parent.AbstractArtifactReportsTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "reports" }, dependsOnGroups = "login")
+@Test( groups = { "reports" })
public class ReportsTest
extends AbstractArtifactReportsTest
{
- //TODO Tests for repository with defects
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ //TODO Tests for repository with defects
public void testRepoStatisticsWithoutRepoCompared()
{
*/
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.testng.Assert;
-@Test( groups = { "reposcan" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "reposcan" }, sequential = true )
public class RepositoryScanningTest
extends AbstractRepositoryTest
{
- public void testAddArtifactFileType_NullValue()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testAddArtifactFileType_NullValue()
{
goToRepositoryScanningPage();
clickAddIcon( "newpattern_0" );
*/
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "repository" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "repository" }, sequential = true )
public class RepositoryTest
extends AbstractRepositoryTest
{
- public void testAddManagedRepoValidValues()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ @AfterSuite
+ public void tearDown()
+ {
+ goToRepositoriesPage();
+ deleteManagedRepository( "managedrepo1", false );
+ deleteManagedRepository( "managedrepo", false );
+ deleteRemoteRepository( "remoterepo", false );
+ }
+
+ public void testAddManagedRepoValidValues()
{
goToRepositoriesPage();
getSelenium().open( "/archiva/admin/addRepository.action" );
addManagedRepository( "managedrepo1", "Managed Repository Sample 1" , getRepositoryDir() + "repository/" , "", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
clickButtonWithValue( "Save" );
- assertTextPresent( "Managed Repository Sample 1" );
+ assertTextPresent( "Managed Repository Sample 1" );
assertRepositoriesPage();
}
@Test(dependsOnMethods = { "testAddManagedRepoInvalidDaysOlder" } )
public void testAddManagedRepoBlankValues()
- {
+ {
goToRepositoriesPage();
- getSelenium().open( "/archiva/admin/addRepository.action" ); ;
+ 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" } )
public void testAddManagedRepoNoIdentifier()
- {
+ {
addManagedRepository( "", "name" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
assertTextPresent( "You must enter a repository identifier." );
}
-
+
@Test(dependsOnMethods = { "testAddManagedRepoNoIdentifier" } )
public void testAddManagedRepoNoRepoName()
{
addManagedRepository( "identifier", "" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
assertTextPresent( "You must enter a repository name." );
}
-
+
@Test(dependsOnMethods = { "testAddManagedRepoNoRepoName" } )
public void testAddManagedRepoNoDirectory()
{
addManagedRepository( "identifier", "name" , "" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
assertTextPresent( "You must enter a directory." );
}
-
+
@Test(dependsOnMethods = { "testAddManagedRepoNoDirectory" } )
public void testAddManagedRepoNoCron()
{
addManagedRepository( "identifier", "name" , "/home" , "/.index", "Maven 2.x Repository", "", "", "" );
assertTextPresent( "Invalid cron expression." );
}
-
+
@Test(dependsOnMethods = { "testAddManagedRepoNoCron" } )
public void testAddManagedRepoForEdit()
{
editManagedRepository( "repository.name" , "Managed Repo" );
assertTextPresent( "Managed Repository Sample" );
}
-
+
//TODO
@Test(dependsOnMethods = { "testEditManagedRepo" } )
public void testDeleteManageRepo()
{
- deleteManagedRepository();
- //assertTextNotPresent( "managedrepo" );
+ deleteManagedRepository( "managedrepo", true );
}
-
+
@Test(dependsOnMethods = { "testAddRemoteRepoValidValues" } )
public void testAddRemoteRepoNullValues()
- {
+ {
getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
addRemoteRepository( "" , "" , "" , "" , "" , "" , "Maven 2.x Repository" );
assertTextPresent( "You must enter a repository identifier." );
assertTextPresent( "You must enter a repository name." );
assertTextPresent( "You must enter a url." );
}
-
+
@Test(dependsOnMethods = { "testAddRemoteRepoNullValues" } )
public void testAddRemoteRepositoryNullIdentifier()
{
addRemoteRepository( "" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
assertTextPresent( "You must enter a repository identifier." );
}
-
+
@Test(dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } )
public void testAddRemoteRepoNullName()
{
addRemoteRepository( "remoterepo" , "" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
assertTextPresent( "You must enter a repository name." );
}
-
+
@Test(dependsOnMethods = { "testAddRemoteRepoNullName" } )
public void testAddRemoteRepoNullURL()
{
@Test(dependsOnMethods = { "testDeleteManageRepo" } )
public void testAddRemoteRepoValidValues()
- {
+ {
getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
assertTextPresent( "Remote Repository Sample" );
}
-
+
// *** BUNDLED REPOSITORY TEST ***
-
+
@Test ( dependsOnMethods = { "testWithCorrectUsernamePassword" }, alwaysRun = true )
public void testBundledRepository()
{
String repo1 = baseUrl + "repository/internal/";
String repo2 = baseUrl + "repository/snapshots/";
-
+
assertRepositoryAccess( repo1 );
assertRepositoryAccess( repo2 );
-
+
getSelenium().open( "/archiva" );
}
-
+
private void assertRepositoryAccess( String repo )
{
getSelenium().open( "/archiva" );
import java.io.File;
import org.apache.archiva.web.test.parent.AbstractSearchTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "search" }, dependsOnGroups = "login" )
+@Test( groups = { "search" } )
public class SearchTest
extends AbstractSearchTest
{
-
- public void testSearchNonExistingArtifact()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testSearchNonExistingArtifact()
throws Exception
{
searchForArtifact( getProperty( "SEARCH_BAD_ARTIFACT" ) );
public void testSearchExistingArtifact()
{
- searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
+ searchForArtifact( "searchArtifactId" );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
- assertLinkPresent( "test" );
+ assertLinkPresent( "searchArtifactId" );
}
public void testViewSearchedArtifact()
{
- searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
- clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) );
+ searchForArtifact( "searchArtifactId" );
+ clickLinkWithText( "searchArtifactId" );
assertPage( "Apache Archiva \\ Browse Repository" );
- assertTextPresent( getProperty( "ARTIFACT_ARTIFACTID" ) );
- clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
+ assertTextPresent( "searchArtifactId" );
+ clickLinkWithText( "1.0/" );
assertPage( "Apache Archiva \\ Browse Repository" );
}
public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
{
- searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, getProperty( "REPOSITORYID" ), null, null );
+ searchForArtifactAdvancedSearch( null, "searchArtifactId", null, getProperty( "REPOSITORYID" ), null, null );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
- assertLinkPresent( "test" );
+ assertLinkPresent( "searchArtifactId" );
}
public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
{
- searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null, null );
+ searchForArtifactAdvancedSearch( "searchGroup", null, null, getProperty( "REPOSITORYID" ), null, null );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
- assertLinkPresent( "test" );
+ assertLinkPresent( "searchGroup" );
}
public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
{
- searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );
+ searchForArtifactAdvancedSearch( null, "searchArtifactId", null, "snapshots", null, null );
assertTextPresent( "No results found" );
assertTextNotPresent( "Results" );
assertTextNotPresent( "Hits: 1 to 1 of 1" );
- assertLinkNotPresent( "test" );
+ assertLinkNotPresent( "searchArtifactId" );
}
}
*/
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-@Test( groups = { "userroles" }, dependsOnGroups = "login")
+@Test( groups = { "userroles" })
public class UserRolesTest
extends AbstractArchivaTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
- public void testBasicAddDeleteUser()
+ public void testBasicAddDeleteUser()
{
username = getProperty( "GUEST_USERNAME" );
fullname = getProperty( "GUEST_FULLNAME" );
{
username = getProperty("REPOMANAGER_INTERNAL_USERNAME");
fullname = getProperty("REPOMANAGER_INTERNAL_FULLNAME");
-
- createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
- clickLinkWithText( username );
- clickLinkWithText( "Edit Roles" );
- checkResourceRoleWithValue( fullname );
- clickButtonWithValue( "Submit" );
+
+ createUserWithRole( username, fullname, getUserEmail(), getUserRolePassword() );
logout();
login(username, getUserRolePassword());
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
- /*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
+
+ /*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
public void testUserWithRepoManagerSnapshotsRole()
{
username = getProperty("REPOMANAGER_SNAPSHOTS_USERNAME");
{
username = getProperty( "REPOOBSERVER_INTERNAL_USERNAME" );
fullname = getProperty( "REPOOBSERVER_INTERNAL_FULLNAME" );
-
- createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
- clickLinkWithText( username );
- clickLinkWithText( "Edit Roles" );
- checkResourceRoleWithValue( fullname );
- clickButtonWithValue( "Submit" );
+
+ createUserWithRole( username, fullname, getUserEmail(), getUserRolePassword() );
logout();
login(username, getUserRolePassword());
*/
import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.testng.Assert;
-@Test( groups = { "virtualrepository" }, dependsOnGroups = "login")
+@Test( groups = { "virtualrepository" })
public class VirtualRepositoryTest
extends AbstractRepositoryTest
{
- public void testAddRepositoryGroupNullValue()
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
+ public void testAddRepositoryGroupNullValue()
{
addRepositoryGroup( " " );
assertTextPresent( "Identifier field is required." );
* under the License.
*/
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
/**
* Test all actions affected with XSS security issue.
*/
-@Test( groups = { "xss" }, dependsOnGroups = "login", sequential = true )
+@Test( groups = { "xss" }, sequential = true )
public class XSSSecurityTest
extends AbstractArchivaTest
{
+ @BeforeTest
+ public void setUp()
+ {
+ loginAsAdmin();
+ }
+
public void testDeleteArtifactImmunityToURLCrossSiteScripting()
{
getSelenium().open( "/archiva/deleteArtifact!doDelete.action?groupId=\"/>1<script>alert('xss')</script>&artifactId=\"/>1<script>alert('xss')</script>&version=\"/>1<script>alert('xss')</script>&repositoryId=\"/>1<script>alert('xss')</script>");
import org.testng.ITestResult;
import org.testng.TestListenerAdapter;
import com.thoughtworks.selenium.Selenium;
+import org.testng.annotations.Listeners;
public class CaptureScreenShotsListener
extends TestListenerAdapter
import java.io.IOException;
import org.apache.archiva.web.test.XPathExpressionUtil;
+import org.apache.archiva.web.test.listener.CaptureScreenShotsListener;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* under the License.
*/
+@Listeners(value = CaptureScreenShotsListener.class)
public abstract class AbstractArchivaTest
extends AbstractSeleniumTest
{
protected String fullname;
+ @BeforeSuite( alwaysRun = true )
+ @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
+ public void initializeArchiva( @Optional( "http://localhost:9696/archiva/" ) String baseUrl,
+ @Optional( "*firefox" ) String browser,
+ @Optional( "localhost" ) String seleniumHost,
+ @Optional( "4444" ) int seleniumPort ) throws Exception
+ {
+ super.open( baseUrl, browser, seleniumHost, seleniumPort );
+ getSelenium().open( baseUrl );
+ String title = getSelenium().getTitle();
+ if ( title.endsWith( "Create Admin User" ) )
+ {
+ assertCreateAdmin();
+ String fullname = getProperty( "ADMIN_FULLNAME" );
+ String username = getProperty( "ADMIN_USERNAME" );
+ String mail = getProperty( "ADMIN_EMAIL" );
+ String password = getProperty( "ADMIN_PASSWORD" );
+ submitAdminData( fullname, mail, password );
+ assertUserLoggedIn( username );
+ submit();
+ clickLinkWithText( "Logout" );
+ }
+ }
+
public String getUserEmail()
{
String email = getProperty( "USERROLE_EMAIL" );
public void checkResourceRoleWithValue( String value )
{
assertResourceRolesCheckBoxPresent( value );
- getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
+ getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value + "']" );
}
assertLinkNotPresent( "Logout" );
assertLinkPresent( "Login" );
}
+
+ protected void loginAsAdmin()
+ {
+ login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
+ }
+
+ protected void createUserWithRole( String username, String fullname, String email, String password )
+ {
+ createUser( username, fullname, email, password, true );
+ clickLinkWithText( username );
+ clickLinkWithText( "Edit Roles" );
+ checkResourceRoleWithValue( fullname );
+
+ clickButtonWithValue( "Submit" );
+ }
}
clickButtonWithValue( "Add Repository" );
}
- public void deleteRemoteRepository()
+ public void deleteRemoteRepository( String id, boolean validate )
{
goToRepositoriesPage();
- clickLinkWithXPath( "//div[@id='contentArea']/div/div[8]/div[1]/a[2]" );
+ String xpath = "//div[@id='contentArea']//a[contains(@href,'confirmDeleteRemoteRepository.action?repoid=" + id + "')]";
+ if ( validate || isElementPresent( "xpath=" + xpath ) )
+ {
+ clickLinkWithXPath( xpath );
assertDeleteRemoteRepositoryPage();
clickButtonWithValue( "Confirm" );
+ }
}
public void editRemoteRepository( String fieldName, String value)
clickButtonWithValue( "Update Repository" );
}
- public void deleteManagedRepository()
+ public void deleteManagedRepository( String id, boolean validate )
{
- clickLinkWithXPath( "//div[@id='contentArea']/div/div[5]/div[1]/a[2]" );
- assertPage( "Apache Archiva \\ Admin: Delete Managed Repository" );
- clickButtonWithValue( "Delete Configuration Only" );
- }
+ String xpath = "//div[@id='contentArea']//a[contains(@href,'confirmDeleteRepository.action?repoid=" + id + "')]";
+ if ( validate || isElementPresent( "xpath=" + xpath ) )
+ {
+ clickLinkWithXPath( xpath );
+ assertPage( "Apache Archiva \\ Admin: Delete Managed Repository" );
+ clickButtonWithValue( "Delete Configuration Only" );
+ }
+ }
public String getRepositoryDir()
{
import com.thoughtworks.selenium.Selenium;
import org.apache.commons.io.IOUtils;
import org.testng.Assert;
+import org.testng.annotations.AfterSuite;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
private final static String PROPERTIES_SEPARATOR = "=";
- public void open()
- throws Exception
- {
- p = new Properties();
- p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) );
-
- //baseUrl = getProperty( "BASE_URL" );
- maxWaitTimeInMs = System.getProperty( "MAX_WAIT_TIME_IN_MS" );
- }
-
/**
* Initialize selenium
*/
public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort )
throws Exception
{
+ p = new Properties();
+ p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) );
+
+ //baseUrl = getProperty( "BASE_URL" );
+ maxWaitTimeInMs = System.getProperty( "MAX_WAIT_TIME_IN_MS" );
+
this.baseUrl = baseUrl;
if ( getSelenium() == null )
public static Selenium getSelenium()
{
- if (selenium.get() != null)
- {
- return selenium.get();
- }
- DefaultSelenium s =
- new DefaultSelenium( System.getProperty("seleniumHost","localhost"), Integer.getInteger( "seleniumPort",4444), System.getProperty("browser"), baseUrl );
- s.start();
- s.setTimeout( maxWaitTimeInMs );
- selenium.set( s );
- return selenium.get();
+ return selenium == null ? null : selenium.get();
}
protected String getProperty( String key )
/**
* Close selenium session. Called from AfterSuite method of sub-class
*/
+ @AfterSuite
public void close()
throws Exception
{
public void assertImgWithAlt( String alt )
{
- assertElementPresent( "/¯img[@alt='" + alt + "']" );
+ assertElementPresent( "//img[@alt='" + alt + "']" );
}
public void assertImgWithAltAtRowCol( boolean isALink, String alt, int row, int column )
SEARCH_BAD_ARTIFACT=asdf
# Existing Artifact
ARTIFACT_GROUPID=test
-ARTIFACT_ARTIFACTID=test
+ARTIFACT_ARTIFACTID=testExisting
ARTIFACT_VERSION=1.0
ARTIFACT_PACKAGING=jar
# Reports