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