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.

MergingRepositoriesTest.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.AbstractMergingRepositoriesTest;
  21. import org.testng.annotations.Test;
  22. @Test(groups = {"merging"}, dependsOnMethods = {"testWithCorrectUsernamePassword"}, sequential = true)
  23. public class MergingRepositoriesTest
  24. extends AbstractMergingRepositoriesTest
  25. {
  26. public void testAddStagingRepository()
  27. {
  28. goToRepositoriesPage();
  29. getSelenium().open( "/archiva/admin/addRepository.action" );
  30. addStagingRepository( "merging-repo", "merging-repo", getRepositoryDir() + "merging-repo/", "",
  31. "Maven 2.x Repository", "0 0 * * * ?", "", "" );
  32. assertTextPresent( "merging-repo" );
  33. }
  34. // here we upload an artifact to the staging repository
  35. @Test(dependsOnMethods = {"testAddStagingRepository"})
  36. public void testAddArtifactToStagingRepository()
  37. {
  38. addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
  39. "merging-repo-stage" );
  40. assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
  41. "' was successfully deployed to repository 'merging-repo-stage'" );
  42. }
  43. // here we test the merging (no conflicts artifacts are available)
  44. @Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
  45. public void testMerging()
  46. {
  47. goToRepositoriesPage();
  48. clickButtonWithValue( "Merge" );
  49. assertTextPresent( "No conflicting artifacts" );
  50. clickButtonWithValue( "Merge All" );
  51. assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
  52. }
  53. // check audit updating is done properly or not
  54. @Test(dependsOnMethods = {"testMerging"})
  55. public void testAuditLogs()
  56. {
  57. goToAuditLogReports();
  58. assertTextPresent( "Merged Artifact" );
  59. assertTextPresent( "merging-repo" );
  60. }
  61. // merging is done by skipping conflicts
  62. @Test(dependsOnMethods = {"testMerging"})
  63. public void testMergingWithSkippingConflicts()
  64. {
  65. goToRepositoriesPage();
  66. clickButtonWithValue( "Merge" );
  67. assertTextPresent( "WARNING: The following are the artifacts in conflict." );
  68. clickButtonWithValue( "Merge With Skip" );
  69. assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
  70. }
  71. // merging all
  72. @Test(dependsOnMethods = {"testMerging"})
  73. public void testMergingWithOutSkippingConflicts()
  74. {
  75. goToRepositoriesPage();
  76. clickButtonWithValue( "Merge" );
  77. assertTextPresent( "WARNING: The following are the artifacts in conflict." );
  78. clickButtonWithValue( "Merge All" );
  79. assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
  80. }
  81. // change the configuaration first and try to upload existing artifact to the repository
  82. public void testConfigurationChangesOfStagingRepository()
  83. {
  84. editManagedRepository();
  85. addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
  86. "merging-repo-stage" );
  87. assertTextPresent(
  88. "Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );
  89. }
  90. }