@Test(groups = {"requiresUpload"})
public void testCorrectRepositoryInBrowse()
{
- File artifact =
- new File( getBasedir(),
- "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" );
-
String releasesRepo = getProperty( "RELEASES_REPOSITORY" );
// create releases repository first
String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
+ String path = "src/test/it-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", artifact.getPath(),
- 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 + "'" );
goToBrowsePage();
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", artifact.getPath(),
- 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 + "'" );
goToBrowsePage();
package org.apache.archiva.web.test.parent;
import java.io.File;
+import java.io.IOException;
import org.apache.archiva.web.test.XPathExpressionUtil;
checkField( "generatePom" );
}
- setFieldValue( "artifact", artifactFilePath );
+ String path;
+ if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 )
+ {
+ File f = new File( artifactFilePath );
+ try
+ {
+ path = f.getCanonicalPath();
+ }
+ catch ( IOException e )
+ {
+ path = f.getAbsolutePath();
+ }
+ }
+ else
+ {
+ path = artifactFilePath;
+ }
+
+ setFieldValue( "artifact", path );
setFieldValue( "repositoryId", repositoryId );
clickButtonWithValue( "Submit" );
package org.apache.archiva.web.test.parent;
-import java.io.*;
-
-public abstract class AbstractArtifactManagementTest
+public abstract class AbstractArtifactManagementTest
extends AbstractArchivaTest
{
public String getArtifactFilePath()
{
- File f = new File( "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" );
- try
- {
- return f.getCanonicalPath();
- }
- catch ( IOException e )
- {
- return f.getAbsolutePath();
- }
+ return "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
}
public String getRepositoryId()