1 package org.apache.archiva.web.test.parent;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 public abstract class AbstractArtifactManagementTest
23 extends AbstractArchivaTest
26 public String getGroupId()
28 String groupId = getProperty( "GROUPID" );
32 public String getArtifactId()
34 String artifactId = getProperty( "ARTIFACTID" );
38 public String getVersion()
40 String version = getProperty( "VERSION" );
44 public String getPackaging()
46 String packaging = getProperty( "PACKAGING" );
50 public String getArtifactFilePath()
52 return "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
55 public String getRepositoryId()
57 String repositoryId = getProperty( "REPOSITORYID" );
61 public void goToDeleteArtifactPage()
63 login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
64 clickLinkWithText( "Delete Artifact" );
65 assertDeleteArtifactPage();
68 public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
70 goToDeleteArtifactPage();
71 setFieldValue( "groupId", groupId );
72 setFieldValue( "artifactId", artifactId );
73 setFieldValue( "version", version );
74 selectValue( "repositoryId", repositoryId );
75 clickButtonWithValue( "Submit" );
78 public void assertDeleteArtifactPage()
80 assertPage( "Apache Archiva \\ Delete Artifact" );
81 assertTextPresent( "Delete Artifact" );
82 assertTextPresent( "Group Id*:" );
83 assertTextPresent( "Artifact Id*:" );
84 assertTextPresent( "Version*:" );
85 assertTextPresent( "Repository Id:" );
86 assertElementPresent( "groupId" );
87 assertElementPresent( "artifactId" );
88 assertElementPresent( "version" );
89 assertElementPresent( "repositoryId" );
90 assertButtonWithValuePresent( "Submit" );
94 public void goToLegacySupportPage()
96 clickLinkWithText( "Legacy Support" );
97 assertLegacySupportPage();
100 public void assertLegacySupportPage()
102 assertPage( "Apache Archiva \\ Administration - Legacy Support" );
103 assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
104 assertTextPresent( "Path Mappings" );
105 assertLinkPresent( "Add" );
108 public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version,
109 String classifier, String type )
111 assertAddLegacyArtifactPathPage();
112 setFieldValue( "legacyArtifactPath.path", path );
113 setFieldValue( "groupId", groupId );
114 setFieldValue( "artifactId", artifactId );
115 setFieldValue( "version", version );
116 setFieldValue( "classifier", classifier );
117 setFieldValue( "type", type );
118 clickButtonWithValue( "Add Legacy Artifact Path" );
121 public void assertAddLegacyArtifactPathPage()
123 assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
124 assertTextPresent( "Admin: Add Legacy Artifact Path" );
125 assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
127 "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
128 String[] arrayElement = element.split( "," );
129 for ( String arrayelement : arrayElement )
130 assertElementPresent( arrayelement );
131 assertButtonWithValuePresent( "Add Legacy Artifact Path" );