commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/base64 TestAll.java Base64TestCase.java
Date Mon, 18 Nov 2002 12:41:24 GMT
rwaldhoff    2002/11/18 04:41:24

  Modified:    codec    build.xml default.properties
               codec/src/java/org/apache/commons/codec Encoder.java
                        EncoderComparator.java Metaphone.java
                        RefinedSoundex.java Soundex.java
               codec/src/test/org/apache/commons/codec/base64
                        Base64TestCase.java
  Added:       codec/src/test/org/apache/commons/codec TestAll.java
                        TestMetaphone.java
               codec/src/test/org/apache/commons/codec/base64 TestAll.java
  Log:
  * add basic test infrastructure
  * add additional tests
  * add Base64 tests from HttpClient
  
  * cleanup: fix whitespace issues, copyright years, normalize some formatting
  
  Revision  Changes    Path
  1.6       +7 -7      jakarta-commons-sandbox/codec/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/build.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.xml	23 Mar 2002 00:41:26 -0000	1.5
  +++ build.xml	18 Nov 2002 12:41:24 -0000	1.6
  @@ -152,13 +152,13 @@
   
   <!-- ========== Unit Test Targets ========================================= -->
   
  -
  -  <target name="test"  depends="compile.tests,
  -                                test.base64
  -                               "
  -   description="Run all unit test cases">
  +  <target name="test" depends="compile.tests" description="Run all unit test cases">
  +    <java classname="${test.runner}" fork="yes"
  +        failonerror="${test.failonerror}">
  +      <arg value="${test.entry}"/>
  +      <classpath refid="test.classpath"/>
  +    </java>
     </target>
  -
   
     <target name="test.base64" depends="compile.tests">
       <echo message="Running Base64 tests ..."/>
  
  
  
  1.2       +3 -0      jakarta-commons-sandbox/codec/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/default.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- default.properties	23 Mar 2002 00:13:05 -0000	1.1
  +++ default.properties	18 Nov 2002 12:41:24 -0000	1.2
  @@ -45,3 +45,6 @@
   
   # The test runner to execute
   test.runner = junit.textui.TestRunner
  +
  +# Root test class to execute
  +test.entry = org.apache.commons.codec.TestAll
  \ No newline at end of file
  
  
  
  1.2       +34 -69    jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Encoder.java
  
  Index: Encoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Encoder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Encoder.java	18 Nov 2002 08:46:02 -0000	1.1
  +++ Encoder.java	18 Nov 2002 12:41:24 -0000	1.2
  @@ -1,69 +1,34 @@
  -package org.apache.commons.codec;
  -
  -/* ====================================================================
  - * 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 "Apache" and "Apache Software Foundation" and
  - *    "Apache Commons" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", 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/>.
  - */
  -
  -/**
  - * Encoder is an interface, which is implemented by Soundex,
  - * Metaphone, Soundex2, etc.
  - *
  - * @author tobrien@transolutions.net
  - * @version $Id$
  - */
  -public interface Encoder {
  -
  -    public String encode(String str);
  -    
  -}
  -    
  +/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002 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 "Apache" and "Apache Software Foundation" and
  + *    "Apache Commons" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
  + *    written permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + *    "Apache Turbine", 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 org.apache.commons.codec;

/**
 * Encoder is an interface, which is implemented by Soundex,
 * Metaphone, Soundex2, etc.
 *
 * @author tobrien@transolutions.net
 * @version $Revision$ $Date$
 */
public interface Encoder {
    String encode(String str);
}  
  
  
  
  1.2       +2 -89     jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/EncoderComparator.java
  
  Index: EncoderComparator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/EncoderComparator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EncoderComparator.java	18 Nov 2002 08:46:02 -0000	1.1
  +++ EncoderComparator.java	18 Nov 2002 12:41:24 -0000	1.2
  @@ -1,89 +1,2 @@
  -package org.apache.commons.codec;
  -
  -/* ====================================================================
  - * 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 "Apache" and "Apache Software Foundation" and
  - *    "Apache Commons" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", 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/>.
  - */
  -
  -import java.util.Comparator;
  -
  -/**
  - * Compare using an Encoder.
  - *
  - * @author tobrien@transolutions.net
  - * @version $Id$
  - */
  -public class EncoderComparator implements Comparator {
  -
  -    private Encoder encoder;
  -
  -    /**
  -     * Use the default soundex algorithm, US_ENGLISH.
  -     */
  -    public EncoderComparator() {
  -        this(RefinedSoundex.US_ENGLISH);
  -    }
  -
  -    /**
  -     * Use the provided soundex algorithm.
  -     */
  -    public EncoderComparator(Encoder en) {
  -        this.encoder = en;
  -    }
  -
  -    public int compare(Object o1, Object o2) {
  -        String s1 = encoder.encode(o1.toString());
  -        String s2 = encoder.encode(o2.toString());
  -        return s1.compareTo(s2);
  -    }
  -
  -}
  +/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002 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 "Apache" and "Apache Software Foundation" and
 *    "Apache Commons" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Turbine", 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 org.apache.commons.codec;
  +import java.util.Comparator;

/**
 * Compare using an Encoder.
 *
 * @author tobrien@transolutions.net
 * @version $Revision$ $Date$
 */
public class EncoderComparator implements Comparator {

    private Encoder encoder;

    /**
     * Use the default soundex algorithm, US_ENGLISH.
     */
    public EncoderComparator() {
        this(RefinedSoundex.US_ENGLISH);
    }

    /**
     * Use the provided soundex algorithm.
     */
    public EncoderComparator(Encoder en) {
        this.encoder = en;
    }

