]> source.dussan.org Git - archiva.git/blob
06ff65698b877db05f85234fbfe02a356441ed64
[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/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         clickLinkWithText( "Delete Artifact" );
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         clickLinkWithText( "Legacy Support" );
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,
90                                        String classifier, String type )
91     {
92         assertAddLegacyArtifactPathPage();
93         setFieldValue( "legacyArtifactPath.path", path );
94         setFieldValue( "groupId", groupId );
95         setFieldValue( "artifactId", artifactId );
96         setFieldValue( "version", version );
97         setFieldValue( "classifier", classifier );
98         setFieldValue( "type", type );
99         clickButtonWithValue( "Add Legacy Artifact Path" );
100     }
101
102     public void assertAddLegacyArtifactPathPage()
103     {
104         assertPage( "Apache Archiva \\ Admin: Add Legacy Artifact Path" );
105         assertTextPresent( "Admin: Add Legacy Artifact Path" );
106         assertTextPresent( "Enter the legacy path to map to a particular artifact reference, then adjust the fields as necessary." );
107         String element =
108             "addLegacyArtifactPath_legacyArtifactPath_path,addLegacyArtifactPath_groupId,addLegacyArtifactPath_artifactId,addLegacyArtifactPath_version,addLegacyArtifactPath_classifier,addLegacyArtifactPath_type";
109         String[] arrayElement = element.split( "," );
110         for ( String arrayelement : arrayElement )
111             assertElementPresent( arrayelement );
112         assertButtonWithValuePresent( "Add Legacy Artifact Path" );
113     }
114 }