Author: niallp
Date: Wed May 21 10:44:18 2008
New Revision: 658783
URL: http://svn.apache.org/viewvc?rev=658783&view=rev
Log:
Fix svn properties only (eol-style, keywords etc)
Modified:
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
(contents, props changed)
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
(contents, props changed)
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
(contents, props changed)
commons/proper/validator/trunk/xdocs/style/project.css (props changed)
Modified:
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java?rev=658783&r1=658782&r2=658783&view=diff
==============================================================================
---
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
(original)
+++
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
Wed May 21 10:44:18 2008
@@ -1,196 +1,196 @@
-/*
- * 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.
- */
-package org.apache.commons.validator.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.collections.FastHashMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.validator.Arg;
-import org.apache.commons.validator.Msg;
-import org.apache.commons.validator.Var;
-
-/**
- * Basic utility methods.
- * <p>
- * The use of FastHashMap is deprecated and will be replaced in a future
- * release.
- * </p>
- *
- * @version $Revision$ $Date$
- */
-public class ValidatorUtils {
-
- /**
- * <p>Replace part of a <code>String</code> with another value.</p>
- *
- * @param value <code>String</code> to perform the replacement on.
- * @param key The name of the constant.
- * @param replaceValue The value of the constant.
- *
- * @return The modified value.
- */
- public static String replace(String value, String key, String
replaceValue) {
-
- if (value == null || key == null || replaceValue == null) {
- return value;
- }
-
- int pos = value.indexOf(key);
-
- if (pos < 0) {
- return value;
- }
-
- int length = value.length();
- int start = pos;
- int end = pos + key.length();
-
- if (length == key.length()) {
- value = replaceValue;
-
- } else if (end == length) {
- value = value.substring(0, start) + replaceValue;
-
- } else {
- value =
- value.substring(0, start)
- + replaceValue
- + replace(value.substring(end), key, replaceValue);
- }
-
- return value;
- }
-
- /**
- * Convenience method for getting a value from a bean property as a
- * <code>String</code>. If the property is a <code>String[]</code> or
- * <code>Collection</code> and it is empty, an empty <code>String</code>
- * "" is returned. Otherwise, property.toString() is returned. This
method
- * may return <code>null</code> if there was an error retrieving the
- * property.
- *
- * @param bean The bean object.
- * @param property The name of the property to access.
- *
- * @return The value of the property.
- */
- public static String getValueAsString(Object bean, String property) {
- Object value = null;
-
- try {
- value = PropertyUtils.getProperty(bean, property);
-
- } catch(IllegalAccessException e) {
- Log log = LogFactory.getLog(ValidatorUtils.class);
- log.error(e.getMessage(), e);
- } catch(InvocationTargetException e) {
- Log log = LogFactory.getLog(ValidatorUtils.class);
- log.error(e.getMessage(), e);
- } catch(NoSuchMethodException e) {
- Log log = LogFactory.getLog(ValidatorUtils.class);
- log.error(e.getMessage(), e);
- }
-
- if (value == null) {
- return null;
- }
-
- if (value instanceof String[]) {
- return ((String[]) value).length > 0 ? value.toString() : "";
-
- } else if (value instanceof Collection) {
- return ((Collection) value).isEmpty() ? "" : value.toString();
-
- } else {
- return value.toString();
- }
-
- }
-
- /**
- * Makes a deep copy of a <code>FastHashMap</code> if the values
- * are <code>Msg</code>, <code>Arg</code>,
- * or <code>Var</code>. Otherwise it is a shallow copy.
- *
- * @param map <code>FastHashMap</code> to copy.
- * @return FastHashMap A copy of the <code>FastHashMap</code> that was
- * passed in.
- * @deprecated This method is not part of Validator's public API.
Validator
- * will use it internally until FastHashMap references are removed. Use
- * copyMap() instead.
- */
- public static FastHashMap copyFastHashMap(FastHashMap map) {
- FastHashMap results = new FastHashMap();
-
- Iterator i = map.keySet().iterator();
- while (i.hasNext()) {
- String key = (String) i.next();
- Object value = map.get(key);
-
- if (value instanceof Msg) {
- results.put(key, ((Msg) value).clone());
- } else if (value instanceof Arg) {
- results.put(key, ((Arg) value).clone());
- } else if (value instanceof Var) {
- results.put(key, ((Var) value).clone());
- } else {
- results.put(key, value);
- }
- }
-
- results.setFast(true);
- return results;
- }
-
- /**
- * Makes a deep copy of a <code>Map</code> if the values are
- * <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
- * it is a shallow copy.
- *
- * @param map The source Map to copy.
- *
- * @return A copy of the <code>Map</code> that was passed in.
- */
- public static Map copyMap(Map map) {
- Map results = new HashMap();
-
- Iterator iter = map.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String) iter.next();
- Object value = map.get(key);
-
- if (value instanceof Msg) {
- results.put(key, ((Msg) value).clone());
- } else if (value instanceof Arg) {
- results.put(key, ((Arg) value).clone());
- } else if (value instanceof Var) {
- results.put(key, ((Var) value).clone());
- } else {
- results.put(key, value);
- }
- }
- return results;
- }
-
-}
+/*
+ * 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.
+ */
+package org.apache.commons.validator.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.collections.FastHashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.validator.Arg;
+import org.apache.commons.validator.Msg;
+import org.apache.commons.validator.Var;
+
+/**
+ * Basic utility methods.
+ * <p>
+ * The use of FastHashMap is deprecated and will be replaced in a future
+ * release.
+ * </p>
+ *
+ * @version $Revision$ $Date$
+ */
+public class ValidatorUtils {
+
+ /**
+ * <p>Replace part of a <code>String</code> with another value.</p>
+ *
+ * @param value <code>String</code> to perform the replacement on.
+ * @param key The name of the constant.
+ * @param replaceValue The value of the constant.
+ *
+ * @return The modified value.
+ */
+ public static String replace(String value, String key, String
replaceValue) {
+
+ if (value == null || key == null || replaceValue == null) {
+ return value;
+ }
+
+ int pos = value.indexOf(key);
+
+ if (pos < 0) {
+ return value;
+ }
+
+ int length = value.length();
+ int start = pos;
+ int end = pos + key.length();
+
+ if (length == key.length()) {
+ value = replaceValue;
+
+ } else if (end == length) {
+ value = value.substring(0, start) + replaceValue;
+
+ } else {
+ value =
+ value.substring(0, start)
+ + replaceValue
+ + replace(value.substring(end), key, replaceValue);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convenience method for getting a value from a bean property as a
+ * <code>String</code>. If the property is a <code>String[]</code> or
+ * <code>Collection</code> and it is empty, an empty <code>String</code>
+ * "" is returned. Otherwise, property.toString() is returned. This
method
+ * may return <code>null</code> if there was an error retrieving the
+ * property.
+ *
+ * @param bean The bean object.
+ * @param property The name of the property to access.
+ *
+ * @return The value of the property.
+ */
+ public static String getValueAsString(Object bean, String property) {
+ Object value = null;
+
+ try {
+ value = PropertyUtils.getProperty(bean, property);
+
+ } catch(IllegalAccessException e) {
+ Log log = LogFactory.getLog(ValidatorUtils.class);
+ log.error(e.getMessage(), e);
+ } catch(InvocationTargetException e) {
+ Log log = LogFactory.getLog(ValidatorUtils.class);
+ log.error(e.getMessage(), e);
+ } catch(NoSuchMethodException e) {
+ Log log = LogFactory.getLog(ValidatorUtils.class);
+ log.error(e.getMessage(), e);
+ }
+
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof String[]) {
+ return ((String[]) value).length > 0 ? value.toString() : "";
+
+ } else if (value instanceof Collection) {
+ return ((Collection) value).isEmpty() ? "" : value.toString();
+
+ } else {
+ return value.toString();
+ }
+
+ }
+
+ /**
+ * Makes a deep copy of a <code>FastHashMap</code> if the values
+ * are <code>Msg</code>, <code>Arg</code>,
+ * or <code>Var</code>. Otherwise it is a shallow copy.
+ *
+ * @param map <code>FastHashMap</code> to copy.
+ * @return FastHashMap A copy of the <code>FastHashMap</code> that was
+ * passed in.
+ * @deprecated This method is not part of Validator's public API.
Validator
+ * will use it internally until FastHashMap references are removed. Use
+ * copyMap() instead.
+ */
+ public static FastHashMap copyFastHashMap(FastHashMap map) {
+ FastHashMap results = new FastHashMap();
+
+ Iterator i = map.keySet().iterator();
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ Object value = map.get(key);
+
+ if (value instanceof Msg) {
+ results.put(key, ((Msg) value).clone());
+ } else if (value instanceof Arg) {
+ results.put(key, ((Arg) value).clone());
+ } else if (value instanceof Var) {
+ results.put(key, ((Var) value).clone());
+ } else {
+ results.put(key, value);
+ }
+ }
+
+ results.setFast(true);
+ return results;
+ }
+
+ /**
+ * Makes a deep copy of a <code>Map</code> if the values are
+ * <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
+ * it is a shallow copy.
+ *
+ * @param map The source Map to copy.
+ *
+ * @return A copy of the <code>Map</code> that was passed in.
+ */
+ public static Map copyMap(Map map) {
+ Map results = new HashMap();
+
+ Iterator iter = map.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ Object value = map.get(key);
+
+ if (value instanceof Msg) {
+ results.put(key, ((Msg) value).clone());
+ } else if (value instanceof Arg) {
+ results.put(key, ((Arg) value).clone());
+ } else if (value instanceof Var) {
+ results.put(key, ((Var) value).clone());
+ } else {
+ results.put(key, value);
+ }
+ }
+ return results;
+ }
+
+}
Propchange:
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/ValidatorUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java?rev=658783&r1=658782&r2=658783&view=diff
==============================================================================
---
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
(original)
+++
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
Wed May 21 10:44:18 2008
@@ -1,135 +1,135 @@
-/*
- * 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.
- */
-package org.apache.commons.validator;
-
-import java.io.IOException;
-import java.util.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.xml.sax.SAXException;
-
-/**
- * Abstracts date unit tests methods.
- *
- * @version $Revision$ $Date$
- */
-public class DateTest extends AbstractCommonTest {
-
- /**
- * The key used to retrieve the set of validation
- * rules from the xml file.
- */
- protected String FORM_KEY = "dateForm";
-
- /**
- * The key used to retrieve the validator action.
- */
- protected String ACTION = "date";
-
-
- public DateTest(String name) {
- super(name);
- }
-
- /**
- * Start the tests.
- *
- * @param theArgs the arguments. Not used
- */
- public static void main(String[] theArgs) {
- junit.awtui.TestRunner.main(new String[]{DateTest.class.getName()});
- }
-
- /**
- * Load <code>ValidatorResources</code> from
- * validator-numeric.xml.
- */
- protected void setUp() throws IOException, SAXException {
- // Load resources
- loadResources("DateTest-config.xml");
- }
-
- protected void tearDown() {
- }
-
- /**
- * @return a test suite (<code>TestSuite</code>) that includes all methods
- * starting with "test"
- */
- public static Test suite() {
- // All methods starting with "test" will be executed in the test suite.
- return new TestSuite(DateTest.class);
- }
-
- /**
- * Tests the date validation.
- */
- public void testValidDate() throws ValidatorException {
- // Create bean to run test on.
- ValueBean info = new ValueBean();
- info.setValue("12/01/2005");
- valueTest(info, true);
- }
-
- /**
- * Tests the date validation.
- */
- public void testInvalidDate() throws ValidatorException {
- // Create bean to run test on.
- ValueBean info = new ValueBean();
- info.setValue("12/01as/2005");
- valueTest(info, false);
- }
-
-
- /**
- * Utlity class to run a test on a value.
- *
- * @param info Value to run test on.
- * @param passed Whether or not the test is expected to pass.
- */
- protected void valueTest(Object info, boolean passed) throws
ValidatorException {
- // Construct validator based on the loaded resources
- // and the form key
- Validator validator = new Validator(resources, FORM_KEY);
- // add the name bean to the validator as a resource
- // for the validations to be performed on.
- validator.setParameter(Validator.BEAN_PARAM, info);
- validator.setParameter(Validator.LOCALE_PARAM, Locale.US);
-
- // Get results of the validation.
- ValidatorResults results = null;
-
- // throws ValidatorException,
- // but we aren't catching for testing
- // since no validation methods we use
- // throw this
- results = validator.validate();
-
- assertNotNull("Results are null.", results);
-
- ValidatorResult result = results.getValidatorResult("value");
-
- assertNotNull(ACTION + " value ValidatorResult should not be null.",
result);
- assertTrue(ACTION + " value ValidatorResult should contain the '" +
ACTION + "' action.", result.containsAction(ACTION));
- assertTrue(ACTION + " value ValidatorResult for the '" + ACTION + "'
action should have " + (passed ? "passed" : "failed") + ".", (passed ?
result.isValid(ACTION) : !result.isValid(ACTION)));
- }
-
-
-}
+/*
+ * 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.
+ */
+package org.apache.commons.validator;
+
+import java.io.IOException;
+import java.util.*;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.xml.sax.SAXException;
+
+/**
+ * Abstracts date unit tests methods.
+ *
+ * @version $Revision$ $Date$
+ */
+public class DateTest extends AbstractCommonTest {
+
+ /**
+ * The key used to retrieve the set of validation
+ * rules from the xml file.
+ */
+ protected String FORM_KEY = "dateForm";
+
+ /**
+ * The key used to retrieve the validator action.
+ */
+ protected String ACTION = "date";
+
+
+ public DateTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Start the tests.
+ *
+ * @param theArgs the arguments. Not used
+ */
+ public static void main(String[] theArgs) {
+ junit.awtui.TestRunner.main(new String[]{DateTest.class.getName()});
+ }
+
+ /**
+ * Load <code>ValidatorResources</code> from
+ * validator-numeric.xml.
+ */
+ protected void setUp() throws IOException, SAXException {
+ // Load resources
+ loadResources("DateTest-config.xml");
+ }
+
+ protected void tearDown() {
+ }
+
+ /**
+ * @return a test suite (<code>TestSuite</code>) that includes all methods
+ * starting with "test"
+ */
+ public static Test suite() {
+ // All methods starting with "test" will be executed in the test suite.
+ return new TestSuite(DateTest.class);
+ }
+
+ /**
+ * Tests the date validation.
+ */
+ public void testValidDate() throws ValidatorException {
+ // Create bean to run test on.
+ ValueBean info = new ValueBean();
+ info.setValue("12/01/2005");
+ valueTest(info, true);
+ }
+
+ /**
+ * Tests the date validation.
+ */
+ public void testInvalidDate() throws ValidatorException {
+ // Create bean to run test on.
+ ValueBean info = new ValueBean();
+ info.setValue("12/01as/2005");
+ valueTest(info, false);
+ }
+
+
+ /**
+ * Utlity class to run a test on a value.
+ *
+ * @param info Value to run test on.
+ * @param passed Whether or not the test is expected to pass.
+ */
+ protected void valueTest(Object info, boolean passed) throws
ValidatorException {
+ // Construct validator based on the loaded resources
+ // and the form key
+ Validator validator = new Validator(resources, FORM_KEY);
+ // add the name bean to the validator as a resource
+ // for the validations to be performed on.
+ validator.setParameter(Validator.BEAN_PARAM, info);
+ validator.setParameter(Validator.LOCALE_PARAM, Locale.US);
+
+ // Get results of the validation.
+ ValidatorResults results = null;
+
+ // throws ValidatorException,
+ // but we aren't catching for testing
+ // since no validation methods we use
+ // throw this
+ results = validator.validate();
+
+ assertNotNull("Results are null.", results);
+
+ ValidatorResult result = results.getValidatorResult("value");
+
+ assertNotNull(ACTION + " value ValidatorResult should not be null.",
result);
+ assertTrue(ACTION + " value ValidatorResult should contain the '" +
ACTION + "' action.", result.containsAction(ACTION));
+ assertTrue(ACTION + " value ValidatorResult for the '" + ACTION + "'
action should have " + (passed ? "passed" : "failed") + ".", (passed ?
result.isValid(ACTION) : !result.isValid(ACTION)));
+ }
+
+
+}
Propchange:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/DateTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java?rev=658783&r1=658782&r2=658783&view=diff
==============================================================================
---
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
(original)
+++
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
Wed May 21 10:44:18 2008
@@ -1,71 +1,71 @@
-/*
- * 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.
- */
-package org.apache.commons.validator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import java.util.Locale;
-import java.net.URL;
-
-
-/**
- * Tests entity imports.
- *
- * @version $Revision$ $Date$
- */
-public class EntityImportTest extends AbstractCommonTest {
-
- public EntityImportTest(String name) {
- super(name);
- }
-
- /**
- * Start the tests.
- *
- * @param theArgs the arguments. Not used
- */
- public static void main(String[] theArgs) {
- junit.awtui.TestRunner.main(new
String[]{EntityImportTest.class.getName()});
- }
-
- /**
- * @return a test suite (<code>TestSuite</code>) that includes all methods
- * starting with "test"
- */
- public static Test suite() {
- // All methods starting with "test" will be executed in the test suite.
- return new TestSuite(EntityImportTest.class);
- }
-
- /**
- * Tests the entity import loading the <code>byteForm</code> form.
- */
- public void testEntityImport() throws Exception {
- URL url = getClass().getResource("EntityImportTest-config.xml");
- ValidatorResources resources = new
ValidatorResources(url.toExternalForm());
- assertNotNull("Form should be found",
resources.getForm(Locale.getDefault(), "byteForm"));
- }
-
- /**
- * Tests loading ValidatorResources from a URL
- */
- public void testParseURL() throws Exception {
- URL url = getClass().getResource("EntityImportTest-config.xml");
- ValidatorResources resources = new ValidatorResources(url);
- assertNotNull("Form should be found",
resources.getForm(Locale.getDefault(), "byteForm"));
- }
-}
+/*
+ * 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.
+ */
+package org.apache.commons.validator;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import java.util.Locale;
+import java.net.URL;
+
+
+/**
+ * Tests entity imports.
+ *
+ * @version $Revision$ $Date$
+ */
+public class EntityImportTest extends AbstractCommonTest {
+
+ public EntityImportTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Start the tests.
+ *
+ * @param theArgs the arguments. Not used
+ */
+ public static void main(String[] theArgs) {
+ junit.awtui.TestRunner.main(new
String[]{EntityImportTest.class.getName()});
+ }
+
+ /**
+ * @return a test suite (<code>TestSuite</code>) that includes all methods
+ * starting with "test"
+ */
+ public static Test suite() {
+ // All methods starting with "test" will be executed in the test suite.
+ return new TestSuite(EntityImportTest.class);
+ }
+
+ /**
+ * Tests the entity import loading the <code>byteForm</code> form.
+ */
+ public void testEntityImport() throws Exception {
+ URL url = getClass().getResource("EntityImportTest-config.xml");
+ ValidatorResources resources = new
ValidatorResources(url.toExternalForm());
+ assertNotNull("Form should be found",
resources.getForm(Locale.getDefault(), "byteForm"));
+ }
+
+ /**
+ * Tests loading ValidatorResources from a URL
+ */
+ public void testParseURL() throws Exception {
+ URL url = getClass().getResource("EntityImportTest-config.xml");
+ ValidatorResources resources = new ValidatorResources(url);
+ assertNotNull("Form should be found",
resources.getForm(Locale.getDefault(), "byteForm"));
+ }
+}
Propchange:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/EntityImportTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/validator/trunk/xdocs/style/project.css
------------------------------------------------------------------------------
svn:eol-style = native