    public int compare(Object o1, Object o2) {
        String s1 = encoder.encode(o1.toString());
        String s2 = encoder.encode(o2.toString());
        return s1.compareTo(s2);
    }

}
  
  
  
  1.4       +2 -320    jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Metaphone.java
  
  Index: Metaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Metaphone.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Metaphone.java	18 Nov 2002 08:46:02 -0000	1.3
  +++ Metaphone.java	18 Nov 2002 12:41:24 -0000	1.4
  @@ -1,320 +1,2 @@
  -// Permission given by wbrogden for code to be used anywhere.
  -package org.apache.commons.codec;
  -
  -
  -/* ====================================================================
  - * 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 "Apache" and "Apache Software Foundation" and
  - *    "Apache Commons" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", 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/>.
  - */
  -
  -/*                                                     Metaphone.java
  - * A class to generate phonetic code and keep lists of objects
  - *  retrievable by a phonetic code.
  - * reference: Computer Language of Dec. 1990, p 39
  - *  "Hanging on the Metaphone" by Lawrence Philips
  - *
  - * This Java implementation, William B. Brogden.  December, 1997
  - *
  - * @author wbrogden@bga.com
  - * @author tobrien@transolutions.net
  - */
  -
  -/*
  - * List functionality removed: 2001-06-21 bayard@generationjava.com
  - */
  -
  -/* 
  - * Notes:
  - * The static method metaphone converts an input String into a code.
  - *   All input is converted to upper case.
  - *   Limitations: Input format is expected to be a single ASCII word
  - *   with only characters in the A - Z range, no punctuation or numbers.
  - *
  - */
  -
  -public class Metaphone implements Encoder {
  -
  -    private String vowels = "AEIOU" ;
  -    private String frontv = "EIY"   ;
  -    private String varson = "CSPTG" ;
  -
  -    private int maxCodeLen = 4 ;
  -
  -    public Metaphone() {
  -        super();
  -    }
  -
  -
  -    /**
  -     * Find the metaphone value of a String. This is similar to the
  -     * soundex algorithm, but better at finding similar sounding words.
  -     */
  -    public String metaphone( String txt ){
  -      int mtsz = 0  ;
  -      boolean hard = false ;
  -      if(( txt == null ) ||
  -         ( txt.length() == 0 )) return "" ;
  -      // single character is itself
  -      if( txt.length() == 1 ) return txt.toUpperCase() ;
  -      
  -      char[] inwd = txt.toUpperCase().toCharArray() ;
  -      
  -      String tmpS ;
  -      StringBuffer local = new StringBuffer( 40 ); // manipulate
  -      StringBuffer code = new StringBuffer( 10 ) ; //   output
  -      // handle initial 2 characters exceptions
  -      switch( inwd[0] ){
  -        case 'K': case 'G' : case 'P' : /* looking for KN, etc*/
  -          if( inwd[1] == 'N')local.append(inwd, 1, inwd.length - 1 );
  -          else local.append( inwd );
  -          break;
  -        case 'A': /* looking for AE */
  -          if( inwd[1] == 'E' )local.append(inwd, 1, inwd.length - 1 );
  -          else local.append( inwd );
  -          break;
  -        case 'W' : /* looking for WR or WH */
  -          if( inwd[1] == 'R' ){   // WR -> R
  -            local.append(inwd, 1, inwd.length - 1 ); break ;
  -          }
  -          if( inwd[1] == 'H'){
  -            local.append(inwd, 1, inwd.length - 1 );
  -            local.setCharAt( 0,'W'); // WH -> W
  -          }
  -          else local.append( inwd );
  -          break;
  -        case 'X' : /* initial X becomes S */
  -          inwd[0] = 'S' ;local.append( inwd );
  -          break ;
  -        default :
  -          local.append( inwd );
  -      } // now local has working string with initials fixed
  -      int wdsz = local.length();
  -      int n = 0 ;
  -      while((mtsz < maxCodeLen ) && // max code size of 4 works well
  -            (n < wdsz ) ){
  -        char symb = local.charAt(n) ;
  -        // remove duplicate letters except C
  -        if(( symb != 'C' ) &&
  -           (n > 0 ) && ( local.charAt(n - 1 ) == symb )) n++ ;
  -        else{ // not dup
  -          switch( symb ){
  -            case 'A' : case 'E' : case 'I' : case 'O' : case 'U' :
  -              if( n == 0 ) { code.append(symb );mtsz++;
  -              }
  -              break ; // only use vowel if leading char
  -            case 'B' :
  -              if( (n > 0 ) &&
  -                  !(n + 1 == wdsz ) && // not MB at end of word
  -                  ( local.charAt(n - 1) == 'M')) {
  -                    code.append(symb);
  -                  }
  -              else code.append(symb);
  -              mtsz++ ;
  -              break ;
  -            case 'C' : // lots of C special cases
  -              /* discard if SCI, SCE or SCY */
  -              if( ( n > 0 ) &&
  -                  ( local.charAt(n-1) == 'S' ) &&
  -                  ( n + 1 < wdsz ) &&
  -                  ( frontv.indexOf( local.charAt(n + 1)) >= 0 )){ break ;}
  -              tmpS = local.toString();
  -              if( tmpS.indexOf("CIA", n ) == n ) { // "CIA" -> X
  -                 code.append('X' ); mtsz++; break ;
  -              }
  -              if( ( n + 1 < wdsz ) &&
  -                  (frontv.indexOf( local.charAt(n+1) )>= 0 )){
  -                 code.append('S');mtsz++; break ; // CI,CE,CY -> S
  -              }
  -              if(( n > 0) &&
  -                 ( tmpS.indexOf("SCH",n-1 )== n-1 )){ // SCH->sk
  -                 code.append('K') ; mtsz++;break ;
  -              }
  -              if( tmpS.indexOf("CH", n ) == n ){ // detect CH
  -                if((n == 0 ) &&
  -                   (wdsz >= 3 ) &&    // CH consonant -> K consonant
  -                   (vowels.indexOf( local.charAt( 2) ) < 0 )){
  -                     code.append('K');
  -                }
  -                else { code.append('X'); // CHvowel -> X
  -                }
  -                mtsz++;
  -              }
  -              else { code.append('K' );mtsz++;
  -              }
  -              break ;
  -            case 'D' :
  -              if(( n + 2 < wdsz )&&  // DGE DGI DGY -> J
  -                 ( local.charAt(n+1) == 'G' )&&
  -                 (frontv.indexOf( local.charAt(n+2) )>= 0)){
  -                    code.append('J' ); n += 2 ;
  -              }
  -              else { code.append( 'T' );
  -              }
  -              mtsz++;
  -              break ;
  -            case 'G' : // GH silent at end or before consonant
  -              if(( n + 2 == wdsz )&&
  -                 (local.charAt(n+1) == 'H' )) break ;
  -              if(( n + 2 < wdsz ) &&
  -                 (local.charAt(n+1) == 'H' )&&
  -                 (vowels.indexOf( local.charAt(n+2)) < 0 )) break ;
  -              tmpS = local.toString();
  -              if((n > 0) &&
  -                 ( tmpS.indexOf("GN", n ) == n)||
  -                 ( tmpS.indexOf("GNED",n) == n )) break ; // silent G
  -              if(( n > 0 ) &&
  -                 (local.charAt(n-1) == 'G')) hard = true ;
  -              else hard = false ;
  -              if((n+1 < wdsz) &&
  -                 (frontv.indexOf( local.charAt(n+1) ) >= 0 )&&
  -                 (!hard) ) code.append( 'J' );
  -              else code.append('K');
  -              mtsz++;
  -              break ;
  -            case 'H':
  -              if( n + 1 == wdsz ) break ; // terminal H
  -              if((n > 0) &&
  -                 (varson.indexOf( local.charAt(n-1)) >= 0)) break ;
  -              if( vowels.indexOf( local.charAt(n+1)) >=0 ){
  -                  code.append('H') ; mtsz++;// Hvowel
  -              }
  -              break;
  -            case 'F': case 'J' : case 'L' :
  -            case 'M': case 'N' : case 'R' :
  -              code.append( symb ); mtsz++; break ;
  -            case 'K' :
  -              if( n > 0 ){ // not initial
  -                if( local.charAt( n -1) != 'C' ) {
  -                     code.append(symb );
  -                }
  -              }
  -              else   code.append( symb ); // initial K
  -              mtsz++ ;
  -              break ;
  -            case 'P' :
  -              if((n + 1 < wdsz) &&  // PH -> F
  -                 (local.charAt( n+1) == 'H'))code.append('F');
  -              else code.append( symb );
  -              mtsz++;
  -              break ;
  -            case 'Q' :
  -              code.append('K' );mtsz++; break ;
  -            case 'S' :
  -              tmpS = local.toString();
  -              if((tmpS.indexOf("SH", n )== n) ||
  -                 (tmpS.indexOf("SIO",n )== n) ||
  -                 (tmpS.indexOf("SIA",n )== n)) code.append('X');
  -              else code.append( 'S' );
  -              mtsz++ ;
  -              break ;
  -            case 'T' :
  -              tmpS = local.toString(); // TIA TIO -> X
  -              if((tmpS.indexOf("TIA",n )== n)||
  -                 (tmpS.indexOf("TIO",n )== n) ){
  -                    code.append('X'); mtsz++; break;
  -              }
  -              if( tmpS.indexOf("TCH",n )==n) break;
  -              // substitute numeral 0 for TH (resembles theta after all)
  -              if( tmpS.indexOf("TH", n )==n) code.append('0');
  -              else code.append( 'T' );
  -              mtsz++ ;
  -              break ;
  -            case 'V' :
  -              code.append('F'); mtsz++;break ;
  -            case 'W' : case 'Y' : // silent if not followed by vowel
  -              if((n+1 < wdsz) &&
  -                 (vowels.indexOf( local.charAt(n+1))>=0)){
  -                    code.append( symb );mtsz++;
  -              }
  -              break ;
  -            case 'X' :
  -              code.append('K'); code.append('S');mtsz += 2;
  -              break ;
  -            case 'Z' :
  -              code.append('S'); mtsz++; break ;
  -          } // end switch
  -          n++ ;
  -        } // end else from symb != 'C'
  -        if( mtsz > 4 )code.setLength( 4);
  -      }
  -      return code.toString();
  -    } // end static method metaPhone()
  -    
  -    public String encode(String pString) {
  -        return( metaphone( pString ) );   
  -    }
  -
  -    /**
  -     * Are the metaphones of two strings the same.
  -     */
  -    public boolean isMetaphoneEqual(String str1, String str2) {
  -        return metaphone(str1).equals(metaphone(str2));
  -    }
  -
  -	/**
  -	 * Returns the maxCodeLen.
  -	 * @return int
  -	 */
  -	public int getMaxCodeLen() {
  -		return maxCodeLen;
  -	}
  -
  -	/**
  -	 * Sets the maxCodeLen.
  -	 * @param maxCodeLen The maxCodeLen to set
  -	 */
  -	public void setMaxCodeLen(int maxCodeLen) {
  -		this.maxCodeLen = maxCodeLen;
  -	}
  -
  -}
  -
  +/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001-2002 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 "Apache" and "Apache Software Foundation" and
 *    "Apache Commons" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Turbine", 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 org.apache.commons.codec;

