mocklib-checkins Mailing List for mocklib (Page 5)
Brought to you by:
bittwidler,
fastdragon
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(1) |
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(54) |
Feb
(120) |
Mar
(31) |
Apr
(11) |
May
(8) |
Jun
(5) |
Jul
|
Aug
(22) |
Sep
(295) |
Oct
(6) |
Nov
(10) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(8) |
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
(8) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
(17) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: dadrox <da...@us...> - 2006-09-12 15:02:19
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10986/input/javasrc/biz/xsoftware/impl/mock Modified Files: MockSuperclass.java Log Message: added some convenience methods to the interface Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockSuperclass.java 12 Sep 2006 02:20:58 -0000 1.1 --- MockSuperclass.java 12 Sep 2006 15:02:11 -0000 1.2 *************** *** 120,123 **** --- 120,128 ---- } + public void addIgnore(String method) + { + addIgnore(method, new Class[] {}); + } + public void addIgnore(String method, Class ... argTypes) { *************** *** 125,128 **** --- 130,138 ---- } + public void removeIgnore(String method) + { + removeIgnore(method, new Class[] {}); + } + public void removeIgnore(String method, Class ... argTypes) { *************** *** 497,500 **** --- 507,515 ---- } } + + public void setDefaultBehavior(Behavior b, String method) + { + setDefaultBehavior(b, method, new Class[] {}); + } public void setDefaultBehavior(Behavior b, String method, Class... argTypes) { *************** *** 504,507 **** --- 519,527 ---- methodToDefaultRetVal.put(method, new BehaviorInfo(b)); } + + public void setDefaultReturnValue(Object returnValue, String method) + { + setDefaultReturnValue(returnValue, method, new Class[] {}); + } public void setDefaultReturnValue(Object o, String method, Class... argTypes) { *************** *** 510,513 **** --- 530,538 ---- methodToDefaultRetVal.put(method, new ReturnValue(o)); } + + public void addBehavior(Behavior behavior, String method) + { + addBehavior(behavior, method, new Class[] {}); + } public void addBehavior(Behavior behavior, String method, Class... argTypes) { *************** *** 547,550 **** --- 572,580 ---- } + public void addThrowException(Throwable e, String method) + { + addThrowException(e, method, new Class[] {}); + } + /** * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.Throwable, java.lang.String, Class...) *************** *** 557,560 **** --- 587,596 ---- } + + public void addReturnValue(Object o, String method) + { + addReturnValue(o, method, new Class[] {}); + } + /** * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.Object, java.lang.String, Class...) |
From: Nobody <fas...@us...> - 2006-09-12 14:35:57
|
Update of /cvsroot/mocklib/gwtmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32185/bldfiles Modified Files: build.xml Log Message: fix the gwt.xml file delivery to work. Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 12 Sep 2006 05:06:21 -0000 1.4 --- build.xml 12 Sep 2006 14:35:50 -0000 1.5 *************** *** 391,395 **** <!-- Put all implementation classes from ${build} into the jar file --> <jar jarfile="${jardist}/${jar.name}" manifest="${manifest}/MANIFEST.MF"> ! <fileset dir="${build}" includes="**/*.class"/> <fileset dir="${javacode}" includes="**/*.java"/> </jar> --- 391,395 ---- <!-- Put all implementation classes from ${build} into the jar file --> <jar jarfile="${jardist}/${jar.name}" manifest="${manifest}/MANIFEST.MF"> ! <fileset dir="${build}" includes="**/*"/> <fileset dir="${javacode}" includes="**/*.java"/> </jar> |
From: Nobody <fas...@us...> - 2006-09-12 13:28:07
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/timer2 In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3813/input/javasrc/biz/xsoftware/examples/timer2 Modified Files: TestExample.java Added Files: CalendarServiceImpl.java CalendarService.java Removed Files: SysUnderTest.java Log Message: change timer example to be CalendarService. --- NEW FILE: CalendarServiceImpl.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.timer2; import java.util.HashMap; import java.util.Map; import java.util.TimerTask; import javax.swing.event.EventListenerList; import biz.xsoftware.examples.timer.ScheduleListener; /** * The SysUnderTest here is a Calendar which notifies users of a * scheduled event. */ public class CalendarServiceImpl implements CalendarService { private TimerInterface timer; private EventListenerList listenerList = new EventListenerList(); private Map<String, CalendarEvent> titleToEvent = new HashMap<String, CalendarEvent>(); /** * @showcode */ public CalendarServiceImpl(TimerInterface t) { timer = t; } /* (non-Javadoc) * @see biz.xsoftware.examples.timer2.CalendarService#addEvent(java.lang.String, long) */ public void addEvent(String title, long delay) { CalendarEvent evt = new CalendarEvent(title); titleToEvent.put(title, evt); timer.schedule(evt, delay); } /* (non-Javadoc) * @see biz.xsoftware.examples.timer2.CalendarService#addScheduleListener(biz.xsoftware.examples.timer.ScheduleListener) */ public void addScheduleListener(ScheduleListener l) { listenerList.add(ScheduleListener.class, l); } /* (non-Javadoc) * @see biz.xsoftware.examples.timer2.CalendarService#removeScheduleListener(biz.xsoftware.examples.timer.ScheduleListener) */ public void removeScheduleListener(ScheduleListener l) { listenerList.remove(ScheduleListener.class, l); } private class CalendarEvent extends TimerTask { private String title; /** * @showcode */ public CalendarEvent(String title) { this.title = title; } /** * @showcode */ @Override public void run() { fireEventStarted(title); } } /** * @showcode */ protected void fireEventStarted(String title) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==ScheduleListener.class) { ((ScheduleListener)listeners[i+1]).eventStarted(title); } } } /* (non-Javadoc) * @see biz.xsoftware.examples.timer2.CalendarService#cancelEvent(java.lang.String) */ public void cancelEvent(String title) { CalendarEvent event = titleToEvent.get(title); timer.cancelTask(event); } } Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/timer2/TestExample.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestExample.java 11 Sep 2006 03:47:39 -0000 1.3 --- TestExample.java 12 Sep 2006 13:27:56 -0000 1.4 *************** *** 35,39 **** private MockObject mockListener; private MockObject mockTimer; ! private SysUnderTest calendar; /** --- 35,39 ---- private MockObject mockListener; private MockObject mockTimer; ! private CalendarService calendar; /** *************** *** 50,54 **** //Create a mockTimer which acts as a cache for TimerTasks..... mockTimer = MockObjectFactory.createMock(TimerInterface.class); ! calendar = new SysUnderTest((TimerInterface) mockTimer); //Create and add a mockListener which we use to verify receiving of the --- 50,54 ---- //Create a mockTimer which acts as a cache for TimerTasks..... mockTimer = MockObjectFactory.createMock(TimerInterface.class); ! calendar = new CalendarServiceImpl((TimerInterface) mockTimer); //Create and add a mockListener which we use to verify receiving of the --- SysUnderTest.java DELETED --- --- NEW FILE: CalendarService.java --- package biz.xsoftware.examples.timer2; import biz.xsoftware.examples.timer.ScheduleListener; public interface CalendarService { public abstract void addEvent(String title, long delay); public abstract void cancelEvent(String title); public abstract void addScheduleListener(ScheduleListener l); public abstract void removeScheduleListener(ScheduleListener l); } |
From: Nobody <fas...@us...> - 2006-09-12 13:28:06
|
Update of /cvsroot/mocklib/mocklib3/input/staging In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3813/input/staging Modified Files: index.html Log Message: change timer example to be CalendarService. Index: index.html =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/staging/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 12 Sep 2006 03:28:58 -0000 1.3 --- index.html 12 Sep 2006 13:27:56 -0000 1.4 *************** *** 8,12 **** This is a very small library but powerful enough to create most of your mockobjects for you. The ones it can't create, you can leverage the library to create. <br/><br/> ! <a href="http://sourceforge.net/projects/mockobject">MockLib</a> <br/><br/> <a href="http://sourceforge.net/project/showfiles.php?group_id=134303&package_id=151809">Download MockLib library plus these web pages</a> --- 8,12 ---- This is a very small library but powerful enough to create most of your mockobjects for you. The ones it can't create, you can leverage the library to create. <br/><br/> ! <a href="http://sourceforge.net/projects/mocklib">MockLib</a> <br/><br/> <a href="http://sourceforge.net/project/showfiles.php?group_id=134303&package_id=151809">Download MockLib library plus these web pages</a> |
From: Nobody <fas...@us...> - 2006-09-12 05:06:24
|
Update of /cvsroot/mocklib/gwtmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22950/bldfiles Modified Files: build.xml Log Message: make sure source code is in the jar for gwtmocklib Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/build.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build.xml 12 Sep 2006 05:02:09 -0000 1.3 --- build.xml 12 Sep 2006 05:06:21 -0000 1.4 *************** *** 390,395 **** <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF"> ! </jar> --- 390,396 ---- <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.name}" manifest="${manifest}/MANIFEST.MF"> ! <fileset dir="${build}" includes="**/*.class"/> ! <fileset dir="${javacode}" includes="**/*.java"/> </jar> |
From: Nobody <fas...@us...> - 2006-09-12 05:02:13
|
Update of /cvsroot/mocklib/gwtmocklib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20919 Modified Files: .cvsignore Log Message: finish commit Index: .cvsignore =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 12 Sep 2006 01:21:03 -0000 1.1 --- .cvsignore 12 Sep 2006 05:02:10 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- output tomcat + eclipsegen |
From: Nobody <fas...@us...> - 2006-09-12 05:02:13
|
Update of /cvsroot/mocklib/gwtmocklib/input/libinclude In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20919/input/libinclude Removed Files: gwt-user.jar Log Message: finish commit --- gwt-user.jar DELETED --- |
From: Nobody <fas...@us...> - 2006-09-12 05:02:12
|
Update of /cvsroot/mocklib/gwtmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20919/bldfiles Modified Files: build.xml Log Message: finish commit Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.xml 12 Sep 2006 05:00:23 -0000 1.2 --- build.xml 12 Sep 2006 05:02:09 -0000 1.3 *************** *** 390,394 **** <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF" /> <verifydesign jar="${jardist}/${jar.name}" design="bldfiles/design.xml" /> --- 390,396 ---- <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF"> ! ! </jar> <verifydesign jar="${jardist}/${jar.name}" design="bldfiles/design.xml" /> |
Update of /cvsroot/mocklib/gwtmocklib/tools/gwt In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/tools/gwt Modified Files: gwt-user.jar gwt-dev-windows.jar Added Files: libswt-pi-gtk-3139.so libgwt-ll.so libswt-gtk-3139.so libswt-mozilla-gtk-3139.so Log Message: finishing up gwtmocklib --- NEW FILE: libswt-mozilla-gtk-3139.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-gtk-3139.so --- (This appears to be a binary file; contents omitted.) Index: gwt-dev-windows.jar =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/tools/gwt/gwt-dev-windows.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsI3AC5g and /tmp/cvsEtBtiZ differ --- NEW FILE: libgwt-ll.so --- (This appears to be a binary file; contents omitted.) Index: gwt-user.jar =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/tools/gwt/gwt-user.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsHIGWLj and /tmp/cvsECJSW2 differ --- NEW FILE: libswt-pi-gtk-3139.so --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-12 05:00:33
|
Update of /cvsroot/mocklib/gwtmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/bldfiles Modified Files: build.xml ant.properties design.xml directory.properties Log Message: finishing up gwtmocklib Index: design.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/design.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** design.xml 12 Sep 2006 01:21:03 -0000 1.1 --- design.xml 12 Sep 2006 05:00:23 -0000 1.2 *************** *** 11,27 **** <package name="manifest" package="biz.xsoftware.manifest" needdeclarations="true" subpackages="include" needdepends="false"/> - <package name="junit" package="junit" subpackages="include" needdeclarations="false"/> - <package name="mocklib" package="biz.xsoftware.mock" subpackages="include" needdeclarations="false"/> ! <!-- should erase the following... --> ! <package name="biz" package="biz" subpackages="include" needdepends="false"/> ! <package name="com" package="com" subpackages="include" needdepends="false"/> ! <package name="org" package="org" subpackages="include" needdepends="false"/> ! <package name="net" package="net" subpackages="include" needdepends="false"/> ! <!-- should use something like this instead on a per project basis --> ! <package name="api" package="biz.xsoftware.api" subpackages="include"/> ! <package name="testapi" package="biz.xsoftware.test" subpackages="include" depends="api"/> ! <package name="impl" package="biz.xsoftware.impl" subpackages="include" depends="api"/> </design> --- 11,33 ---- <package name="manifest" package="biz.xsoftware.manifest" needdeclarations="true" subpackages="include" needdepends="false"/> ! <package name="google" package="com.google.gwt.junit.client"/> ! <package name="google2" package="com.google.gwt.core.client"/> ! <package name="google3" package="com.google.gwt.user.client.ui"/> ! <package name="gwtmocklib" package="biz.xsoftware.mock.client"> ! <depends>google2</depends> ! </package> ! ! <package name="test" package="biz.xsoftware.mock.client.test"> ! <depends>gwtmocklib</depends> ! <depends>google</depends> ! </package> ! ! <package name="example" package="biz.xsoftware.mock.client.example1"> ! <depends>gwtmocklib</depends> ! <depends>google</depends> ! <depends>google3</depends> ! </package> </design> Index: ant.properties =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/ant.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ant.properties 12 Sep 2006 01:21:03 -0000 1.1 --- ant.properties 12 Sep 2006 05:00:23 -0000 1.2 *************** *** 3,7 **** #----------------------------------------------------------------------- ! name =gwtrpc #used as the jar file name(ie. ${name}.jar) #used as zip file name(ie. ${name}-version.jar) --- 3,7 ---- #----------------------------------------------------------------------- ! name =gwtmocklib #used as the jar file name(ie. ${name}.jar) #used as zip file name(ie. ${name}-version.jar) Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.xml 12 Sep 2006 01:21:03 -0000 1.1 --- build.xml 12 Sep 2006 05:00:23 -0000 1.2 *************** *** 3,7 **** Run "ant -projecthelp" to view all the possible targets and descriptions. --> ! <project name="std_buildfile" default="all" basedir=".."> <!-- Now allow any of the properties to be overridden --> --- 3,7 ---- Run "ant -projecthelp" to view all the possible targets and descriptions. --> ! <project name="std_buildfile" default="release" basedir=".."> <!-- Now allow any of the properties to be overridden --> *************** *** 62,65 **** --- 62,72 ---- <property name="checkstyle.dir" value="${tool.dir}/checkstyle" /> + <property name="java2html.location" location="${tool.dir}/ant-java2html" /> + <path id="java2html.lib"> + <fileset dir="${java2html.location}"> + <include name="**/*.jar" /> + </fileset> + </path> + <property name="osgi.location" location="${tool.dir}/ant-osgi" /> <path id="osgi.ant.lib"> *************** *** 68,71 **** --- 75,79 ---- </fileset> </path> + <!-- *********************************************************************** *************** *** 108,111 **** --- 116,120 ---- <fileset dir="${codecov.jar}" includes="**/*.jar" /> <!--pathelement location="${codecov.temp}"/--> + <pathelement location="${javacode}" /> <path refid="tool.and.lib" /> <path refid="classes.classpath" /> *************** *** 122,127 **** </tstamp> <!-- Override this property to build official release --> ! <property name="version" value="0.0.0" /> <echo message="***************************USING THIS ANT************************" /> <echo message="ant.home=${ant.home}" /> --- 131,140 ---- </tstamp> + <input message="Please enter the version number such as r1-0-1, etc." addproperty="version" /> + <input message="Please enter your sourceforge username" addproperty="user" /> + <input message="Please enter your sourceforge password" addproperty="password" /> + <!-- Override this property to build official release --> ! <property name="version" value="Developer-Build" /> <echo message="***************************USING THIS ANT************************" /> <echo message="ant.home=${ant.home}" /> *************** *** 146,154 **** </taskdef> <taskdef name="bundleinfo" classname="org.knopflerfish.ant.taskdefs.bundle.BundleInfoTask" classpathref="osgi.ant.lib" /> <taskdef name="bundlemanifest" classname="org.knopflerfish.ant.taskdefs.bundle.BundleManifestTask" classpathref="osgi.ant.lib" /> <taskdef name="bundlehtml" classname="org.knopflerfish.ant.taskdefs.bundle.BundleHTMLExtractorTask" classpathref="osgi.ant.lib" /> <taskdef name="bundleobr" classname="org.knopflerfish.ant.taskdefs.bundle.OBRExtractorTask" classpathref="osgi.ant.lib" /> - </target> --- 159,168 ---- </taskdef> + <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpathref="java2html.lib" /> + <taskdef name="bundleinfo" classname="org.knopflerfish.ant.taskdefs.bundle.BundleInfoTask" classpathref="osgi.ant.lib" /> <taskdef name="bundlemanifest" classname="org.knopflerfish.ant.taskdefs.bundle.BundleManifestTask" classpathref="osgi.ant.lib" /> <taskdef name="bundlehtml" classname="org.knopflerfish.ant.taskdefs.bundle.BundleHTMLExtractorTask" classpathref="osgi.ant.lib" /> <taskdef name="bundleobr" classname="org.knopflerfish.ant.taskdefs.bundle.OBRExtractorTask" classpathref="osgi.ant.lib" /> </target> *************** *** 165,170 **** <mkdir dir="${lib}" /> <mkdir dir="${libexclude}" /> ! <mkdir dir="${native}" /> ! <mkdir dir="${schemas}" /> <mkdir dir="${jardist}" /> --- 179,183 ---- <mkdir dir="${lib}" /> <mkdir dir="${libexclude}" /> ! <mkdir dir="${staging.in}" /> <mkdir dir="${jardist}" /> *************** *** 177,181 **** <pathelement path="${jardist}" /> </path> - </target> --- 190,193 ---- *************** *** 203,208 **** </javac> ! <property name="gwt.module" value="com.google.gwt.sample.dynatable.DynaTable"/> ! <!-- compile java to javascript here --> <java failonerror="true" classname="com.google.gwt.dev.GWTCompiler" fork="true"> --- 215,220 ---- </javac> ! <property name="gwt.module" value="biz.xsoftware.mock.MockLib" /> ! <!-- compile java to javascript here --> <java failonerror="true" classname="com.google.gwt.dev.GWTCompiler" fork="true"> *************** *** 241,263 **** <pathconvert pathsep="\r\n" property="have.rmi.files" refid="rmi.fileset" setonempty="false" /> </target> - <!-- - *********************************************************************** - GWT SHELL - *********************************************************************** - --> - <target name="gwtShell" depends="compile"> - <echo message="HELLLLLLO"/> - <java failonerror="true" classname="com.google.gwt.dev.GWTShell" fork="true"> - <classpath> - <pathelement path="${javacode}" /> - <pathelement path="${build}"/> - <path refid="gwt" /> - </classpath> - <arg value="-out" /> - <arg value="output/gwt" /> - <arg value="${gwt.module}/index.html" /> - </java> - </target> <!-- *********************************************************************** --- 253,257 ---- *************** *** 305,313 **** <mkdir dir="${manifest}" /> - <!-- convert cvs tag to osgi compatible version number --> - <propertyregex property="tmp10" input="${version}" regexp="-" replace="." defaultValue="${version}" /> - <propertyregex property="realVersion" input="${tmp10}" regexp="r" replace="" defaultValue="${version}" /> - <echo message="v=${realVersion}" /> - <property name="bundle.uuid" value="biz.xsoftware:${name}:${version}:all" /> <property name="ee.check.foundation" value="false" /> --- 299,302 ---- *************** *** 315,324 **** <!--generate classpath to add to manifest using all jars in lib and main jar--> ! <pathconvert dirsep="/" pathsep="," property="manifest.classpath" refid="lib.include" setonempty="true"> <!--The map takes away the beginning of the path just leaving the jar file name --> <map from="${full.lib.path}${file.separator}" to="" /> </pathconvert> ! <property name="bundle.classpath" value=".,${manifest.classpath}" /> <echo message="bundle.classpath=${bundle.classpath}" /> --- 304,313 ---- <!--generate classpath to add to manifest using all jars in lib and main jar--> ! <pathconvert dirsep="/" pathsep="," property="osgi.classpath" refid="lib.include" setonempty="true"> <!--The map takes away the beginning of the path just leaving the jar file name --> <map from="${full.lib.path}${file.separator}" to="" /> </pathconvert> ! <property name="bundle.classpath" value=".,${osgi.classpath}" /> <echo message="bundle.classpath=${bundle.classpath}" /> *************** *** 339,343 **** <attribute name="Bundle-Name" value="${name}" /> <attribute name="Bundle-SymbolicName" value="${name}" /> ! <attribute name="Bundle-Version" value="${realVersion}" /> <attribute name="Bundle-Description" value="${manifest.description}" /> <attribute name="Bundle-Vendor" value="${manifest.vendor}" /> --- 328,332 ---- <attribute name="Bundle-Name" value="${name}" /> <attribute name="Bundle-SymbolicName" value="${name}" /> ! <attribute name="Bundle-Version" value="${version}" /> <attribute name="Bundle-Description" value="${manifest.description}" /> <attribute name="Bundle-Vendor" value="${manifest.vendor}" /> *************** *** 361,366 **** <attribute name="Built-By" value="${manifest.builder}" /> ! <!--can't do this with osgi, nor war files probably --> ! <!--attribute name="Main-Class" value="biz.xsoftware.manifest.ManifestInfo"/--> <attribute name="Class-Path" value="${manifest.classpath}" /> <!-- --- 350,354 ---- <attribute name="Built-By" value="${manifest.builder}" /> ! <attribute name="Main-Class" value="biz.xsoftware.manifest.ManifestInfo" /> <attribute name="Class-Path" value="${manifest.classpath}" /> <!-- *************** *** 387,415 **** </target> - <target name="copyForJar" depends="manifest"> - <echo message="osgi.enabled=${osgi.enabled}" /> - <echo message="webapp.enabled=${webapp.enabled}" /> - <if> - <ispropertytrue property="osgi.enabled" /> - <then> - <!-- copy all jars that need to be in this osgi bundle jar into the directory that will be jarred up--> - <copy todir="${build}"> - <fileset dir="${lib}" includes="**" /> - </copy> - </then> - <elseif> - <ispropertytrue property="webapp.enabled" /> - <then> - <property name="run.war.target" value="true" /> - </then> - </elseif> - <else> - <!-- Also, copy over all needed jars from ${lib} to ${jardist} --> - <copy todir="${jardist}"> - <fileset dir="${lib}" includes="**" /> - </copy> - </else> - </if> - </target> <!-- *********************************************************************** --- 375,378 ---- *************** *** 417,424 **** *********************************************************************** --> ! <target name="jar" depends="copyForJar, make" description="Builds a jar file"> <!-- Create the distribution directory --> <mkdir dir="${jardist}" /> <!-- Put all implementation classes from ${build} into the jar file --> <jar jarfile="${jardist}/${jar.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF" /> --- 380,392 ---- *********************************************************************** --> ! <target name="jar" depends="manifest, make" description="Create distribution"> <!-- Create the distribution directory --> <mkdir dir="${jardist}" /> + <!-- Also, copy over all needed jars from ${lib} to ${jardist} --> + <copy todir="${jardist}"> + <fileset dir="${lib}" includes="**" /> + </copy> + <!-- Put all implementation classes from ${build} into the jar file --> <jar jarfile="${jardist}/${jar.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF" /> *************** *** 427,455 **** </target> <!-- *********************************************************************** ! WAR TARGET *********************************************************************** --> ! <target name="war" depends="jar" if="run.war.target" description="Builds a war file"> ! <mkdir dir="${wardist}" /> ! <war destfile="${wardist}/${name}.war" webxml="${webroot}/WEB-INF/web.xml"> ! <lib dir="${lib}"> ! <include name="**/*.jar" /> ! </lib> ! <classes dir="${build}" /> ! <fileset dir="${webroot}" /> ! <fileset dir="output/gwt/${gwt.module}"/> ! </war> ! </target> ! ! <!-- ! ================================================================================ ! Creates the distribution ! ================================================================================ ! --> ! <target name="createdist" depends="war"> ! <mkdir dir="${dist}" /> ! <mkdir dir="${staging}" /> </target> --- 395,420 ---- </target> + <!-- *********************************************************************** ! GWT SHELL *********************************************************************** --> ! <target name="shell" depends="jar" description="Runs the gwtShell with the servlet running"> ! <echo message="HELLLLLLO" /> ! <java failonerror="true" classname="com.google.gwt.dev.GWTShell" fork="true"> ! <classpath> ! <pathelement path="${javacode}" /> ! <pathelement path="${build}" /> ! <path refid="gwt" /> ! <path refid="lib.jars" /> ! </classpath> ! <arg value="-out" /> ! <arg value="output/gwt" /> ! <arg value="-logLevel" /> ! <arg value="ALL" /> ! <arg value="${gwt.module}/index.html" /> ! <jvmarg value="-DshellMode=true" /> ! </java> </target> *************** *** 460,464 **** *********************************************************************** --> ! <target name="run" depends="war"> <pathconvert property="application.classpath" pathsep=":"> --- 425,429 ---- *********************************************************************** --> ! <target name="run" depends="jar"> <pathconvert property="application.classpath" pathsep=":"> *************** *** 485,489 **** *********************************************************************** --> ! <target name="instrumentation" depends="war"> <property name="emma.enabled" value="true" /> <mkdir dir="${codecov.temp}" /> --- 450,454 ---- *********************************************************************** --> ! <target name="instrumentation" depends="jar"> <property name="emma.enabled" value="true" /> <mkdir dir="${codecov.temp}" /> *************** *** 583,586 **** --- 548,552 ---- <path refid="testall.classpath" /> <path refid="emma.lib" /> + <path refid="gwt" /> </classpath> <jvmarg value="-Demma.coverage.out.file=${codecov.temp}/coverage.emma" /> *************** *** 633,637 **** *********************************************************************** --> ! <target name="findbugs" depends="war" description="Runs findbugs against the code"> <mkdir dir="${findbugs.report}" /> <findbugs home="${findbugs.dir}" output="html" outputFile="${findbugs.report}/index.html"> --- 599,603 ---- *********************************************************************** --> ! <target name="findbugs" depends="jar" description="Runs findbugs against the code"> <mkdir dir="${findbugs.report}" /> <findbugs home="${findbugs.dir}" output="html" outputFile="${findbugs.report}/index.html"> *************** *** 656,659 **** --- 622,630 ---- </target> + <target name="java2html"> + <mkdir dir="${html.code}" /> + <java2html srcdir="${javacode}" destdir="${html.code}" includes="**/*.java" style="eclipse" showLineNumbers="true" showFileName="true" showTableBorder="true" /> + </target> + <!-- *********************************************************************** *************** *** 661,665 **** *********************************************************************** --> ! <target name="all" depends="war,testall,checkstyle,findbugs,javadoc" description="compiles, runs tests, checkstyle, findbugs, and javadoc"> </target> --- 632,636 ---- *********************************************************************** --> ! <target name="all" depends="testall,checkstyle,findbugs,javadoc,java2html"> </target> *************** *** 670,743 **** *********************************************************************** --> ! <target name="autobuild" depends="clean, all"> ! <cvs command="tag -R ${label}" failonerror="true" /> </target> ! <!-- *********************************************************************** ! JAVAH TARGET - Creates JNI C header files if needed *********************************************************************** --> ! <target name="javah" depends="compile" if="javah.classes"> ! <javah class="${javah.classes}" destdir="${native}"> ! <classpath refid="build.classpath" /> ! </javah> ! </target> ! <!-- *********************************************************************** ! Runs make on the C++/C code if a Makefile exists in the proper directory *********************************************************************** --> - <target name="make" depends="javah" if="makeExists"> - <echo message="make in ${native}" /> - <exec executable="make" dir="${native}" /> - </target> ! <target name="tomcatTasks"> ! <fail unless="tomcat.home" message="PLEASE make sure you have a ${user.home}/ant.properties file with the property tomcat.home set" /> ! <fail unless="tomcat.username" message="PLEASE make sure you have a ${user.home}/ant.properties file with the property tomcat.username set" /> ! <fail unless="tomcat.password" message="PLEASE make sure you have a ${user.home}/ant.properties file with the property tomcat.password set" /> ! <fail unless="tomcat.url" message="PLEASE make sure you have a ${user.home}/ant.properties file with the property tomcat.url set" /> ! <property name="tomcat.manager.url" value="${tomcat.url}/manager" /> ! <path id="tomcat.classpath"> ! <fileset dir="${tomcat.home}/server/lib/"> ! <include name="catalina-ant.jar" /> ! </fileset> ! </path> ! <!--Just a convenient pathconvert to debug paths above by converting to string and printing --> ! <pathconvert dirsep="/" pathsep=" " property="temp.tomcat" refid="tomcat.classpath" setonempty="true" /> ! <echo message="tomcat ant task jars=${temp.tomcat}" /> ! <taskdef resource="org/apache/catalina/ant/antlib.xml" classpathref="tomcat.classpath" /> ! </target> ! <target name="deploy" description="Install application in Tomcat" depends="tomcatTasks, war"> ! <deploy url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${name}" war="${wardist}/${name}.war" /> ! </target> ! <target name="undeploy" description="Remove application in Tomcat" depends="tomcatTasks"> ! <undeploy url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${name}" /> ! </target> - <target name="redeploy" description="Reload application in Tomcat" depends="war, undeploy, deploy"> </target> ! <target name="start" description="Start Tomcat application" depends="tomcatTasks"> ! <start url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${name}" /> ! </target> ! <target name="stop" description="Stop Tomcat application" depends="tomcatTasks"> ! <stop url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${name}" /> ! </target> ! <target name="tomcatInfo" description="List Tomcat applications" depends="tomcatTasks"> ! <list url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" /> ! <roles url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" /> ! <resources url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" /> ! <sessions url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${name}" /> ! </target> <!-- *********************************************************************** --- 641,723 ---- *********************************************************************** --> ! <target name="autobuild" depends="all"> </target> ! <!-- *********************************************************************** ! RELEASE TARGET *********************************************************************** --> + <property name="misc" value="${input}/misc" /> + <property name="javadoc.examples.title" value="MockLib Examples" /> ! <!-- temporary until we fix buildtemplate to not erase every folder in tools --> ! <property name="taglet" value="${tool.dir}/taglet" /> ! <!-- *********************************************************************** ! JAVADOC TARGET *********************************************************************** --> ! <target name="createdist" depends="all"> ! <copy todir="${projstaging}"> ! <fileset dir="${staging.in}" includes="**/*" /> ! <fileset dir="${reports}" /> ! <fileset dir="${jardist}" includes="${jar.name}" /> ! </copy> ! <!-- ! <copy file="README" tofile="${dist.build.dir}/README" overwrite="yes" /> ! <copy file="LICENSE" tofile="${dist.build.dir}/LICENSE" overwrite="yes" /> ! --> ! <mkdir dir="${dist}" /> ! <!-- package everything up nice and tidy --> ! <zip zipfile="${dist}/${name}-${version}.zip" basedir="${staging}" includes="**" update="yes" /> ! <!--tar tarfile="${dist.dir}/${name}-${version}.tar" basedir="${dist.build.dir}" includes="**" /> ! <gzip zipfile="${dist.dir}/${name}-${version}.tar.gz" src="${dist.dir}/${name}-${version}.tar" /--> ! <copy tofile="${dist}/${name}-${version}.jar"> ! <fileset dir="${jardist}"> ! <include name="${jar.name}" /> ! </fileset> ! </copy> </target> ! <!-- this is run after createdist is run and after testall is ! run so codecoverage, the release, can all be posted to some ! website --> ! <target name="release" depends="createdist" if="password"> ! <echo message="***************************************************************" /> ! <echo message="***************************************************************" /> ! <echo message=" Delivering zip=${name}-${version}.zip to" /> ! <echo message=" sourceforge ftp site, and to ${name} website" /> ! <echo message=" The website will be updated at mocklib.sourceforge.net" /> ! <echo message=" Please finish this and go to sourceforge.net/projects/mocklib" /> ! <echo message=" to pick up the release and release it to the world" /> ! <echo message="" /> ! <echo message=" ps. This will take a while" /> ! <echo message="***************************************************************" /> ! <echo message="***************************************************************" /> ! <ftp server="upload.sourceforge.net" remotedir="incoming" userid="anonymous" passive="true" binary="true" verbose="true" password="${user}@user.sourceforge.net"> ! <fileset dir="${dist}"> ! <include name="${name}-${version}.zip" /> ! <include name="${name}-${version}.jar" /> ! </fileset> ! </ftp> ! <scp file="${dist}/${name}-${version}.zip" todir="${user}@shell.sourceforge.net:/home/groups/m/mo/mocklib" password="${password}" /> ! <sshexec host="shell.sourceforge.net" username="${user}" password="${password}" command="rm -rf /home/groups/m/mo/mocklib/htdocs/${name}/*" /> ! <sshexec host="shell.sourceforge.net" username="${user}" password="${password}" command="unzip /home/groups/m/mo/mocklib/${name}-${version}.zip -d /home/groups/m/mo/mocklib/htdocs/" /> ! <!--sshexec host="shell.sourceforge.net" username="${user}" password="${password}" command="mv /home/groups/m/mo/mocklib/htdocs/${name}/* /home/groups/m/mo/mocklib/htdocs" /> ! <sshexec host="shell.sourceforge.net" username="${user}" password="${password}" command="rm /home/groups/m/mo/mocklib/${name}*.zip" /--> ! ! <echo message="Trying to tag cvs now....." /> ! <cvs failonerror="true" command="tag ${version}" /> + </target> <!-- *********************************************************************** *************** *** 745,756 **** *********************************************************************** --> ! <target name="javadoc" description="Generate JavaDoc"> ! <mkdir dir="${javadoc}" /> ! <!-- copy all package.html files, img's etc for javadoc --> ! <copy todir="${javadoc}"> ! <fileset dir="${javacode}" excludes="**/*.java" /> ! </copy> <echo message="package lists in=${package.list}" /> ! <javadoc sourcepath="${javacode}" destdir="${javadoc}" author="true" version="true" use="true" public="yes" overview="${javacode}/overview.html" windowtitle="${javadoc.title} ${version}" doctitle="${javadoc.title} ${version}" Verbose="true"> <!-- classpath needed to link up to third_party libs without 100's of warnings --> <classpath> --- 725,736 ---- *********************************************************************** --> ! <target name="javadoc" description="Generate JavaDoc for API"> ! <mkdir dir="${projstaging}/api" /> ! <!--copy todir="${projstaging}/api"> ! <fileset dir="${javacode}" excludes="**\*.java" /> ! </copy--> ! <echo message="list is at ${misc}" /> <echo message="package lists in=${package.list}" /> ! <javadoc sourcepath="${javacode}" destdir="${projstaging}/api" author="true" version="true" use="true" public="yes" overview="${misc}/mockoverview.html" windowtitle="${javadoc.title} ${version}" doctitle="${javadoc.title} ${version}" Verbose="true"> <!-- classpath needed to link up to third_party libs without 100's of warnings --> <classpath> *************** *** 758,762 **** </classpath> <fileset dir="${javacode}"> ! <include name="${javadoc.pattern}" /> </fileset> --- 738,742 ---- </classpath> <fileset dir="${javacode}"> ! <include name="**/Js*.java"/> </fileset> *************** *** 765,773 **** <bottom> <![CDATA[<i>${copyright}</i> ! <br>${javadoc.bottom}]]></bottom> <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api" packagelistLoc="${package.list}/jdk" /> <link offline="true" href="http://www.junit.org/junit/javadoc/3.8.1" packagelistLoc="${package.list}/junit" /> </javadoc> </target> <!-- *********************************************************************** --- 745,796 ---- <bottom> <![CDATA[<i>${copyright}</i> ! <br> ! ${javadoc.bottom}]]> ! </bottom> <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api" packagelistLoc="${package.list}/jdk" /> <link offline="true" href="http://www.junit.org/junit/javadoc/3.8.1" packagelistLoc="${package.list}/junit" /> </javadoc> </target> + + <!-- + *********************************************************************** + JAVAH TARGET - Creates JNI C header files if needed + *********************************************************************** + --> + + <target name="javah" depends="compile" if="javah.classes" description="Creates C header files"> + <javah class="${javah.classes}" destdir="${native}"> + <classpath refid="build.classpath" /> + </javah> + </target> + + <!-- + *********************************************************************** + Runs make on the C++/C code if a Makefile exists in the proper directory + *********************************************************************** + --> + <target name="make" depends="javah" if="makeExists" description="runs make"> + <echo message="make in ${native}" /> + <exec executable="make" dir="${native}" /> + </target> + + <!-- + *********************************************************************** + GENERATE CASTOR OBJECTS TARGET + *********************************************************************** + --> + <!--target name="castor" depends="create-src" description="Generates class files from xsd"> + <echo message="build=${build}"/> + <echo message="generating source from ${schemas}/${xsd.start}"/> + <echo message="putting generated source in ${basedir}/${src.gen}"/> + + <castor bindingfile="${basedir}/bldfiles/binding.file" dest="${basedir}/${src.gen}"> + <i dir="${basedir}/${schemas}"> + <include name="${xsd.start}"/> + </i> + </castor> + </target--> + + <!-- *********************************************************************** Index: directory.properties =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/directory.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** directory.properties 12 Sep 2006 01:21:03 -0000 1.1 --- directory.properties 12 Sep 2006 05:00:23 -0000 1.2 *************** *** 39,42 **** --- 39,44 ---- checkstyle.report=${reports}/checkstyle javadoc =${reports}/javadoc + html.code =${reports}/htmlcode + #contains the javadoc of biz.xsoftware.api *************** *** 102,105 **** --- 104,113 ---- #service for example + staging.in =${input}/staging + #build copies everything from here to ${staging} so staging area can just be + #zipped up or rpm'd up or whatever during the dist target. + #typically, there will be another directory in here called <project> + #or something. Some projects won't but most will. + native =${input}/native #contains JNI C header file |
From: Nobody <fas...@us...> - 2006-09-12 05:00:32
|
Update of /cvsroot/mocklib/gwtmocklib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350 Modified Files: .classpath Log Message: finishing up gwtmocklib Index: .classpath =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/.classpath,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .classpath 12 Sep 2006 01:21:03 -0000 1.1 --- .classpath 12 Sep 2006 05:00:24 -0000 1.2 *************** *** 2,10 **** <classpath> <classpathentry kind="src" path="input/javasrc"/> - <classpathentry kind="src" path="input/jscript"/> <classpathentry kind="lib" path="tools/ant-junit/junit.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="lib" path="input/libinclude/gwt-user.jar"/> <classpathentry kind="lib" path="input/libexclude/servlet-api.jar"/> <classpathentry kind="output" path="eclipsegen"/> </classpath> --- 2,10 ---- <classpath> <classpathentry kind="src" path="input/javasrc"/> <classpathentry kind="lib" path="tools/ant-junit/junit.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="input/libexclude/servlet-api.jar"/> + <classpathentry kind="lib" path="tools/gwt/gwt-dev-windows.jar"/> + <classpathentry kind="lib" path="input/libexclude/gwt-user.jar"/> <classpathentry kind="output" path="eclipsegen"/> </classpath> |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/tools/ant-java2html In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/tools/ant-java2html Added Files: java2html.jar Log Message: finishing up gwtmocklib --- NEW FILE: java2html.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/libexclude In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/libexclude Added Files: gwt-user.jar Log Message: finishing up gwtmocklib --- NEW FILE: gwt-user.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/com/google/gwt/sample/dynatable/server In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/com/google/gwt/sample/dynatable/server Removed Files: SchoolCalendarServiceImpl.java Log Message: finishing up gwtmocklib --- SchoolCalendarServiceImpl.java DELETED --- |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client/test In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/biz/xsoftware/mock/client/test Added Files: MockFakeInterface.java FakeInterface.java TestMocking.java Log Message: finishing up gwtmocklib --- NEW FILE: TestMocking.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.test; import biz.xsoftware.mock.client.JsCalledMethod; import com.google.gwt.junit.client.GWTTestCase; /** */ public class TestMocking extends GWTTestCase { /** * @see com.google.gwt.junit.client.GWTTestCase#getModuleName() */ public String getModuleName() { return "biz.xsoftware.mock.MockLib"; } public void testBasicMock() { MockFakeInterface mock = new MockFakeInterface(); String val = "Aasfd"; int val2 = 5; mock.someMethod(val, val2); JsCalledMethod m = mock.expect(MockFakeInterface.SOME_METHOD); String actualVal = (String)m.getAllParams()[0]; Integer actualVal2 = (Integer)m.getAllParams()[1]; assertEquals(val, actualVal); assertEquals(val2, actualVal2.intValue()); } public void testReturnValue() { MockFakeInterface mock = new MockFakeInterface(); int expectedVal = 5; mock.addReturnValue(MockFakeInterface.GET_VALUE, new Integer(expectedVal)); int actualVal = mock.getValue(); assertEquals(expectedVal, actualVal); } } --- NEW FILE: FakeInterface.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.test; /** */ public interface FakeInterface { public void someMethod(String s, int i); public int getValue(); } --- NEW FILE: MockFakeInterface.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.test; import biz.xsoftware.mock.client.JsMockSuperclass; /** */ public class MockFakeInterface extends JsMockSuperclass implements FakeInterface { public static final String SOME_METHOD = "someMethod"; public static final String GET_VALUE = "getValue"; /** * @see biz.xsoftware.mock.client.test.FakeInterface#someMethod(java.lang.String, int) */ public void someMethod(String s, int i) { methodCalled(SOME_METHOD, new Object[] {s, new Integer(i)}); } /** * @see biz.xsoftware.mock.client.test.FakeInterface#getValue() */ public int getValue() { return ((Integer)methodCalled(GET_VALUE, null)).intValue(); } } |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/staging In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/staging Added Files: index.html README.html Log Message: finishing up gwtmocklib --- NEW FILE: README.html --- <HTML> <h1><a href="index.html">Click here for documentation</a></h1> </HTML> --- NEW FILE: index.html --- <HTML> <TITLE>GwtMockLib</TITLE> <BODY> <h1>GwtMockLib</h1> This is the only mock library I am aware of for mocking in GWT. <br/><br/> <a href="http://sourceforge.net/projects/mockobject">MockLib</a> <br/><br/> <a href="http://sourceforge.net/project/showfiles.php?group_id=134303&package_id=151809">Download GwtMockLib library plus these web pages</a> <br/> <a href="codecoverage/index.html">Test coverage report - THIS DOES NOT WORK WITH GWT YET - ASK GOOGLE TO HELP!!!</a> <br/> <a href="findbugs/index.html">FindBugs report</a> <br/> <a href="api/index.html">GwtMockLib Javadoc</a> <br/><br/> <h3>All GwtMockLib Examples</h3> <ol> <li><a href="htmlcode/example1.html">Basic Examples</a> - Basic Examples to help get started</li> <li>See JMockLib for more examples of what you can do with GwtMockLib as much of the functionality is the same</li> </ol> <br/><br/><br/><br/> <a href=http://sourceforge.net> <IMG src=http://sourceforge.net/sflogo.php?group_id=113040 width=210 height=62 border=0 alt=SourceForge Logo> </a> </BODY> </HTML> |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/.settings In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/.settings Added Files: org.eclipse.jdt.ui.prefs org.eclipse.jdt.core.prefs Log Message: finishing up gwtmocklib --- NEW FILE: org.eclipse.jdt.core.prefs --- #Mon Sep 11 21:35:01 MDT 2006 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.4 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning org.eclipse.jdt.core.compiler.source=1.4 --- NEW FILE: org.eclipse.jdt.ui.prefs --- #Mon Sep 11 21:35:01 MDT 2006 eclipse.preferences.version=1 internal.default.compliance=user |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/biz/xsoftware/mock Added Files: MockLib.gwt.xml Log Message: finishing up gwtmocklib --- NEW FILE: MockLib.gwt.xml --- <module> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <!-- Specify the app entry point class. --> <entry-point class='biz.xsoftware.mock.client.JsMockEntry'/> </module> |
From: Nobody <fas...@us...> - 2006-09-12 05:00:29
|
Update of /cvsroot/mocklib/gwtmocklib/input/staging/htmlcode In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/staging/htmlcode Added Files: example1.html Log Message: finishing up gwtmocklib --- NEW FILE: example1.html --- <html> <body> <h1>Basic Example</h1> <h2>Basic Example to help get started</h2> This example consists of a test on a GWT GUI application. Here are the files for this example.... <ul> <li><a href="biz/xsoftware/mock/client/example1/TestExample.java.html"> TestExample.java</a> - The tests themselves.</li> <li><a href="biz/xsoftware/mock/client/example1/MyApplication.java.html"> MyApplication.java</a> - The system we are testing</li> <li><a href="biz/xsoftware/mock/client/example1/ListenerManager.java.html"> ListenerManager.java</a> - A system we are mocking</li> <li><a href="biz/xsoftware/mock/client/example1/MockListenerManager.java.html"> MockListenerManager.java</a> - The Mock that extends GwtMockLib's JsMockSuperclass to gain alot of mock functionality for free</li> <li><a href="biz/xsoftware/mock/client/example1/ListenerManagerImpl.java.html"> ListenerManagerImpl.java</a> - What the real implementation of the ListenerManager would look like</li> </ul> </body> </html> |
From: Nobody <fas...@us...> - 2006-09-12 05:00:24
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/biz/xsoftware/mock/client Added Files: JsMockObject.java JsMockSuperclass.java JsMockEntry.java JsBehavior.java JsExpectFailedException.java JsCalledMethod.java Log Message: finishing up gwtmocklib --- NEW FILE: JsMockObject.java --- /* * Created on Jun 7, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.mock.client; /** * The interface all mock objects implement. This is the interface used * by the unit tests once the mock object is created. * * @author Dean Hiller */ public interface JsMockObject { /** * Field used to expect that no methods have been called. */ public static String NONE = "No method should have been called"; /** * Field used to expect any method so expectCall returns as soon as * any method is called. */ public static String ANY = "'Any method'"; /** * Waits for one and only one method to be called. If any methods are * called before or after this one(after can sometimes be caught by * the MockObject when the threading is not synchronous), then * this call will throw an ExpectFailedException. * * @param method The expected method. * @return An array of params that were passed to the methods called */ public JsCalledMethod expect(String method); /** * Waits for all the methods to be called. If any of the methods * are not called or are called out of order, this method throws * an exception which will fail the test case. For each method, * this will wait WAIT_TIME milliseconds for each method to be called. * If the method is not called within this period, an exception will * be thrown saying 'method' was not called within timeout period. * * @param methods The expected method(s) in the correct order. * @return An array or arrays of params that were passed to the methods called */ public JsCalledMethod[] expect(String[] methods); /** * Add an exception to throw when a method on the mockObject is called. * <br/<br/> * This can be called many times where each time it is called, the * exception is added to a queue. Each time 'method' is called, it * checks the queue, if empty, it does not throw an exception. * <br/<br/> * Should only pass the type of Throwable that the 'method' * can throw. If you pass IOException in for a method that * doesn't have a signature of 'throws IOException', then * one of the following exceptions will be thrown into * the sysUnderTest * <ol> * <li> UndeclaredThrowableException for MockObjects created with MockCreator</li> * <li> RuntimeException for Subclasses of MockSuperclass</li> * </ol> * * @param method The method to throw the exception on when it is called. * @param e The exception to throw on method. */ public void addThrowException(String method, Throwable e); /** * Add a return value to return when 'method' is called. * <br></br> * This can be called multiple times and each call will add * to a queue. When 'method' is called, it will return * the first value on the queue. If the queue is null, * 'method' will return the defaultvalue which is null unless * setDefaultReturnValue is called on MockObject. * <br></br> * Use Integer to return int, Long for long, etc. * * @param method The method that when called returns first value on queue * @param o The object to return that is added to the queue */ public void addReturnValue(String method, Object o); public void addBehavior(String method, JsBehavior behavior); /** * When calling expect, the MockObject will ignore this method, * so it will not result in an exception. */ public void addIgnore(String method); /** * Removes the method from the ignored methods set. */ public void removeIgnore(String method); /** * Set the DefaultReturnValue for a 'method' * @param method The method */ public void setDefaultReturnValue(String method, Object o); public void setExpectTimeout(int timeout); public int getExpectTimeout(); } --- NEW FILE: JsMockSuperclass.java --- package biz.xsoftware.mock.client; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * This is a super class for mock Objects. It has the following options * <ol> * <li>Guarantee order of events and that events happen on one object</li> * <li>Guarantee events called with order not mattering on one object</li> * <li>Guarantee order of events is correct between two objects(One mock obj. implements two interfaces)</li> * </ol> * This class will also return the parameters that were passed into the MockObject * so they can be introspected in testing to make sure they were correct. * * The MockObject extending this class can also be told to throw exceptions on certain * methods so we can test error leg behavior. * * Example of how to use * MockActionListener implements ActionListener and extends this class * The only method in MockActionListener * is * <PRE> * public final static ACTION_METHOD = "actionPerformed method"; * public void actionPerformed(ActionEvent evt) { * super.methodCalled(ACTION_METHOD, evt); * } * </PRE> * * In the test, when you expect an ActionEvent, you can call * <PRE> * Object o = MockActionListener.expectEvent(ACTION_METHOD); * ActionEvent evt = (ActionEvent)evt; * assertNonNull(evt.getSource()); * </PRE> * * Another useful behavior is throwing any type of exception using * setExceptionOnMethod(String method, Throwable e). This can test * robustness in a system to make sure listeners or services that * throw exceptions don't affect your system, or at least affect * your system in the proper way. * * @author Dean Hiller (de...@xs...) */ public abstract class JsMockSuperclass implements JsMockObject { /** * List of the current methods that have been called. */ private List methodsCalled = new ArrayList(); /** * A map of queues, containing either * 1. objects to return when methods are called * 2. Behaviors to run which return objects to return * 3. Exceptions to throw */ private Map methodToReturnVal = new HashMap(); /** * A map of default return values, which are used to return if the * queue for the method is empty. */ private Map methodToDefaultRetVal = new HashMap(); private List ignoredMethods = new ArrayList(); /** * Default wait time to wait for a method to be called once expectCall is * called. */ public static final int DEFAULT_WAIT_TIME = 10000; private int waitTime = DEFAULT_WAIT_TIME; private String id; /** * Default constructor of superclass of all mockObjects with a delay of * 10 seconds. This delay is the amount of time the mock object waits for * a method to be called when a client calls expectCall. */ public JsMockSuperclass() { } /** * The constructor to use to override the default delay({@link #DEFAULT_WAIT_TIME}) * such that the mock object will give methods a longer time to be called * before timing out to fail the test. * * @param delay The amount of time in milliseconds to wait for a method to be * called. */ public JsMockSuperclass(int delay) { waitTime = delay; } public JsMockSuperclass(String id) { this.id = id; } public void setExpectTimeout(int delay) { this.waitTime = delay; } public int getExpectTimeout() { return waitTime; } public void addIgnore(String method) { ignoreImpl(new String[] {method}); } public void removeIgnore(String method) { removeIgnoreImpl(new String[] {method}); } private void removeIgnoreImpl(String[] methods) { for(int i = 0; i < methods.length; i++) { String method = methods[i]; ignoredMethods.remove(method); } } private void ignoreImpl(String[] methods) { addIgnoredMethods(methods); } private void addIgnoredMethods(String[] methods) { if(methods == null) return; verifyMethodsExist(methods); for(int i = 0; i < methods.length; i++) { String method = methods[i]; ignoredMethods.add(method); } } /** * Subclasses should call this method when a method on their interface * is called. This method is for users to create subclasses and call so * they don't have to wrap it in a try-catch block. * * @param method * @param parameters * @return whatever the client has specified using addReturnValue */ protected Object methodCalled(String method, Object p) { try { Object parameters = p; if(!(parameters instanceof Object[])) { parameters = new Object[] {parameters}; } return methodCalledImpl(method, (Object[])parameters); } catch (Throwable e) { if(e instanceof RuntimeException) throw (RuntimeException)e; throw new RuntimeException("Sorry, must wrap exception, unwrap in " + "your mockobject, or have mockObject call methodCalledImpl instead", e); } } protected synchronized Object methodCalledImpl(String method, Object[] parameters) throws Throwable { //Since no notify and wait can be used in GWT mocklib, intern is not needed and can be commented out. // method = method.intern(); String params = ""; if(parameters == null) { params = "no params"; } else { Object[] array = parameters; for(int i = 0; i < array.length-1; i++) { params += array[i]+", "; } params += array[array.length-1]; } System.out.println(id+"method called="+method+"("+params+") on obj="+this); //sometimes, the contract is for the "code" to give a parameter //to a library and then modify the parameter after the library //is done with it. This means the object the "code" gave to //the MockObject will change out from under the MockObject and be //corrupted meaning you can't write a test to test the contract //without cloning the object so it can't be changed. Object[] newParams = clone(method, parameters); methodsCalled.add(new JsCalledMethod(method, newParams, new Throwable().fillInStackTrace())); // this.notifyAll(); return findNextAction(method, parameters); } private Object findNextAction(String method, Object[] params) throws Throwable { List l = (List)methodToReturnVal.get(method); if(l == null) { return methodToDefaultRetVal.get(method); } Object retVal = l.remove(0); if(l.size()<=0) methodToReturnVal.remove(method); else if(retVal == null) methodToDefaultRetVal.get(method); if(retVal instanceof JsBehavior) { return ((JsBehavior)retVal).runMethod(params); } else if(retVal instanceof Throwable) { Throwable t = (Throwable)retVal; t.fillInStackTrace(); throw t; } else return retVal; } // /** // * @see biz.xsoftware.mock.JsMockObject#expectUnorderedCalls(java.lang.String[]) // */ // public synchronized JsCalledMethod[] expectUnorderedCalls(String[] methods) { // if(methods == null) // throw new IllegalArgumentException("methods cannot be null"); // else if(methods.length <= 0) // throw new IllegalArgumentException("methods.length must be >= 1"); // for(int i = 0; i < methods.length; i++) { // if(methods[i] == null) // throw new IllegalArgumentException("None of values in methods " + // "can be null, yet methods["+i+"] was null"); // } // // Map expectedMethods = new HashMap(); // for(int i = 0; i < methods.length; i++) { // expectedMethods.put(methods[i], new Integer(i)); // } // // Set ignorables = createIgnorableMap(ignoredMethods); // JsCalledMethod[] retVal = new JsCalledMethod[methods.length]; // // List methodsCalledList = new ArrayList(); // for(int i = 0; i < methods.length; i++) { // if(ANY.equals(methods[i])) // throw new IllegalArgumentException("The parameter 'methods' in " + // "expectUnorderedCalls cannot contain MockSuperclass.ANY(use expectOrderedCalls instead)"); // // JsCalledMethod o = expectUnignoredCall(ANY, ignorables, methodsCalledList); // if(o == null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, // "timed out on next expected method\n"); // throw new JsExpectFailedException("Timed out waiting for a method call\n" // +reason, retVal, JsExpectFailedException.TIMED_OUT); // } // Integer index = (Integer)expectedMethods.remove(o.getMethodName()); // if(index == null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, null); // throw new JsExpectFailedException(reason, retVal, JsExpectFailedException.UNEXPECTED_CALL_BEFORE); // } // // retVal[index.intValue()] = o; // } // // LeftOverMethods leftOver = getLeftOverMethods(ignorables); // if(leftOver != null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, "extra method(s)="+leftOver+"\n"); // throw new JsExpectFailedException("There was a method called after your expected methods.\n"+reason, retVal // , JsExpectFailedException.UNEXPECTED_CALL_AFTER); // } // // return retVal; // } private String getHowMethodWasCalled(JsCalledMethod method) { // Throwable t = method.getHowItWasCalled(); String retVal = "\nThe last method was="+method.getMethodName(); retVal += "\nHere is a stack trace showing "; retVal += "you how it was called...\n"; retVal += "--------BEGIN="+method.getMethodName()+"---------------\n"; retVal += "THIS DOES NOT WORK IN GWT(so it is commented out)\n"; // StringWriter s = new StringWriter(); // PrintWriter p = new PrintWriter(s); // t.printStackTrace(p); // retVal += s.toString(); retVal += "--------END="+method.getMethodName() +"---------------\n"; return retVal; } private JsCalledMethod[] cleanup(JsCalledMethod[] methods, int size) { JsCalledMethod[] retVal = new JsCalledMethod[size]; for(int i = 0; i < retVal.length; i++) { retVal[i] = methods[i]; } return retVal; } /** * @see biz.xsoftware.mock.JsMockObject#expectCall(java.lang.String) */ public JsCalledMethod expectCall(String method) { return expectImpl(new String[] {method})[0]; } /** * @see biz.xsoftware.mock.JsMockObject#expect(java.lang.String) */ public JsCalledMethod expect(String method) { return expectImpl(new String[] {method})[0]; } /** * @see biz.xsoftware.mock.JsMockObject#expect(java.lang.String[]) */ public synchronized JsCalledMethod[] expect(String[] methods) { return expectImpl(methods); } private synchronized JsCalledMethod[] expectImpl(String[] methods) { return expectOrderedCalls(methods); } /** * @see biz.xsoftware.mock.JsMockObject#expectOrderedCalls(java.lang.String[]) */ private synchronized JsCalledMethod[] expectOrderedCalls(String[] methods) { if(methods == null) throw new IllegalArgumentException("methods cannot be null"); else if(methods.length <= 0) throw new IllegalArgumentException("methods.length must be >= 1"); for(int i = 0; i < methods.length; i++) { if(methods[i] == null) throw new IllegalArgumentException("None of values in methods can be null, yet methods["+i+"] was null"); } verifyMethodsExist(methods); Set ignorables = createIgnorableMap(ignoredMethods); List methodsCalledList = new ArrayList(); JsCalledMethod[] retVal = new JsCalledMethod[methods.length]; int i = 0; for(; i < methods.length; i++) { String method = methods[i]; JsCalledMethod o = null; try { o = expectUnignoredCall(method, ignorables, methodsCalledList); } catch(JsExpectFailedException e) { if(!JsExpectFailedException.UNEXPECTED_ON_NONE.equals(e.getReason())) { throw e; } Object[] leftOver = e.getCalledMethods(); throw new JsExpectFailedException(e.getMessage(), leftOver, e.getReason()); } if(o == null) { String reason = putTogetherReason(methods, ignorables, methodsCalledList, "timed out on next expected method\n"); throw new JsExpectFailedException("Timed out waiting for call=" +method+"\n"+reason, cleanup(retVal, i), JsExpectFailedException.TIMED_OUT); } retVal[i] = o; if(!method.equals(o.getMethodName()) && !ANY.equals(method)) { String reason = putTogetherReason(methods, ignorables, methodsCalledList, null); reason += getHowMethodWasCalled(o); throw new JsExpectFailedException(reason, cleanup(retVal, i), null); } } LeftOverMethods leftOver = getLeftOverMethods(ignorables); if(leftOver != null) { String reason = putTogetherReason(methods, ignorables, methodsCalledList, "extra method(s)="+leftOver+"\n"); reason += getHowMethodWasCalled(leftOver.getMethod(0)); JsCalledMethod[] calledOnes = new JsCalledMethod[retVal.length+1]; //System.arraycopy(retVal, 0, calledOnes, 0, retVal.length); arraycopy(retVal, calledOnes); calledOnes[retVal.length] = leftOver.getMethod(0); throw new JsExpectFailedException("There was a method called after your expected methods.\n"+reason, calledOnes , JsExpectFailedException.UNEXPECTED_CALL_AFTER); } return retVal; } private void arraycopy(JsCalledMethod[] retVal, JsCalledMethod[] calledOnes) { for(int i = 0; i < retVal.length; i++) { calledOnes[i] = retVal[i]; } } private void verifyMethodsExist(String[] methods) { for(int i = 0; i < methods.length; i++) { verifyMethod(methods[i]); } } private void verifyMethod(String method) { //verifyMethod can't be done in GWT return; // if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) // return; // Class[] classes = getClasses(); // if(classes == null) // return; // // String classNames = ""; // for(int i = 0; i < classes.length; i++) { // //FINEST LOG..... // //System.out.println("class="+classes[i].getName()); // if(methodExistInThisClass(method, classes[i])) // return; // classNames += "\n"+classes[i]; // } // // throw new IllegalArgumentException("method='"+method+"' is not a method on any of the" + // "\nfollowing Classes/Interfaces"+classNames); } // private boolean methodExistInThisClass(String method, Class c) { // return true; // //This does not work in GWT testing..... // Method[] methods = c.getMethods(); // for(int i = 0; i < methods.length; i++) { // if(log.isLoggable(Level.FINEST)) // log.finest("method in class='"+methods[i].getName()+"' expected='"+method+"'"); // if(method.equals(methods[i].getName())) // return true; // } // return false; // } private String putTogetherReason(String[] methods, Set ignorables, List methodsCalled, String lastLine) { String reason = "\nMethods you expected...\n"; for(int i = 0; i < methods.length; i++) { reason += "method["+i+"]="+methods[i]+"\n"; } reason += "Methods you ignored...\n"; //String[] ignored = (String[])ignorables.toArray(new String[0]); Object[] ignored = ignorables.toArray(); if(ignored.length <= 0) reason += "no ignored methods\n"; for(int i = 0; i < ignored.length; i++) { reason += "ignored["+i+"]="+ignored[i]+"\n"; } reason += "\nMethods that were called...\n"; for(int i = 0; i < methodsCalled.size(); i++) { if(ignorables.contains(methodsCalled.get(i))) reason += "method["+i+"](ignored)="; else reason += "method["+i+"]="; reason += methodsCalled.get(i)+"\n"; } if(lastLine == null) reason += "(possibly more but we quit after finding unexpected methods)\n"; else reason += lastLine+"\n"; return reason; } protected synchronized JsCalledMethod expectUnignoredCall(String m, Set ignorables, List calledMethods) { String method = m; if(method == null) method = NONE; //kind of dangerous if used with multiple threads because we might miss //a bad event coming in, but if you keep using the same listener for every test //the problem should still manifest itself in a //different test case which sucks but works. if(method.equals(NONE)) { System.out.println("method expected="+NONE+" on obj="+this); // we have to strip out all of the ignored methods from methodsCalled //CalledMethod[] methods = (CalledMethod[])methodsCalled.toArray(new CalledMethod[0]); Object[] methods = methodsCalled.toArray(); for(int i = 0; i < methods.length; i++) { JsCalledMethod calledMethod = (JsCalledMethod)methods[i]; if(ignorables.contains(calledMethod.getMethodName())) { while(methodsCalled.contains(calledMethod)) { methodsCalled.remove(calledMethod); } } } LeftOverMethods leftOver = getLeftOverMethods(ignorables); if(leftOver != null) { String reason = "You were expecting no methods to be called, but method(s) not\n" +"in the ignore list were called earlier. method(s)="+leftOver; reason += getHowMethodWasCalled(leftOver.getMethod(0)); throw new JsExpectFailedException(reason, leftOver.getMethods(), JsExpectFailedException.UNEXPECTED_ON_NONE); } return new JsCalledMethod(NONE, null, null); } return waitForUnignoredCall(method, ignorables, calledMethods); } private JsCalledMethod waitForUnignoredCall( String logM, Set ignorables, List calledMethods) { long waitTime2 = waitTime+50; // long currentTime; //only while waitTime is greater than 50 milliseconds while(waitTime2 >= 50) { //if there are no methods called yet, since we can't wait like mocklib, throw an exception //as all testing will have to happen on test thread!!! if(methodsCalled.size() <= 0) { return null; // currentTime = System.currentTimeMillis(); // System.out.println("method expected(not called yet-waiting)="+logM+" on obj="+this+" wait="+waitTime2); // this.wait(waitTime2); // long waitedOnWait = System.currentTimeMillis() - currentTime; // waitTime2 -= waitedOnWait; } //check for new methods to be called now...if no non-ignorable methods, then //continue while loop. for(int i = 0; i < methodsCalled.size(); i++) { JsCalledMethod calledMethod = (JsCalledMethod)methodsCalled.remove(0); calledMethods.add(calledMethod); if(!ignorables.contains(calledMethod.getMethodName())) { System.out.println("method expected and was called="+logM+" on obj="+this); return calledMethod; } } } //return null means timeout.... return null; } private Set createIgnorableMap(List ignorableMethods) { Set ignorables = new HashSet(); if(ignorableMethods != null) { for(int i = 0; i < ignorableMethods.size(); i++) { String method = (String)ignorableMethods.get(i); ignorables.add(method); } } return ignorables; } private LeftOverMethods getLeftOverMethods(Set ignorables) { List leftOver = new ArrayList(); for(int i = 0; i < methodsCalled.size(); i++) { JsCalledMethod o = (JsCalledMethod)methodsCalled.get(i); if(o != null && !ignorables.contains(o.getMethodName())) { leftOver.add(o); } } if(leftOver.size() <= 0) return null; Object[] m = new Object[0]; //m = (CalledMethod[])leftOver.toArray(m); m = leftOver.toArray(); return new LeftOverMethods(m); } private class LeftOverMethods { private Object[] leftOver; public LeftOverMethods(Object[] m) { leftOver = m; } public Object[] getMethods() { return leftOver; } public int getCalledMethodCount() { return leftOver.length; } public JsCalledMethod getMethod(int index) { return (JsCalledMethod)leftOver[index]; } public String toString() { String retVal = ""; for(int i = 0; i < leftOver.length; i++) { retVal+="\n"+leftOver[i]; } return retVal; } } /** * @see biz.xsoftware.mock.JsMockObject#addThrowException(java.lang.String, java.lang.Throwable) */ public synchronized void addThrowException(String method, Throwable e) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); else if(e == null) throw new IllegalArgumentException("e parameter to this method cannot be null"); List l = (List)methodToReturnVal.get(method); if(l == null) { l = new ArrayList(); methodToReturnVal.put(method, l); } l.add(e); } /** * @see biz.xsoftware.mock.JsMockObject#addReturnValue(java.lang.String, java.lang.Object) */ public synchronized void addReturnValue(String method, Object o) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); List l = (List)methodToReturnVal.get(method); if(l == null) { l = new ArrayList(); methodToReturnVal.put(method, l); } l.add(o); } public void setDefaultReturnValue(String method, Object o) { methodToDefaultRetVal.put(method, o); } /** * This is the method that calls the cloner to clone * objects like ByteBuffer that can change after * they are called. * * @param o */ private Object[] clone(String method, Object[] params) { if(params == null) return null; //check if the next object is a Behavior object List actions = (List)methodToReturnVal.get(method); if(actions != null) { Object action = actions.get(0); if(action instanceof JsBehavior) { JsBehavior behavior = (JsBehavior)action; return behavior.clone(params); } } return params; } public void addBehavior(String method, JsBehavior behavior) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); List l = (List)methodToReturnVal.get(method); if(l == null) { l = new ArrayList(); methodToReturnVal.put(method, l); } l.add(behavior); } } --- NEW FILE: JsBehavior.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client; /** * An implementation of this class must have the */ public interface JsBehavior { public Object[] clone(Object[] params); /** * This method will be called in place of the interface method you are expecting to be called. * This is where you can add behavior to the mock object. * * @param params */ public Object runMethod(Object[] params); } --- NEW FILE: JsExpectFailedException.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.mock.client; /** * This Exception is thrown when something is expected to happen * and doesn't. It is basically the assert failing. When * MockSuperclass.expectEvent is called and the event doesn't come, * this exception is thrown. * * @author Dean Hiller */ public class JsExpectFailedException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; /** * Expect failed because an event never came and waiting finally timed out. */ public static final String TIMED_OUT = "timed out waiting for method"; /** * Expect failed because a method you did not list in expected methods was called after * all your expected methods were called. */ public static final String UNEXPECTED_CALL_AFTER = "Another method that was not expected nor ignored was called after all the expected method calls"; /** * Expect failed because a method you did not list in expected methods was called * before or during the other methods you did expect. */ public static final String UNEXPECTED_CALL_BEFORE = "Another method that was not expected nor ignored was called before all the expected method calls were called"; /** * Expect failed because you expected no methods to be called, but a method was called. */ public static final String UNEXPECTED_ON_NONE = "Another method was called when no methods should have been called"; private String reason; private Object[] methods; private String detailMessage; public JsExpectFailedException() {} /** * Constructor for Expects that fail with a reason and message. * * @param message */ public JsExpectFailedException(String message, Object[] methods, String reason) { super(message); this.detailMessage = message; this.reason = reason; this.methods = methods; } /** * Gets the reason expecting the call(s) failed. * * Returns either * <ol> * <li>{@link #TIMED_OUT}</li> * <li>{@link #UNEXPECTED_CALL_AFTER}</li> * <li>{@link #UNEXPECTED_CALL_BEFORE}</li> * <li>{@link #UNEXPECTED_ON_NONE}</li> * </ol> * @return The reason for the failure. One of */ public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public int retrieveCalledMethodCount() { return methods.length; } /** * Gives you back the CalledMethods giving you access to the * parameters that were passed in and the stack traces of how * they were called. * */ public JsCalledMethod retrieveCalledMethod(int index) { return (JsCalledMethod)methods[index]; } /** * @return */ Object[] getCalledMethods() { return methods; } public void setCalledMethods(Object[] methods) { this.methods = methods; } public String toString() { return super.toString()+" Subclass:"+detailMessage; } } --- NEW FILE: JsCalledMethod.java --- /* * Created on Aug 12, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package biz.xsoftware.mock.client; import java.util.Arrays; import java.util.List; /** * @author Dean Hiller * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class JsCalledMethod { private String method; private Object[] params; private Throwable howItWasCalled; public JsCalledMethod(String method, Object[] params, Throwable howItWasCalled) { this.method = method; if(params == null) this.params = new Object[0]; else this.params = params; this.howItWasCalled = howItWasCalled; } public String getMethodName() { return method; } public int getParameterCount() { return params.length; } public Object getParameter(int index) { return params[index]; } /** * */ public Object[] getAllParams() { return params; } public Throwable getHowItWasCalled() { return howItWasCalled; } public String toString() { List paramList = null; if(params != null) paramList = Arrays.asList(params); return "[method="+method+" params="+paramList+"]"; } } --- NEW FILE: JsMockEntry.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client; import com.google.gwt.core.client.EntryPoint; /** */ public class JsMockEntry implements EntryPoint { /** * @see com.google.gwt.core.client.EntryPoint#onModuleLoad() */ public void onModuleLoad() { } } |
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/com/google/gwt/sample/dynatable/client In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/com/google/gwt/sample/dynatable/client Removed Files: SchoolCalendarService.java DynaTableDataProvider.java SchoolCalendarWidget.java Student.java Professor.java Person.java DynaTable.java TimeSlot.java DayFilterWidget.java Schedule.java DynaTableWidget.java SchoolCalendarServiceAsync.java Log Message: finishing up gwtmocklib --- DayFilterWidget.java DELETED --- --- Schedule.java DELETED --- --- Person.java DELETED --- --- Professor.java DELETED --- --- SchoolCalendarService.java DELETED --- --- Student.java DELETED --- --- SchoolCalendarServiceAsync.java DELETED --- --- TimeSlot.java DELETED --- --- SchoolCalendarWidget.java DELETED --- --- DynaTableDataProvider.java DELETED --- --- DynaTableWidget.java DELETED --- --- DynaTable.java DELETED --- |
From: Nobody <fas...@us...> - 2006-09-12 05:00:23
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/com/google/gwt/sample/dynatable/public In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/com/google/gwt/sample/dynatable/public Removed Files: index.html calendar45.txt calendar60.txt calendar90.txt calendar30.txt calendar0.txt calendar15.txt DynaTable.css calendar75.txt Log Message: finishing up gwtmocklib --- calendar75.txt DELETED --- --- index.html DELETED --- --- calendar30.txt DELETED --- --- calendar60.txt DELETED --- --- calendar0.txt DELETED --- --- DynaTable.css DELETED --- --- calendar90.txt DELETED --- --- calendar45.txt DELETED --- --- calendar15.txt DELETED --- |
From: Nobody <fas...@us...> - 2006-09-12 05:00:23
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/com/google/gwt/sample/dynatable In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/com/google/gwt/sample/dynatable Removed Files: COPYING DynaTable.gwt.xml Log Message: finishing up gwtmocklib --- COPYING DELETED --- --- DynaTable.gwt.xml DELETED --- |
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client/example1 In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18350/input/javasrc/biz/xsoftware/mock/client/example1 Added Files: MockListenerManager.java ListenerManagerImpl.java MyApplication.java ListenerManager.java TestExample.java Log Message: finishing up gwtmocklib --- NEW FILE: MyApplication.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.example1; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Widget; /** */ public class MyApplication { private boolean wasClicked = false; public MyApplication(ListenerManager mgr) { Button button = new Button("Gwt-Button"); mgr.addClickListener(button, new MyClickListener()); } private class MyClickListener implements ClickListener { /** * @see com.google.gwt.user.client.ui.ClickListener#onClick(com.google.gwt.user.client.ui.Widget) */ public void onClick(Widget sender) { wasClicked = true; } } public boolean getWasClicked() { return wasClicked; } } --- NEW FILE: ListenerManagerImpl.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.example1; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.SourcesClickEvents; /** */ public class ListenerManagerImpl implements ListenerManager { public void addClickListener(SourcesClickEvents src, ClickListener l) { src.addClickListener(l); } public void removeClickListener(SourcesClickEvents src, ClickListener l) { src.removeClickListener(l); } } --- NEW FILE: TestExample.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.example1; import biz.xsoftware.mock.client.JsCalledMethod; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Widget; /** */ public class TestExample extends GWTTestCase { /** * @see com.google.gwt.junit.client.GWTTestCase#getModuleName() */ public String getModuleName() { return "biz.xsoftware.mock.MockLib"; } public void testClickingButton() { MockListenerManager mock = new MockListenerManager(); MyApplication app = new MyApplication(mock); JsCalledMethod method = mock.expect("addClickListener"); Widget widget = (Widget)method.getAllParams()[0]; ClickListener l = (ClickListener)method.getAllParams()[1]; //click the button..... l.onClick(widget); assertEquals(true, app.getWasClicked()); } } --- NEW FILE: ListenerManager.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.example1; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.SourcesClickEvents; /** */ public interface ListenerManager { public void addClickListener(SourcesClickEvents src, ClickListener l); public void removeClickListener(SourcesClickEvents src, ClickListener l); } --- NEW FILE: MockListenerManager.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.mock.client.example1; import biz.xsoftware.mock.client.JsMockSuperclass; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.SourcesClickEvents; /** */ public class MockListenerManager extends JsMockSuperclass implements ListenerManager { private static final String ADD_CLICKLISTENER = "addClickListener"; private static final String REMOVE_CLICKLISTENER = "removeClickListener"; /** * @see biz.xsoftware.mock.client.example1.ListenerManager * #addClickListener(com.google.gwt.user.client.ui.SourcesClickEvents, com.google.gwt.user.client.ui.ClickListener) */ public void addClickListener(SourcesClickEvents src, ClickListener l) { methodCalled(ADD_CLICKLISTENER, new Object[] {src, l}); } /** * @see biz.xsoftware.mock.client.example1.ListenerManager * \#removeClickListener(com.google.gwt.user.client.ui.SourcesClickEvents, com.google.gwt.user.client.ui.ClickListener) */ public void removeClickListener(SourcesClickEvents src, ClickListener l) { methodCalled(REMOVE_CLICKLISTENER, new Object[] {src, l}); } } |
From: Nobody <fas...@us...> - 2006-09-12 04:55:22
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18298/input/javasrc/biz/xsoftware/mock/client Log Message: Directory /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client added to the repository |