1 package org.apache.maven.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
24 * Test archiva 'Settings'
27 public class SettingsTest
28 extends AbstractArchivaTestCase
31 public void testRunIndexer()
35 clickLinkWithText( "Run Now" );
38 assertPage( "Administration" );
43 public void testEditIndexDirectory()
45 clickEditConfiguration();
47 setFieldValue( "indexPath", getBasedir() + "/target/web-ui-index" );
48 clickButtonWithValue( "Save Configuration" );
50 assertPage( "Administration" );
51 assertTextPresent( getBasedir() + "/target/web-ui-index" );
56 public void testValidIndexSchedule()
58 clickEditConfiguration();
60 setFieldValue( "second", "*" );
61 setFieldValue( "minute", "*" );
62 clickButtonWithValue( "Save Configuration" );
64 assertPage( "Administration" );
69 public void testInvalidIndexSchedule()
71 clickEditConfiguration();
72 setFieldValue( "second", "asdf" );
73 clickButtonWithValue( "Save Configuration" );
75 assertPage( "Configuration" );
76 assertTextPresent( "Invalid Cron Expression" );
81 public void testEditProxyHost()
83 clickEditConfiguration();
85 setFieldValue( "proxy.host", "asdf" );
86 clickButtonWithValue( "Save Configuration" );
88 assertPage( "Administration" );
93 public void testValidProxyPort()
95 clickEditConfiguration();
97 setFieldValue( "proxy.port", "32143" );
98 clickButtonWithValue( "Save Configuration" );
100 assertPage( "Administration" );
105 public void testInvalidProxyPort()
107 clickEditConfiguration();
108 setFieldValue( "proxy.port", "asdf" );
109 clickButtonWithValue( "Save Configuration" );
111 assertPage( "Configuration" );
112 assertTextPresent( "Port" );
113 assertTextPresent( "Invalid field value for field \"proxy.port\"" );
115 setFieldValue( "proxy.port", "-1" );
116 clickButtonWithValue( "Save Configuration" );
118 assertPage( "Administration" );
123 public void testEditProxyCredentials()
125 clickEditConfiguration();
127 setFieldValue( "proxy.username", "asdf" );
128 clickButtonWithValue( "Save Configuration" );
130 assertPage( "Administration" );
136 * Click Edit Configuration link
138 private void clickEditConfiguration()
142 clickLinkWithText( "Edit Configuration" );
143 assertPage( "Configuration" );
147 * Click Settings from the navigation menu
149 private void clickSettings()
152 submitLoginPage( adminUsername, adminPassword );
154 clickLinkWithText( "Settings" );
155 assertPage( "Administration" );
158 public void tearDown()
161 clickEditConfiguration();
162 setFieldValue( "indexPath", getBasedir() + "/target/web-ui-index" );
163 setFieldValue( "second", "0" );
164 setFieldValue( "minute", "0,30" );
165 setFieldValue( "hour", "*" );
166 setFieldValue( "dayOfMonth", "*" );
167 setFieldValue( "month", "*" );
168 setFieldValue( "dayOfWeek", "?" );
169 setFieldValue( "year", "" );
170 setFieldValue( "proxy.port", "8080" );
171 setFieldValue( "proxy.host", "" );
172 setFieldValue( "proxy.username", "" );
173 setFieldValue( "proxy.password", "" );
174 clickButtonWithValue( "Save Configuration" );
176 assertPage( "Administration" );