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 public void testAddManagedRepoValidValues()
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" );
39 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
40 public void testAddManagedRepoInvalidValues()
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." );
51 @Test(dependsOnMethods = { "testAddManagedRepoInvalidValues" } )
52 public void testAddManagedRepoNoIdentifier()
54 //goToRepositoriesPage();
55 addManagedRepository( "", "name" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
56 assertTextPresent( "You must enter a repository identifier." );
59 @Test(dependsOnMethods = { "testAddManagedRepoNoIdentifier" } )
60 public void testAddManagedRepoNoRepoName()
62 addManagedRepository( "identifier", "" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
63 assertTextPresent( "You must enter a repository name." );
66 @Test(dependsOnMethods = { "testAddManagedRepoNoRepoName" } )
67 public void testAddManagedRepoNoDirectory()
69 addManagedRepository( "identifier", "name" , "" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" );
70 assertTextPresent( "You must enter a directory." );
73 @Test(dependsOnMethods = { "testAddManagedRepoNoDirectory" } )
74 public void testAddManagedRepoNoCron()
76 addManagedRepository( "identifier", "name" , "/home" , "/.index", "Maven 2.x Repository", "", "", "" );
77 assertTextPresent( "Invalid cron expression." );
80 @Test(dependsOnMethods = { "testAddManagedRepoNoCron" } )
81 public void testAddManagedRepoForEdit()
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" );
91 @Test(dependsOnMethods = { "testAddManagedRepoForEdit" } )
92 public void testEditManagedRepo()
94 editManagedRepository( "repository.name" , "Managed Repo" );
95 assertTextPresent( "Managed Repository Sample" );
99 @Test(dependsOnMethods = { "testEditManagedRepo" } )
100 public void testDeleteManageRepo()
102 deleteManagedRepository();
103 //assertTextNotPresent( "managedrepo" );
106 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
107 public void testAddRemoteRepoNullValues()
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." );
117 @Test(dependsOnMethods = { "testAddRemoteRepoNullValues" } )
118 public void testAddRemoteRepositoryNullIdentifier()
120 addRemoteRepository( "" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
121 assertTextPresent( "You must enter a repository identifier." );
124 @Test(dependsOnMethods = { "testAddRemoteRepositoryNullIdentifier" } )
125 public void testAddRemoteRepoNullName()
127 addRemoteRepository( "remoterepo" , "" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
128 assertTextPresent( "You must enter a repository name." );
131 @Test(dependsOnMethods = { "testAddRemoteRepoNullName" } )
132 public void testAddRemoteRepoNullURL()
134 addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "" , "" , "" , "" , "Maven 2.x Repository" );
135 assertTextPresent( "You must enter a url." );
138 @Test(dependsOnMethods = { "testAddManagedRepoValidValues" } )
139 public void testAddRemoteRepoValidValues()
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" );