/**
 * A class to generate phonetic code.
 * The initial Java implementation, William B. Brogden.  December, 1997
 * Permission given by wbrogden for code to be used anywhere.
 * 
 * @see "Hanging on the Metaphone" by Lawrence Philips
 *      <i>Computer Language</i> of Dec. 1990, p 39   
 * 
 * @version $Revision$ $Date$
 * @author wbrogden@bga.com
 * @author bayard@generationjava.com
 * @author tobrien@transolutions.net
 */
public class Metaphone implements Encoder {
  +    private String vowels = "AEIOU" ;
    private String frontv = "EIY"   ;
    private String varson = "CSPTG" ;

    private int maxCodeLen = 4 ;

    public Metaphone() {
        super();
    }

    /**
     * Find the metaphone value of a String. This is similar to the
     * soundex algorithm, but better at finding similar sounding words.
     * All input is converted to upper case.
     * Limitations: Input format is expected to be a single ASCII word
     * with only characters in the A - Z range, no punctuation or numbers.
     */
    public String metaphone( String txt ){
      int mtsz = 0  ;
      boolean hard = false ;
      if(( txt == null ) ||
         ( txt.length() == 0 )) return "" ;
      // single character is itself
      if( txt.length() == 1 ) return txt.toUpperCase() ;
      
      char[] inwd = txt.toUpperCase().toCharArray() ;
      
      String tmpS ;
      StringBuffer local = new StringBuffer( 40 ); // manipulate
      StringBuffer code = new StringBuffer( 10 ) ; //   output
      // handle initial 2 characters exceptions
      switch( inwd[0] ){
        case 'K': case 'G' : case 'P' : /* looking for KN, etc*/
          if( inwd[1] == 'N')local.append(inwd, 1, inwd.length - 1 );
          else local.append( inwd );
          break;
        case 'A': /* looking for AE */
          if( inwd[1] == 'E' )local.append(inwd, 1, inwd.length - 1 );
          else local.append( inwd );
          break;
        case 'W' : /* looking for WR or WH */
          if( inwd[1] == 'R' ){   // WR -> R
            local.append(inwd, 1, inwd.length - 1 ); break ;
          }
          if( inwd[1] == 'H'){
            local.append(inwd, 1, inwd.length - 1 );
            local.setCharAt( 0,'W'); // WH -> W
          }
          else local.append( inwd );
          break;
        case 'X' : /* initial X becomes S */
          inwd[0] = 'S' ;local.append( inwd );
          break ;
        default :
          local.append( inwd );
      } // now local has working string with initials fixed
      int wdsz = local.length();
      int n = 0 ;
      while((mtsz < maxCodeLen ) && // max code size of 4 works well
            (n < wdsz ) ){
        char symb = local.charAt(n) ;
        // remove duplicate letters except C
        if(( symb != 'C' ) &&
           (n > 0 ) && ( local.charAt(n - 1 ) == symb )) n++ ;
        else{ // not dup
          switch( symb ){
            case 'A' : case 'E' : case 'I' : case 'O' : case 'U' :
              if( n == 0 ) { code.append(symb );mtsz++;
              }
              break ; // only use vowel if leading char
            case 'B' :
              if( (n > 0 ) &&
                  !(n + 1 == wdsz ) && // not MB at end of word
                  ( local.charAt(n - 1) == 'M')) {
                    code.append(symb);
                  }
              else code.append(symb);
              mtsz++ ;
              break ;
            case 'C' : // lots of C special cases
              /* discard if SCI, SCE or SCY */
              if( ( n > 0 ) &&
                  ( local.charAt(n-1) == 'S' ) &&
                  ( n + 1 < wdsz ) &&
                  ( frontv.indexOf( local.charAt(n + 1)) >= 0 )){ break ;}
              tmpS = local.toString();
              if( tmpS.indexOf("CIA", n ) == n ) { // "CIA" -> X
                 code.append('X' ); mtsz++; break ;
              }
              if( ( n + 1 < wdsz ) &&
                  (frontv.indexOf( local.charAt(n+1) )>= 0 )){
                 code.append('S');mtsz++; break ; // CI,CE,CY -> S
              }
              if(( n > 0) &&
                 ( tmpS.indexOf("SCH",n-1 )== n-1 )){ // SCH->sk
                 code.append('K') ; mtsz++;break ;
              }
              if( tmpS.indexOf("CH", n ) == n ){ // detect CH
                if((n == 0 ) &&
                   (wdsz >= 3 ) &&    // CH consonant -> K consonant
                   (vowels.indexOf( local.charAt( 2) ) < 0 )){
                     code.append('K');
                }
                else { code.append('X'); // CHvowel -> X
                }
                mtsz++;
              }
              else { code.append('K' );mtsz++;
              }
              break ;
            case 'D' :
              if(( n + 2 < wdsz )&&  // DGE DGI DGY -> J
                 ( local.charAt(n+1) == 'G' )&&
                 (frontv.indexOf( local.charAt(n+2) )>= 0)){
                    code.append('J' ); n += 2 ;
              }
              else { code.append( 'T' );
              }
              mtsz++;
              break ;
            case 'G' : // GH silent at end or before consonant
              if(( n + 2 == wdsz )&&
                 (local.charAt(n+1) == 'H' )) break ;
              if(( n + 2 < wdsz ) &&
                 (local.charAt(n+1) == 'H' )&&
                 (vowels.indexOf( local.charAt(n+2)) < 0 )) break ;
              tmpS = local.toString();
              if((n > 0) &&
                 ( tmpS.indexOf("GN", n ) == n)||
                 ( tmpS.indexOf("GNED",n) == n )) break ; // silent G
              if(( n > 0 ) &&
                 (local.charAt(n-1) == 'G')) hard = true ;
              else hard = false ;
              if((n+1 < wdsz) &&
                 (frontv.indexOf( local.charAt(n+1) ) >= 0 )&&
                 (!hard) ) code.append( 'J' );
              else code.append('K');
              mtsz++;
              break ;
            case 'H':
              if( n + 1 == wdsz ) break ; // terminal H
              if((n > 0) &&
                 (varson.indexOf( local.charAt(n-1)) >= 0)) break ;
              if( vowels.indexOf( local.charAt(n+1)) >=0 ){
                  code.append('H') ; mtsz++;// Hvowel
              }
              break;
            case 'F': case 'J' : case 'L' :
            case 'M': case 'N' : case 'R' :
              code.append( symb ); mtsz++; break ;
            case 'K' :
              if( n > 0 ){ // not initial
                if( local.charAt( n -1) != 'C' ) {
                     code.append(symb );
                }
              }
              else   code.append( symb ); // initial K
              mtsz++ ;
              break ;
            case 'P' :
              if((n + 1 < wdsz) &&  // PH -> F
                 (local.charAt( n+1) == 'H'))code.append('F');
              else code.append( symb );
              mtsz++;
              break ;
            case 'Q' :
              code.append('K' );mtsz++; break ;
            case 'S' :
              tmpS = local.toString();
              if((tmpS.indexOf("SH", n )== n) ||
                 (tmpS.indexOf("SIO",n )== n) ||
                 (tmpS.indexOf("SIA",n )== n)) code.append('X');
              else code.append( 'S' );
              mtsz++ ;
              break ;
            case 'T' :
              tmpS = local.toString(); // TIA TIO -> X
              if((tmpS.indexOf("TIA",n )== n)||
                 (tmpS.indexOf("TIO",n )== n) ){
                    code.append('X'); mtsz++; break;
              }
              if( tmpS.indexOf("TCH",n )==n) break;
              // substitute numeral 0 for TH (resembles theta after all)
              if( tmpS.indexOf("TH", n )==n) code.append('0');
              else code.append( 'T' );
              mtsz++ ;
              break ;
            case 'V' :
              code.append('F'); mtsz++;break ;
            case 'W' : case 'Y' : // silent if not followed by vowel
              if((n+1 < wdsz) &&
                 (vowels.indexOf( local.charAt(n+1))>=0)){
                    code.append( symb );mtsz++;
              }
              break ;
            case 'X' :
              code.append('K'); code.append('S');mtsz += 2;
              break ;
            case 'Z' :
              code.append('S'); mtsz++; break ;
          } // end switch
          n++ ;
        } // end else from symb != 'C'
        if( mtsz > 4 )code.setLength( 4);
      }
      return code.toString();
    } // end static method metaPhone()
    
