public class VirtualRepositoryTest
extends AbstractRepositoryTest
{
- // FIXME: says repositoryGroup id cannot be empty
- @Test( enabled = false )
+ @Test
public void testAddRepositoryGroupNullValue()
{
- addRepositoryGroup( " " );
+ addRepositoryGroup( " ", false );
assertTextPresent( "Identifier field is required." );
}
@Test( dependsOnMethods = { "testWithCorrectUsernamePassword" } )
public void testAddRepositoryGroupValidValue()
{
- addRepositoryGroup( "testing" );
+ addRepositoryGroup( "testing", true );
Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[1]/p[1]" ), "testing" );
}
assertButtonWithValuePresent( "Cancel" );
}
- public void addRepositoryGroup( String repoGroupName )
+ public void addRepositoryGroup( String repoGroupName, boolean wait )
{
goToRepositoryGroupsPage();
setFieldValue( "repositoryGroup.id", repoGroupName );
- clickButtonWithValue( "Add Group" );
+ clickButtonWithValue( "Add Group", wait );
}
public void addRepositoryToRepositoryGroup( String repositoryGroupName, String repositoryName )
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="repositoryGroup.id">
+ <field-validator type="requiredstring">
+ <message>Identifier field is required.</message>
+ </field-validator>
+ <field-validator type="regex">
+ <param name="trim">true</param>
+ <param name="expression">^[a-zA-Z0-9._-]+$</param>
+ <message>Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-).</message>
+ </field-validator>
+ </field>
+</validators>
<div align="right">
<redback:ifAnyAuthorized permissions="archiva-manage-configuration">
- <s:form action="addRepositoryGroup" namespace="/admin">
- <span class="label">Identifier<span style="color:red">*</span>:</span>
- <s:textfield size="10" label="Identifier" theme="simple" name="repositoryGroup.id"/>
+ <s:form name="addRepositoryGroup" action="addRepositoryGroup" namespace="/admin" validate="true">
+ <s:textfield size="10" label="Identifier" name="repositoryGroup.id"/>
<s:token/>
- <s:submit value="Add Group" theme="simple" cssClass="button"/>
+ <s:submit value="Add Group" cssClass="button"/>
</s:form>
</redback:ifAnyAuthorized>
</div>