mocklib-checkins Mailing List for mocklib (Page 4)
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: Nobody <fas...@us...> - 2006-09-16 04:33:38
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32564/bldfiles Added Files: directory.properties project.build project.properties Log Message: add netbuildtemplate. --- NEW FILE: project.build --- <?xml version="1.0" encoding="utf-8"?> <project name="Build Project" default="all" basedir=".."> <!-- Targets that gets called for the Build --> <include buildfile="bldfiles/project.properties"/> <include buildfile="bldfiles/directory.properties"/> <property name="type" value="library" overwrite="false"/> <property name="ext" value=".dll" if="${type == 'library'}" /> <property name="ext" value=".exe" if="${type == 'exe'}" /> <property name="comp.name" value="${assembly.name}${ext}"/> <loadtasks assembly="${tools}/nant-contrib/NAnt.Contrib.Tasks.dll" /> <target name="gensrc" description="Generates source code from an xsd to use for xml processing"> <mkdir dir="${gensrc}"/> <foreach item="File" property="filename"> <in> <items> <include name="${schemas}/*.xsd" /> </items> </in> <do> <xsd outputdir="${gensrc}" namespace="${namespace}" schema="${filename}"/> </do> </foreach> </target> <target name="compile" depends="gensrc" description="compiles the source file for this project"> <echo message="Generating ${comp.name} type=${type}"/> <mkdir dir="${assemblies}"/> <csc target="${type}" debug="true" output="${assemblies}/${comp.name}" warnaserror="true"> <sources basedir="."> <include name="${csfiles}/**/*.cs"/> <include name="${gensrc}/**/*.cs"/> </sources> <references basedir="."> <include name="${lib}/**/*.dll"/> <include name="${tools}/NUnit/*.dll"/> </references> <resources basedir="${csfiles}"> <include name="**/*.resx"/> </resources> </csc> <copy todir="${assemblies}"> <fileset basedir="${lib}"> <include name="**/*.dll" /> </fileset> </copy> </target> <target name="winsvc.staging" depends="compile" description="Packages the webservice all up together to resemble deployment"> <mkdir dir="${winsvc.staging.bin}"/> <mkdir dir="${winsvc.staging}/log"/> <copy todir="${winsvc.staging.bin}"> <fileset basedir="${assemblies}"> <include name="**/*" /> </fileset> </copy> <copy todir="${winsvc.staging}"> <fileset basedir="${config}"> <include name="**/*" /> </fileset> </copy> </target> <target name="deployWinSvc" depends="winsvc.staging" description="deploys the windows service" > <echo message="Installing the Framework Windows Service...."/> <readregistry property="installutil.dir" key="SOFTWARE\Microsoft\ASP.NET\1.1.4322.0\path" hive="LocalMachine" failonerror="false"/> <exec basedir="${installutil.dir}" program="installutil" commandline="HSEM.Framework.exe" workingdir="${winsvc.staging.bin}" failonerror="true"/> </target> <target name="undeployWinSvc" description="undeploys the windows service" > <echo message="Uninstalling the Framework Windows Service...."/> <readregistry property="installutil.dir" key="SOFTWARE\Microsoft\ASP.NET\1.1.4322.0\path" hive="LocalMachine" failonerror="false"/> <exec basedir="${installutil.dir}" program="installutil" commandline="/u HSEM.Framework.exe" workingdir="${winsvc.staging.bin}" failonerror="false"/> </target> <target name="codecoverage" depends="compile"> <mkdir dir="${codecov}"/> <delete dir="${assemblies}\log" failonerror="false"/> <copy todir="${assemblies}"> <fileset basedir="${config}"> <include name="**/*" /> </fileset> </copy> <exec program="${tools}/NCover/NCover.Console.exe" commandline="/o ${codecov}/${comp.name}.xml /c "${tools}/NUnit/nunit-console.exe" ${assemblies}/${comp.name} /a ${assembly.name} /l ${codecov}/NCover.log"/> </target> <target name="testall" depends="compile"> <nunit2> <formatter type="Plain" /> <test assemblyname="${assemblies}/${comp.name}"/> </nunit2> </target> <target name="all" depends="winsvc.staging, testall" description="Builds everything, puts in web.staging and runs testall"/> <target name="clean" depends="undeployWinSvc" description="Cleans out files generated from this build file"> <delete dir="${output}" failonerror="false"/> </target> </project> --- NEW FILE: project.properties --- <?xml version="1.0" encoding="utf-8"?> <project name="project.properties"> <!--property name="type" value="exe"--> <property name="assembly.name" value="NMockLib"/> <property name="namespace" value="NMockLib"/> </project> --- NEW FILE: directory.properties --- <?xml version="1.0" encoding="utf-8"?> <project name="directory.properties"> <!-- input directories --> <property name="input" value="input"/> <property name="csfiles" value="${input}/csharp"/> <property name="lib" value="${input}/lib"/> <property name="config" value="${input}/config"/> <property name="schemas" value="${input}/schemas"/> <property name="tools" value="tools"/> <!-- output directories --> <property name="output" value="output"/> <property name="gensrc" value="${output}/gensrc"/> <property name="assemblies" value="${output}/outassemblies"/> <property name="web.staging" value="${output}/staging-web"/> <property name="web.staging.bin" value="${web.staging}/bin"/> <property name="winsvc.staging" value="${output}/staging-winsvc"/> <property name="winsvc.staging.bin" value="${winsvc.staging}/bin"/> <property name="dist" value="${output}/dist"/> <property name="codecov" value="${output}/codecov"/> </project> |
From: Nobody <fas...@us...> - 2006-09-16 04:31:51
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32203/bldfiles Log Message: Directory /cvsroot/mocklib/netmocklib/bldfiles added to the repository |
From: dadrox <da...@us...> - 2006-09-15 21:23:03
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15444/input/javasrc/biz/xsoftware/mock Modified Files: MockObjectFactory.java Behavior.java Log Message: removed some stuff that shouldn't have been in the files Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Behavior.java 10 Sep 2006 20:45:04 -0000 1.3 --- Behavior.java 15 Sep 2006 21:22:56 -0000 1.4 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.mock; --- 1,2 ---- Index: MockObjectFactory.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObjectFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockObjectFactory.java 12 Sep 2006 02:21:01 -0000 1.4 --- MockObjectFactory.java 15 Sep 2006 21:22:56 -0000 1.5 *************** *** 1,8 **** - /* - * 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; --- 1,2 ---- |
From: dadrox <da...@us...> - 2006-09-15 21:23:00
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15444/input/javasrc/biz/xsoftware/impl/mock Modified Files: MockObjectImpl.java Log Message: removed some stuff that shouldn't have been in the files Index: MockObjectImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockObjectImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockObjectImpl.java 12 Sep 2006 02:20:59 -0000 1.1 --- MockObjectImpl.java 15 Sep 2006 21:22:56 -0000 1.2 *************** *** 1,8 **** - /* - * 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.impl.mock; --- 1,2 ---- |
From: dadrox <da...@us...> - 2006-09-15 21:22:59
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15444/input/javasrc/biz/xsoftware/test/mock Modified Files: ExtendedCar.java CarImpl.java Identical.java Log Message: removed some stuff that shouldn't have been in the files Index: ExtendedCar.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/ExtendedCar.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtendedCar.java 14 Sep 2006 22:36:53 -0000 1.1 --- ExtendedCar.java 15 Sep 2006 21:22:56 -0000 1.2 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.test.mock; --- 1,2 ---- Index: Identical.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/Identical.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Identical.java 10 Sep 2006 18:25:48 -0000 1.1 --- Identical.java 15 Sep 2006 21:22:56 -0000 1.2 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.test.mock; --- 1,2 ---- Index: CarImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/CarImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CarImpl.java 15 Sep 2006 16:12:14 -0000 1.2 --- CarImpl.java 15 Sep 2006 21:22:56 -0000 1.3 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.test.mock; --- 1,2 ---- |
From: dadrox <da...@us...> - 2006-09-15 21:20:14
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14089/input/javasrc/biz/xsoftware/mock Modified Files: Behavior.java MockObject.java MockObjectImpl.java Log Message: removed some stuff that shouldn't have been in the files Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Behavior.java 10 Sep 2006 17:41:29 -0000 1.4 --- Behavior.java 15 Sep 2006 21:19:46 -0000 1.5 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.mock; --- 1,2 ---- Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MockObject.java 10 Sep 2006 17:41:29 -0000 1.8 --- MockObject.java 15 Sep 2006 21:19:46 -0000 1.9 *************** *** 1,8 **** - /* - * 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; --- 1,2 ---- Index: MockObjectImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/MockObjectImpl.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MockObjectImpl.java 10 Sep 2006 17:18:39 -0000 1.12 --- MockObjectImpl.java 15 Sep 2006 21:19:46 -0000 1.13 *************** *** 1,8 **** - /* - * 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; --- 1,2 ---- |
From: dadrox <da...@us...> - 2006-09-15 21:19:51
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14089/input/javasrc/biz/xsoftware/test/mock Modified Files: Identical.java Car.java CarImpl.java TestMockCreator.java Log Message: removed some stuff that shouldn't have been in the files Index: Car.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock/Car.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Car.java 1 Sep 2006 16:31:43 -0000 1.2 --- Car.java 15 Sep 2006 21:19:46 -0000 1.3 *************** *** 1,15 **** - /* - * Created on Jun 8, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ package biz.xsoftware.test.mock; /** * @author Dean Hiller - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments */ public interface Car { --- 1,6 ---- Index: Identical.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock/Identical.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Identical.java 10 Jun 2006 12:41:03 -0000 1.1 --- Identical.java 15 Sep 2006 21:19:46 -0000 1.2 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.test.mock; --- 1,2 ---- Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TestMockCreator.java 10 Sep 2006 17:41:29 -0000 1.11 --- TestMockCreator.java 15 Sep 2006 21:19:46 -0000 1.12 *************** *** 1,8 **** - /* - * 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.test.mock; --- 1,2 ---- Index: CarImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock/CarImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CarImpl.java 1 Sep 2006 16:31:43 -0000 1.1 --- CarImpl.java 15 Sep 2006 21:19:46 -0000 1.2 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.test.mock; --- 1,2 ---- |
From: dadrox <da...@us...> - 2006-09-15 21:17:53
|
Update of /cvsroot/mocklib/mocklib/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13220/input/javasrc/biz/xsoftware/mock Modified Files: Behavior.java Log Message: removed some stuff that shouldn't have been in the files Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Behavior.java 10 Sep 2006 18:01:12 -0000 1.1 --- Behavior.java 15 Sep 2006 21:17:27 -0000 1.2 *************** *** 1,5 **** - /** - * Copyright (C) 2006 Carrier Access, Corp. - */ package biz.xsoftware.mock; --- 1,2 ---- |
From: Nobody <fas...@us...> - 2006-09-15 16:12:21
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20979/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java Car.java CarImpl.java Log Message: fix broken test Index: Car.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/Car.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Car.java 10 Sep 2006 18:25:48 -0000 1.1 --- Car.java 15 Sep 2006 16:12:14 -0000 1.2 *************** *** 18,21 **** public void closeDoor(); ! public int getWheelCount(); } --- 18,21 ---- public void closeDoor(); ! public int getWheelCount(int carId); } Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestMockCreator.java 14 Sep 2006 22:36:53 -0000 1.7 --- TestMockCreator.java 15 Sep 2006 16:12:14 -0000 1.8 *************** *** 218,222 **** try { mock.addReturnValue("getWheelCount", new Long(56)); ! car.getWheelCount(); fail("should have thrown exception"); } catch(IllegalArgumentException e) { --- 218,222 ---- try { mock.addReturnValue("getWheelCount", new Long(56)); ! car.getWheelCount(3); fail("should have thrown exception"); } catch(IllegalArgumentException e) { *************** *** 229,233 **** Car car = (Car)mock; try { ! car.getWheelCount(); fail("should have thrown exception"); } catch(IllegalArgumentException e) { --- 229,233 ---- Car car = (Car)mock; try { ! car.getWheelCount(1); fail("should have thrown exception"); } catch(IllegalArgumentException e) { *************** *** 240,244 **** Car car = (Car)mock; mock.addReturnValue("getWheelCount", new Integer(5)); ! car.getWheelCount(); mock.expect("getWheelCount"); --- 240,244 ---- Car car = (Car)mock; mock.addReturnValue("getWheelCount", new Integer(5)); ! car.getWheelCount(2); mock.expect("getWheelCount"); Index: CarImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/CarImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CarImpl.java 10 Sep 2006 18:25:48 -0000 1.1 --- CarImpl.java 15 Sep 2006 16:12:14 -0000 1.2 *************** *** 26,30 **** * @see biz.xsoftware.test.mock.Car#getWheelCount() */ ! public int getWheelCount() { return 0; --- 26,30 ---- * @see biz.xsoftware.test.mock.Car#getWheelCount() */ ! public int getWheelCount(int carId) { return 0; |
From: Nobody <fas...@us...> - 2006-09-15 16:01:23
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16534/input/javasrc/biz/xsoftware/impl/mock Modified Files: MethodVerifier.java Log Message: fixes for mocklib3 Index: MethodVerifier.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MethodVerifier.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MethodVerifier.java 14 Sep 2006 22:36:53 -0000 1.2 --- MethodVerifier.java 15 Sep 2006 16:01:17 -0000 1.3 *************** *** 2,5 **** --- 2,8 ---- import java.lang.reflect.Method; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; *************** *** 47,120 **** } ! private static Method methodExistInThisClass(Class c, boolean isVerifyArgs, String method, Class... argTypes) { ! 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())) { ! if(!isVerifyArgs) ! return methods[i]; ! else if(noOverloadedVersionsExist(c, methods[i])) ! return methods[i]; ! else if(paramsMatch(methods[i], argTypes)) ! return methods[i]; ! else { ! throwException(c, method); ! } ! } ! ! } ! return null; } ! /** ! * @param c * @param method */ ! private static void throwException(Class c, String method) { ! String msg = "The following methods match the method expected:\n"; ! for(Method m : c.getMethods()) { ! if(m.getName().equals(method)) ! msg += MessageHelper.getMethodSignature(m, "")+"\n"; } ! msg += "You need to clarify which method you would like to add the return value to by " + ! "specifying the Class arguments which are the type of overloaded method"; ! throw new IllegalArgumentException(msg); } ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { ! if(method == null) ! throw new IllegalArgumentException("method parameter cannot be null"); ! else if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) ! return null; ! else if(classes == null) ! return null; ! ! String classNames = ""; ! for(int i = 0; i < classes.length; i++) { ! if(log.isLoggable(Level.FINEST)) ! log.finest("class="+classes[i].getName()); ! Method m = methodExistInThisClass(classes[i], isVerifyArgs, method, argTypes); ! if(m != null) ! return m; ! classNames += "\n"+classes[i]; ! } ! ! String args = ""; ! if(argTypes != null && argTypes.length > 0) { ! int i = 0; ! for(; i < argTypes.length-1; i++) { ! Class c = argTypes[i]; ! args += c.getName()+","; ! } ! args+=argTypes[i].getName(); ! } ! ! String methodSig = method+"("+args+")"; ! ! throw new IllegalArgumentException("method='"+methodSig+"' is not a public method on any of the" + ! "\nfollowing Classes/Interfaces"+classNames); ! } } --- 50,190 ---- } ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { ! if(method == null) ! throw new IllegalArgumentException("method parameter cannot be null"); ! else if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) ! return null; ! else if(classes == null) ! return null; ! else if(argTypes != null) { ! for(Class argType : argTypes) { ! if(argType == null) ! throw new IllegalArgumentException("No Class parameters can be null, yet one was null"); ! } ! } ! ! List<Method> methods = new ArrayList<Method>(); ! for(Class c : classes) { ! if(log.isLoggable(Level.FINEST)) ! log.finest("adding methods for class="+c.getName()); ! Method[] classMethods = c.getMethods(); ! List<Method> listedMethods = Arrays.asList(classMethods); ! methods.addAll(listedMethods); ! } ! ! List<Method> matchingMethods = findMatchingMethods(methods, method, argTypes); ! ! if(matchingMethods == null) { ! String classNames = getClassNamesString(classes); ! String methodSig = getMethodSigString(method, argTypes); ! throw new IllegalArgumentException("method='"+methodSig+"' is not a public method on any of the" + ! "\nfollowing Classes/Interfaces"+classNames); ! } else if(matchingMethods.size() == 1) { ! return matchingMethods.get(0); ! } else if(!isVerifyArgs && matchingMethods.size() > 0) { ! return null; //don't need to return anything for this. ! } else { ! String msg = "Too many methods match your method expected='"+method+"'. Methods found:\n"; ! for(Method m : matchingMethods) { ! msg += MessageHelper.getMethodSignature(m, "")+"\n"; ! } ! msg += "You need to clarify which method you would like to add the return value to by " + ! "specifying the Class arguments which are the type of overloaded method"; ! throw new IllegalArgumentException(msg); ! } } ! /** * @param method + * @param argTypes + * @return */ ! private static String getMethodSigString(String method, Class... argTypes) { ! String args = ""; ! if(argTypes != null && argTypes.length > 0) { ! int i = 0; ! for(; i < argTypes.length-1; i++) { ! Class c = argTypes[i]; ! args += c.getName()+","; ! } ! args+=argTypes[i].getName(); } ! ! String methodSig = method+"("+args+")"; ! return methodSig; } ! /** ! * @param classes ! * @return ! */ ! private static String getClassNamesString(Class[] classes) ! { ! String classNames = ""; ! for(int i = 0; i < classes.length; i++) { ! classNames += "\n"+classes[i]; ! } ! return classNames; ! } + /** + * @param methods + * @param method + * @param argTypes + * @return + */ + private static List<Method> findMatchingMethods(List<Method> methods, String methodName, Class[] argTypes) + { + //find all methods with same name first + List<Method> matches = new ArrayList<Method>(); + for(Method method : methods) { + if(method.getName().equals(methodName)) { + matches.add(method); + } + } + if(matches.size() == 0) + return null; + + List<Method> narrowedMatches = new ArrayList<Method>(); + //find one that takes no args if that is what we are looking for... + if(argTypes == null || argTypes.length == 0) { + for(Method method : matches) { + if(method.getParameterTypes() == null || method.getParameterAnnotations().length == 0) { + narrowedMatches.add(method); + return narrowedMatches; + } + } + return matches; + } + + //we have some argType then....fine the single method.... + for(Method method : matches) { + Class< ? >[] types = method.getParameterTypes(); + if(isArgTypesMatch(types, argTypes)) { + narrowedMatches.add(method); + return narrowedMatches; + } + } + + return null; + } + + /** + * @param types + * @param argTypes + * @return + */ + private static boolean isArgTypesMatch(Class< ? >[] types, Class[] argTypes) + { + if(types.length != argTypes.length) + return false; + + for(int i = 0; i < types.length; i++) { + if(!types[i].equals(argTypes[i])) + return false; + } + return true; + } } + |
From: Nobody <fas...@us...> - 2006-09-14 22:36:56
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20712/input/javasrc/biz/xsoftware/impl/mock Modified Files: MessageHelper.java MethodVerifier.java Log Message: test overloaded method and get exception messages working. Index: MethodVerifier.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MethodVerifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MethodVerifier.java 12 Sep 2006 02:20:59 -0000 1.1 --- MethodVerifier.java 14 Sep 2006 22:36:53 -0000 1.2 *************** *** 24,28 **** } ! private static boolean paramsNotNeedMatch(Class c, Method method) { Method[] classMethods = c.getMethods(); int matches = 0; --- 24,37 ---- } ! /** ! * Returns true if their are no overloaded versions of the method expected in the Class. ! * ie. only one version of write exists. There is not a method write(byte[] b) and write(int i). If ! * there is an overloaded version, this returns false. ! * ! * @param c ! * @param method ! * @return ! */ ! private static boolean noOverloadedVersionsExist(Class c, Method method) { Method[] classMethods = c.getMethods(); int matches = 0; *************** *** 46,53 **** if(!isVerifyArgs) return methods[i]; ! else if(paramsNotNeedMatch(c, methods[i])) return methods[i]; else if(paramsMatch(methods[i], argTypes)) ! return methods[i]; } --- 55,65 ---- if(!isVerifyArgs) return methods[i]; ! else if(noOverloadedVersionsExist(c, methods[i])) return methods[i]; else if(paramsMatch(methods[i], argTypes)) ! return methods[i]; ! else { ! throwException(c, method); ! } } *************** *** 56,60 **** } ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); --- 68,88 ---- } ! /** ! * @param c ! * @param method ! */ ! private static void throwException(Class c, String method) ! { ! String msg = "The following methods match the method expected:\n"; ! for(Method m : c.getMethods()) { ! if(m.getName().equals(method)) ! msg += MessageHelper.getMethodSignature(m, "")+"\n"; ! } ! msg += "You need to clarify which method you would like to add the return value to by " + ! "specifying the Class arguments which are the type of overloaded method"; ! throw new IllegalArgumentException(msg); ! } ! ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); Index: MessageHelper.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MessageHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MessageHelper.java 12 Sep 2006 02:20:58 -0000 1.1 --- MessageHelper.java 14 Sep 2006 22:36:53 -0000 1.2 *************** *** 14,22 **** public static String getMethodSignature(Method method, String postfix) { ! String methodSig = "public "+method.getReturnType()+" "+method.getName()+postfix+"("; for(Class c : method.getParameterTypes()) { methodSig += c.getName()+", "; } ! return methodSig.substring(0, methodSig.length()-2)+")"; } --- 14,29 ---- public static String getMethodSignature(Method method, String postfix) { ! String methodSig = "public "+method.getReturnType(); ! methodSig += " "+method.getName(); ! methodSig += postfix; ! methodSig += "("; ! boolean needChop = false; for(Class c : method.getParameterTypes()) { methodSig += c.getName()+", "; + needChop = true; } ! if(needChop) ! return methodSig.substring(0, methodSig.length()-2)+")"; ! return methodSig+")"; } |
From: Nobody <fas...@us...> - 2006-09-14 22:36:56
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20712/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java Added Files: ExtendedCar.java Log Message: test overloaded method and get exception messages working. --- NEW FILE: ExtendedCar.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.test.mock; /** */ public interface ExtendedCar extends Car { public int getWheelCount(String s); } Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestMockCreator.java 13 Sep 2006 03:09:00 -0000 1.6 --- TestMockCreator.java 14 Sep 2006 22:36:53 -0000 1.7 *************** *** 273,276 **** --- 273,296 ---- } + // public void testTemp() { + // MockObject mock = MockObjectFactory.createMock(ChannelManagerService.class); + // int value = 5; + // mock.addReturnValue("getWheelCount", value); + // + // ExtendedCar car = (ExtendedCar)mock; + // int wheelCount = car.getWheelCount(); + // assertEquals(value, wheelCount); + // } + + public void testOverloadedMethod() { + MockObject mock = MockObjectFactory.createMock(ExtendedCar.class); + int value = 5; + try { + mock.addReturnValue("getWheelCount", value); + fail("should have thrown exception"); + } catch(IllegalArgumentException e) { + } + } + public void testAddRemoveIgnore() { |
From: Nobody <fas...@us...> - 2006-09-14 15:30:32
|
Update of /cvsroot/mocklib/gwtmocklib/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv8374/bldfiles Modified Files: build.xml Log Message: fix url and tweak build file. Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/bldfiles/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 12 Sep 2006 14:35:50 -0000 1.5 --- build.xml 14 Sep 2006 15:30:28 -0000 1.6 *************** *** 690,697 **** </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="***************************************************************" /> --- 690,706 ---- </target> + <target name="releaseDocs" depends="createdist" if="password"> + <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" /--> + + </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="releaseDocs" if="password"> <echo message="***************************************************************" /> <echo message="***************************************************************" /> *************** *** 713,722 **** </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}" /> --- 722,725 ---- |
From: Nobody <fas...@us...> - 2006-09-14 15:28:03
|
Update of /cvsroot/mocklib/mocklib3/bldfiles In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7129/bldfiles Modified Files: build.xml Log Message: change delivery mechanism slightly. Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 12 Sep 2006 03:39:25 -0000 1.6 --- build.xml 14 Sep 2006 15:27:57 -0000 1.7 *************** *** 657,664 **** </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="***************************************************************" /> --- 657,673 ---- </target> + <target name="releaseDocs" depends="createdist" if="password"> + <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" /--> + + </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="releaseDocs" if="password"> <echo message="***************************************************************" /> <echo message="***************************************************************" /> *************** *** 680,689 **** </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}"/> --- 689,692 ---- |
From: Nobody <fas...@us...> - 2006-09-13 18:01:56
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7962/input/javasrc/biz/xsoftware/examples/basic Modified Files: CreditAuthorizationSvc.java Log Message: try to trigger syncmail. Index: CreditAuthorizationSvc.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic/CreditAuthorizationSvc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CreditAuthorizationSvc.java 11 Sep 2006 03:47:39 -0000 1.2 --- CreditAuthorizationSvc.java 13 Sep 2006 18:01:51 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- public interface CreditAuthorizationSvc { + public void takeMoney(String user, double usDollars); public void returnMoney(String user, double usDollars); |
From: Nobody <fas...@us...> - 2006-09-13 03:23:28
|
Update of /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26149/input/javasrc/biz/xsoftware/mock/client Modified Files: JsMockSuperclass.java Log Message: minor mod to remove public method that is not needed anymore Index: JsMockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/gwtmocklib/input/javasrc/biz/xsoftware/mock/client/JsMockSuperclass.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JsMockSuperclass.java 12 Sep 2006 05:00:15 -0000 1.1 --- JsMockSuperclass.java 13 Sep 2006 03:23:23 -0000 1.2 *************** *** 300,310 **** /** - * @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) */ --- 300,303 ---- |
From: Nobody <fas...@us...> - 2006-09-13 03:09:11
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/impl/mock Modified Files: MockSuperclass.java Log Message: refactor mocklib back to original api. Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockSuperclass.java 12 Sep 2006 15:02:11 -0000 1.2 --- MockSuperclass.java 13 Sep 2006 03:09:00 -0000 1.3 *************** *** 508,517 **** } ! public void setDefaultBehavior(Behavior b, String method) { ! setDefaultBehavior(b, method, new Class[] {}); } ! public void setDefaultBehavior(Behavior b, String method, Class... argTypes) { checkMethod(method, argTypes); if(b == null) --- 508,517 ---- } ! public void setDefaultBehavior(String method, Behavior b) { ! setDefaultBehavior(method, b, new Class[] {}); } ! public void setDefaultBehavior(String method, Behavior b, Class... argTypes) { checkMethod(method, argTypes); if(b == null) *************** *** 520,529 **** } ! public void setDefaultReturnValue(Object returnValue, String method) { ! setDefaultReturnValue(returnValue, method, new Class[] {}); } ! public void setDefaultReturnValue(Object o, String method, Class... argTypes) { checkMethod(method, argTypes); --- 520,529 ---- } ! public void setDefaultReturnValue(String method, Object returnValue) { ! setDefaultReturnValue(method, returnValue, new Class[] {}); } ! public void setDefaultReturnValue(String method, Object o, Class... argTypes) { checkMethod(method, argTypes); *************** *** 531,540 **** } ! public void addBehavior(Behavior behavior, String method) { ! addBehavior(behavior, method, new Class[] {}); } ! public void addBehavior(Behavior behavior, String method, Class... argTypes) { if(behavior == null) throw new IllegalArgumentException("behavior parameter cannot be null"); --- 531,540 ---- } ! public void addBehavior(String method, Behavior behavior) { ! addBehavior(method, behavior, new Class[] {}); } ! public void addBehavior(String method, Behavior behavior, Class... argTypes) { if(behavior == null) throw new IllegalArgumentException("behavior parameter cannot be null"); *************** *** 572,584 **** } ! 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...) */ ! public synchronized void addThrowException(Throwable e, String method, Class... argTypes) { if(e == null) throw new IllegalArgumentException("e parameter to this method cannot be null"); --- 572,584 ---- } ! public void addThrowException(String method, Throwable e) { ! addThrowException(method, e, new Class[] {}); } /** ! * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.String, java.lang.Throwable, Class...) */ ! public synchronized void addThrowException(String method, Throwable e, Class... argTypes) { if(e == null) throw new IllegalArgumentException("e parameter to this method cannot be null"); *************** *** 588,600 **** ! 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...) */ ! public synchronized void addReturnValue(Object o, String method, Class... argTypes) { Action action = new ReturnValue(o); addToActionList(action, method, argTypes); --- 588,600 ---- ! public void addReturnValue(String method, Object o) { ! addReturnValue(method, o, new Class[] {}); } /** ! * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.String, java.lang.Object, Class...) */ ! public synchronized void addReturnValue(String method, Object o, Class... argTypes) { Action action = new ReturnValue(o); addToActionList(action, method, argTypes); |
From: Nobody <fas...@us...> - 2006-09-13 03:09:11
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/examples/basic Modified Files: TestExample.java Log Message: refactor mocklib back to original api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic/TestExample.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestExample.java 11 Sep 2006 03:47:39 -0000 1.4 --- TestExample.java 13 Sep 2006 03:09:00 -0000 1.5 *************** *** 113,117 **** //we want to tell mockCreditSvc to simulate a failure //by throwing an exception on the takeMoney method call ! mockCreditSvc.addThrowException(new IllegalStateException("cause failure"), "takeMoney"); String user = "user1"; --- 113,117 ---- //we want to tell mockCreditSvc to simulate a failure //by throwing an exception on the takeMoney method call ! mockCreditSvc.addThrowException("takeMoney", new IllegalStateException("cause failure")); String user = "user1"; *************** *** 133,137 **** public void testFailureOfBuyingGiftCard() { //Now, we want to simulate a failure that should cause recovery to occur.... ! mockGiftSvc.addThrowException(new RuntimeException("cause failure in subsystem"), "putMoneyOnCard"); String user = "userXXX"; --- 133,137 ---- public void testFailureOfBuyingGiftCard() { //Now, we want to simulate a failure that should cause recovery to occur.... ! mockGiftSvc.addThrowException("putMoneyOnCard", new RuntimeException("cause failure in subsystem")); String user = "userXXX"; |
From: Nobody <fas...@us...> - 2006-09-13 03:09:11
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/socket In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/examples/socket Modified Files: TestExample.java Log Message: refactor mocklib back to original api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/socket/TestExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestExample.java 11 Sep 2006 05:04:46 -0000 1.1 --- TestExample.java 13 Sep 2006 03:09:00 -0000 1.2 *************** *** 58,66 **** */ public void testNetworkProblems() { ! mockSocket.addThrowException(new IOException("problems writing to server"), "write"); ByteBuffer buffer = ByteBuffer.allocate(100); buffer.put(new byte[] { 1, 2, 3, 4}); buffer.flip(); ! mockSubsys.addReturnValue(buffer, "getUserData"); int id = 10; --- 58,66 ---- */ public void testNetworkProblems() { ! mockSocket.addThrowException("write", new IOException("problems writing to server")); ByteBuffer buffer = ByteBuffer.allocate(100); buffer.put(new byte[] { 1, 2, 3, 4}); buffer.flip(); ! mockSubsys.addReturnValue("getUserData", buffer); int id = 10; |
From: Nobody <fas...@us...> - 2006-09-13 03:09:11
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/examples/advanced Modified Files: TestExample.java Log Message: refactor mocklib back to original api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced/TestExample.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestExample.java 11 Sep 2006 00:34:10 -0000 1.4 --- TestExample.java 13 Sep 2006 03:09:00 -0000 1.5 *************** *** 64,69 **** //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("foo", "addTaskDone"); ! mockRecord.addReturnValue(mockUser, "getUser"); //have mockTaskSvc fire an event that should cause sysUnderTest --- 64,69 ---- //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("addTaskDone", "foo"); ! mockRecord.addReturnValue("getUser", mockUser); //have mockTaskSvc fire an event that should cause sysUnderTest |
From: Nobody <fas...@us...> - 2006-09-13 03:09:11
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/mock Modified Files: MockObject.java Log Message: refactor mocklib back to original api. Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MockObject.java 12 Sep 2006 15:02:11 -0000 1.6 --- MockObject.java 13 Sep 2006 03:09:00 -0000 1.7 *************** *** 48,68 **** /** * Set the DefaultReturnValue for a 'method' - * - * @param returnValue * @param method The method name to set the default return value for */ ! public void setDefaultReturnValue(Object returnValue, String method); /** * Set the DefaultReturnValue for a 'method' - * - * @param returnValue * @param method The method name to set the default return value for * @param argTypes Optionally specify the type of parameters of the method */ ! public void setDefaultReturnValue(Object returnValue, String method, Class... argTypes); ! public void setDefaultBehavior(Behavior b, String method); ! public void setDefaultBehavior(Behavior b, String method, Class ... argTypes); /** --- 48,66 ---- /** * Set the DefaultReturnValue for a 'method' * @param method The method name to set the default return value for + * @param returnValue */ ! public void setDefaultReturnValue(String method, Object returnValue); /** * Set the DefaultReturnValue for a 'method' * @param method The method name to set the default return value for + * @param returnValue * @param argTypes Optionally specify the type of parameters of the method */ ! public void setDefaultReturnValue(String method, Object returnValue, Class... argTypes); ! public void setDefaultBehavior(String method, Behavior b); ! public void setDefaultBehavior(String method, Behavior b, Class ... argTypes); /** *************** *** 82,89 **** * <li> RuntimeException for Subclasses of MockSuperclass</li> * </ol> - * @param e The exception to throw on method. * @param method The method to throw the exception on when it is called. */ ! public void addThrowException(Throwable e, String method); /** --- 80,87 ---- * <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); /** *************** *** 103,111 **** * <li> RuntimeException for Subclasses of MockSuperclass</li> * </ol> - * @param e The exception to throw on method. * @param method The method to throw the exception on when it is called. * @param argTypes Optionally specify the type of parameters of the method */ ! public void addThrowException(Throwable e, String method, Class... argTypes); /** --- 101,109 ---- * <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. * @param argTypes Optionally specify the type of parameters of the method */ ! public void addThrowException(String method, Throwable e, Class... argTypes); /** *************** *** 119,126 **** * <br></br> * Use Integer to return int, Long for long, etc. - * @param o The object to return that is added to the queue * @param method The method that when called returns first value on queue */ ! public void addReturnValue(Object o, String method); /** --- 117,124 ---- * <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); /** *************** *** 134,145 **** * <br></br> * Use Integer to return int, Long for long, etc. - * @param o The object to return that is added to the queue * @param method The method that when called returns first value on queue * @param argTypes Optionally specify the type of parameters of the method */ ! public void addReturnValue(Object o, String method, Class... argTypes); ! public void addBehavior(Behavior behavior, String method); ! public void addBehavior(Behavior behavior, String method, Class... argTypes); /** --- 132,143 ---- * <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 * @param argTypes Optionally specify the type of parameters of the method */ ! public void addReturnValue(String method, Object o, Class... argTypes); ! public void addBehavior(String method, Behavior behavior); ! public void addBehavior(String method, Behavior behavior, Class... argTypes); /** |
From: Nobody <fas...@us...> - 2006-09-13 03:09:08
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/behavior In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/examples/behavior Modified Files: TestExample.java Log Message: refactor mocklib back to original api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/behavior/TestExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestExample.java 11 Sep 2006 05:04:46 -0000 1.1 --- TestExample.java 13 Sep 2006 03:09:00 -0000 1.2 *************** *** 57,61 **** public void testNetworkProblems() throws IOException { ! mockSocket.addBehavior(new MyBehavior(), "write"); byte[] data = new byte[] { 1, 2, 3, 4 }; --- 57,61 ---- public void testNetworkProblems() throws IOException { ! mockSocket.addBehavior("write", new MyBehavior()); byte[] data = new byte[] { 1, 2, 3, 4 }; |
From: Nobody <fas...@us...> - 2006-09-13 03:09:07
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java Log Message: refactor mocklib back to original api. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestMockCreator.java 11 Sep 2006 15:03:59 -0000 1.5 --- TestMockCreator.java 13 Sep 2006 03:09:00 -0000 1.6 *************** *** 91,95 **** MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue(car, "createCar"); //now we would normally tweak code on the subsystem which --- 91,95 ---- MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue("createCar", car); //now we would normally tweak code on the subsystem which *************** *** 104,108 **** public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException(new IOException("test throwing IOException"), "callMeSecond"); ListenerOne l = (ListenerOne)mockList; --- 104,108 ---- public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException("callMeSecond", new IOException("test throwing IOException")); ListenerOne l = (ListenerOne)mockList; *************** *** 149,153 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat"); Identical ident = (Identical)mock; --- 149,153 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue("doThat", new byte[] {4}); Identical ident = (Identical)mock; *************** *** 163,169 **** { MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addReturnValue(new byte[] {3}, "doThat"); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat"); ! mock.addReturnValue(new byte[] {5}, "doThat"); Identical ident = (Identical)mock; --- 163,169 ---- { MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addReturnValue("doThat", new byte[] {3}); ! mock.setDefaultReturnValue("doThat", new byte[] {4}); ! mock.addReturnValue("doThat", new byte[] {5}); Identical ident = (Identical)mock; *************** *** 193,197 **** FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue(new CarImpl(), "createCar"); Car car = factory.createCar("id"); --- 193,197 ---- FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue("createCar", new CarImpl()); Car car = factory.createCar("id"); *************** *** 217,221 **** Car car = (Car)mock; try { ! mock.addReturnValue(new Long(56), "getWheelCount"); car.getWheelCount(); fail("should have thrown exception"); --- 217,221 ---- Car car = (Car)mock; try { ! mock.addReturnValue("getWheelCount", new Long(56)); car.getWheelCount(); fail("should have thrown exception"); *************** *** 239,243 **** Car car = (Car)mock; ! mock.addReturnValue(new Integer(5), "getWheelCount"); car.getWheelCount(); --- 239,243 ---- Car car = (Car)mock; ! mock.addReturnValue("getWheelCount", new Integer(5)); car.getWheelCount(); *************** *** 248,252 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new MyTestBehavior(), "doThat"); Identical ident = (Identical)mock; --- 248,252 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior("doThat", new MyTestBehavior()); Identical ident = (Identical)mock; |
From: Nobody <fas...@us...> - 2006-09-13 03:09:07
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/test In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20057/input/javasrc/biz/xsoftware/impl/mock/test Modified Files: TestOrderedCalls.java Log Message: refactor mocklib back to original api. Index: TestOrderedCalls.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/test/TestOrderedCalls.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestOrderedCalls.java 12 Sep 2006 02:21:00 -0000 1.1 --- TestOrderedCalls.java 13 Sep 2006 03:09:00 -0000 1.2 *************** *** 120,124 **** RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(e, MockOne.FIRST); try { --- 120,124 ---- RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(MockOne.FIRST, e); try { |
From: dadrox <da...@us...> - 2006-09-12 15:02:49
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10986/input/javasrc/biz/xsoftware/mock Modified Files: MockObject.java Log Message: added some convenience methods to the interface Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MockObject.java 11 Sep 2006 15:03:59 -0000 1.5 --- MockObject.java 12 Sep 2006 15:02:11 -0000 1.6 *************** *** 31,35 **** * @return An array of params that were passed to the methods called */ ! public CalledMethod expect(String method); //, Class ... argTypes); /** --- 31,35 ---- * @return An array of params that were passed to the methods called */ ! public CalledMethod expect(String method); /** *************** *** 45,59 **** */ public CalledMethod[] expect(String ... methods); /** * Set the DefaultReturnValue for a 'method' * * @param method The method name to set the default return value for * @param argTypes Optionally specify the type of parameters of the method */ ! public void setDefaultReturnValue(Object o, String method, Class... argTypes); ! public void setDefaultBehavior(Behavior b, String method, Class ... argTypes); /** --- 45,89 ---- */ public CalledMethod[] expect(String ... methods); + + /** + * Set the DefaultReturnValue for a 'method' + * + * @param returnValue + * @param method The method name to set the default return value for + */ + public void setDefaultReturnValue(Object returnValue, String method); /** * Set the DefaultReturnValue for a 'method' * + * @param returnValue * @param method The method name to set the default return value for * @param argTypes Optionally specify the type of parameters of the method */ ! public void setDefaultReturnValue(Object returnValue, String method, Class... argTypes); + public void setDefaultBehavior(Behavior b, String method); public void setDefaultBehavior(Behavior b, String method, Class ... argTypes); + + /** + * 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 e The exception to throw on method. + * @param method The method to throw the exception on when it is called. + */ + public void addThrowException(Throwable e, String method); /** *************** *** 78,81 **** --- 108,127 ---- */ public void addThrowException(Throwable e, String method, Class... argTypes); + + /** + * 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 o The object to return that is added to the queue + * @param method The method that when called returns first value on queue + */ + public void addReturnValue(Object o, String method); + /** * Add a return value to return when 'method' is called. *************** *** 93,98 **** */ public void addReturnValue(Object o, String method, Class... argTypes); ! ! public void addBehavior(Behavior behavior, String string, Class... argTypes); /** --- 139,154 ---- */ public void addReturnValue(Object o, String method, Class... argTypes); ! ! public void addBehavior(Behavior behavior, String method); ! public void addBehavior(Behavior behavior, String method, Class... argTypes); ! ! /** ! * When calling expect, the MockObject will ignore the methods ! * in 'methods' variable so if one of the methods in this array is ! * called, it will not result in an exception. ! * ! * @param method The name of the method to ignore ! */ ! public void addIgnore(String method); /** *************** *** 110,113 **** --- 166,176 ---- * * @param method The name of the method to not ignore + */ + public void removeIgnore(String method); + + /** + * Removes the method from the ignored methods set. + * + * @param method The name of the method to not ignore * @param argTypes Optionally specify the type of parameters of the method */ |