]> source.dussan.org Git - archiva.git/blob
ca03471de31a35a7a4fc90f5cad853ac24534537
[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.AbstractArtifactManagementTest;
23 import org.testng.annotations.Test;
24
25 @Test( groups = { "artifactmanagement" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
26 public class ArtifactManagementTest
27         extends AbstractArtifactManagementTest
28 {
29
30         
31         public void testAddArtifactNullValues()
32         {
33                 goToAddArtifactPage();
34                 clickButtonWithValue( "Submit" );
35                 assertTextPresent( "Please add a file to upload." );
36                 assertTextPresent( "Invalid version." );
37                 assertTextPresent( "You must enter a groupId." );
38                 assertTextPresent( "You must enter an artifactId." );
39                 assertTextPresent( "You must enter a version" );
40                 assertTextPresent( "You must enter a packaging" );
41         }
42         
43         @Test(dependsOnMethods = { "testAddArtifactNullValues" } )
44         public void testAddArtifactNoGroupId()
45         {
46                 addArtifact( " " , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
47                 assertTextPresent( "You must enter a groupId." );
48         }
49         
50         @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
51         public void testAddArtifactNoArtifactId()
52         {
53                 
54                 addArtifact( getGroupId() , " ", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
55                 assertTextPresent( "You must enter an artifactId." );
56         }
57         
58         @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
59         public void testAddArtifactNoVersion()
60         {
61                 addArtifact( getGroupId() , getArtifactId(), " ", getPackaging() , getArtifactFilePath(), getRepositoryId() );
62                 assertTextPresent( "You must enter a version." );
63         }
64         
65         @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
66         public void testAddArtifactInvalidVersion()
67         {
68                 addArtifact( getGroupId() , getArtifactId(), "asdf", getPackaging() , getArtifactFilePath(), getRepositoryId() );
69                 assertTextPresent( "Invalid version." );
70         }
71         
72         @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
73         public void testAddArtifactNoPackaging()
74         {
75                 addArtifact( getGroupId() , getArtifactId(), getVersion(), " " , getArtifactFilePath(), getRepositoryId() );
76                 assertTextPresent( "You must enter a packaging." );
77         }
78         
79         @Test(dependsOnMethods = { "testAddArtifactNoGroupId" } )
80         public void testAddArtifactNoFilePath()
81         {
82                 addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , " ", getRepositoryId() );
83                 assertTextPresent( "Please add a file to upload." );
84         }
85         
86         public void testAddArtifactValidValues()
87         {
88                 addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
89                 assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" );
90         }
91                 
92         //MRM-747
93         @Test(dependsOnMethods = { "testAddArtifactValidValues" } )
94         public void testAddArtifactBlockRedeployments()
95         {
96             addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
97         assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
98         }
99         
100         public void testAddArtifactValidValues1()
101         {
102                 String groupId = getProperty( "GROUPID1" );
103                 String artifactId = getProperty( "ARTIFACTID1" );
104                 String version = getProperty( "VERSION1" );
105                 String packaging = getProperty( "PACKAGING1" );
106                 String repositoryId = getProperty( "REPOSITORYID1" );
107                 addArtifact( groupId , artifactId, version, packaging , getArtifactFilePath(), repositoryId );
108                 assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
109         }
110         
111         @Test(dependsOnMethods = { "testAddArtifactValidValues1" } )
112         public void testDeleteArtifact()
113         {
114                 deleteArtifact( "delete", "delete", "1.0", "internal");
115                 assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deleted from repository 'internal'" );
116         }
117         
118         public void testDeleteArtifactNoGroupId()
119         {
120                 deleteArtifact( " ", "delete", "1.0", "internal");
121                 assertTextPresent( "You must enter a groupId." );
122         }
123         
124         public void testDeleteArtifactNoArtifactId()
125         {
126                 deleteArtifact( "delete", " ", "1.0", "internal");
127                 assertTextPresent( "You must enter an artifactId." );
128         }
129         
130         public void testDeleteArtifactNoVersion()
131         {
132                 deleteArtifact( "delete", "delete", " ", "internal");
133                 assertTextPresent( "Invalid version." );
134                 assertTextPresent( "You must enter a version." );
135         }
136         
137         public void testDeleteArtifactInvalidVersion()
138         {
139                 deleteArtifact( "delete", "delete", "asdf", "internal");
140                 assertTextPresent( "Invalid version." );
141         }
142 }