]> source.dussan.org Git - archiva.git/commitdiff
Last commit archiva-MRM-829 archiva-MRM-829
authorJames William Dumay <jdumay@apache.org>
Sat, 5 Jul 2008 08:32:04 +0000 (08:32 +0000)
committerJames William Dumay <jdumay@apache.org>
Sat, 5 Jul 2008 08:32:04 +0000 (08:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-829@674160 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction-validation.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editAppearance.jsp
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java [new file with mode: 0644]

diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction-validation.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/appearance/EditOrganisationInfoAction-validation.xml
new file mode 100644 (file)
index 0000000..38b3bcf
--- /dev/null
@@ -0,0 +1,40 @@
+<?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="organisationName">
+        <field-validator type="requiredstring">
+            <message>You must enter a name</message>
+        </field-validator>
+    </field>
+    <field name="organisationUrl">
+        <field-validator type="url">
+            <message>You must enter a URL</message>
+        </field-validator>
+    </field>
+    <field name="organisationLogo">
+        <field-validator type="url">
+            <message>You must enter a URL</message>
+        </field-validator>
+    </field>
+</validators>
\ No newline at end of file
index bf0dd543c84a4b6672c60c51362de092422c7f84..5f5316a2a4fa4d65966ec40c34a6938d4505ae63 100644 (file)
@@ -36,7 +36,7 @@
 <ww:set name="editOrganisationInfo" value="editOrganisationInfo"/>
 <ww:actionmessage/>
 <ww:form method="post" action="saveAppearance" namespace="/admin" validate="true" theme="xhtml">
-    <ww:textfield name="organisationName" value="${organisationName}" label="Name" size="50" />
+    <ww:textfield name="organisationName" value="${organisationName}" label="Name" size="50"  />
     <ww:textfield name="organisationUrl" value="${organisationUrl}" label="URL" size="50"/>
     <ww:textfield name="organisationLogo" value="${organisationLogo}" label="Logo URL" size="50" />
   <ww:submit value="Save"/>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
new file mode 100644 (file)
index 0000000..c840c23
--- /dev/null
@@ -0,0 +1,47 @@
+package org.apache.maven.archiva.web.action.admin.appearance;
+
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.web.action.AbstractWebworkTestCase;
+import org.easymock.MockControl;
+
+/**
+ * @author <a href="mailto:james@atlassian.com">James William Dumay</a>
+ */
+public abstract class AbstractOrganizationInfoActionTest extends AbstractWebworkTestCase
+{
+    protected MockControl archivaConfigurationControl;
+    
+    protected ArchivaConfiguration configuration;
+    
+    protected AbstractAppearanceAction action;
+    
+    protected Configuration config;
+    
+    protected abstract AbstractAppearanceAction getAction();
+
+    @Override
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+        
+        config = new Configuration();
+        archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
+        configuration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
+        
+        configuration.getConfiguration();
+        archivaConfigurationControl.setReturnValue(config, 1, 2);
+        
+        configuration.save(config);
+        archivaConfigurationControl.setVoidCallable(1, 2);
+        
+        archivaConfigurationControl.replay();
+    }
+    
+    protected void reloadAction()
+    {
+        action = getAction();
+        action.setConfiguration( configuration );
+    }
+}