Richard,
Gump was failing because resource.properties should be copied over to
build/classes/test/utils....I checked in a new test/utils/build.xml to fix this issue.
Thanks,
dims
--- [EMAIL PROTECTED] wrote:
> rsitze 2002/09/20 13:14:30
>
> Modified: java/test/utils TestMessages.java
> Added: java/test/utils axisNLS.properties Messages.java
> Log:
> Test cases for message extensions:
> - for all messages test, verify that # keys found exceeds a threshold (currently
>500).
> this ensures that we linked back to org.apache.axis.utils.axisNLS correctly.
> - verify that we find keys in org.apache.axis.utils.axisNLS
> - verify that we find key in test.utils.axisNLS
>
> Revision Changes Path
> 1.18 +25 -3 xml-axis/java/test/utils/TestMessages.java
>
> Index: TestMessages.java
> ===================================================================
> RCS file: /home/cvs/xml-axis/java/test/utils/TestMessages.java,v
> retrieving revision 1.17
> retrieving revision 1.18
> diff -u -r1.17 -r1.18
> --- TestMessages.java 20 Sep 2002 16:50:48 -0000 1.17
> +++ TestMessages.java 20 Sep 2002 20:14:30 -0000 1.18
> @@ -14,13 +14,12 @@
> import junit.framework.TestCase;
> import junit.framework.TestSuite;
>
> -import org.apache.axis.utils.Messages;
> -
>
> /**
> * This TestCase verifies:
> * - the contents of axisNLS.properties for well-formedness, and
> * - tests calls to Messages.getMessage.
> + * - tests Messages extension mechanism
> */
> public class TestMessages extends TestCase {
> public TestMessages(String name) {
> @@ -32,14 +31,19 @@
> }
>
> /**
> - * Call getMessage for each key in axisNLS.properties to make sure they are
>all well
> formed.
> + * Call getMessage for each key in axisNLS.properties
> + * to make sure they are all well formed.
> */
> + private static final int expectedNumberKeysThreshold = 500;
> public void testAllMessages() {
> String arg0 = "arg0";
> String arg1 = "arg1";
> String[] args = {arg0, arg1, "arg2"};
> +
> + int count = 0;
> Enumeration keys = Messages.getResourceBundle().getKeys();
> while (keys.hasMoreElements()) {
> + count++;
> String key = (String) keys.nextElement();
> try {
> String message = Messages.getMessage(key);
> @@ -51,6 +55,9 @@
> throw new AssertionFailedError("Test failure on key = " + key +
>": " +
> iae.getMessage());
> }
> }
> +
> + assertTrue("expected # keys greater than " + expectedNumberKeysThreshold
>+ ", only
> got " + count + "! VERIFY HIERARCHICAL MESSAGES WORK/LINKED CORRECTLY",
> + count > expectedNumberKeysThreshold);
> } // testAllMessages
>
> /**
> @@ -103,6 +110,21 @@
> throw new AssertionFailedError("Test failure: " + t.getMessage());
> }
> } // testTestMessages
> +
> +
> + /**
> + * Make sure the extended test messages come out as we expect them to.
> + */
> + public void testTestExtendedMessages() {
> + try {
> + String message = Messages.getMessage("extended.test00");
> + String expected = "message in extension file";
> + assertTrue("expected (" + expected + ") got (" + message + ")",
> expected.equals(message));
> + }
> + catch (Throwable t) {
> + throw new AssertionFailedError("Test failure: " + t.getMessage());
> + }
> + } // testTestExtendedMessages
>
>
> private static final String LS = System.getProperty("line.separator");
>
>
>
> 1.1 xml-axis/java/test/utils/axisNLS.properties
>
> Index: axisNLS.properties
> ===================================================================
> # Extension to org.apache.axis.i18n.resource.properties.
>
> extended.test00=message in extension file
>
>
>
> 1.1 xml-axis/java/test/utils/Messages.java
>
> Index: Messages.java
> ===================================================================
> /*
> * The Apache Software License, Version 1.1
> *
> *
> * Copyright (c) 2001 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software itself,
> * if and wherever such third-party acknowledgments normally appear.
> *
> * 4. The names "Axis" and "Apache Software Foundation" must
> * not be used to endorse or promote products derived from this
> * software without prior written permission. For written
> * permission, please contact [EMAIL PROTECTED]
> *
> * 5. Products derived from this software may not be called "Apache",
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> */
>
> package test.utils;
>
> import java.util.Locale;
> import java.util.MissingResourceException;
> import java.util.ResourceBundle;
>
> /**
> * These two imports added to facilitate copying to different packages...
> *
> * import org.apache.axis.i18n.MessageBundle;
> * import org.apache.axis.i18n.MessagesConstants;
> */
> import org.apache.axis.i18n.MessageBundle;
> import org.apache.axis.i18n.MessagesConstants;
>
>
> /**
> * @see org.apache.axis.i18n.Messages
> *
> * Changed projectName to local package (test.utils).
> *
> * @author Richard A. Sitze ([EMAIL PROTECTED])
> * @author Karl Moss ([EMAIL PROTECTED])
> * @author Glen Daniels ([EMAIL PROTECTED])
> */
> public class Messages {
> private static final Class thisClass = Messages.class;
>
> private static final String projectName = "test.utils";
>
> private static final String resourceName = MessagesConstants.resourceName;
> private static final Locale locale = MessagesConstants.locale;
>
> private static final String packageName = getPackage(thisClass.getName());
> private static final ClassLoader classLoader = thisClass.getClassLoader();
>
=== message truncated ===
=====
Davanum Srinivas - http://xml.apache.org/~dims/
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com