]> source.dussan.org Git - archiva.git/blob
2857cf7cfb380b70875142d40da45fb0827d3dd3
[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     }
54     
55     @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
56     public void testViewAuditLogsNoDataFound()
57     {
58         goToAuditLogReports();        
59         assertAuditLogsReportPage();
60         
61         setFieldValue( "groupId", "non.existing" );
62         submit();
63         
64         assertPage( "Apache Archiva \\ Audit Log Report" );        
65         assertTextPresent( "No audit logs found." );
66     }    
67     
68     @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
69     public void testViewAuditLogsDataFound()
70     {
71         goToAuditLogReports();        
72         assertAuditLogsReportPage();
73         
74         selectValue( "repository", "internal" );
75         setFieldValue( "groupId", "test" );
76         submit();
77                 
78         assertAuditLogsReportPage();
79         assertTextNotPresent( "No audit logs found." );
80         assertTextPresent( "test:test:1.0" );
81         assertTextPresent( "Uploaded File" );
82         assertTextPresent( "internal" );
83         assertTextPresent( "admin" );
84     }
85     
86     @Test (dependsOnMethods = { "testViewAuditLogsDataFound" } )
87     public void testViewAuditLogsOnlyArtifactIdIsSpecified()
88     {
89         goToAuditLogReports();        
90         assertAuditLogsReportPage();
91         
92         selectValue( "repository", "internal" );
93         setFieldValue( "artifactId", "test" );
94         submit();
95                 
96         assertAuditLogsReportPage();
97         assertTextNotPresent( "No audit logs found." );
98         assertTextPresent( "test:test:1.0" );
99         assertTextPresent( "Uploaded File" );
100         assertTextPresent( "internal" );
101         assertTextPresent( "admin" );
102     }
103     
104     @Test (dependsOnMethods = { "testViewAuditLogsOnlyArtifactIdIsSpecified" } )
105     public void testViewAuditLogsForAllRepositories()
106     {
107         goToAuditLogReports();        
108         assertAuditLogsReportPage();
109         
110         selectValue( "repository", "all" );
111         submit();
112         
113         assertAuditLogsReportPage();
114         assertTextNotPresent( "No audit logs found." );
115         assertTextPresent( "test:test:1.0" );
116         assertTextPresent( "Uploaded File" );
117         assertTextPresent( "internal" );
118         assertTextPresent( "admin" );
119     }
120 }