]> source.dussan.org Git - archiva.git/blob
45e14cda936fffc1eec51db48d77381c77cefe88
[archiva.git] /
1 package org.apache.archiva.web.test;
2
3 /*
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
11  *
12  *   http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  * under the License.
20  */
21
22 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
23 import org.testng.annotations.Test;
24
25 @Test( groups = { "auditlogsreport" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
26 public class AuditLogsReportTest
27     extends AbstractArchivaTest
28 {
29     private void goToAuditLogReports()
30     {
31         clickLinkWithText( "Audit Log Report" );        
32     }
33     
34     private void assertAuditLogsReportPage()
35     {   
36         assertPage( "Apache Archiva \\ Audit Log Report" );
37         assertTextPresent( "Audit Log Report" );
38         
39         assertElementPresent( "repository" );
40         assertElementPresent( "groupId" );
41         assertElementPresent( "artifactId" );
42         assertElementPresent( "startDate" );
43         assertElementPresent( "endDate" );
44         assertElementPresent( "rowCount" );
45         assertButtonWithValuePresent( "View Audit Log" );
46     }
47     
48     @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
49     public void testAuditLogsReport()
50     {
51         goToAuditLogReports();        
52         assertAuditLogsReportPage();
53         assertTextPresent( "Latest Events" );
54     }
55     
56     @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
57     public void testViewAuditLogsNoDataFound()
58     {
59         goToAuditLogReports();        
60         assertAuditLogsReportPage();
61         
62         setFieldValue( "groupId", "non.existing" );
63         submit();
64         
65         assertPage( "Apache Archiva \\ Audit Log Report" );   
66         assertTextPresent( "Results" );
67         assertTextPresent( "No audit logs found." );
68     }    
69     
70     @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
71     public void testViewAuditLogsDataFound()
72     {
73         goToAuditLogReports();        
74         assertAuditLogsReportPage();
75         
76         selectValue( "repository", "internal" );
77         setFieldValue( "groupId", "test" );
78         submit();
79                 
80         assertAuditLogsReportPage();
81         assertTextPresent( "Results" );
82         assertTextNotPresent( "No audit logs found." );
83         assertTextPresent( "test:test:1.0" );
84         assertTextPresent( "Uploaded File" );
85         assertTextPresent( "internal" );
86         assertTextPresent( "admin" );
87     }
88     
89     @Test (dependsOnMethods = { "testViewAuditLogsDataFound" } )
90     public void testViewAuditLogsOnlyArtifactIdIsSpecified()
91     {
92         goToAuditLogReports();        
93         assertAuditLogsReportPage();
94         
95         selectValue( "repository", "internal" );
96         setFieldValue( "artifactId", "test" );
97         submit();
98                 
99         assertAuditLogsReportPage();
100         assertTextPresent( "Results" );
101         assertTextNotPresent( "No audit logs found." );
102         assertTextPresent( "test:test:1.0" );
103         assertTextPresent( "Uploaded File" );
104         assertTextPresent( "internal" );
105         assertTextPresent( "admin" );
106     }
107     
108     @Test (dependsOnMethods = { "testViewAuditLogsOnlyArtifactIdIsSpecified" } )
109     public void testViewAuditLogsForAllRepositories()
110     {
111         goToAuditLogReports();        
112         assertAuditLogsReportPage();
113         
114         selectValue( "repository", "all" );
115         submit();
116         
117         assertAuditLogsReportPage();
118         assertTextPresent( "Results" );
119         assertTextNotPresent( "No audit logs found." );
120         assertTextPresent( "test:test:1.0" );
121         assertTextPresent( "Uploaded File" );
122         assertTextPresent( "internal" );
123         assertTextPresent( "admin" );
124     }
125 }