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