    public String encode(String pString) {
        return( metaphone( pString ) );   
    }

    /**
     * Are the metaphones of two strings the same.
     */
    public boolean isMetaphoneEqual(String str1, String str2) {
        return metaphone(str1).equals(metaphone(str2));
    }

	/**
	 * Returns the maxCodeLen.
	 * @return int
	 */
	public int getMaxCodeLen() {
		return maxCodeLen;
	}

	/**
	 * Sets the maxCodeLen.
	 * @param maxCodeLen The maxCodeLen to set
	 */
	public void setMaxCodeLen(int maxCodeLen) {
		this.maxCodeLen = maxCodeLen;
	}

}
  \ No newline at end of file
  
  
  
  1.2       +3 -131    jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/RefinedSoundex.java
  
  Index: RefinedSoundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/RefinedSoundex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RefinedSoundex.java	18 Nov 2002 08:46:02 -0000	1.1
  +++ RefinedSoundex.java	18 Nov 2002 12:41:24 -0000	1.2
  @@ -1,131 +1,3 @@
  -package org.apache.commons.codec;
  -
  -/* ====================================================================
  - * 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 "Apache" and "Apache Software Foundation" and
  - *    "Apache Commons" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", 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/>.
  - */
  -
  -/**
  - * Encodes a string into a soundex value.  Sounde is an encoding used to
  - * relate similar names, but can also be used as a general purpose
  - * scheme to find word with similar phonemes. 
  - * More information may be found at: http://www.bluepoof.com/Soundex/info2.html
  - * 
  - * @todo Needs internationalisation in a future release.
  - *
  - * @author tobrien@transolutions.net
  - * @version $Id$
  - */
  -public class RefinedSoundex implements Encoder {
  -
  -    static public final char[] US_ENGLISH_MAPPING =
  -        "01360240043788015936020505".toCharArray();
  -
  -    static public final RefinedSoundex US_ENGLISH = new RefinedSoundex();
  -    
  -    private char[] soundexMapping;
  -
  -    public RefinedSoundex() {
  -        this(US_ENGLISH_MAPPING);
  -    }
  -
  -    public RefinedSoundex(char[] mapping) {
  -        this.soundexMapping = mapping;
  -    }
  -
  -    /**
  -     * Get the SoundEx value of a string.
  -     * This implementation is taken from the code-snippers on 
  -     * http://www.sourceforge.net/
  -     */
  -    public String soundex(String str) {
  -       
  -        StringBuffer sBuf = new StringBuffer();        
  -        str = str.toUpperCase();
  -
  -        sBuf.append( str.charAt(0) );
  -
  -        char last, mapped, current;
  -        last = '*';
  -
  -        for( int i = 0; i < str.length(); i++ ) {
  -
  -            current = getMappingCode( str.charAt(i) );
  -            if( current == last ) {
  -                continue;
  -            } else if( current != 0 ) {
  -                sBuf.append( current );   
  -            }
  -            
  -            last = current;             
  -            
  -        }
  -        
  -        return sBuf.toString();
  -    }
  -
  -    public String encode(String pString) {
  -        return( soundex( pString ) );   
  -    }
  -
  -    /**
  -     * Used internally by the SoundEx algorithm.
  -     */
  -    private char getMappingCode(char c) {
  -        if( !Character.isLetter(c) ) {
  -            return 0;
  -        } else {
  -            return soundexMapping[Character.toUpperCase(c) - 'A'];
  -        }
  -    }
  -
  -}
  +/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2002 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 "Apache" and "Apache Software Foundation" and
 *    "Apache Commons" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Turbine", 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 org.apache.commons.codec;
  +
  +/**
 * Encodes a string into a soundex value.  Sounde is an encoding used to
 * relate similar names, but can also be used as a general purpose
 * scheme to find word with similar phonemes. 
 * More information may be found at: http://www.bluepoof.com/Soundex/info2.html
 * 
 * @todo Needs internationalisation in a future release.
 *
 * @author tobrien@transolutions.net
 * @version $Revision$ $Date$
 */
