cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2004-06-12 Thread leosutic
leosutic2004/06/12 11:18:39

  Modified:validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Minor changes to JavaDocs.
  
  Revision  ChangesPath
  1.27  +11 -10
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- EmailTest.java8 Jun 2004 14:48:35 -   1.26
  +++ EmailTest.java12 Jun 2004 18:18:38 -  1.27
  @@ -151,8 +151,8 @@
  }
   
  /**
  -* pTests the e-mail validation with a dot at the end of 
  -* the address./p
  +* Tests the e-mail validation with a dot at the end of 
  +* the address.
   */
  public void testEmailWithDotEnd() throws ValidatorException {
 // Create bean to run test on.
  @@ -164,8 +164,8 @@
  }
   
   /**
  - * pTests the e-mail validation with an RCS-noncompliant character in
  - * the address./p
  + * Tests the e-mail validation with an RCS-noncompliant character in
  + * the address.
*/
   public void testEmailWithBogusCharacter() throws ValidatorException {
   // Create bean to run test on.
  @@ -199,10 +199,11 @@
   /**
* Write this test according to parts of RFC, as opposed to the type of 
character
* that is being tested.
  - * @throws ValidatorException
  - * 
  - * FIXME This test fails so disable it with a leading _ for 1.1.2 release.
  + *
  + * pbFIXME/b: This test fails so disable it with a leading _ for 1.1.2 
release.
* The real solution is to fix the email parsing.
  + *
  + * @throws ValidatorException
*/
   public void _testEmailUserName() throws ValidatorException {
   ValueBean info = new ValueBean();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-08-21 Thread rleland
rleland 2003/08/21 21:22:42

  Modified:validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Cleanup tests I had slightly misinterpreted RFC822 at first.
  
  Revision  ChangesPath
  1.18  +53 -23
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- EmailTest.java17 Aug 2003 04:21:05 -  1.17
  +++ EmailTest.java22 Aug 2003 04:22:42 -  1.18
  @@ -202,9 +202,9 @@
 valueTest(info, true);
   
 info.setValue([EMAIL PROTECTED]);
  -   valueTest(info, false);
  +   valueTest(info, true);
  info.setValue([EMAIL PROTECTED]);
  -   valueTest(info, false);
  +   valueTest(info,true);
  info.setValue([EMAIL PROTECTED]);
  valueTest(info, true);
   
  @@ -261,8 +261,6 @@
   /**
* Write this test according to parts of RFC, as opposed to the type of 
character
* that is being tested.
  - * According to RFC 1738 a user name can be composed of the following :
  - *  *[alpha | digit | $ | - | _ | . | +  | ! | * | ' | ( | 
) | , | % hex hex | ; | ? |  | = ]
   
* @throws ValidatorException
*/
  @@ -276,32 +274,64 @@
   valueTest(info, true);
   info.setValue([EMAIL PROTECTED]);
   valueTest(info, true);
  +
  +//UnQuoted Special characters are invalid
  +
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe'@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe(@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe)@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe,@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe;@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue(joe@apache.org);
  -valueTest(info, true);
  +valueTest(info, false);
   info.setValue([EMAIL PROTECTED]);
  +valueTest(info, false);
  +
  +//Quoted Special characters are valid
  +info.setValue(\joe.\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe+\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe!\@apache.org);
   valueTest(info, true);
  +info.setValue(\joe*\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe'\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe(\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe)\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe,\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe%45\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe;\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe?\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe\@apache.org);
  +valueTest(info, true);
  +info.setValue(\joe=\@apache.org);
  +valueTest(info, true);
  +
   
   }
   
  @@ -313,7 +343,7 @@
   * @param infoValue to run test on.
   * @param passed  Whether or not the test is expected to pass.
  */
  -   private void valueTest(Object info, boolean passed) throws ValidatorException {
  +   private void valueTest(ValueBean info, boolean passed) throws ValidatorException 
{
 // Construct validator based on the loaded resources 
 // and the form key
 Validator validator = new Validator(resources, FORM_KEY);
  @@ -335,7 +365,7 @@
 ValidatorResult result = results.getValidatorResult(value);
   
 assertNotNull(ACTION +  value ValidatorResult should not be null., result);
  -  assertTrue(ValidatorResult should contain the ' + ACTION +' action., 
result.containsAction(ACTION));
  -  

cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-08-16 Thread rleland
rleland 2003/08/16 21:21:05

  Modified:validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Bug 22124
  
  Add tests so Email validation will fail.
  These tests test for all special characters allowed in the users
  part of the email. Both serverside java and javascript need to be fixed.
  
  Revision  ChangesPath
  1.17  +73 -17
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- EmailTest.java12 Aug 2003 00:29:34 -  1.16
  +++ EmailTest.java17 Aug 2003 04:21:05 -  1.17
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -36,7 +36,7 @@
*
* 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.
  + *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
  @@ -77,6 +77,7 @@
*
* @author David Winterfeldt
* @author David Graham
  + * @author Rob Leland
* @version $Revision$ $Date$
   */   
   public class EmailTest extends TestCase {
  @@ -200,8 +201,12 @@
 info.setValue([EMAIL PROTECTED]);
 valueTest(info, true);
   
  -  info.setValue([EMAIL PROTECTED]);
  -  valueTest(info, true);
  +  info.setValue([EMAIL PROTECTED]);
  +   valueTest(info, false);
  +   info.setValue([EMAIL PROTECTED]);
  +   valueTest(info, false);
  +   info.setValue([EMAIL PROTECTED]);
  +   valueTest(info, true);
   
   
  }
  @@ -241,15 +246,66 @@
  /**
   * Tests the email validation with commas.
   */
  -   public void testEmailWithCommas() throws ValidatorException {
  -  ValueBean info = new ValueBean();
  -  info.setValue(joe,[EMAIL PROTECTED]);
  -  valueTest(info, false);
  -  info.setValue([EMAIL PROTECTED],che.org);
  -  valueTest(info, false);
  -  info.setValue([EMAIL PROTECTED],rg);
  -  valueTest(info, false);
  -   }
  +
  +public void testEmailWithCommas() throws ValidatorException {
  +   ValueBean info = new ValueBean();
  +   info.setValue([EMAIL PROTECTED],che.org);
  +   valueTest(info, false);
  +   info.setValue([EMAIL PROTECTED],rg);
  +   valueTest(info, false);
  +info.setValue([EMAIL PROTECTED],org);
  +valueTest(info, false);
  +
  +}
  +
  +/**
  + * Write this test according to parts of RFC, as opposed to the type of 
character
  + * that is being tested.
  + * According to RFC 1738 a user name can be composed of the following :
  + *  *[alpha | digit | $ | - | _ | . | +  | ! | * | ' | ( | 
) | , | % hex hex | ; | ? |  | = ]
  +
  + * @throws ValidatorException
  + */
  +public void testEmailUserName() throws ValidatorException {
  +   ValueBean info = new ValueBean();
  +   info.setValue([EMAIL PROTECTED]);
  +   valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue(joe'@apache.org);
  +valueTest(info, true);
  +info.setValue(joe(@apache.org);
  +valueTest(info, true);
  +info.setValue(joe)@apache.org);
  +valueTest(info, true);
  +info.setValue(joe,@apache.org);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue(joe;@apache.org);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +info.setValue(joe@apache.org);
  +valueTest(info, true);
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
  +
  +}
  +
  +
   
  /**
   * Utlity class to 

cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-06-14 Thread dgraham
dgraham 2003/06/14 11:49:03

  Modified:validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Added test for '+' in email address.
  
  Revision  ChangesPath
  1.14  +7 -4  
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- EmailTest.java28 May 2003 04:28:00 -  1.13
  +++ EmailTest.java14 Jun 2003 18:49:03 -  1.14
  @@ -232,6 +232,9 @@
   // The ' character is valid in an email address.
info.setValue(andy.o'[EMAIL PROTECTED]);
valueTest(info, true);
  +
  +info.setValue([EMAIL PROTECTED]);
  +valueTest(info, true);
   }
  
  /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-03-12 Thread dgraham
dgraham 2003/03/12 18:26:25

  Modified:validator/src/share/org/apache/commons/validator
GenericValidator.java
   validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Added test and fixed comma problem for PR #17219.
  
  Revision  ChangesPath
  1.11  +11 -8 
jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java
  
  Index: GenericValidator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- GenericValidator.java 20 Jan 2003 06:50:26 -  1.10
  +++ GenericValidator.java 13 Mar 2003 02:26:25 -  1.11
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -76,7 +76,7 @@
* @author David Winterfeldt
* @author James Turner
* @version $Revision$ $Date$
  -*/
  + */
   public class GenericValidator implements Serializable {
   
   /**
  @@ -499,8 +499,11 @@
// Make sure there's a host name preceding the domain.
if (len  2) {
   bValid = false;
  - }
  -  }  
  + } 
  + 
  +  } else {
  +bValid = false; 
  +  }  
   }
  } catch (Exception e) {
 bValid = false;
  
  
  
  1.8   +18 -5 
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EmailTest.java13 Mar 2003 02:09:23 -  1.7
  +++ EmailTest.java13 Mar 2003 02:26:25 -  1.8
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -223,6 +223,19 @@
 info.setValue([EMAIL PROTECTED]);
 valueTest(info, false);
   
  +   }
  +   
  +   /**
  +* Tests the email validation with commas.
  +*/
  +   public void testEmailWithCommas() throws ValidatorException {
  +  ValueBean info = new ValueBean();
  +  info.setValue(joe,[EMAIL PROTECTED]);
  +  valueTest(info, false);
  +  info.setValue([EMAIL PROTECTED],che.org);
  +  valueTest(info, false);
  +  info.setValue([EMAIL PROTECTED],rg);
  +  valueTest(info, false);
  }
   
  /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-01-19 Thread turner
turner  2003/01/19 22:28:37

  Modified:validator/src/share/org/apache/commons/validator
GenericValidator.java
   validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Fixes bug 15898
  
  Dots at the end of domain names
  
  Revision  ChangesPath
  1.9   +9 -4  
jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java
  
  Index: GenericValidator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GenericValidator.java 16 Oct 2002 22:17:31 -  1.8
  +++ GenericValidator.java 20 Jan 2003 06:28:37 -  1.9
  @@ -424,8 +424,13 @@
  // Check the whole email address structure
  bValid = matchEmailPat.match(emailPat, value);
   
  +if (value.endsWith(.)) {
  +bValid = false;
  +}
  +
  // Check the user component of the email address
  if (bValid) {
  +
 String user = matchEmailPat.group(1);
 
 // See if user is valid 
  
  
  
  1.5   +17 -4 
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EmailTest.java15 Dec 2002 21:46:41 -  1.4
  +++ EmailTest.java20 Jan 2003 06:28:37 -  1.5
  @@ -200,6 +200,19 @@
  }
   
  /**
  +* pTests the e-mail validation with a dot at the end of 
  +* the address./p
  +   */
  +   public void testEmailWithDotEnd() throws ValidatorException {
  +  // Create bean to run test on.
  +  ValueBean info = new ValueBean();
  +
  +  info.setValue([EMAIL PROTECTED]);
  +  valueTest(info, false);
  +
  +   }
  +
  +   /**
   * Utlity class to run a test on a value.
   *
   * @param infoValue to run test on.
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator EmailTest.java

2003-01-19 Thread turner
turner  2003/01/19 22:50:27

  Modified:validator/src/share/org/apache/commons/validator
GenericValidator.java
   validator/src/test/org/apache/commons/validator
EmailTest.java
  Log:
  Fixes bug 16198 , non-ascii characters are now blocked in e-Mail addresses
  
  Revision  ChangesPath
  1.10  +10 -4 
jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java
  
  Index: GenericValidator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- GenericValidator.java 20 Jan 2003 06:28:37 -  1.9
  +++ GenericValidator.java 20 Jan 2003 06:50:26 -  1.10
  @@ -406,6 +406,7 @@
  String word = ( + atom + | + quotedUser + );
   
  // Each pattern must be surrounded by /
  +String legalAsciiPat = getDelimittedRegexp(^[\\000-\\177]+$);
  String emailPat = getDelimittedRegexp(^(.+)@(.+)$);
  String ipDomainPat = 
getDelimittedRegexp(^(\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})[.](\\d{1,3})$);
  String userPat = getDelimittedRegexp(^ + word + (\\. + word + )*$);
  @@ -417,10 +418,15 @@
  Perl5Util matchIPPat = new Perl5Util();
  Perl5Util matchDomainPat = new Perl5Util();
  Perl5Util matchAtomPat = new Perl5Util();
  +   Perl5Util matchAsciiPat = new Perl5Util();

  boolean ipAddress = false;
  boolean symbolic = false;

  +if (!matchAsciiPat.match(legalAsciiPat, value)) {
  +return false;
  +}
  +
  // Check the whole email address structure
  bValid = matchEmailPat.match(emailPat, value);
   
  
  
  
  1.6   +17 -4 
jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java
  
  Index: EmailTest.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/EmailTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EmailTest.java20 Jan 2003 06:28:37 -  1.5
  +++ EmailTest.java20 Jan 2003 06:50:26 -  1.6
  @@ -213,6 +213,19 @@
  }
   
  /**
  +* pTests the e-mail validation with an RCS-noncompliant character in 
  +* the address./p
  +   */
  +   public void testEmailWithBogusCharacter() throws ValidatorException {
  +  // Create bean to run test on.
  +  ValueBean info = new ValueBean();
  +
  +  info.setValue(andy.noble@\u008fdata-workshop.com);
  +  valueTest(info, false);
  +
  +   }
  +
  +   /**
   * Utlity class to run a test on a value.
   *
   * @param infoValue to run test on.
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]