cvs commit: jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java LogonUserTest.java
husted 2004/04/08 16:26:07 Modified:chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java LogonUserTest.java Log: Optimize imports Revision ChangesPath 1.3 +8 -10 jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/ChangeLocaleTest.java Index: ChangeLocaleTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/ChangeLocaleTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ChangeLocaleTest.java 29 Mar 2004 02:34:19 - 1.2 +++ ChangeLocaleTest.java 8 Apr 2004 23:26:07 - 1.3 @@ -23,7 +23,6 @@ import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; import org.apache.commons.chain.mailreader.MailReader; -import org.apache.commons.chain.mailreader.MailReaderBase; import org.apache.commons.chain.mailreader.commands.LocaleChange; import org.apache.commons.chain.impl.ContextBase; @@ -47,19 +46,18 @@ Locale expected = Locale.CANADA_FRENCH; Context input = new ContextBase(); -input.put(MailReader.PN_COUNTRY,CA); -input.put(MailReader.PN_LANGUAGE,FR); +input.put(MailReader.PN_COUNTRY, CA); +input.put(MailReader.PN_LANGUAGE, FR); -MailReader context = new MailReaderBase(original,input,null); +MailReader context = new MailReader(original, input, null); try { command.execute(context); -} -catch(Exception e) { +} catch (Exception e) { fail(e.getMessage()); } -assertEquals(Unexpected Locale,expected,context.getLocale()); +assertEquals(Unexpected Locale, expected, context.getLocale()); } 1.3 +19 -23 jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/LogonUserTest.java Index: LogonUserTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/LogonUserTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LogonUserTest.java29 Mar 2004 02:34:20 - 1.2 +++ LogonUserTest.java8 Apr 2004 23:26:07 - 1.3 @@ -24,7 +24,6 @@ import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; import org.apache.commons.chain.mailreader.MailReader; -import org.apache.commons.chain.mailreader.MailReaderBase; import org.apache.commons.chain.mailreader.commands.LogonUser; import org.apache.commons.chain.impl.ContextBase; import org.apache.struts.webapp.example.User; @@ -58,61 +57,58 @@ public void testJohnQ() { Context input = new ContextBase(); -input.put(MailReader.PN_USERNAME,USER); -input.put(MailReader.PN_PASSWORD,PASS); +input.put(MailReader.PN_USERNAME, USER); +input.put(MailReader.PN_PASSWORD, PASS); -MailReader context = new MailReaderBase(locale,input,database); +MailReader context = new MailReader(locale, input, database); try { command.execute(context); -} -catch(Exception e) { +} catch (Exception e) { fail(e.getMessage()); } User user = context.getUser(); -assertNotNull(Where's waldo?,user); -assertEquals(Who am I?,John Q. User,user.getFullName()); +assertNotNull(Where's waldo?, user); +assertEquals(Who am I?, John Q. User, user.getFullName()); } public void testInvalidPassword() { Context input = new ContextBase(); -input.put(MailReader.PN_USERNAME,USER); -input.put(MailReader.PN_PASSWORD,SezMe); +input.put(MailReader.PN_USERNAME, USER); +input.put(MailReader.PN_PASSWORD, SezMe); -MailReader context = new MailReaderBase(locale,input,database); +MailReader context = new MailReader(locale, input, database); try { command.execute(context); -} -catch(Exception e) { +} catch (Exception e) { fail(e.getMessage()); } User user = context.getUser(); -assertNull(Who's watching the store,user); +assertNull(Who's watching the store, user); } public void testInvalidUsername() { Context input = new ContextBase(); -input.put(MailReader.PN_USERNAME,zaphod); -input.put(MailReader.PN_PASSWORD,PASS); +input.put(MailReader.PN_USERNAME, zaphod); +
cvs commit: jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java
husted 2004/03/28 16:54:23 Added: chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java Log: Add LocaleChange test Revision ChangesPath 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/ChangeLocaleTest.java Index: ChangeLocaleTest.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader/ChangeLocaleTest.java,v 1.1 2004/03/29 00:54:23 husted Exp $ * $Revision: 1.1 $ * $Date: 2004/03/29 00:54:23 $ * * Copyright 2000-2004 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.mailreader; import junit.framework.TestCase; import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; import org.apache.commons.chain.mailreader.MailReader; import org.apache.commons.chain.mailreader.MailReaderBase; import org.apache.commons.chain.mailreader.commands.LocaleChange; import org.apache.commons.chain.impl.ContextBase; import java.util.Locale; /** */ public class ChangeLocaleTest extends TestCase { private Command command; public void setUp() { command = new LocaleChange(); } public void testCanadaFrench() { Locale original = Locale.US; Locale expected = Locale.CANADA_FRENCH; Context input = new ContextBase(); input.put(MailReader.PN_COUNTRY,CA); input.put(MailReader.PN_LANGUAGE,FR); MailReader context = new MailReaderBase(original,input); try { command.execute(context); } catch(Exception e) { fail(e.getMessage()); } assertEquals(Unexpected Locale,expected,context.getLocale()); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java LogonUserTest.java
husted 2004/03/28 18:34:20 Modified:chain/apps/mailreader project.xml chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader ClientContext.java MailReader.java MailReaderBase.java chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/commands LocaleChange.java chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts ActionHelper.java ActionHelperBase.java MailReaderAction.java chain/apps/mailreader/src/test/org/apache/commons/mailreader ChangeLocaleTest.java LogonUserTest.java Log: Implement code to pass LogonUser test. Test for failure. Revision ChangesPath 1.3 +6 -0 jakarta-commons-sandbox/chain/apps/mailreader/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/project.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- project.xml 26 Mar 2004 18:22:41 - 1.2 +++ project.xml 29 Mar 2004 02:34:19 - 1.3 @@ -27,6 +27,12 @@ !-- include in WAR -- + dependency +groupIdcommons-beanutils/groupId +artifactIdcommons-beanutils/artifactId +version1.6/version + /dependency + dependency groupIdcommons-collections/groupId artifactIdcommons-collections/artifactId 1.3 +16 -0 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/ClientContext.java Index: ClientContext.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/ClientContext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ClientContext.java29 Mar 2004 00:52:22 - 1.2 +++ ClientContext.java29 Mar 2004 02:34:19 - 1.3 @@ -23,8 +23,16 @@ */ public static String PN_LOCALE = locale; +/** + * pAssign Locale property/p + * @param locale New Locale + */ public void setLocale(Locale locale); +/** + * pReturn Locale property/p + * @return This Locale property + */ public Locale getLocale(); /** @@ -32,8 +40,16 @@ */ public static String PN_INPUT = input; +/** + * pAssign Input property/p + * @param context New Input context + */ public void setInput(Context context); +/** + * pReturn Input property./p + * @return This Input property + */ public Context getInput(); } 1.2 +38 -5 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/MailReader.java Index: MailReader.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/MailReader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MailReader.java 29 Mar 2004 00:52:22 - 1.1 +++ MailReader.java 29 Mar 2004 02:34:19 - 1.2 @@ -19,6 +19,9 @@ */ package org.apache.commons.chain.mailreader; +import org.apache.struts.webapp.example.UserDatabase; +import org.apache.struts.webapp.example.User; + /** * Application interface for MailReader Commands. @@ -35,8 +38,38 @@ */ static String PN_LANGUAGE = language; +/** + * Property name for username. + */ +static String PN_USERNAME = username; + +/** + * Property name for password. + */ +static String PN_PASSWORD = password; + +/** + * pReturn user database or null./p + * @return user database or null. + */ +public UserDatabase getDatabase(); -// Database -// User +/** + * pAssign user database./p + * @param database The new database instance + */ +public void setDatabase(UserDatabase database); + +/** + * pReturn current user, if any/p + * @return + */ +public User getUser(); + +/** + * pAssign current user./p + * @param user The new user + */ +public void setUser(User user); } 1.2 +42 -20 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/MailReaderBase.java Index: MailReaderBase.java === RCS file: