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.AbstractRepositoryTest;
23 import org.testng.annotations.Test;
25 @Test( groups = { "repository" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
26 public class RepositoryTest
27 extends AbstractRepositoryTest
29 @Test(dependsOnMethods = { "testWithCorrectUsernamePassword" } )
30 public void testAddManagedRepoValidValues()
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" );
40 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
41 public void testAddManagedRepoInvalidValues()
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." );
52 @Test(dependsOnMethods = { "testAddManagedRepoInvalidValues" } )
53 public void testAddManagedRepoNoIdentifier()
55 //goToRepositoriesPage();
56 addManagedRepository( "", "name" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
57 assertTextPresent( "You must enter a repository identifier." );
60 @Test(dependsOnMethods = { "testAddManagedRepoNoIdentifier" } )
61 public void testAddManagedRepoNoRepoName()
63 addManagedRepository( "identifier", "" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
64 assertTextPresent( "You must enter a repository name." );
67 @Test(dependsOnMethods = { "testAddManagedRepoNoRepoName" } )
68 public void testAddManagedRepoNoDirectory()
70 addManagedRepository( "identifier", "name" , "" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
71 assertTextPresent( "You must enter a directory." );
74 @Test(dependsOnMethods = { "testAddManagedRepoNoDirectory" } )
75 public void testAddManagedRepoNoCron()
77 addManagedRepository( "identifier", "name" , "/home" , "/.index", "Maven 2.x Repository", "", "", "" );
78 assertTextPresent( "Invalid cron expression." );
81 @Test(dependsOnMethods = { "testAddManagedRepoNoCron" } )
82 public void testAddManagedRepoForEdit()
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" );
92 @Test(dependsOnMethods = { "testAddManagedRepoForEdit" } )
93 public void testEditManagedRepo()
95 editManagedRepository( "repository.name" , "Managed Repo" );
96 assertTextPresent( "Managed Repository Sample" );
100 @Test(dependsOnMethods = { "testEditManagedRepo" } )
101 public void testDeleteManageRepo()
103 deleteManagedRepository();
104 //assertTextNotPresent( "managedrepo" );
107 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
108 public void testAddRemoteRepoNullValues()
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." );
118 @Test(dependsOnMethods = { "testAddRemoteRepoNullValues" } )
119 public void testAddRemoteRepositoryNullIdentifier()
121 addRemoteRepository( "" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
122 assertTextPresent( "You must enter a repository identifier." );
125 @Test(dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } )
126 public void testAddRemoteRepoNullName()
128 addRemoteRepository( "remoterepo" , "" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
129 assertTextPresent( "You must enter a repository name." );
132 @Test(dependsOnMethods = { "testAddRemoteRepoNullName" } )
133 public void testAddRemoteRepoNullURL()
135 addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "" , "" , "" , "" , "Maven 2.x Repository" );
136 assertTextPresent( "You must enter a url." );
139 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
140 public void testAddRemoteRepoValidValues()
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" );