You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AuditLogsReportTest.java 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package org.apache.archiva.web.test;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import org.apache.archiva.web.test.parent.AbstractArchivaTest;
  21. import org.testng.annotations.Test;
  22. @Test( groups = { "auditlogsreport" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
  23. public class AuditLogsReportTest
  24. extends AbstractArchivaTest
  25. {
  26. private void goToAuditLogReports()
  27. {
  28. clickLinkWithText( "Audit Log Report" );
  29. }
  30. private void assertAuditLogsReportPage()
  31. {
  32. assertPage( "Apache Archiva \\ Audit Log Report" );
  33. assertTextPresent( "Audit Log Report" );
  34. assertElementPresent( "repository" );
  35. assertElementPresent( "groupId" );
  36. assertElementPresent( "artifactId" );
  37. assertElementPresent( "startDate" );
  38. assertElementPresent( "endDate" );
  39. assertElementPresent( "rowCount" );
  40. assertButtonWithValuePresent( "View Audit Log" );
  41. }
  42. @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
  43. public void testAuditLogsReport()
  44. {
  45. goToAuditLogReports();
  46. assertAuditLogsReportPage();
  47. assertTextPresent( "Latest Events" );
  48. }
  49. @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
  50. public void testViewAuditLogsNoDataFound()
  51. {
  52. goToAuditLogReports();
  53. assertAuditLogsReportPage();
  54. setFieldValue( "groupId", "non.existing" );
  55. submit();
  56. assertPage( "Apache Archiva \\ Audit Log Report" );
  57. assertTextPresent( "Results" );
  58. assertTextPresent( "No audit logs found." );
  59. }
  60. @Test (dependsOnMethods = { "testAddArtifactValidValues" } )
  61. public void testViewAuditLogsDataFound()
  62. {
  63. goToAuditLogReports();
  64. assertAuditLogsReportPage();
  65. selectValue( "repository", "internal" );
  66. setFieldValue( "groupId", "test" );
  67. submit();
  68. assertAuditLogsReportPage();
  69. assertTextPresent( "Results" );
  70. assertTextNotPresent( "No audit logs found." );
  71. assertTextPresent( "test-1.0.jar" );
  72. assertTextPresent( "Uploaded File" );
  73. assertTextPresent( "internal" );
  74. assertTextPresent( "admin" );
  75. }
  76. @Test (dependsOnMethods = { "testViewAuditLogsDataFound" } )
  77. public void testViewAuditLogsOnlyArtifactIdIsSpecified()
  78. {
  79. goToAuditLogReports();
  80. assertAuditLogsReportPage();
  81. selectValue( "repository", "internal" );
  82. setFieldValue( "artifactId", "test" );
  83. submit();
  84. assertAuditLogsReportPage();
  85. assertTextPresent( "Results" );
  86. assertTextNotPresent( "No audit logs found." );
  87. assertTextPresent( "test-1.0jar" );
  88. assertTextPresent( "Uploaded File" );
  89. assertTextPresent( "internal" );
  90. assertTextPresent( "admin" );
  91. }
  92. @Test (dependsOnMethods = { "testViewAuditLogsOnlyArtifactIdIsSpecified" } )
  93. public void testViewAuditLogsForAllRepositories()
  94. {
  95. goToAuditLogReports();
  96. assertAuditLogsReportPage();
  97. selectValue( "repository", "all" );
  98. submit();
  99. assertAuditLogsReportPage();
  100. assertTextPresent( "Results" );
  101. assertTextNotPresent( "No audit logs found." );
  102. assertTextPresent( "test-1.0.jar" );
  103. assertTextPresent( "Uploaded File" );
  104. assertTextPresent( "internal" );
  105. assertTextPresent( "admin" );
  106. }
  107. }