public class RefinedSoundex implements Encoder {

    static public final char[] US_ENGLISH_MAPPING =
        "01360240043788015936020505".toCharArray();

    static public final RefinedSoundex US_ENGLISH = new RefinedSoundex();
    
    private char[] soundexMapping;

    public RefinedSoundex() {
        this(US_ENGLISH_MAPPING);
    }

    public RefinedSoundex(char[] mapping) {
        this.soundexMapping = mapping;
    }

    /**
     * Get the SoundEx value of a string.
     * This implementation is taken from the code-snippers on 
     * http://www.sourceforge.net/
     */
    public String soundex(String str) {
       
        StringBuffer sBuf = new StringBuffer();        
        str = str.toUpperCase();

        sBuf.append( str.charAt(0) );

        char last, mapped, current;
        last = '*';

        for( int i = 0; i < str.length(); i++ ) {

            current = getMappingCode( str.charAt(i) );
            if( current == last ) {
                continue;
            } else if( current != 0 ) {
                sBuf.append( current );   
            }
            
            last = current;             
            
        }
        
        return sBuf.toString();
    }

    public String encode(String pString) {
        return( soundex( pString ) );   
    }

    /**
     * Used internally by the SoundEx algorithm.
     */
    private char getMappingCode(char c) {
        if( !Character.isLetter(c) ) {
            return 0;
        } else {
            return soundexMapping[Character.toUpperCase(c) - 'A'];
        }
    }
}
  \ No newline at end of file
  
  
  
  1.3       +4 -143    jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Soundex.java
  
  Index: Soundex.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/Soundex.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Soundex.java	18 Nov 2002 08:46:02 -0000	1.2
  +++ Soundex.java	18 Nov 2002 12:41:24 -0000	1.3
  @@ -1,143 +1,4 @@
  -package org.apache.commons.codec;
  -
  -/* ====================================================================
  - * 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 "Apache" and "Apache Software Foundation" and
  - *    "Apache Commons" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", 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/>.
  - */
  -
  -/**
  - * Encodes a string into a refined soundex value.  
  - * A refined soundex code is optimized for spell checking word. 
  - * "Soundex" method originally developed by Margaret Odell and 
  - *          Robert Russell
  - * 
  - * http://www.bluepoof.com/Soundex/info2.html
  - * 
  - * @todo Needs internationalisation in a future release.
  - *
  - * @author bayard@generationjava.com
  - * @author tobrien@transolutions.net
  - * @version $Id$
  - */
  -public class Soundex implements Encoder {
  -
  -    static public final char[] US_ENGLISH_MAPPING =
  -        "01230120022455012623010202".toCharArray();
  -
  -    static public final Soundex US_ENGLISH = new Soundex();
  -    
  -    private char[] soundexMapping;
  -    private int maxLength = 4;
  -
  -    public Soundex() {
  -        this(US_ENGLISH_MAPPING);
  -    }
  -
  -    public Soundex(char[] mapping) {
  -        this.soundexMapping = mapping;
  -    }
  -
  -    /**
  -     * Get the SoundEx value of a string.
  -     * This implementation is taken from the code-snippers on 
  -     * http://www.sourceforge.net/
  -     */
  -    public String soundex(String str) {
  -        char out[] = { '0', '0', '0', '0' };
  -        char last, mapped;
  -        int incount = 1, count = 1;
  -        out[0] = Character.toUpperCase( str.charAt(0) );
  -        last = getMappingCode( str.charAt(0) );
  -        while( (incount < str.length() ) && 
  -               (mapped = getMappingCode(str.charAt(incount++))) != 0 &&
  -               (count < maxLength) )
  -        {
  -            if( (mapped != '0') && (mapped != last) ) {
  -                out[count++] = mapped;
  -            }
  -            last = mapped;
  -        }
  -        return new String(out);
  -    }
  -
  -    public String encode(String pString) {
  -        return( soundex( pString ) );   
  -    }
  -
  -    /**
  -     * Used internally by the SoundEx algorithm.
  -     */
  -    private char getMappingCode(char c) {
  -        if( !Character.isLetter(c) ) {
  -            return 0;
  -        } else {
  -            return soundexMapping[Character.toUpperCase(c) - 'A'];
  -        }
  -    }
  -
  -	/**
  -	 * Returns the maxLength.  Standard Soundex
  -	 * @return int
  -	 */
  -	public int getMaxLength() {
  -		return maxLength;
  -	}
  -
  -	/**
  -	 * Sets the maxLength.
  -	 * @param maxLength The maxLength to set
  -	 */
  -	public void setMaxLength(int maxLength) {
  -		this.maxLength = maxLength;
  -	}
  -
  -}
  +/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 2001-2002 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 "Apache" and "Apache Software Foundation" and
 *    "Apache Commons" must not be used to endorse or promote products
 *    derived from this software without prior written permission. For
 *    written permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache",
 *    "Apache Turbine", 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 org.apache.commons.codec;
  +/**
 * Encodes a string into a refined soundex value.  
 * A refined soundex code is optimized for spell checking word. 
 * "Soundex" method originally developed by Margaret Odell and 
 *          Robert Russell
 * 
 * http://www.bluepoof.com/Soundex/info2.html
 * 
 * @todo Needs internationalisation in a future release.
 *
 * @author bayard@generationjava.com
 * @author tobrien@transolutions.net
 * @version $Revision$ $Date$
 */
public class Soundex implements Encoder {

    static public final char[] US_ENGLISH_MAPPING =
        "01230120022455012623010202".toCharArray();

    static public final Soundex US_ENGLISH = new Soundex();
    
    private char[] soundexMapping;
    private int maxLength = 4;

  +   public Soundex() {
        this(US_ENGLISH_MAPPING);
    }
  +    public Soundex(char[] mapping) {
        this.soundexMapping = mapping;
    }

    /**
     * Get the SoundEx value of a string.
     * This implementation is taken from the code-snippers on 
     * http://www.sourceforge.net/
     */
    public String soundex(String str) {
        char out[] = { '0', '0', '0', '0' };
        char last, mapped;
        int incount = 1, count = 1;
        out[0] = Character.toUpperCase( str.charAt(0) );
        last = getMappingCode( str.charAt(0) );
        while( (incount < str.length() ) && 
               (mapped = getMappingCode(str.charAt(incount++))) != 0 &&
               (count < maxLength) )
        {
            if( (mapped != '0') && (mapped != last) ) {
                out[count++] = mapped;
            }
            last = mapped;
        }
        return new String(out);
    }

    public String encode(String pString) {
        return( soundex( pString ) );   
    }

    /**
     * Used internally by the SoundEx algorithm.
     */
    private char getMappingCode(char c) {
        if( !Character.isLetter(c) ) {
            return 0;
        } else {
            return soundexMapping[Character.toUpperCase(c) - 'A'];
        }
    }

	/**
	 * Returns the maxLength.  Standard Soundex
	 * @return int
	 */
	public int getMaxLength() {
		return maxLength;
	}

	/**
	 * Sets the maxLength.
	 * @param maxLength The maxLength to set
	 */
	public void setMaxLength(int maxLength) {
		this.maxLength = maxLength;
	}

}
  \ No newline at end of file
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestAll.java,v 1.1 2002/11/18 12:41:24 rwaldhoff Exp $
   * $Revision: 1.1 $
   * $Date: 2002/11/18 12:41:24 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.codec;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Entry point for all Codec tests.
   * @version $Revision: 1.1 $ $Date: 2002/11/18 12:41:24 $
   * @author Rodney Waldhoff
   */
  public class TestAll extends TestCase {
      public TestAll(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          TestSuite suite = new TestSuite();
          suite.addTest(org.apache.commons.codec.base64.TestAll.suite());
          suite.addTest(TestMetaphone.suite());
          return suite;
      }
          
      public static void main(String args[]) {
          String[] testCaseName = { TestAll.class.getName() };
          junit.textui.TestRunner.main(testCaseName);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestMetaphone.java
  
  Index: TestMetaphone.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/TestMetaphone.java,v 1.1 2002/11/18 12:41:24 rwaldhoff Exp $
   * $Revision: 1.1 $
   * $Date: 2002/11/18 12:41:24 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.codec;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import java.util.Arrays;
  import java.util.Random;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2002/11/18 12:41:24 $
   * @author Rodney Waldhoff
   */
  public class TestMetaphone extends TestCase {
  
      public TestMetaphone(String name) {
          super(name);
      }
  
      public static Test suite() {
          return (new TestSuite(TestMetaphone.class));
      }
  
      public void setUp() throws Exception {        
          super.setUp();
          _metaphone = new Metaphone();
      }
  
      public void tearDown() throws Exception {
          super.tearDown();
          _metaphone = null;
      }
  
      // ------------------------------------------------------------------------
  
      public void testMetaphone() {
          assertEquals("TSTN",_metaphone.metaphone("testing"));
          assertEquals("0",_metaphone.metaphone("The"));
          assertEquals("KK",_metaphone.metaphone("quick"));
          assertEquals("BRN",_metaphone.metaphone("brown"));
          assertEquals("FKS",_metaphone.metaphone("fox"));
          assertEquals("JMPT",_metaphone.metaphone("jumped"));
          assertEquals("OFR",_metaphone.metaphone("over"));
          assertEquals("0",_metaphone.metaphone("the"));
          assertEquals("LS",_metaphone.metaphone("lazy"));
          assertEquals("TKS",_metaphone.metaphone("dogs"));
      }
  
      public void testIsMetaphoneEqual() {
          assertTrue(_metaphone.isMetaphoneEqual("Case","case"));
          assertTrue(_metaphone.isMetaphoneEqual("CASE","Case"));
          assertTrue(_metaphone.isMetaphoneEqual("caSe","cAsE"));
          
          assertTrue(_metaphone.isMetaphoneEqual("cookie","quick"));
          assertTrue(_metaphone.isMetaphoneEqual("quick","cookie"));
      }
  
      private Metaphone _metaphone = null;
  }
  
  
  
  1.3       +244 -6    jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/base64/Base64TestCase.java
  
  Index: Base64TestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/base64/Base64TestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Base64TestCase.java	28 Jan 2002 05:00:18 -0000	1.2
  +++ Base64TestCase.java	18 Nov 2002 12:41:24 -0000	1.3
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -58,15 +58,20 @@
    * <http://www.apache.org/>.
    *
    */
  -
   package org.apache.commons.codec.base64;
   
   
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  +import java.util.Arrays;
  +import java.util.Random;
   
  -
  +/**
  + * @version $Revision$ $Date$
  + * @author Scott Sanders
  + * @author Rodney Waldhoff
  + */
   public class Base64TestCase extends TestCase {
   
       /**
  @@ -110,5 +115,238 @@
           assertTrue("encoding hello world", encodedContent.equals("SGVsbG8gV29ybGQ="));
       }
   
  +    // encode/decode random arrays from size 0 to size 11
  +    public void testEncodeDecodeSmall() {
  +        for(int i=0;i<12;i++) {
  +            byte[] data = new byte[i];
  +            _random.nextBytes(data);
  +            byte[] enc =  Base64.encode(data);
  +            assertTrue("\"" + (new String(enc)) + "\" is Base64 data.",Base64.isBase64((new String(enc))));
  +            byte[] data2 = Base64.decode(enc);
  +            assertTrue(toString(data) + " equals " + toString(data2),Arrays.equals(data,data2));
  +        }
  +    }
  +
  +    // encode/decode a large random array
  +    public void testEncodeDecodeRandom() {
  +        for(int i=1;i<5;i++) {
  +            byte[] data = new byte[_random.nextInt(10000)+1];
  +            _random.nextBytes(data);
  +            byte[] enc =  Base64.encode(data);
  +            assertTrue(Base64.isBase64(new String(enc)));
  +            byte[] data2 = Base64.decode(enc);
  +            assertTrue(Arrays.equals(data,data2));
  +        }
  +    }
  +
  +    public void testSingletons() {
  +        assertEquals("AA==",new String(Base64.encode(new byte[] { (byte)0 })));
  +        assertEquals("AQ==",new String(Base64.encode(new byte[] { (byte)1 })));
  +        assertEquals("Ag==",new String(Base64.encode(new byte[] { (byte)2 })));
  +        assertEquals("Aw==",new String(Base64.encode(new byte[] { (byte)3 })));
  +        assertEquals("BA==",new String(Base64.encode(new byte[] { (byte)4 })));
  +        assertEquals("BQ==",new String(Base64.encode(new byte[] { (byte)5 })));
  +        assertEquals("Bg==",new String(Base64.encode(new byte[] { (byte)6 })));
  +        assertEquals("Bw==",new String(Base64.encode(new byte[] { (byte)7 })));
  +        assertEquals("CA==",new String(Base64.encode(new byte[] { (byte)8 })));
  +        assertEquals("CQ==",new String(Base64.encode(new byte[] { (byte)9 })));
  +        assertEquals("Cg==",new String(Base64.encode(new byte[] { (byte)10 })));
  +        assertEquals("Cw==",new String(Base64.encode(new byte[] { (byte)11 })));
  +        assertEquals("DA==",new String(Base64.encode(new byte[] { (byte)12 })));
  +        assertEquals("DQ==",new String(Base64.encode(new byte[] { (byte)13 })));
  +        assertEquals("Dg==",new String(Base64.encode(new byte[] { (byte)14 })));
  +        assertEquals("Dw==",new String(Base64.encode(new byte[] { (byte)15 })));
  +        assertEquals("EA==",new String(Base64.encode(new byte[] { (byte)16 })));
  +        assertEquals("EQ==",new String(Base64.encode(new byte[] { (byte)17 })));
  +        assertEquals("Eg==",new String(Base64.encode(new byte[] { (byte)18 })));
  +        assertEquals("Ew==",new String(Base64.encode(new byte[] { (byte)19 })));
  +        assertEquals("FA==",new String(Base64.encode(new byte[] { (byte)20 })));
  +        assertEquals("FQ==",new String(Base64.encode(new byte[] { (byte)21 })));
  +        assertEquals("Fg==",new String(Base64.encode(new byte[] { (byte)22 })));
  +        assertEquals("Fw==",new String(Base64.encode(new byte[] { (byte)23 })));
  +        assertEquals("GA==",new String(Base64.encode(new byte[] { (byte)24 })));
  +        assertEquals("GQ==",new String(Base64.encode(new byte[] { (byte)25 })));
  +        assertEquals("Gg==",new String(Base64.encode(new byte[] { (byte)26 })));
  +        assertEquals("Gw==",new String(Base64.encode(new byte[] { (byte)27 })));
  +        assertEquals("HA==",new String(Base64.encode(new byte[] { (byte)28 })));
  +        assertEquals("HQ==",new String(Base64.encode(new byte[] { (byte)29 })));
  +        assertEquals("Hg==",new String(Base64.encode(new byte[] { (byte)30 })));
  +        assertEquals("Hw==",new String(Base64.encode(new byte[] { (byte)31 })));
  +        assertEquals("IA==",new String(Base64.encode(new byte[] { (byte)32 })));
  +        assertEquals("IQ==",new String(Base64.encode(new byte[] { (byte)33 })));
  +        assertEquals("Ig==",new String(Base64.encode(new byte[] { (byte)34 })));
  +        assertEquals("Iw==",new String(Base64.encode(new byte[] { (byte)35 })));
  +        assertEquals("JA==",new String(Base64.encode(new byte[] { (byte)36 })));
  +        assertEquals("JQ==",new String(Base64.encode(new byte[] { (byte)37 })));
  +        assertEquals("Jg==",new String(Base64.encode(new byte[] { (byte)38 })));
  +        assertEquals("Jw==",new String(Base64.encode(new byte[] { (byte)39 })));
  +        assertEquals("KA==",new String(Base64.encode(new byte[] { (byte)40 })));
  +        assertEquals("KQ==",new String(Base64.encode(new byte[] { (byte)41 })));
  +        assertEquals("Kg==",new String(Base64.encode(new byte[] { (byte)42 })));
  +        assertEquals("Kw==",new String(Base64.encode(new byte[] { (byte)43 })));
  +        assertEquals("LA==",new String(Base64.encode(new byte[] { (byte)44 })));
  +        assertEquals("LQ==",new String(Base64.encode(new byte[] { (byte)45 })));
  +        assertEquals("Lg==",new String(Base64.encode(new byte[] { (byte)46 })));
  +        assertEquals("Lw==",new String(Base64.encode(new byte[] { (byte)47 })));
  +        assertEquals("MA==",new String(Base64.encode(new byte[] { (byte)48 })));
  +        assertEquals("MQ==",new String(Base64.encode(new byte[] { (byte)49 })));
  +        assertEquals("Mg==",new String(Base64.encode(new byte[] { (byte)50 })));
  +        assertEquals("Mw==",new String(Base64.encode(new byte[] { (byte)51 })));
  +        assertEquals("NA==",new String(Base64.encode(new byte[] { (byte)52 })));
  +        assertEquals("NQ==",new String(Base64.encode(new byte[] { (byte)53 })));
  +        assertEquals("Ng==",new String(Base64.encode(new byte[] { (byte)54 })));
  +        assertEquals("Nw==",new String(Base64.encode(new byte[] { (byte)55 })));
  +        assertEquals("OA==",new String(Base64.encode(new byte[] { (byte)56 })));
  +        assertEquals("OQ==",new String(Base64.encode(new byte[] { (byte)57 })));
  +        assertEquals("Og==",new String(Base64.encode(new byte[] { (byte)58 })));
  +        assertEquals("Ow==",new String(Base64.encode(new byte[] { (byte)59 })));
  +        assertEquals("PA==",new String(Base64.encode(new byte[] { (byte)60 })));
  +        assertEquals("PQ==",new String(Base64.encode(new byte[] { (byte)61 })));
  +        assertEquals("Pg==",new String(Base64.encode(new byte[] { (byte)62 })));
  +        assertEquals("Pw==",new String(Base64.encode(new byte[] { (byte)63 })));
  +        assertEquals("QA==",new String(Base64.encode(new byte[] { (byte)64 })));
  +        assertEquals("QQ==",new String(Base64.encode(new byte[] { (byte)65 })));
  +        assertEquals("Qg==",new String(Base64.encode(new byte[] { (byte)66 })));
  +        assertEquals("Qw==",new String(Base64.encode(new byte[] { (byte)67 })));
  +        assertEquals("RA==",new String(Base64.encode(new byte[] { (byte)68 })));
  +        assertEquals("RQ==",new String(Base64.encode(new byte[] { (byte)69 })));
  +        assertEquals("Rg==",new String(Base64.encode(new byte[] { (byte)70 })));
  +        assertEquals("Rw==",new String(Base64.encode(new byte[] { (byte)71 })));
  +        assertEquals("SA==",new String(Base64.encode(new byte[] { (byte)72 })));
  +        assertEquals("SQ==",new String(Base64.encode(new byte[] { (byte)73 })));
  +        assertEquals("Sg==",new String(Base64.encode(new byte[] { (byte)74 })));
  +        assertEquals("Sw==",new String(Base64.encode(new byte[] { (byte)75 })));
  +        assertEquals("TA==",new String(Base64.encode(new byte[] { (byte)76 })));
  +        assertEquals("TQ==",new String(Base64.encode(new byte[] { (byte)77 })));
  +        assertEquals("Tg==",new String(Base64.encode(new byte[] { (byte)78 })));
  +        assertEquals("Tw==",new String(Base64.encode(new byte[] { (byte)79 })));
  +        assertEquals("UA==",new String(Base64.encode(new byte[] { (byte)80 })));
  +        assertEquals("UQ==",new String(Base64.encode(new byte[] { (byte)81 })));
  +        assertEquals("Ug==",new String(Base64.encode(new byte[] { (byte)82 })));
  +        assertEquals("Uw==",new String(Base64.encode(new byte[] { (byte)83 })));
  +        assertEquals("VA==",new String(Base64.encode(new byte[] { (byte)84 })));
  +        assertEquals("VQ==",new String(Base64.encode(new byte[] { (byte)85 })));
  +        assertEquals("Vg==",new String(Base64.encode(new byte[] { (byte)86 })));
  +        assertEquals("Vw==",new String(Base64.encode(new byte[] { (byte)87 })));
  +        assertEquals("WA==",new String(Base64.encode(new byte[] { (byte)88 })));
  +        assertEquals("WQ==",new String(Base64.encode(new byte[] { (byte)89 })));
  +        assertEquals("Wg==",new String(Base64.encode(new byte[] { (byte)90 })));
  +        assertEquals("Ww==",new String(Base64.encode(new byte[] { (byte)91 })));
  +        assertEquals("XA==",new String(Base64.encode(new byte[] { (byte)92 })));
  +        assertEquals("XQ==",new String(Base64.encode(new byte[] { (byte)93 })));
  +        assertEquals("Xg==",new String(Base64.encode(new byte[] { (byte)94 })));
  +        assertEquals("Xw==",new String(Base64.encode(new byte[] { (byte)95 })));
  +        assertEquals("YA==",new String(Base64.encode(new byte[] { (byte)96 })));
  +        assertEquals("YQ==",new String(Base64.encode(new byte[] { (byte)97 })));
  +        assertEquals("Yg==",new String(Base64.encode(new byte[] { (byte)98 })));
  +        assertEquals("Yw==",new String(Base64.encode(new byte[] { (byte)99 })));
  +        assertEquals("ZA==",new String(Base64.encode(new byte[] { (byte)100 })));
  +        assertEquals("ZQ==",new String(Base64.encode(new byte[] { (byte)101 })));
  +        assertEquals("Zg==",new String(Base64.encode(new byte[] { (byte)102 })));
  +        assertEquals("Zw==",new String(Base64.encode(new byte[] { (byte)103 })));
  +        assertEquals("aA==",new String(Base64.encode(new byte[] { (byte)104 })));
  +    }
  +
  +    public void testTriplets() {
  +        assertEquals("AAAA",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)0 })));
  +        assertEquals("AAAB",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)1 })));
  +        assertEquals("AAAC",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)2 })));
  +        assertEquals("AAAD",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)3 })));
  +        assertEquals("AAAE",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)4 })));
  +        assertEquals("AAAF",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)5 })));
  +        assertEquals("AAAG",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)6 })));
  +        assertEquals("AAAH",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)7 })));
  +        assertEquals("AAAI",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)8 })));
  +        assertEquals("AAAJ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)9 })));
  +        assertEquals("AAAK",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)10 })));
  +        assertEquals("AAAL",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)11 })));
  +        assertEquals("AAAM",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)12 })));
  +        assertEquals("AAAN",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)13 })));
  +        assertEquals("AAAO",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)14 })));
  +        assertEquals("AAAP",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)15 })));
  +        assertEquals("AAAQ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)16 })));
  +        assertEquals("AAAR",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)17 })));
  +        assertEquals("AAAS",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)18 })));
  +        assertEquals("AAAT",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)19 })));
  +        assertEquals("AAAU",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)20 })));
  +        assertEquals("AAAV",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)21 })));
  +        assertEquals("AAAW",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)22 })));
  +        assertEquals("AAAX",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)23 })));
  +        assertEquals("AAAY",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)24 })));
  +        assertEquals("AAAZ",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)25 })));
  +        assertEquals("AAAa",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)26 })));
  +        assertEquals("AAAb",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)27 })));
  +        assertEquals("AAAc",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)28 })));
  +        assertEquals("AAAd",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)29 })));
  +        assertEquals("AAAe",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)30 })));
  +        assertEquals("AAAf",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)31 })));
  +        assertEquals("AAAg",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)32 })));
  +        assertEquals("AAAh",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)33 })));
  +        assertEquals("AAAi",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)34 })));
  +        assertEquals("AAAj",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)35 })));
  +        assertEquals("AAAk",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)36 })));
  +        assertEquals("AAAl",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)37 })));
  +        assertEquals("AAAm",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)38 })));
  +        assertEquals("AAAn",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)39 })));
  +        assertEquals("AAAo",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)40 })));
  +        assertEquals("AAAp",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)41 })));
  +        assertEquals("AAAq",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)42 })));
  +        assertEquals("AAAr",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)43 })));
  +        assertEquals("AAAs",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)44 })));
  +        assertEquals("AAAt",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)45 })));
  +        assertEquals("AAAu",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)46 })));
  +        assertEquals("AAAv",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)47 })));
  +        assertEquals("AAAw",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)48 })));
  +        assertEquals("AAAx",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)49 })));
  +        assertEquals("AAAy",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)50 })));
  +        assertEquals("AAAz",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)51 })));
  +        assertEquals("AAA0",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)52 })));
  +        assertEquals("AAA1",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)53 })));
  +        assertEquals("AAA2",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)54 })));
  +        assertEquals("AAA3",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)55 })));
  +        assertEquals("AAA4",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)56 })));
  +        assertEquals("AAA5",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)57 })));
  +        assertEquals("AAA6",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)58 })));
  +        assertEquals("AAA7",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)59 })));
  +        assertEquals("AAA8",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)60 })));
  +        assertEquals("AAA9",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)61 })));
  +        assertEquals("AAA+",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)62 })));
  +        assertEquals("AAA/",new String(Base64.encode(new byte[] { (byte)0, (byte)0, (byte)63 })));
  +    }
  +
  +    public void testKnownEncodings() {
  +        assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==",new String(Base64.encode("The quick brown fox jumped over the lazy dogs.".getBytes())));
  +        assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==",new String(Base64.encode("It was the best of times, it was the worst of times.".getBytes())));
  +        assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==",new String(Base64.encode("http://jakarta.apache.org/commmons".getBytes())));
  +        assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==",new String(Base64.encode("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())));
  +        assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=",new String(Base64.encode("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())));
  +        assertEquals("eHl6enkh",new String(Base64.encode("xyzzy!".getBytes())));
  +    }
  +
  +    public void testKnownDecodings() {
  +        assertEquals("The quick brown fox jumped over the lazy dogs.",new String(Base64.decode("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes())));
  +        assertEquals("It was the best of times, it was the worst of times.",new String(Base64.decode("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==".getBytes())));
  +        assertEquals("http://jakarta.apache.org/commmons",new String(Base64.decode("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==".getBytes())));
  +        assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",new String(Base64.decode("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==".getBytes())));
  +        assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }",new String(Base64.decode("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=".getBytes())));
  +        assertEquals("xyzzy!",new String(Base64.decode("eHl6enkh".getBytes())));
  +    }
  +
  +    // -------------------------------------------------------- Private Methods
  +
  +    private String toString(byte[] data) {
  +        StringBuffer buf = new StringBuffer();
  +        for(int i=0;i<data.length;i++) {
  +            buf.append(data[i]);
  +            if(i != data.length-1) {
  +                buf.append(",");
  +            }
  +        }
  +        return buf.toString();
  +    }
  +
  +    // ------------------------------------------------------------------------
  +
  +    private Random _random = new Random();
   
   }
  
  
  
  1.1                  jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/base64/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/test/org/apache/commons/codec/base64/TestAll.java,v 1.1 2002/11/18 12:41:24 rwaldhoff Exp $
   * $Revision: 1.1 $
   * $Date: 2002/11/18 12:41:24 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", 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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.codec.base64;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Entry point for Base64 tests.
   * @version $Revision: 1.1 $ $Date: 2002/11/18 12:41:24 $
   */
  public class TestAll extends TestCase {
      public TestAll(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          TestSuite suite = new TestSuite();
          suite.addTest(Base64TestCase.suite());
          return suite;
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message