]> source.dussan.org Git - archiva.git/blob
830c39cd7d4f796a0826ebfded7d586d20bfc49e
[archiva.git] /
1 package org.apache.archiva.web.test.parent;
2
3 import java.io.File;
4
5 public abstract class AbstractArtifactManagementTest 
6         extends AbstractArchivaTest
7 {
8         
9         public String getGroupId()
10         {
11                 String groupId = getProperty( "GROUPID" ) ;
12                 return groupId;
13         }
14         
15         public String getArtifactId()
16         {
17                 String artifactId = getProperty( "GROUPID" ) ;
18                 return artifactId;
19         }
20         
21         public String getVersion()
22         {
23                 String version = getProperty( "VERSION" ) ;
24                 return version;
25         }
26         
27         public String getPackaging()
28         {
29                 String packaging = getProperty( "PACKAGING" ) ;
30                 return packaging;
31         }
32         
33         public String getArtifactFilePath()
34         {
35                 File f = new File( "" );
36                 String artifactFilePath = f.getAbsolutePath();
37                 return artifactFilePath + "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" ;
38         }
39         
40         public String getRepositoryId()
41         {
42                 String repositoryId = getProperty( "REPOSITORYID" ) ;
43                 return repositoryId;
44         }
45         
46         public void goToDeleteArtifactPage()
47         {
48                 clickLinkWithText( "Delete Artifact" );
49                 assertDeleteArtifactPage();
50         }
51                 
52         public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId )
53         {
54                 goToDeleteArtifactPage();
55                 setFieldValue( "groupId" , groupId );
56                 setFieldValue( "artifactId" , artifactId );
57                 setFieldValue( "version" , version );
58                 selectValue( "repositoryId" ,  repositoryId );
59                 clickButtonWithValue( "Submit" ) ;
60         }
61         
62         public void assertDeleteArtifactPage()
63         {
64                 assertPage( "Apache Archiva \\ Delete Artifact" );
65                 assertTextPresent( "Delete Artifact" );
66                 assertTextPresent( "Group Id*:" );
67                 assertTextPresent( "Artifact Id*:" );
68                 assertTextPresent( "Version*:" );
69                 assertTextPresent( "Repository Id:" );
70                 assertElementPresent( "groupId" );
71                 assertElementPresent( "artifactId" );
72                 assertElementPresent( "version" );
73                 assertElementPresent( "repositoryId" );
74                 assertButtonWithValuePresent( "Submit" );
75         }
76         
77         // Legacy Support
78         public void goToLegacySupportPage()
79         {
80                 clickLinkWithText( "Legacy Support" );
81                 assertLegacySupportPage();
82         }
83         
84         public void assertLegacySupportPage()
85         {
86                 assertPage( "Apache Archiva \\ Administration - Legacy Support" );
87                 assertTextPresent( "Administration - Legacy Artifact Path Resolution" );
88                 assertTextPresent( "Path Mappings" );
89                 assertLinkPresent( "Add" );
90         }
91         
92         public void addLegacyArtifactPath( String path, String groupId, String artifactId, String version, String classifier, String type)
93         {
94                 assertAddLegacyArtifactPathPage();
95                 setFieldValue( "legacyArtifactPath.path" , path );
96                 setFieldValue( "groupId" , groupId );
97                 setFieldValue( "artifactId" , artifactId );
98                 setFieldValue( "version" , version );
99                 setFieldValue( "classifier" , classifier );
100                 setFieldValue( "type" , type );
101                 clickButtonWithValue( "Add Legacy Artifact Path" );
102         }
103         
104         public void assertAddLegacyArtifactPathPage()
105         {
106                 assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
107                 assertTextPresent( "Admin: Add Legacy Artifact Path" );
108                 assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
109                 String element = "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
110                 String[] arrayElement = element.split( "," );
111                 for ( String arrayelement : arrayElement )
112                         assertElementPresent( arrayelement );
113                 assertButtonWithValuePresent( "Add Legacy Artifact Path" );
114         }
115 }