1 package org.apache.archiva.web.test;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.archiva.web.test.parent.AbstractMergingRepositoriesTest;
23 import org.testng.annotations.Test;
25 @Test(groups = {"merging"}, dependsOnMethods = {"testWithCorrectUsernamePassword"}, sequential = true)
26 public class MergingRepositoriesTest
27 extends AbstractMergingRepositoriesTest
30 public void testAddStagingRepository()
32 goToRepositoriesPage();
33 getSelenium().open( "/archiva/admin/addRepository.action" );
34 addStagingRepository( "merging-repo", "merging-repo", getRepositoryDir() + "merging-repo/", "",
35 "Maven 2.x Repository", "0 0 * * * ?", "", "" );
36 assertTextPresent( "merging-repo" );
39 // here we upload an artifact to the staging repository
40 @Test(dependsOnMethods = {"testAddStagingRepository"}, groups = "requiresUpload" )
41 public void testAddArtifactToStagingRepository()
43 addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
44 "merging-repo-stage", true );
45 assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
46 "' was successfully deployed to repository 'merging-repo-stage'" );
49 // here we test the merging (no conflicts artifacts are available)
50 @Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
51 public void testMerging()
53 goToRepositoriesPage();
54 clickButtonWithValue( "Merge" );
55 assertTextPresent( "No conflicting artifacts" );
56 clickButtonWithValue( "Merge All" );
57 assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
60 // check audit updating is done properly or not
61 @Test(dependsOnMethods = {"testMerging"})
62 public void testAuditLogs()
64 goToAuditLogReports();
65 assertTextPresent( "Merged Artifact" );
66 assertTextPresent( "merging-repo" );
69 // merging is done by skipping conflicts
70 @Test(dependsOnMethods = {"testMerging"})
71 public void testMergingWithSkippingConflicts()
73 goToRepositoriesPage();
74 clickButtonWithValue( "Merge" );
75 assertTextPresent( "WARNING: The following are the artifacts in conflict." );
76 clickButtonWithValue( "Merge With Skip" );
77 assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
81 @Test(dependsOnMethods = {"testMerging"})
82 public void testMergingWithOutSkippingConflicts()
84 goToRepositoriesPage();
85 clickButtonWithValue( "Merge" );
86 assertTextPresent( "WARNING: The following are the artifacts in conflict." );
87 clickButtonWithValue( "Merge All" );
88 assertTextPresent( "Repository 'merging-repo-stage' successfully merged to 'merging-repo'." );
91 // change the configuaration first and try to upload existing artifact to the repository
92 @Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
93 public void testConfigurationChangesOfStagingRepository()
95 editManagedRepository();
96 addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
97 "merging-repo-stage", true );
99 "Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );