]> source.dussan.org Git - archiva.git/blob
a93748b4351c9aac32e2361c5f91c124676101a3
[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.AbstractMergingRepositoriesTest;
23 import org.testng.annotations.Test;
24
25 @Test(groups = {"merging"}, dependsOnMethods = {"testWithCorrectUsernamePassword"}, sequential = true)
26 public class MergingRepositoriesTest
27     extends AbstractMergingRepositoriesTest
28 {
29
30     public void testAddStagingRepository()
31     {
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" );
37     }
38
39     // here we upload an artifact to the staging repository
40     @Test(dependsOnMethods = {"testAddStagingRepository"}, groups = "requiresUpload" )
41     public void testAddArtifactToStagingRepository()
42     {
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'" );
47     }
48
49     // here we test the merging (no conflicts artifacts are available)
50     @Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
51     public void testMerging()
52     {
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'." );
58     }
59
60     // check audit updating is done properly or not
61     @Test(dependsOnMethods = {"testMerging"})
62     public void testAuditLogs()
63     {
64         goToAuditLogReports();
65         assertTextPresent( "Merged Artifact" );
66         assertTextPresent( "merging-repo" );
67     }
68
69     // merging is done by skipping conflicts
70     @Test(dependsOnMethods = {"testMerging"})
71     public void testMergingWithSkippingConflicts()
72     {
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'." );
78     }
79
80     // merging all 
81     @Test(dependsOnMethods = {"testMerging"})
82     public void testMergingWithOutSkippingConflicts()
83     {
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'." );
89     }
90
91     // change the configuaration first and try to upload existing artifact to the repository
92     @Test(dependsOnMethods = {"testAddArtifactToStagingRepository"})
93     public void testConfigurationChangesOfStagingRepository()
94     {
95         editManagedRepository();
96         addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
97                      "merging-repo-stage", true );
98         assertTextPresent(
99             "Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );
100     }
101
102 }