]> source.dussan.org Git - archiva.git/blob
a0ed9b0a6fae96bf55aa922175f011a90e7c3575
[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.AbstractRepositoryTest;
23 import org.testng.annotations.Test;
24
25 @Test( groups = { "repository" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
26 public class RepositoryTest
27         extends AbstractRepositoryTest
28 {
29         @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
30         public void testAddManagedRepoValidValues()
31         {
32                 goToRepositoriesPage();
33                 clickLinkWithText( "Add" );
34                 addManagedRepository( "managedrepo1", "Managed Repository Sample 1" , getRepositoryDir() + "repository/" , "", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
35                 clickButtonWithValue( "Save" );
36                 assertTextPresent( "Managed Repository Sample 1" );
37                 
38         }
39
40         @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
41         public void testAddManagedRepoInvalidValues()
42         {
43                 //goToRepositoriesPage();
44                 clickLinkWithText( "Add" );
45                 addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", "", "", "" );
46                 assertTextPresent( "You must enter a repository identifier." );
47                 assertTextPresent( "You must enter a repository name." );
48                 assertTextPresent( "You must enter a directory." );
49                 assertTextPresent( "Invalid cron expression." );
50         }
51         
52         @Test(dependsOnMethods = { "testAddManagedRepoInvalidValues" } )
53         public void testAddManagedRepoNoIdentifier()
54         {
55                 //goToRepositoriesPage();
56                 addManagedRepository( "", "name" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
57                 assertTextPresent( "You must enter a repository identifier." );
58         }
59         
60         @Test(dependsOnMethods = { "testAddManagedRepoNoIdentifier" } )
61         public void testAddManagedRepoNoRepoName()
62         {
63                 addManagedRepository( "identifier", "" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
64                 assertTextPresent( "You must enter a repository name." );
65         }
66         
67         @Test(dependsOnMethods = { "testAddManagedRepoNoRepoName" } )
68         public void testAddManagedRepoNoDirectory()
69         {
70                 addManagedRepository( "identifier", "name" , "" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
71                 assertTextPresent( "You must enter a directory." );
72         }
73         
74         @Test(dependsOnMethods = { "testAddManagedRepoNoDirectory" } )
75         public void testAddManagedRepoNoCron()
76         {
77                 addManagedRepository( "identifier", "name" , "/home" , "/.index", "Maven 2.x Repository", "", "", "" );
78                 assertTextPresent( "Invalid cron expression." );
79         }
80         
81         @Test(dependsOnMethods = { "testAddManagedRepoNoCron" } )
82         public void testAddManagedRepoForEdit()
83         {
84                 goToRepositoriesPage();
85                 clickLinkWithText( "Add" );
86                 addManagedRepository( "managedrepo", "Managed Repository Sample" , getRepositoryDir() + "local-repo/", "", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
87                 clickButtonWithValue( "Save" );
88                 assertTextPresent( "Managed Repository Sample" );
89         }
90
91         //TODO
92         @Test(dependsOnMethods = { "testAddManagedRepoForEdit" } )
93         public void testEditManagedRepo()
94         {
95                 editManagedRepository( "repository.name" , "Managed Repo" );
96                 assertTextPresent( "Managed Repository Sample" );
97         }
98         
99         //TODO
100         @Test(dependsOnMethods = { "testEditManagedRepo" } )
101         public void testDeleteManageRepo()
102         {
103                 deleteManagedRepository();
104                 //assertTextNotPresent( "managedrepo" );
105         }
106         
107         @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
108         public void testAddRemoteRepoNullValues()
109         {
110                 //goToRepositoriesPage();
111                 clickLinkWithLocator( "//div[@id='contentArea']/div/div[5]/a" );
112                 addRemoteRepository( "" , "" , "" , "" , "" , "" , "Maven 2.x Repository" );
113                 assertTextPresent( "You must enter a repository identifier." );
114                 assertTextPresent( "You must enter a repository name." );
115                 assertTextPresent( "You must enter a url." );
116         }
117         
118         @Test(dependsOnMethods = { "testAddRemoteRepoNullValues" } )
119         public void testAddRemoteRepositoryNullIdentifier()
120         {
121                 addRemoteRepository( "" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
122                 assertTextPresent( "You must enter a repository identifier." );
123         }
124         
125         @Test(dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } )
126         public void testAddRemoteRepoNullName()
127         {
128                 addRemoteRepository( "remoterepo" , "" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
129                 assertTextPresent( "You must enter a repository name." );
130         }
131         
132         @Test(dependsOnMethods = { "testAddRemoteRepoNullName" } )
133         public void testAddRemoteRepoNullURL()
134         {
135                 addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "" , "" , "" , "" , "Maven 2.x Repository" );
136                 assertTextPresent( "You must enter a url." );
137         }
138
139         @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
140         public void testAddRemoteRepoValidValues()
141         {
142                 goToRepositoriesPage();
143                 clickLinkWithLocator( "//div[@id='contentArea']/div/div[5]/a" );
144                 addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
145                 assertTextPresent( "Remote Repository Sample" );
146         }
147 }