extends AbstractArtifactManagementTest
{
- @Test( alwaysRun = true, dependsOnGroups = "about")
+ @Test( alwaysRun = true, dependsOnGroups = "about" )
public void testAddArtifactNullValues()
{
goToAddArtifactPage();
@Test( dependsOnMethods = { "testAddArtifactNullValues" }, alwaysRun = true )
public void testAddArtifactNoGroupId()
{
- addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(),
+ false );
assertTextPresent( "You must enter a groupId." );
}
public void testAddArtifactNoArtifactId()
{
- addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(), false );
assertTextPresent( "You must enter an artifactId." );
}
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoVersion()
{
- addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId(),
+ false );
assertTextPresent( "You must enter a version." );
}
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactInvalidVersion()
{
- addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId(),
+ true );
assertTextPresent( "Invalid version." );
}
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoPackaging()
{
- addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId() );
+ addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId(),
+ false );
assertTextPresent( "You must enter a packaging." );
}
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoFilePath()
{
- addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId() );
+ addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId(), false );
assertTextPresent( "Please add a file to upload." );
}
String groupId = getProperty( "VALIDARTIFACT_GROUPID" );
String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" );
- addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
+ addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(),
+ true );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" );
}
String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" );
String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" );
- addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId() );
+ addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId(), false );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" );
getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() );
public void testAddArtifactBlockRedeployments()
{
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(),
- getRepositoryId() );
+ getRepositoryId(), false );
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
}
String packaging = getProperty( "PACKAGING1" );
String repositoryId = getProperty( "REPOSITORYID1" );
// TODO: do this differently as it only works in Firefox's chrome mode
- addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId );
+ addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId, false );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
deleteArtifact( "delete", "delete", "1.0", "internal" );
public void testDeleteArtifactInvalidValues()
{
deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" );
- assertTextPresent( "Invalid version." );
assertTextPresent(
"Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
assertTextPresent(
"Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
+ // as it's a validation on server side it's not available here but tested in testDeleteArtifactInvalidVersion
+ //assertTextPresent( "Invalid version." );
}
+
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidGroupId()
{
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
- + getProperty( "ARTIFACT_PACKAGING" ) );
+ assertTextPresent(
+ getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
+ "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
assertTextNotPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
- + getProperty( "ARTIFACT_PACKAGING" ) );
+ assertTextNotPresent(
+ getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
+ "ARTIFACT_PACKAGING" ) );
assertTextNotPresent( "Uploaded File" );
}
assertAuditLogsReportPage();
assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." );
- assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
- + getProperty( "ARTIFACT_PACKAGING" ) );
+ assertTextPresent(
+ getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
+ "ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" );
assertTextPresent( "admin" );
}
- @Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload" )
+ @Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" },
+ groups = "requiresUpload" )
public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
{
String groupId = getProperty( "SNAPSHOT_GROUPID" );
String repo = getProperty( "SNAPSHOT_REPOSITORYID" );
String packaging = getProperty( "SNAPSHOT_PACKAGING" );
- addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo );
- assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version
- + "' was successfully deployed to repository '" + repo + "'" );
+ addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo, true );
+ assertTextPresent(
+ "Artifact '" + groupId + ":" + artifactId + ":" + version + "' was successfully deployed to repository '"
+ + repo + "'" );
clickLinkWithText( "Logout" );
assertAuditLogsReportPage();
assertTextPresent( "Results" );
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( "internal" );
assertTextPresent( "admin" );
String repositoryId = getProperty( "REPOSITORYID" );
String expectedArtifact = getProperty( "AUDITLOG_EXPECTED_ARTIFACT" );
- addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId );
+ addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId,
+ true );
goToAuditLogReports();
* under the License.
*/
-import java.io.File;
-
import org.apache.archiva.web.test.parent.AbstractBrowseTest;
import org.testng.Assert;
import org.testng.annotations.Test;
+import java.io.File;
+
@Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
public class BrowseTest
extends AbstractBrowseTest
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
-
+
assertTextPresent( "Info" );
assertTextPresent( "Dependencies" );
assertTextPresent( "Dependency Tree" );
"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)
// upload a snapshot artifact to repository 'releases'
- addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo );
- assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '"
- + releasesRepo + "'" );
+ addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo, true );
+ assertTextPresent(
+ "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo
+ + "'" );
goToBrowsePage();
assertBrowsePage();
assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" );
// upload a snapshot artifact to repository 'snapshots'
- addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
- assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '"
- + snapshotsRepo + "'" );
+ addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
+ assertTextPresent(
+ "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo
+ + "'" );
goToBrowsePage();
assertBrowsePage();
"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)
// upload a snapshot artifact to repository 'releases'
- addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
- assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
- + snapshotsRepo + "'" );
+ addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
+ assertTextPresent(
+ "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+ + snapshotsRepo + "'" );
goToBrowsePage();
assertBrowsePage();
assertGroupsPage( "archiva/" );
assertArtifactsPage( "archiva-multiple-artifacts/" );
- assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" );
+ assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT",
+ "jar" );
-
- addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
- assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
- + snapshotsRepo + "'" );
+ addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
+ assertTextPresent(
+ "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+ + snapshotsRepo + "'" );
goToBrowsePage();
assertBrowsePage();
assertGroupsPage( "archiva/" );
assertArtifactsPage( "archiva-multiple-artifacts/" );
- assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" );
+ assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT",
+ "jar" );
String firstSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[2]/a/" );
Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) );
String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" );
Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) );
}
-
+
public void testAddMetadataPropertyEmpty()
{
goToBrowsePage();
{
addMetadataProperty();
}
-
+
@Test( dependsOnMethods = { "testAddMetadataProperty" } )
public void testDeleteMetadataProperty()
{
deleteMetadataProperty();
}
-
- @Test( dependsOnMethods = { "testDeleteMetadataProperty" })
+
+ @Test( dependsOnMethods = { "testDeleteMetadataProperty" } )
public void testMetadataAccessWithRepositoryObserverRole()
- {
+ {
addMetadataProperty();
-
+
logout();
-
+
goToBrowsePage();
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
clickLinkWithText( "Metadata" );
waitPage();
-
+
assertTextNotPresent( "No metadata content." );
assertButtonWithValueNotPresent( "Add" );
assertTextNotPresent( "Add Property" );
assertImgWithAltNotPresent( "Delete" );
-
+
login( getAdminUsername(), getAdminPassword() );
-
+
deleteMetadataProperty();
- }
-
+ }
+
private void addMetadataProperty()
{
goToBrowsePage();
assertTextNotPresent( "No metadata content." );
assertTextPresent( "foo=bar" );
}
-
+
private void deleteMetadataProperty()
{
goToBrowsePage();
assertTextPresent( "Property successfully deleted." );
assertImgWithAltNotPresent( "Delete" );
assertTextPresent( "No metadata content." );
- }
+ }
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
String artifactInfoArtifactId, String artifactInfoVersion,
public void testAddArtifactToStagingRepository()
{
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
- "merging-repo-stage" );
+ "merging-repo-stage", true );
assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
"' was successfully deployed to repository 'merging-repo-stage'" );
}
{
editManagedRepository();
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
- "merging-repo-stage" );
+ "merging-repo-stage", true );
assertTextPresent(
"Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );
}
* under the License.
*/
-import java.io.File;
-
import org.apache.archiva.web.test.parent.AbstractSearchTest;
import org.testng.annotations.Test;
-@Test( groups = { "search" }, dependsOnGroups = {"about"}, sequential = true)
+@Test( groups = { "search" }, dependsOnGroups = { "about" }, sequential = true )
public class SearchTest
extends AbstractSearchTest
{
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchNonExistingArtifact()
throws Exception
{
}
// TODO: make search tests more robust especially when comparing/asserting number of hits
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchExistingArtifact()
{
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
assertLinkPresent( "test" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testViewSearchedArtifact()
{
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
assertPage( "Apache Archiva \\ Browse Repository" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchWithMultipleKeywords()
{
String groupId = getProperty( "ADD_REMOVE_GROUPID" );
String packaging = getProperty( "SNAPSHOT_PACKAGING" );
String filePath = getProperty( "SNAPSHOT_ARTIFACTFILEPATH" );
String repoId = getProperty( "SNAPSHOT_REPOSITORYID" );
-
+
String existingArtifactId = getProperty( "ADD_REMOVE_ARTIFACTID" );
String multiKeywords = existingArtifactId.replace( "-", " " );
-
- addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId );
-
+
+ addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId, true );
+
// verify artifact is existing
searchForArtifact( existingArtifactId );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( existingArtifactId );
-
+
// search for existing artifact using multiple keywords
searchForArtifact( multiKeywords );
assertTextPresent( "No results found" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchNonExistingArtifactInAdvancedSearch()
{
searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null );
assertTextPresent( "No results found" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch()
{
searchForArtifactAdvancedSearch( null, null, null, null, null, null );
assertTextPresent( "Advanced Search - At least one search criteria must be provided." );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
{
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null,
assertLinkPresent( "test" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
{
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null,
assertLinkPresent( "test" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchExistingArtifactAllCriteriaSpecifiedInAdvancedSearch()
{
- searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ) , getProperty( "ARTIFACT_VERSION" ),
- getProperty( "REPOSITORYID" ), getProperty( "ARTIFACT_CLASSNAME" ), null );
+ searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ),
+ getProperty( "ARTIFACT_VERSION" ), getProperty( "REPOSITORYID" ),
+ getProperty( "ARTIFACT_CLASSNAME" ), null );
assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( "test" );
}
- @Test(alwaysRun = true)
+ @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
{
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );
}
public void addArtifact( String groupId, String artifactId, String version, String packaging,
- String artifactFilePath, String repositoryId )
+ String artifactFilePath, String repositoryId, boolean wait )
{
- addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId );
+ addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId, wait );
}
public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom,
- String artifactFilePath, String repositoryId )
+ String artifactFilePath, String repositoryId, boolean wait )
{
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
goToAddArtifactPage();
selectValue( "upload_repositoryId", repositoryId );
//clickButtonWithValue( "Submit" );
- clickButtonWithLocator( "uploadSubmit" );
+ clickButtonWithLocator( "uploadSubmit", wait );
}
public void goToRepositoriesPage()