mocklib-checkins Mailing List for mocklib (Page 2)
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...> - 2008-04-14 01:05:01
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16006/bldfiles Modified Files: project.build directory.properties project.properties Log Message: fix nunit to work now with NMocklib...what a pain. Index: project.build =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.build,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** project.build 12 Apr 2008 01:18:20 -0000 1.8 --- project.build 14 Apr 2008 01:04:52 -0000 1.9 *************** *** 47,51 **** </csc> - <echo message="libinclude=${lib}"/> <copy todir="${assemblies}"> <fileset basedir="${lib}"> --- 47,50 ---- *************** *** 56,60 **** <target name="compileTest" depends="compile" description="compiles the source file for this project"> ! <echo message="Generating ${comp.name} type=${type}"/> <mkdir dir="${test.assemblies}"/> --- 55,59 ---- <target name="compileTest" depends="compile" description="compiles the source file for this project"> ! <echo message="Generating ${test.assemblies}/${test.comp} type=${type}"/> <mkdir dir="${test.assemblies}"/> *************** *** 164,168 **** <arg line="${test.assemblies}/${test.comp}" /> </exec> ! <!--nunit2> <formatter type="Plain" /> <test assemblyname="${assemblies}/${test.comp}"/> --- 163,167 ---- <arg line="${test.assemblies}/${test.comp}" /> </exec> ! <!--nunit2 nunutconsole="tools/NUnit/nunit-console.exe"> <formatter type="Plain" /> <test assemblyname="${assemblies}/${test.comp}"/> Index: project.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** project.properties 11 Apr 2008 05:27:01 -0000 1.3 --- project.properties 14 Apr 2008 01:04:52 -0000 1.4 *************** *** 13,18 **** <property name="namespace" value="NMockLib"/> ! <property name="allowed.critical.errors" value="1"/> ! <property name="allowed.errors" value="7"/> ! <property name="allowed.warnings" value="9"/> </project> --- 13,18 ---- <property name="namespace" value="NMockLib"/> ! <property name="allowed.critical.errors" value="2"/> ! <property name="allowed.errors" value="38"/> ! <property name="allowed.warnings" value="21"/> </project> Index: directory.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/directory.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** directory.properties 10 Apr 2008 08:46:56 -0000 1.6 --- directory.properties 14 Apr 2008 01:04:52 -0000 1.7 *************** *** 18,24 **** <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="test.assemblies" value="${output}/testassemblies"/> --- 18,28 ---- <property name="tools" value="tools"/> + <!-- damn Visual Studio is a pain in the $$@ so + generate the source in the input directory instead + of the output directory --> + <property name="gensrc" value="${input}/GenSrc"/> + <!-- output directories --> <property name="output" value="output"/> <property name="assemblies" value="${output}/outassemblies"/> <property name="test.assemblies" value="${output}/testassemblies"/> |
From: Nobody <fas...@us...> - 2008-04-12 01:18:25
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17190/bldfiles Modified Files: project.build Log Message: fix nunit to work now with NMocklib...what a pain. Index: project.build =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.build,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** project.build 11 Apr 2008 05:42:55 -0000 1.7 --- project.build 12 Apr 2008 01:18:20 -0000 1.8 *************** *** 57,63 **** <target name="compileTest" depends="compile" 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}/${test.comp}" warnaserror="true"> <sources basedir="."> <include name="${test.input}/**/*.cs"/> --- 57,63 ---- <target name="compileTest" depends="compile" description="compiles the source file for this project"> <echo message="Generating ${comp.name} type=${type}"/> ! <mkdir dir="${test.assemblies}"/> ! <csc target="${type}" debug="true" output="${test.assemblies}/${test.comp}" warnaserror="true"> <sources basedir="."> <include name="${test.input}/**/*.cs"/> *************** *** 65,70 **** <references basedir="."> <include name="${lib}/**/*.dll"/> - <include name="${assemblies}/${comp.name}"/> <include name="${libexclude}/**/*.dll"/> </references> <resources basedir="${csfiles}"> --- 65,70 ---- <references basedir="."> <include name="${lib}/**/*.dll"/> <include name="${libexclude}/**/*.dll"/> + <include name="${assemblies}/${comp.name}"/> </references> <resources basedir="${csfiles}"> *************** *** 112,116 **** <targets> <include name="${assemblies}/${comp.name}" /> ! <include name="${assemblies}/${test.comp}" /> </targets> <arg value="/out:${reports}/fxcop.xml" /> --- 112,116 ---- <targets> <include name="${assemblies}/${comp.name}" /> ! <include name="${test.assemblies}/${test.comp}" /> </targets> <arg value="/out:${reports}/fxcop.xml" /> *************** *** 139,144 **** <target name="testall" depends="compile"> <exec program="tools/NUnit/nunit-console.exe"> ! <arg line="${assemblies}/${test.comp}" /> </exec> <!--nunit2> --- 139,166 ---- <target name="testall" depends="compile"> + <!-- ahhhh, this following hack is because of this + 1. C# has no concept of path...ahhhh + 2. work around 1 would be to put in GAC. That is NOT an option + as the build should run immediately after checking out from + source control without installing stuff. + 3. I don't know how to generate the probing path(they should have a nant task) + --> + <copy todir="${test.assemblies}"> + <fileset basedir="${libexclude}"> + <include name="**/*.dll" /> + </fileset> + </copy> + <copy todir="${test.assemblies}"> + <fileset basedir="${assemblies}"> + <include name="**/*.dll" /> + </fileset> + </copy> + + <!--Because of the ick design of NUnit2, we have to exec the + NUnit task ourselves!!! This is because they are expecting + NUnit to be installed on a computer....We prefer our developers + don't install NUnit so the upgrade is seamless --> <exec program="tools/NUnit/nunit-console.exe"> ! <arg line="${test.assemblies}/${test.comp}" /> </exec> <!--nunit2> *************** *** 146,149 **** --- 168,172 ---- <test assemblyname="${assemblies}/${test.comp}"/> </nunit2--> + </target> |
From: Nobody <fas...@us...> - 2008-04-11 05:43:00
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21122/bldfiles Modified Files: project.build Log Message: change to executing exe Index: project.build =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.build,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** project.build 10 Apr 2008 08:46:56 -0000 1.6 --- project.build 11 Apr 2008 05:42:55 -0000 1.7 *************** *** 139,146 **** <target name="testall" depends="compile"> ! <nunit2> <formatter type="Plain" /> <test assemblyname="${assemblies}/${test.comp}"/> ! </nunit2> </target> --- 139,149 ---- <target name="testall" depends="compile"> ! <exec program="tools/NUnit/nunit-console.exe"> ! <arg line="${assemblies}/${test.comp}" /> ! </exec> ! <!--nunit2> <formatter type="Plain" /> <test assemblyname="${assemblies}/${test.comp}"/> ! </nunit2--> </target> |
From: Nobody <fas...@us...> - 2008-04-11 05:27:10
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13220/bldfiles Modified Files: project.properties config.FxCop Log Message: fixing fxcop errors. Index: project.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.properties 10 Apr 2008 08:22:30 -0000 1.2 --- project.properties 11 Apr 2008 05:27:01 -0000 1.3 *************** *** 14,18 **** <property name="allowed.critical.errors" value="1"/> ! <property name="allowed.errors" value="9"/> ! <property name="allowed.warnings" value="10"/> </project> --- 14,18 ---- <property name="allowed.critical.errors" value="1"/> ! <property name="allowed.errors" value="7"/> ! <property name="allowed.warnings" value="9"/> </project> Index: config.FxCop =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/config.FxCop,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.FxCop 10 Apr 2008 08:22:30 -0000 1.1 --- config.FxCop 11 Apr 2008 05:27:01 -0000 1.2 *************** *** 29,33 **** <RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" /> <RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" /> ! <RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="True" /> <RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" /> <RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" /> --- 29,50 ---- <RuleFile Name="$(FxCopDir)\Rules\MobilityRules.dll" Enabled="True" AllRulesEnabled="True" /> <RuleFile Name="$(FxCopDir)\Rules\NamingRules.dll" Enabled="True" AllRulesEnabled="True" /> ! <RuleFile Name="$(FxCopDir)\Rules\PerformanceRules.dll" Enabled="True" AllRulesEnabled="False"> ! <Rule Name="AvoidExcessiveLocals" Enabled="True" /> ! <Rule Name="AvoidUncalledPrivateCode" Enabled="True" /> ! <Rule Name="AvoidUninstantiatedInternalClasses" Enabled="True" /> ! <Rule Name="AvoidUnsealedAttributes" Enabled="True" /> ! <Rule Name="AvoidUnusedPrivateFields" Enabled="True" /> ! <Rule Name="DoNotCastUnnecessarily" Enabled="True" /> ! <Rule Name="DoNotInitializeUnnecessarily" Enabled="True" /> ! <Rule Name="InitializeReferenceTypeStaticFieldsInline" Enabled="True" /> ! <Rule Name="MarkAssembliesWithNeutralResourcesLanguage" Enabled="True" /> ! <Rule Name="OverrideEqualsAndOperatorEqualsOnValueTypes" Enabled="True" /> ! <Rule Name="PreferJaggedArraysOverMultidimensional" Enabled="True" /> ! <Rule Name="PropertiesShouldNotReturnArrays" Enabled="True" /> ! <Rule Name="RemoveEmptyFinalizers" Enabled="True" /> ! <Rule Name="RemoveUnusedLocals" Enabled="True" /> ! <Rule Name="TestForEmptyStringsUsingStringLength" Enabled="True" /> ! <Rule Name="UseLiteralsWhereAppropriate" Enabled="True" /> ! </RuleFile> <RuleFile Name="$(FxCopDir)\Rules\PortabilityRules.dll" Enabled="True" AllRulesEnabled="True" /> <RuleFile Name="$(FxCopDir)\Rules\SecurityRules.dll" Enabled="True" AllRulesEnabled="True" /> |
From: Nobody <fas...@us...> - 2008-04-10 08:47:04
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15530/bldfiles Modified Files: project.build directory.properties Log Message: refactor the buildtemplate build to work better with the test and rebuilding over and over. Index: project.build =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.build,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** project.build 10 Apr 2008 08:22:30 -0000 1.5 --- project.build 10 Apr 2008 08:46:56 -0000 1.6 *************** *** 64,68 **** </sources> <references basedir="."> ! <include name="${assemblies}/**/*.dll"/> <include name="${libexclude}/**/*.dll"/> </references> --- 64,69 ---- </sources> <references basedir="."> ! <include name="${lib}/**/*.dll"/> ! <include name="${assemblies}/${comp.name}"/> <include name="${libexclude}/**/*.dll"/> </references> Index: directory.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/directory.properties,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** directory.properties 10 Apr 2008 08:22:30 -0000 1.5 --- directory.properties 10 Apr 2008 08:46:56 -0000 1.6 *************** *** 14,19 **** service dll's that you deploy to and only need for compiling --> <property name="libexclude" value="${input}/LibExclude"/> ! <property name="config" value="${input}/config"/> ! <property name="schemas" value="${input}/schemas"/> <property name="tools" value="tools"/> --- 14,19 ---- service dll's that you deploy to and only need for compiling --> <property name="libexclude" value="${input}/LibExclude"/> ! <property name="config" value="${input}/Config"/> ! <property name="schemas" value="${input}/Schemas"/> <property name="tools" value="tools"/> *************** *** 22,25 **** --- 22,26 ---- <property name="gensrc" value="${output}/gensrc"/> <property name="assemblies" value="${output}/outassemblies"/> + <property name="test.assemblies" value="${output}/testassemblies"/> <property name="web.staging" value="${output}/staging-web"/> <property name="web.staging.bin" value="${web.staging}/bin"/> |
From: Nobody <fas...@us...> - 2008-04-10 08:23:08
|
Update of /cvsroot/mocklib/netmocklib/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4115/bldfiles Modified Files: project.build project.properties directory.properties Added Files: config.FxCop Log Message: ant build is now passing with NUnit and with fxcop...yeah. Index: project.build =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.build,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.build 17 Sep 2006 16:35:13 -0000 1.4 --- project.build 10 Apr 2008 08:22:30 -0000 1.5 *************** *** 10,15 **** <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"> --- 10,17 ---- <property name="ext" value=".exe" if="${type == 'exe'}" /> <property name="comp.name" value="${assembly.name}${ext}"/> ! <property name="test.comp" value="${assembly.name}Test.dll"/> ! <loadtasks assembly="${tools}/nant-contrib/NAnt.Contrib.Tasks.dll" /> + <loadtasks path="${tools}/CheckFxCop" /> <target name="gensrc" description="Generates source code from an xsd to use for xml processing"> *************** *** 45,48 **** --- 47,51 ---- </csc> + <echo message="libinclude=${lib}"/> <copy todir="${assemblies}"> <fileset basedir="${lib}"> *************** *** 52,55 **** --- 55,77 ---- </target> + <target name="compileTest" depends="compile" 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}/${test.comp}" warnaserror="true"> + <sources basedir="."> + <include name="${test.input}/**/*.cs"/> + </sources> + <references basedir="."> + <include name="${assemblies}/**/*.dll"/> + <include name="${libexclude}/**/*.dll"/> + </references> + <resources basedir="${csfiles}"> + <include name="**/*.resx"/> + </resources> + </csc> + + </target> + <target name="winsvc.staging" depends="compile" description="Packages the webservice all up together to resemble deployment"> <mkdir dir="${winsvc.staging.bin}"/> *************** *** 80,93 **** </target> ! <target name="fxcop" depends="compile" description="Runs FxCop"> ! <exec program="${tools}/FxCop/fxcopcmd.exe" ! commandline="/p:${tools}/FxCop/ProjectRules.FxCop /c"/> ! <!-- Unfortunately, neither fail the build on warnings --> ! <!--fxcop directOutputToConsole="true" failonerror="true"> <targets> ! <include name="${assemblies}/${comp.name}" /> </targets> ! </fxcop--> </target> --- 102,123 ---- </target> ! <target name="fxcop" depends="compileTest" description="Runs FxCop"> ! <mkdir dir="${reports}"/> ! <fxcop directOutputToConsole="true" failonerror="true" projectFile="bldfiles/config.FxCop"> ! <dependencyDirectories> ! <include name="${libexclude}"/> ! </dependencyDirectories> <targets> ! <include name="${assemblies}/${comp.name}" /> ! <include name="${assemblies}/${test.comp}" /> </targets> ! <arg value="/out:${reports}/fxcop.xml" /> ! </fxcop> ! ! <checkfxcop fxcopOutput="${reports}/fxcop.xml" ! allowedCriticalErrors="${allowed.critical.errors}" ! allowedErrors="${allowed.errors}" ! allowedWarnings="${allowed.warnings}"/> </target> *************** *** 110,120 **** <nunit2> <formatter type="Plain" /> ! <test assemblyname="${assemblies}/${comp.name}"/> </nunit2> </target> ! <target name="all" depends="winsvc.staging, fxcop, codecoverage" 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> --- 140,150 ---- <nunit2> <formatter type="Plain" /> ! <test assemblyname="${assemblies}/${test.comp}"/> </nunit2> </target> ! <target name="all" depends="winsvc.staging, fxcop, testall" description="Builds everything, puts in web.staging and runs testall"/> ! <target name="clean" description="Cleans out files generated from this build file"> <delete dir="${output}" failonerror="false"/> </target> Index: project.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/project.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project.properties 16 Sep 2006 04:33:35 -0000 1.1 --- project.properties 10 Apr 2008 08:22:30 -0000 1.2 *************** *** 2,8 **** --- 2,18 ---- <project name="project.properties"> + <!-- damn Visual Studio screws the way this would be done + in java like java's buildtemplate, so this needs to be + configured unlike java --> + <property name="input" value="NMockLib"/> + <!-- NOTE: there must be a project called + NMockLibTest that is created to --> + <!--property name="type" value="exe"--> <property name="assembly.name" value="NMockLib"/> <property name="namespace" value="NMockLib"/> + <property name="allowed.critical.errors" value="1"/> + <property name="allowed.errors" value="9"/> + <property name="allowed.warnings" value="10"/> </project> --- NEW FILE: config.FxCop --- (This appears to be a binary file; contents omitted.) Index: directory.properties =================================================================== RCS file: /cvsroot/mocklib/netmocklib/bldfiles/directory.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** directory.properties 17 Sep 2006 15:03:38 -0000 1.4 --- directory.properties 10 Apr 2008 08:22:30 -0000 1.5 *************** *** 3,10 **** <!-- input directories --> ! <property name="input" value="input"/> ! <property name="csfiles" value="csharpcode"/> ! <property name="lib" value="${input}/libinclude"/> ! <property name="libexclude" value="${input}/libexclude"/> <property name="config" value="${input}/config"/> <property name="schemas" value="${input}/schemas"/> --- 3,17 ---- <!-- input directories --> ! <property name="csfiles" value="${input}"/> ! <property name="test.input" value="${input}Test"/> ! ! <!-- These are dlls that are needed for deployment and ! must be included in the distribution --> ! <property name="lib" value="${input}/LibInclude"/> ! ! <!-- These are dlls needed for compile BUT NOT for deployment ! Examples are NUnit.dll, MockLib.dll, or frameworks or ! service dll's that you deploy to and only need for compiling --> ! <property name="libexclude" value="${input}/LibExclude"/> <property name="config" value="${input}/config"/> <property name="schemas" value="${input}/schemas"/> |
Update of /cvsroot/mocklib//cppmocklib/src/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2676/src/mock Modified Files: CalledMethod.cpp MockSuperclass.cpp Removed Files: Behavior.h MockSuperclass.h MockObject.h CalledMethod.h basic.h Log Message: using loki to resolve the valist problem --- basic.h DELETED --- Index: MockSuperclass.cpp =================================================================== RCS file: /cvsroot/mocklib//cppmocklib/src/mock/MockSuperclass.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockSuperclass.cpp 27 Dec 2007 08:25:01 -0000 1.1 --- MockSuperclass.cpp 3 Feb 2008 03:03:34 -0000 1.2 *************** *** 1,8 **** using namespace std; ! #include"MockSuperclass.h" - string MockObject::NONE="No method should have been called"; string MockObject::ANY="Any method"; void MockSuperclass::removeIgnore(string method){ --- 1,10 ---- using namespace std; ! #include "../../include/cppmocklib/MockSuperclass.h" + string MockObject::NONE="No method should have been called"; string MockObject::ANY="Any method"; + + void MockSuperclass::removeIgnore(string method){ *************** *** 12,28 **** CalledMethod & MockSuperclass::expect(string method){ return (calledMethods.at(0)); ! }; - MockSuperclass::vector_CalledMethod * MockSuperclass::expect(string method[]){ - return &calledMethods; - }; ! void MockSuperclass::methodCalled(string methodName, ...){ ! va_list argus; CalledMethod *pCalledMethod = new CalledMethod(); pCalledMethod->setMethod(methodName); ! va_start(argus, methodName); ! }; --- 14,32 ---- CalledMethod & MockSuperclass::expect(string method){ return (calledMethods.at(0)); ! }; ! vector<CalledMethod> *MockSuperclass::expect(string methods[]){ ! return &calledMethods; ! } ! ! ! void MockSuperclass::methodCalled(string methodName, Loki::BasicTypeList *params){ ! CalledMethod *pCalledMethod = new CalledMethod(); pCalledMethod->setMethod(methodName); ! pCalledMethod->setParams(params); ! }; Index: CalledMethod.cpp =================================================================== RCS file: /cvsroot/mocklib//cppmocklib/src/mock/CalledMethod.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CalledMethod.cpp 27 Dec 2007 08:25:00 -0000 1.1 --- CalledMethod.cpp 3 Feb 2008 03:03:33 -0000 1.2 *************** *** 1,3 **** ! #include "CalledMethod.h" ! --- 1,3 ---- ! //#include "CalledMethod.h" ! #include "../../include/cppmocklib/CalledMethod.h" --- CalledMethod.h DELETED --- --- MockSuperclass.h DELETED --- --- MockObject.h DELETED --- --- Behavior.h DELETED --- |
Update of /cvsroot/mocklib//cppmocklib/src/biz/xsoftware/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6515/src/biz/xsoftware/mock Removed Files: CalledMethod.cpp MockSuperclass.h MockSuperclass.cpp basic.h MockObject.h Behavior.h CalledMethod.h Log Message: package refactor --- basic.h DELETED --- --- MockSuperclass.cpp DELETED --- --- CalledMethod.cpp DELETED --- --- CalledMethod.h DELETED --- --- MockSuperclass.h DELETED --- --- MockObject.h DELETED --- --- Behavior.h DELETED --- |
Update of /cvsroot/mocklib//cppmocklib/src/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6515/src/mock Added Files: Behavior.h CalledMethod.cpp MockSuperclass.cpp MockSuperclass.h MockObject.h CalledMethod.h basic.h Log Message: package refactor --- NEW FILE: basic.h --- #ifndef BASIC_H_ #define BASIC_H_ #endif /*BASIC_H_*/ using namespace std; class NullType; class EmptyType {}; template <class T,class U> struct Typelist{ typedef T Head; typedef U Tail; }; #define TYPELIST_1(T1) Typelist<T1,NullType> #define TYPELIST_2(T1,T2) Typelist<T1,TYPELIST_1(T2) > #define TYPELIST_3(T1,T2,T3) Typelist<T1,TYPELIST_2(T1,T2) > --- NEW FILE: MockSuperclass.cpp --- using namespace std; #include"MockSuperclass.h" string MockObject::NONE="No method should have been called"; string MockObject::ANY="Any method"; void MockSuperclass::removeIgnore(string method){ }; CalledMethod & MockSuperclass::expect(string method){ return (calledMethods.at(0)); }; MockSuperclass::vector_CalledMethod * MockSuperclass::expect(string method[]){ return &calledMethods; }; void MockSuperclass::methodCalled(string methodName, ...){ va_list argus; CalledMethod *pCalledMethod = new CalledMethod(); pCalledMethod->setMethod(methodName); va_start(argus, methodName); }; --- NEW FILE: CalledMethod.cpp --- #include "CalledMethod.h" --- NEW FILE: CalledMethod.h --- #ifndef CALLEDMETHOD_H_ #define CALLEDMETHOD_H_ #include<stdarg.h> #include <string> #include "basic.h" class CalledMethod{ private : string method; va_list params; exception howItWasCalled; public : string getMethod(){ return method; }; va_list getParams(){return params;}; exception getHowItWasCalled(){return howItWasCalled;}; void setMethod(string strMethod){method=strMethod;}; void setParams(va_list valist){params=valist;}; void setHowItWasCalled(exception argu){howItWasCalled=argu;}; public : }; #endif /*CALLEDMETHOD_H_*/ --- NEW FILE: MockSuperclass.h --- #ifndef MOCKSUPERCLASS_H_ #define MOCKSUPERCLASS_H_ #include<vector> #include "MockObject.h" #include<stdarg.h> class MockSuperclass : public MockObject{ public: void removeIgnore(string method); CalledMethod & expect(string method); MockSuperclass::vector_CalledMethod * expect(string method[]); void methodCalled(string methodName, ...); private: vector_CalledMethod calledMethods; }; #endif /*MOCKSUPERCLASS_H_*/ --- NEW FILE: MockObject.h --- #ifndef MOCKOBJECT_H_ #define MOCKOBJECT_H_ using namespace std; #include <string> #include <vector> #include "CalledMethod.h" #include "Behavior.h" class MockObject{ public : static string NONE; static string ANY; public : typedef vector<CalledMethod> vector_CalledMethod; public: virtual CalledMethod & expect(string method)=0; virtual vector_CalledMethod * expect(string methods[])=0; //virtual void setDefaultReturnValue(string method,T object)=0; // virtual void setDefaultBehavior(string method,T object)=0; //this method should have different type arguments and numbers is not exactly confirmed //so argus should use typelist // virtual void setDefaultBehavior(string method, Behavior b, T argus[])=0; // virtual void addThrowException(string method, exception e)=0; // virtual void addReturnValue(string method, T obj)=0; // virtual void addReturnValue(string method, T obj[])=0; // virtual void addIgnore(string method)=0; virtual void removeIgnore(string method)=0; // virtual void setExpectTimeout(int timeout)=0; // virtual int getExpectTimeout()=0; }; #endif /*MOCKOBJECT_H_*/ --- NEW FILE: Behavior.h --- #ifndef BEHAVIOR_H_ #define BEHAVIOR_H_ class Behavior{ }; #endif /*BEHAVIOR_H_*/ |
From: jiangh <cac...@us...> - 2007-12-27 08:24:58
|
Update of /cvsroot/mocklib//cppmocklib/src/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6494/src/mock Log Message: Directory /cvsroot/mocklib//cppmocklib/src/mock added to the repository |
From: cac_erin <cac...@us...> - 2007-12-06 01:11:31
|
Update of /cvsroot/mocklib/mocklib3/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20193/bldfiles Modified Files: configDesign.xml Log Message: remove manifest package Index: configDesign.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/configDesign.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configDesign.xml 5 Dec 2007 04:55:25 -0000 1.1 --- configDesign.xml 6 Dec 2007 01:11:24 -0000 1.2 *************** *** 13,17 **** <!-- DO NOT MODIFY THE NEXT LINE --> ! <package name="manifest" package="biz.xsoftware.manifest" subpackages="include" needdepends="false"/> <!-- should erase the following... --> --- 13,17 ---- <!-- DO NOT MODIFY THE NEXT LINE --> ! <!--<package name="manifest" package="biz.xsoftware.manifest" subpackages="include" needdepends="false"/>--> <!-- should erase the following... --> |
From: cac_erin <cac...@us...> - 2007-12-05 04:56:07
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31858/input/javasrc/biz/xsoftware/mock Modified Files: ExpectFailedException.java Log Message: change build template Index: ExpectFailedException.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/ExpectFailedException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExpectFailedException.java 10 Sep 2006 18:25:52 -0000 1.1 --- ExpectFailedException.java 5 Dec 2007 04:55:31 -0000 1.2 *************** *** 42,47 **** public static final String UNEXPECTED_ON_NONE = "Another method was called when no methods should have been called"; ! private String reason; ! private CalledMethod[] methods; --- 42,47 ---- public static final String UNEXPECTED_ON_NONE = "Another method was called when no methods should have been called"; ! private final String reason; ! private final CalledMethod[] methods; |
From: cac_erin <cac...@us...> - 2007-12-05 04:56:06
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31858/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java Log Message: change build template Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TestMockCreator.java 22 Nov 2006 16:46:22 -0000 1.12 --- TestMockCreator.java 5 Dec 2007 04:55:31 -0000 1.13 *************** *** 4,7 **** --- 4,9 ---- import java.io.IOException; + import java.util.logging.Level; + import java.util.logging.Logger; import junit.framework.TestCase; *************** *** 25,29 **** public class TestMockCreator extends TestCase { ! //private final static Logger log = Logger.getLogger(TestMockCreator.class.getName()); /** --- 27,31 ---- public class TestMockCreator extends TestCase { ! private final Logger log = Logger.getLogger(TestMockCreator.class.getName()); /** *************** *** 68,72 **** fail("Should have failed with ExpectFailedException"); } catch(ExpectFailedException e) { ! //gulp } } --- 70,74 ---- fail("Should have failed with ExpectFailedException"); } catch(ExpectFailedException e) { ! log.log(Level.INFO, e.getMessage()); } } *************** *** 91,95 **** m.expect("callMeFirst"); fail("should have thrown exception"); ! } catch(ExpectFailedException e) {} } --- 93,99 ---- m.expect("callMeFirst"); fail("should have thrown exception"); ! } catch(ExpectFailedException e) { ! log.log(Level.INFO, e.getMessage()); ! } } *************** *** 117,121 **** l.callMeSecond("dummy"); fail("should have thrown IOException"); ! } catch(IOException e) {} } --- 121,127 ---- l.callMeSecond("dummy"); fail("should have thrown IOException"); ! } catch(IOException e) { ! log.log(Level.INFO, e.getMessage()); ! } } *************** *** 150,153 **** --- 156,160 ---- fail("This should throw an exception"); } catch(IllegalArgumentException e) { + log.log(Level.INFO, e.getMessage()); } } *************** *** 228,231 **** --- 235,239 ---- fail("should have thrown exception"); } catch(IllegalArgumentException e) { + log.log(Level.INFO, e.getMessage()); } } *************** *** 239,242 **** --- 247,251 ---- fail("should have thrown exception"); } catch(IllegalArgumentException e) { + log.log(Level.INFO, e.getMessage()); } } |
Update of /cvsroot/mocklib/mocklib3/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31858/bldfiles Modified Files: build.xml directory.properties ant.properties Added Files: configCheckstyle.xml configDesign.xml configPmd.xml Removed Files: design.xml Log Message: change build template Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/build.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** build.xml 23 May 2007 17:21:27 -0000 1.12 --- build.xml 5 Dec 2007 04:55:25 -0000 1.13 *************** *** 3,7 **** Run "ant -projecthelp" to view all the possible targets and descriptions. --> ! <project name="std_buildfile" default="createdist" 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="testCheckin" basedir=".."> [...1030 lines suppressed...] - <!-- *********************************************************************** --- 872,887 ---- </classpath> <fileset dir="${javacode}"> ! <include name="${javadoc.pattern}" /> </fileset> ! <doctitle> ! <![CDATA[<h1>${javadoc.title} ${version}</h1>]]></doctitle> ! <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> <!-- *********************************************************************** --- NEW FILE: configPmd.xml --- <?xml version="1.0"?> <ruleset name="Custom ruleset" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> <description>This ruleset checks my code for bad stuff</description> <!-- Below are some examples of defining rulesets We'll use the entire 'strings' ruleset <rule ref="rulesets/strings.xml" /> Here's some rules we'll specify one at a time <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" /> <rule ref="rulesets/unusedcode.xml/UnusedPrivateField" /> <rule ref="rulesets/imports.xml/DuplicateImports" /> <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary" /> We want to customize this rule a bit, change the message and raise the priority <rule ref="rulesets/basic.xml/EmptyCatchBlock" message="Must handle exceptions"> <priority>2</priority> </rule> Now we'll customize a rule's property value <rule ref="rulesets/codesize.xml/CyclomaticComplexity"> <properties> <property name="reportLevel" value="5" /> </properties> </rule> Note we want everything from braces.xml except WhileLoopsMustUseBraces <rule ref="rulesets/braces.xml"> <exclude name="WhileLoopsMustUseBraces" /> </rule> --> <rule ref="rulesets/basic.xml"/> <rule ref="rulesets/optimizations.xml"> <!-- using .toString instead of adding an empty string results in nullpointerexceptions so I prefer ""+object...then if the object is null, null is printed instead of nullpointerexception --> <exclude name="AddEmptyString"/> <exclude name="MethodArgumentCouldBeFinal" /> <exclude name="LocalVariableCouldBeFinal"/> </rule> <rule ref="rulesets/braces.xml"> <exclude name="IfElseStmtsMustUseBraces"/> <exclude name="IfStmtsMustUseBraces"/> </rule> <rule ref="rulesets/clone.xml"/> <rule ref="rulesets/codesize.xml"> <!-- I would love to use this but appears not to be working. IT says the complexity is 2 and should break at 7 and causes a break with just 2 so I am confused by the error message --> <exclude name="CyclomaticComplexity"/> </rule> <rule ref="rulesets/controversial.xml"> <exclude name="UnusedModifier"/> <exclude name="AtLeastOneConstructor"/> <exclude name="OnlyOneReturn"/> </rule> <rule ref="rulesets/coupling.xml"/> <rule ref="rulesets/design.xml"> <exclude name="ImmutableField"/> <exclude name="UncommentedEmptyMethod"/> </rule> <rule ref="rulesets/favorites.xml"/> <rule ref="rulesets/finalizers.xml"/> <rule ref="rulesets/imports.xml"/> <rule ref="rulesets/javabeans.xml"> <!-- Quite annoying since it flags private fields that are returned from methods, otherwise would be quite nice --> <exclude name="BeanMembersShouldSerialize"/> </rule> <rule ref="rulesets/junit.xml"> <exclude name="JUnitAssertionsShouldIncludeMessage"/> </rule> <rule ref="rulesets/logging-java.xml"/> <rule ref="rulesets/naming.xml"> <exclude name="ShortVariable"/> </rule> <rule ref="rulesets/scratchpad.xml"/> <rule ref="rulesets/strictexception.xml"> <!-- while they are correct, it is convenient to just have JUnit tests throw Exception --> <exclude name="SignatureDeclareThrowsException"/> <!-- unfortunately, we have seen the JVM throw catchable Errors and we want to log and record those --> <exclude name="AvoidCatchingThrowable"/> <exclude name="AvoidThrowingRawExceptionTypes"/> </rule> <rule ref="rulesets/strings.xml"/> <rule ref="rulesets/sunsecure.xml"/> <rule ref="rulesets/typeresolution.xml"/> <rule ref="rulesets/unusedcode.xml"/> <rule ref="rulesets/j2ee.xml"/> <rule ref="rulesets/basic-jsf.xml"/> <rule ref="rulesets/basic-jsp.xml"/> </ruleset> Index: directory.properties =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/directory.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** directory.properties 11 Sep 2006 03:58:16 -0000 1.3 --- directory.properties 5 Dec 2007 04:55:25 -0000 1.4 *************** *** 26,29 **** --- 26,31 ---- jardist =${generated}/jardist #will contain a *.jar containing everything in ${build} + wardist =${generated}/wardist + #will contain a *.war containing everything in ${build} and ${webroot} dist =${generated}/dist *************** *** 32,39 **** reports =${generated}/reports codecov.report =${reports}/codecoverage #contains the code coverage reports of what the unit tests #covered findbugs.report =${reports}/findbugs - checkstyle.report=${reports}/checkstyle javadoc =${reports}/javadoc html.code =${reports}/htmlcode --- 34,42 ---- reports =${generated}/reports codecov.report =${reports}/codecoverage + pmd.report =${reports}/pmd #contains the code coverage reports of what the unit tests #covered + findbugs.report =${reports}/findbugs javadoc =${reports}/javadoc html.code =${reports}/htmlcode *************** *** 43,49 **** --- 46,54 ---- allcodecov =${generated}/codecoverage codecov.temp =${allcodecov}/misc + #previously used by emma, not used by cobertura so this is useless property for now codecov.classes =${allcodecov}/instrumented-classes #intermediate directory that contains instrumented classes to #run testall against so a code coverage report can be spit out. + codecov.instrument.file=${codecov.classes}/cobertura.ser codecov.jar =${allcodecov}/instrumented-jar *************** *** 68,72 **** #testing. It usually gets deleted afterwards. ! src.gen =${generated}/src #generated source code --- 73,77 ---- #testing. It usually gets deleted afterwards. ! gen.src =${generated}/src #generated source code *************** *** 74,77 **** --- 79,84 ---- # INPUT DIRECTORIES - don't change these after the project is started. #----------------------------------------------------------------------- + project =. + input =input #contains all stuff that is an input into the build *************** *** 83,99 **** javacode =${input}/javasrc #Contains all *.java source files #Contains all *.html files needed by javadoc ! #Contains all *.jpg files needed by javadoc ! #Contains all *.gif files needed by javadoc #Contains all *.* files needed by javadoc - #Will NOT contain any *.jpg, *.gif, *.html, *.htm needed by application - #Use ${properties} for *.jpg, *.gif, *.html, *.htm needed by application ! properties =${input}/properties ! #contains *.property files for i18n ! #contains *.gif needed for application ! #contains *.* any other resource files needed for application ! lib =${input}/lib #contains all *.jar needed to run the app and that need to be deployed with the app #does not contain *.jars needed to compile the app(such as junit.jar) --- 90,105 ---- javacode =${input}/javasrc #Contains all *.java source files + #Contains all *.properties files that will go into the jar + #Contains all *.xml files that will go into the jar + #Contains all *.* that will go into the jar except doc_*.gif and doc_*.jpg #Contains all *.html files needed by javadoc ! #Contains all doc_*.jpg files needed by javadoc ! #Contains all doc_*.gif files needed by javadoc #Contains all *.* files needed by javadoc ! webroot =${input}/webroot ! #Contains all html, jsp, gif, jpg's, WEB-INF/web.xml, WEB-INF/faces-config.xml, etc. etc ! lib =${input}/libinclude #contains all *.jar needed to run the app and that need to be deployed with the app #does not contain *.jars needed to compile the app(such as junit.jar) *************** *** 108,122 **** #typically, there will be another directory in here called <project> #or something. Some projects won't but most will. - - scripts =${input}/tests/scripts - #DO NOT MODIFY. This is hardcoded in TestSuiteAllScripts.java. - #contains all *.xml abbot scripts to do GUI testing. - test.input =${input}/tests/input - #for miscellaneous input to junit tests. - native =${input}/native #contains JNI C header file ! schemas =${javacode}/schemas #contains xsd schemas --- 114,121 ---- #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 ! schemas =${input}/schemas #contains xsd schemas *************** *** 125,129 **** #----------------------------------------------------------------------- junit.pattern1=**/Test*.class ! junit.pattern2=biz/xsoftware/examples/**/Test*.class javadoc.pattern=**/*.java --- 124,128 ---- #----------------------------------------------------------------------- junit.pattern1=**/Test*.class ! #junit.pattern2=**/test/IntegTest*.class javadoc.pattern=**/*.java --- design.xml DELETED --- --- NEW FILE: configCheckstyle.xml --- <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> <!-- Checkstyle configuration that checks the sun coding conventions from: - the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html - the Sun Code Conventions at http://java.sun.com/docs/codeconv/ - the Javadoc guidelines at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html - some best practices Checkstyle is very configurable. Be sure to read the documentation at http://checkstyle.sf.net (or in your downloaded distribution). Most Checks are configurable, be sure to consult the documentation. To completely disable a check, just comment it out or delete it from the file. Finally, it is worth reading the documentation. --> <module name="Checker"> <!-- Checks that a package.html file exists for each package. --> <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> <!--module name="PackageHtml"/--> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> <!--module name="NewlineAtEndOfFile"/--> <!-- Checks that property files contain the same keys. --> <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <module name="Translation"/> <module name="TreeWalker"> <!-- Checks for Javadoc comments. --> <!-- See http://checkstyle.sf.net/config_javadoc.html --> <!--module name="JavadocMethod"/> <module name="JavadocType"/> <module name="JavadocVariable"/> <module name="JavadocStyle"/--> <!-- Checks for Naming Conventions. --> <!-- See http://checkstyle.sf.net/config_naming.html --> <module name="ConstantName"> <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$|^log$|^apiLog$"/> </module> <module name="LocalFinalVariableName"/> <module name="LocalVariableName"/> <module name="MemberName"/> <module name="MethodName"/> <module name="PackageName"/> <module name="ParameterName"/> <module name="StaticVariableName"/> <module name="TypeName"/> <module name="ParameterAssignment"/> <!-- Checks for Headers --> <!-- See http://checkstyle.sf.net/config_header.html --> <!-- <module name="Header"> --> <!-- The follow property value demonstrates the ability --> <!-- to have access to ANT properties. In this case it uses --> <!-- the ${basedir} property to allow Checkstyle to be run --> <!-- from any directory within a project. See property --> <!-- expansion, --> <!-- http://checkstyle.sf.net/config.html#properties --> <!-- <property --> <!-- name="headerFile" --> <!-- value="${basedir}/java.header"/> --> <!-- </module> --> <!-- Following interprets the header file as regular expressions. --> <!-- <module name="RegexpHeader"/> --> <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> <module name="AvoidStarImport"/> <module name="IllegalImport"/> <!-- defaults to sun.* packages --> <module name="RedundantImport"/> <module name="UnusedImports"/> <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> <module name="FileLength"> <property name="max" value="700"/> </module> <module name="LineLength"> <property name="max" value="150"/> </module> <module name="MethodLength"> <property name="max" value="75"/> <property name="countEmpty" value="false"/> </module> <module name="ParameterNumber"/> <!-- Checks for whitespace --> <!-- See http://checkstyle.sf.net/config_whitespace.html --> <!--module name="EmptyForIteratorPad"/> <module name="MethodParamPad"/> <module name="NoWhitespaceAfter"/> <module name="NoWhitespaceBefore"/> <module name="OperatorWrap"/> <module name="ParenPad"/> <module name="TypecastParenPad"/> <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/--> <!-- Modifier Checks --> <!-- See http://checkstyle.sf.net/config_modifiers.html --> <module name="ModifierOrder"/> <!--module name="RedundantModifier"/--> <!-- Checks for blocks. You know, those {}'s --> <!-- See http://checkstyle.sf.net/config_blocks.html --> <module name="AvoidNestedBlocks"/> <module name="EmptyBlock"/> <!--module name="LeftCurly"/> <module name="NeedBraces"/> <module name="RightCurly"/--> <!-- Checks for common coding problems --> <!-- See http://checkstyle.sf.net/config_coding.html --> <module name="AvoidInlineConditionals"/> <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> <module name="EmptyStatement"/> <module name="EqualsHashCode"/> <!--module name="HiddenField"/--> <module name="IllegalInstantiation"/> <module name="InnerAssignment"/> <!--module name="MagicNumber"/--> <module name="MissingSwitchDefault"/> <module name="RedundantThrows"/> <module name="SimplifyBooleanExpression"/> <module name="SimplifyBooleanReturn"/> <module name="NestedIfDepth"> </module> <module name="NestedTryDepth"/> <module name="ModifiedControlVariable"/> <module name="StringLiteralEquality"/> <module name="SuperClone"/> <module name="PackageDeclaration"/> <module name="ReturnCount"> <property name="max" value="3"/> </module> <module name="ParameterAssignment"/> <module name="FallThrough"/> <!-- Checks for class design --> <!-- See http://checkstyle.sf.net/config_design.html --> <!--module name="DesignForExtension"/--> <module name="FinalClass"/> <module name="HideUtilityClassConstructor"/> <module name="InterfaceIsType"/> <module name="VisibilityModifier"> <property name="protectedAllowed" value="true"/> </module> <module name="MutableException"/> <!-- Miscellaneous other checks. --> <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> <!--module name="FinalParameters"/--> <module name="GenericIllegalRegexp"> <property name="format" value="System\.exit"/> <property name="message" value="System.exit is not allowed."/> </module> <module name="GenericIllegalRegexp"> <property name="format" value="System\.out\.println"/> <property name="message" value="Use Logger class instead."/> </module> <module name="GenericIllegalRegexp"> <property name="format" value="\.printStackTrace"/> <property name="message" value="Use Logger class instead."/> </module> <!--module name="GenericIllegalRegexp"> <property name="format" value="\s+$"/> <property name="message" value="Line has trailing spaces."/> </module--> <!--module name="TodoComment"/--> <module name="UpperEll"/> </module> </module> Index: ant.properties =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/ant.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ant.properties 12 Sep 2006 01:46:52 -0000 1.2 --- ant.properties 5 Dec 2007 04:55:25 -0000 1.3 *************** *** 9,12 **** --- 9,34 ---- #version info may be retrieved using java -jar ${name}.jar -version + max.errors=0 + #specifies the number of errors or warnings that checkstyle can have before + #failing the build. This number is high for legacy systems and should + #be 0 for new systems from scratch + + pmd.maxerrors=450 + #specifies the number of errors or warnings that pmd can have before + #failing the build. This number is high for legacy systems and should + #be 0 for new systems from scratch + + totallinerate=80 + #specifies required % lines of code to be covered when tests are executed for + #entire library. If this number is not met, the build will fail + + webapp.enabled =false + #if set to true, will build a war file with all jar files in input/libinclude + #and will also contain all files from input/webroot + #and will also contain all the classes from input/javasrc + osgi.enabled =false + #if set to true, will build an osgi jar file with all the jar files from + #input/libinclude and all the classes from input/javasrc + imports =[bundle.emptystring] exports =[bundle.emptystring] *************** *** 14,19 **** #The packages to make private - build.source=5 - manifest.mainclass = TOOLS.JAVA.Main #The class that is run when java -jar xxxx.jar is run --- 36,39 ---- *************** *** 26,30 **** copyright = Copyright © 2000 Dean Hiller All Rights Reserved. javadoc.title = Build Template ! javadoc.bottom = A Library that creates mockobjects that simulate any interface<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> \ --- 46,50 ---- copyright = Copyright © 2000 Dean Hiller All Rights Reserved. javadoc.title = Build Template ! javadoc.bottom = If you would like a shared copyright, contact me at dea...@us...<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> \ *************** *** 52,60 **** # - ########################################################### - #If you need to use castor set 'xsd.start' to the name - #of your main xsd file, and uncomment the line - ########################################################## - # - #xsd.start=yourName.xsd - # \ No newline at end of file --- 72,73 ---- --- NEW FILE: configDesign.xml --- <design> <!-- Use this tool to create your package design which the build will compare with the actual package dependencies. It will then tell you what parts of the code violate the following package design. See the documentation of the ant-contrib project to fill in the package design here ant-contrib is at http://sourceforge.net/projects/ant-contrib. Currently, this template is using a version from the CVS head, and the docs are up to date on the CVS head, but not in the latest download yet as I have not asked for a new release on ant-contrib yet(wanted to finish a few more things), but this is stable and works. I just want to add one more feature--> <!-- DO NOT MODIFY THE NEXT LINE --> <package name="manifest" package="biz.xsoftware.manifest" subpackages="include" needdepends="false"/> <!-- should erase the following... --> <package name="default" package="default package" 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"/--> <!-- Use the following to depend on junit and mocklib --> <!--package name="junit" package="junit" subpackages="include" needdeclarations="false"/> <package name="mocklib" package="biz.xsoftware.mock" subpackages="include" needdeclarations="false"/--> </design> |
From: cac_erin <cac...@us...> - 2007-12-05 04:55:56
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31858/input/javasrc/biz/xsoftware/impl/mock Modified Files: MethodVerifier.java MockSuperclass.java MessageHelper.java ThrowException.java Log Message: change build template Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MockSuperclass.java 14 Nov 2007 03:13:32 -0000 1.10 --- MockSuperclass.java 5 Dec 2007 04:55:21 -0000 1.11 *************** *** 188,193 **** * @return whatever the client has specified using addReturnValue */ ! protected Object methodCalled(String method, Object parameters) { try { if(!(parameters instanceof Object[])) { parameters = new Object[] {parameters}; --- 188,194 ---- * @return whatever the client has specified using addReturnValue */ ! protected Object methodCalled(String method, Object params) { try { + Object parameters = params; if(!(parameters instanceof Object[])) { parameters = new Object[] {parameters}; *************** *** 202,206 **** } ! protected synchronized Object methodCalledImpl(String method, Object[] parameters) throws Throwable { method = method.intern(); String params = ""; --- 203,208 ---- } ! protected synchronized Object methodCalledImpl(String aMethod, Object[] parameters) throws Throwable { ! String method = aMethod ; method = method.intern(); String params = ""; *************** *** 393,398 **** } ! protected synchronized CalledMethod expectUnignoredCall(String method, Set<String> ignorables, List<CalledMethod> calledMethods) { ! if(method == null) method = NONE; --- 395,400 ---- } ! protected synchronized CalledMethod expectUnignoredCall(String aMethod, Set<String> ignorables, List<CalledMethod> calledMethods) { ! String method = aMethod; if(method == null) method = NONE; Index: ThrowException.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/ThrowException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThrowException.java 1 Oct 2006 03:18:44 -0000 1.2 --- ThrowException.java 5 Dec 2007 04:55:21 -0000 1.3 *************** *** 3,7 **** public class ThrowException implements Action { ! private Throwable e; public ThrowException(Throwable e) { --- 3,7 ---- public class ThrowException implements Action { ! private final Throwable e; public ThrowException(Throwable e) { Index: MethodVerifier.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MethodVerifier.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MethodVerifier.java 14 May 2007 18:31:26 -0000 1.4 --- MethodVerifier.java 5 Dec 2007 04:55:21 -0000 1.5 *************** *** 75,78 **** --- 75,79 ---- List<Method> matchingMethods = findMatchingMethods(methods, method, argTypes); + Method retVal = null; if(matchingMethods == null) { String classNames = getClassNamesString(classes); *************** *** 81,87 **** "\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"; --- 82,88 ---- "\nfollowing Classes/Interfaces"+classNames); } else if(matchingMethods.size() == 1) { ! retVal = matchingMethods.get(0); } else if(!isVerifyArgs && matchingMethods.size() > 0) { ! retVal = null; //don't need to return anything for this. } else { String msg = "Too many methods match your method expected='"+method+"'. Methods found:\n"; *************** *** 93,96 **** --- 94,98 ---- throw new IllegalArgumentException(msg); } + return retVal; } *************** *** 147,150 **** --- 149,154 ---- return null; + List<Method> retVal = null; + List<Method> narrowedMatches = new ArrayList<Method>(); //find one that takes no args if that is what we are looking for... *************** *** 153,160 **** if(method.getParameterTypes() == null || method.getParameterAnnotations().length == 0) { narrowedMatches.add(method); ! return narrowedMatches; } } ! return matches; } --- 157,166 ---- if(method.getParameterTypes() == null || method.getParameterAnnotations().length == 0) { narrowedMatches.add(method); ! retVal = narrowedMatches; ! break; } } ! if(retVal == null) ! retVal = matches; } *************** *** 164,172 **** if(isArgTypesMatch(types, argTypes)) { narrowedMatches.add(method); ! return narrowedMatches; } } ! return null; } --- 170,179 ---- if(isArgTypesMatch(types, argTypes)) { narrowedMatches.add(method); ! retVal = narrowedMatches; ! break; } } ! return retVal; } Index: MessageHelper.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MessageHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MessageHelper.java 14 May 2007 18:31:21 -0000 1.4 --- MessageHelper.java 5 Dec 2007 04:55:21 -0000 1.5 *************** *** 6,9 **** --- 6,10 ---- import java.util.List; import java.util.Set; + import java.util.logging.Logger; import biz.xsoftware.mock.CalledMethod; *************** *** 62,65 **** --- 63,67 ---- public static String getHowMethodWasCalled(CalledMethod method) { + Logger log = Logger.getLogger(MessageHelper.class.getName()); Throwable t = method.getHowItWasCalled(); String retVal = "\nThe last method was="+method.getMethodName(); *************** *** 69,73 **** StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s); ! t.printStackTrace(p); retVal += s.toString(); retVal += "--------END="+method.getMethodName() +"---------------\n"; --- 71,75 ---- StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s); ! log.info(t.getMessage()); retVal += s.toString(); retVal += "--------END="+method.getMethodName() +"---------------\n"; |
From: jiangh <cac...@us...> - 2007-11-14 03:13:44
|
Update of /cvsroot/mocklib//mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23038/input/javasrc/biz/xsoftware/mock Modified Files: MockObject.java Log Message: deprecated addreturnvalue method, and add a new one which sepcifies user wants the returnvalue be array or varargs Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib//mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MockObject.java 14 May 2007 18:31:32 -0000 1.12 --- MockObject.java 14 Nov 2007 03:13:31 -0000 1.13 *************** *** 142,145 **** --- 142,155 ---- */ public void addReturnValue(String method, Object o); + public void addReturnValue(String method,boolean isArray,Object ... o); + + /** + * @deprecated + * user should use above method to replace this + * otherwise if user add an arrayobject as return value, + * this method will seperate array to single object + * @param method + * @param o + */ public void addReturnValue(String method, Object ... o); |
From: jiangh <cac...@us...> - 2007-11-14 03:13:39
|
Update of /cvsroot/mocklib//mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23038/input/javasrc/biz/xsoftware/impl/mock Modified Files: MockSuperclass.java Log Message: deprecated addreturnvalue method, and add a new one which sepcifies user wants the returnvalue be array or varargs Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib//mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MockSuperclass.java 14 May 2007 18:31:27 -0000 1.9 --- MockSuperclass.java 14 Nov 2007 03:13:32 -0000 1.10 *************** *** 606,609 **** --- 606,615 ---- addReturnValueImpl(method, o); } + public void addReturnValue(String method,boolean isArray, Object ... o){ + if(isArray) + addReturnValue(method,(Object)o); + else + addReturnValue(method,o); + } public void addReturnValue(String method, Object ... o) |
Update of /cvsroot/mocklib//cppmocklib/src/biz/xsoftware/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5682/src/biz/xsoftware/mock Added Files: basic.h MockObject.h CalledMethod.cpp Behavior.h CalledMethod.h MockSuperclass.h MockSuperclass.cpp Log Message: original --- NEW FILE: basic.h --- #ifndef BASIC_H_ #define BASIC_H_ #endif /*BASIC_H_*/ using namespace std; class NullType; class EmptyType {}; template <class T,class U> struct Typelist{ typedef T Head; typedef U Tail; }; #define TYPELIST_1(T1) Typelist<T1,NullType> #define TYPELIST_2(T1,T2) Typelist<T1,TYPELIST_1(T2) > #define TYPELIST_3(T1,T2,T3) Typelist<T1,TYPELIST_2(T1,T2) > --- NEW FILE: MockSuperclass.cpp --- using namespace std; #include"MockSuperclass.h" string MockObject::NONE="No method should have been called"; string MockObject::ANY="Any method"; void MockSuperclass::removeIgnore(string method){ }; CalledMethod & MockSuperclass::expect(string method){ return (calledMethods.at(0)); }; MockSuperclass::vector_CalledMethod * MockSuperclass::expect(string method[]){ return &calledMethods; }; void MockSuperclass::methodCalled(string methodName,va_list params ...){ }; --- NEW FILE: CalledMethod.cpp --- #include "CalledMethod.h" --- NEW FILE: CalledMethod.h --- #ifndef CALLEDMETHOD_H_ #define CALLEDMETHOD_H_ #include<stdarg.h> #include <string> #include "basic.h" class CalledMethod{ private : string method; va_list params; exception howItWasCalled; public : string getMethod(){ return method; }; va_list getParams(){return params;}; exception getHowItWasCalled(){return howItWasCalled;}; void setMethod(string strMethod){method=strMethod;}; void setParams(va_list valist){params=valist;}; void setHowItWasCalled(exception argu){howItWasCalled=argu;}; public : }; #endif /*CALLEDMETHOD_H_*/ --- NEW FILE: MockSuperclass.h --- #ifndef MOCKSUPERCLASS_H_ #define MOCKSUPERCLASS_H_ #include<vector> #include "MockObject.h" #include<stdarg.h> class MockSuperclass : public MockObject{ public: void removeIgnore(string method); CalledMethod & expect(string method); MockSuperclass::vector_CalledMethod * expect(string method[]); void methodCalled(string methodName,va_list params ...); private: vector_CalledMethod calledMethods; }; #endif /*MOCKSUPERCLASS_H_*/ --- NEW FILE: MockObject.h --- #ifndef MOCKOBJECT_H_ #define MOCKOBJECT_H_ using namespace std; #include <string> #include <vector> #include "CalledMethod.h" #include "Behavior.h" class MockObject{ public : static string NONE; static string ANY; public : typedef vector<CalledMethod> vector_CalledMethod; public: virtual CalledMethod & expect(string method)=0; virtual vector_CalledMethod * expect(string methods[])=0; //virtual void setDefaultReturnValue(string method,T object)=0; // virtual void setDefaultBehavior(string method,T object)=0; //this method should have different type arguments and numbers is not exactly confirmed //so argus should use typelist // virtual void setDefaultBehavior(string method, Behavior b, T argus[])=0; // virtual void addThrowException(string method, exception e)=0; // virtual void addReturnValue(string method, T obj)=0; // virtual void addReturnValue(string method, T obj[])=0; // virtual void addIgnore(string method)=0; virtual void removeIgnore(string method)=0; // virtual void setExpectTimeout(int timeout)=0; // virtual int getExpectTimeout()=0; }; #endif /*MOCKOBJECT_H_*/ --- NEW FILE: Behavior.h --- #ifndef BEHAVIOR_H_ #define BEHAVIOR_H_ class Behavior{ }; #endif /*BEHAVIOR_H_*/ |
From: jiangh <cac...@us...> - 2007-08-21 09:25:02
|
Update of /cvsroot/mocklib//cppmocklib/src/biz/xsoftware/mock In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5594/src/biz/xsoftware/mock Log Message: Directory /cvsroot/mocklib//cppmocklib/src/biz/xsoftware/mock added to the repository |
From: Nobody <fas...@us...> - 2007-07-09 18:52:48
|
Update of /cvsroot/mocklib/mocklibExamples/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19532/bldfiles Added Files: design.xml directory.properties build.xml ant.properties Log Message: mockLibExamples first commit....this is used in article and presentations. --- NEW FILE: design.xml --- <design> <!-- See the documentation of the ant-contrib project to fill in the package design here ant-contrib is at http://sourceforge.net/projects/ant-contrib. Currently, this template is using a version from the CVS head, and the docs are up to date on the CVS head, but not in the latest download yet as I have not asked for a new release on ant-contrib yet(wanted to finish a few more things), but this is stable and works. I just want to add one more feature--> <!-- DO NOT MODIFY THE NEXT LINES --> <package name="junit" package="junit" subpackages="include"/> <package name="javaxswing" package="javax.swing.event" needdeclarations="false"/> <!-- The mocklib api which depends on nothing --> <package name="api" package="biz.xsoftware.mock"/> <!-- notice examples don't depend on the mocklib implementation --> <package name="examples" package="biz.xsoftware.examples" subpackages="include"> <depends>api</depends> <depends>junit</depends> </package> </design> --- NEW FILE: ant.properties --- #----------------------------------------------------------------------- # MANIFEST and JAR properties - Make sure you change these to your settings. #----------------------------------------------------------------------- name = mocklib3 #used as the jar file name(ie. ${name}.jar) #used as zip file name(ie. ${name}-version.jar) #used as the directory staging name #version info may be retrieved using java -jar ${name}.jar -version imports =[bundle.emptystring] exports =[bundle.emptystring] impl.pattern =biz/**,com/**,net/** #The packages to make private build.source=5 manifest.mainclass = TOOLS.JAVA.Main #The class that is run when java -jar xxxx.jar is run manifest.title = MockLib manifest.vendor = http://mocklib.sourceforge.net manifest.builder = Dean Hiller manifest.description = A Library that creates mockobjects with one line of code that simulate any interface manifest.icon = copyright = Copyright © 2000 Dean Hiller All Rights Reserved. javadoc.title = Build Template javadoc.bottom = A Library that creates mockobjects that simulate any interface<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> #----------------------------------------------------------------------- # Properties to run the program using the "run" target in build.xml(ie. build run) # Just try ./build run to execute org.NO.MAIN.YET below(of course, that class # doesn't exist, so I would suggest changing that. #----------------------------------------------------------------------- client.to.run = org.NO.MAIN.YET #Class run when "build run" target is used client.args = #params to the java app for the run target to run the application client.jvm.args = -enableassertions #params to the JVM for the run target to run the application ########################################################### # If you need JNI header files, uncomment the following property # and put the classes that need to generate header files # in this property(a comma delimted list) ########################################################## # #javah.classes=com.avaya.example.callinfo.mci.MCI # ########################################################### #If you need to use castor set 'xsd.start' to the name #of your main xsd file, and uncomment the line ########################################################## # #xsd.start=yourName.xsd # --- NEW FILE: build.xml --- <?xml version="1.0"?> <!-- Run "ant -projecthelp" to view all the possible targets and descriptions. --> <project name="std_buildfile" default="testall" basedir=".."> <!-- Now allow any of the properties to be overridden --> <property file="${user.home}/ant.properties" /> <property file="bldfiles/ant.properties"/> <property file="bldfiles/directory.properties"/> <available property="makeExists" file="${native}/Makefile"/> <!--convert the lib file separators to this file system for later use in pathconvert to put together the manifest file --> <!--we can't do this if there are tool jars in the lib as we don't want tool jars in the manifest classpath???? or do we? --> <property name="full.lib.path" location="${lib}"/> <property name="jar.name" value="${name}.jar"/> <description> This is a generic build file template. All the customizable properties are in ant.properties file. All the directories used by this template are in directory.properties file. </description> <!-- *********************************************************************** TASK DEFINITIONS *********************************************************************** --> <property name="junit.location" location="${tool.dir}/ant-junit"/> <property name="antcontrib.location" location="${tool.dir}/ant-contrib"/> <path id="antcontrib.lib"> <fileset dir="${antcontrib.location}"> <include name="**/*.jar"/> </fileset> </path> <!-- directory that contains emma.jar and emma_ant.jar: --> <property name="emma.dir" value="${tool.dir}/emma" /> <path id="emma.lib" > <fileset dir="${emma.dir}"> <include name="**/*.jar"/> </fileset> </path> <!-- *********************************************************************** PATH DEFINITIONS *********************************************************************** --> <path id="lib.include"> <fileset dir="${lib}"> <include name="**/*.jar"/> </fileset> </path> <!-- all Third Party jars and tool jars this module needs to compile --> <path id="lib.jars"> <path refid="lib.include"/> <fileset dir="${libexclude}"> <include name="**/*.jar"/> </fileset> </path> <!-- must keep junit jars separate for ease of creating classpath in manifest --> <path id="tool.and.lib"> <path refid="lib.jars"/> <fileset dir="${junit.location}"> <include name="**/*.jar"/> </fileset> </path> <path id="classes.classpath" > <pathelement location="${build}" /> </path> <path id="testall.classpath"> <fileset dir="${codecov.jar}" includes="**/*.jar"/> <!--pathelement location="${codecov.temp}"/--> <path refid="tool.and.lib"/> <path refid="classes.classpath"/> </path> <!-- *********************************************************************** INIT TASKS *********************************************************************** --> <target name="taskdefs"> <tstamp> <format property="manifest.date" pattern ="EE MMMM d yyyy, HH:mm:ss" locale ="en"/> </tstamp> <!-- Override this property to build official release --> <property name="version" value="Developer-Build"/> <echo message="***************************USING THIS ANT************************"/> <echo message="ant.home=${ant.home}"/> <echo message="*****************************************************************"/> <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="antcontrib.lib"/> <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> </target> <!-- *********************************************************************** BEGIN TARGETS *********************************************************************** --> <!-- Just creates the input directories this build file uses if they are not already created --> <target name="create-src" depends="taskdefs" description="Create src directories for a new project"> <mkdir dir="${javacode}"/> <mkdir dir="${lib}"/> <mkdir dir="${libexclude}"/> <mkdir dir="${staging.in}"/> <mkdir dir="${jardist}"/> <!-- classpath for the jars needed to run application Used in testall, test, and run targets--> <path id="classpath.application"> <fileset dir="${jardist}"> <include name="**/*.jar"/> </fileset> <pathelement path="${jardist}"/> </path> </target> <!-- *********************************************************************** COMPILE TARGET *********************************************************************** --> <target name="compile" depends="create-src" description="Compile code"> <mkdir dir="${build}"/> <pathconvert property="compile.classpath" pathsep=":"> <path refid="tool.and.lib"/> </pathconvert> <echo message="Compiling files in ${javacode}"/> <echo message="Putting the class files in ${build}"/> <echo message="classpath=${compile.classpath}"/> <!-- Compile the java code from ${javacode} into ${build} --> <javac srcdir="${javacode}" destdir="${build}" deprecation="yes" debug="on"> <classpath> <path refid="tool.and.lib"/> </classpath> </javac> <!-- copy all misc. files over(config.jaas, etc.) from the ${javacode} directory--> <!-- Will not copy over *.jpg, *.gif, *.html for here(those are for javadoc)--> <copy todir="${build}"> <fileset dir="${javacode}"> <exclude name="**/*.java"/> <exclude name="**/*.htm"/> <exclude name="**/*.html"/> <exclude name="**/*.jpg"/> <exclude name="**/*.gif"/> <exclude name="**/*.bak"/> <exclude name="**/*~"/> <exclude name="**/vssver*.*"/> <exclude name="**/.nbattrs"/> </fileset> </copy> <!--check for rmi stubs so if there are we will do the next target--> <fileset dir="${build}" id="rmi.fileset"> <include name="**/RMI*.class"/> </fileset> <pathconvert pathsep="\r\n" property="have.rmi.files" refid="rmi.fileset" setonempty="false"/> </target> <!-- *********************************************************************** JAR TARGET *********************************************************************** --> <target name="jar" depends="compile" 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}"/> <verifydesign jar="${jardist}/${jar.name}" design="bldfiles/design.xml"/> </target> <!-- *********************************************************************** INSTRUMENTATION TARGET *********************************************************************** --> <target name="instrumentation" depends="jar"> <property name="emma.enabled" value="true"/> <mkdir dir="${codecov.temp}"/> <mkdir dir="${codecov.classes}"/> <mkdir dir="${codecov.jar}"/> <mkdir dir="${codecov.report}"/> <pathconvert property="instr.classpath" pathsep=":"> <path refid="classes.classpath"/> </pathconvert> <echo message="instr.classpath=${instr.classpath}"/> <emma enabled="${emma.enabled}" > <instr instrpathref="classes.classpath" destdir="${codecov.classes}" metadatafile="${codecov.temp}/metadata.emma" merge="true" /> </emma> <jar destfile="${codecov.jar}/${name}-instrumented.jar" duplicate="preserve"> <fileset dir="${codecov.classes}" includes="**"/> <fileset dir="${build}" includes="**"/> </jar> </target> <!-- *********************************************************************** TEST ALL TARGET *********************************************************************** --> <target name="testall" depends="instrumentation" description="Run ALL junit and abbot tests after compiling code"> <mkdir dir="${junit.results}"/> <pathconvert property="junit.classpath" pathsep=":"> <path refid="classpath.application"/> </pathconvert> <echo message="About to run JUnit tests..."/> <echo message="pattern1=${junit.pattern1}"/> <echo message="pattern2=${junit.pattern2}"/> <echo message="current directory=${basedir}"/> <echo message="classpath=${junit.classpath}"/> <!-- must be forked for instrumentation to work!!! --> <junit fork="yes" haltonfailure="yes" failureproperty="is.test.fail" dir="${basedir}" printsummary="withOutAndErr"> <classpath> <path refid="testall.classpath"/> <path refid="emma.lib" /> </classpath> <jvmarg value="-Demma.coverage.out.file=${codecov.temp}/coverage.emma" /> <jvmarg value="-Demma.coverage.out.merge=true" /> <jvmarg value="-Djar.name=${jardist}/${jar.name}"/> <jvmarg value="-Dversion=${version}"/> <formatter type="plain" usefile="false"/> <formatter type="xml"/> <batchtest todir="${junit.results}"> <fileset dir="${build}"> <patternset> <include name="biz/xsoftware/manifest/Test*.class"/> <include name="${junit.pattern1}"/> <include name="${junit.pattern2}"/> <exclude name="**/*$$*.class"/> </patternset> </fileset> </batchtest> </junit> <!-- not used because this is good for automated build but bad for developer. Developer doesn't want to look through 100 test cases to see which one is failing. To use this gain haltonfailure above needs to be off--> <!-- after all tests are run, this makes the build fail--> <fail if="is.test.fail"/> <!--autobuilds will not work without this while normal build will because for some reason basedir was not being used property--> <property name="report.tmp" location="${codecov.report}"/> <echo message="report=${report.tmp}"/> <emma enabled="${emma.enabled}" > <report sourcepath="${javacode}:${versioning.src}" > <fileset dir="${codecov.temp}" > <include name="*.emma" /> </fileset> <txt outfile="${report.tmp}/coverage.txt" /> <html outfile="${report.tmp}/index.html" /> </report> </emma> <!--delete dir="${codecov.temp}"/--> </target> <!-- *********************************************************************** CLEAN TARGET *********************************************************************** --> <target name="clean" depends="create-src" description="Clean all generated files"> <!-- Delete everything in the ${generated} directory tree --> <delete dir="${generated}"/> </target> </project> --- NEW FILE: directory.properties --- #---------------------------------------------------------------------- #DO NOT MAKE CHANGES TO THIS FILE, this file is overwriten #every time build is run. To personalize make changes to #ant.properties, dependencies.xml, and #release.xml. All which are in the [basedir]/bldfiles directory #---------------------------------------------------------------------- #----------------------------------------------------------------------- # OUTPUT DIRECTORIES #----------------------------------------------------------------------- generated =output manifest =${generated}/manifest #will contain a generated manifest build =${generated}/classes #will contain all the *.class files after compile #will contain all the *.jpg files from ${properties} #will contain all the *.properties files from ${properties} #will contain all the *.gif files from ${properties} #will contain all the *.html files from ${properties} #will contain all the *.* files from ${properties} #will NOT contain *.html, *.htm, *.jpg, *.gif from ${javacode} jardist =${generated}/jardist #will contain a *.jar containing everything in ${build} dist =${generated}/dist #contains the release that gets released to the world reports =${generated}/reports codecov.report =${reports}/codecoverage #contains the code coverage reports of what the unit tests #covered findbugs.report =${reports}/findbugs checkstyle.report=${reports}/checkstyle javadoc =${reports}/javadoc html.code =${reports}/htmlcode #contains the javadoc of biz.xsoftware.api allcodecov =${generated}/codecoverage codecov.temp =${allcodecov}/misc codecov.classes =${allcodecov}/instrumented-classes #intermediate directory that contains instrumented classes to #run testall against so a code coverage report can be spit out. codecov.jar =${allcodecov}/instrumented-jar junit.results =${generated}/test_results #contains junit test results staging =${generated}/staging projstaging =${generated}/staging/${name} #will contain all *.html generated by javadoc #will contain all *.html from ${javacode} directory(such as package.html) #will contain all *.jpg from ${javacode} directory #will contain all *.gif from ${javacode} directory rmi.stubs =${generated}/rmistubs #contains all Remote*.class files copied from ${build} #contains all *_stub.class files copied from ${build} #contains all *_skel.class files copied from ${build} #this directory is only created if RMI*.class exists test.area =${generated}/tests #This is sometimes created by JUnit tests to do temporary #testing. It usually gets deleted afterwards. src.gen =${generated}/src #generated source code #----------------------------------------------------------------------- # INPUT DIRECTORIES - don't change these after the project is started. #----------------------------------------------------------------------- input =input #contains all stuff that is an input into the build config =bldfiles #contains build.xml for the module, and any other build scripts #plus build property files javacode =${input}/javasrc #Contains all *.java source files #Contains all *.html files needed by javadoc #Contains all *.jpg files needed by javadoc #Contains all *.gif files needed by javadoc #Contains all *.* files needed by javadoc #Will NOT contain any *.jpg, *.gif, *.html, *.htm needed by application #Use ${properties} for *.jpg, *.gif, *.html, *.htm needed by application properties =${input}/properties #contains *.property files for i18n #contains *.gif needed for application #contains *.* any other resource files needed for application lib =${input}/lib #contains all *.jar needed to run the app and that need to be deployed with the app #does not contain *.jars needed to compile the app(such as junit.jar) libexclude =${input}/libexclude #contains all the *.jar that are not needed to run the app. They are for testing or #would already be deployed as services in the framework as in the case of an osgi logging #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. scripts =${input}/tests/scripts #DO NOT MODIFY. This is hardcoded in TestSuiteAllScripts.java. #contains all *.xml abbot scripts to do GUI testing. test.input =${input}/tests/input #for miscellaneous input to junit tests. native =${input}/native #contains JNI C header file schemas =${javacode}/schemas #contains xsd schemas #----------------------------------------------------------------------- # MISCELLANEOUS #----------------------------------------------------------------------- junit.pattern1=**/Test*.class junit.pattern2=biz/xsoftware/examples/**/Test*.class javadoc.pattern=**/*.java tool.dir=tools package.list=${tool.dir}/package-list build.sysclasspath=ignore # Change this value and I call you a complete idiot(cp = classpath) # ignore - trust build file to get the cp right # first - concatenate build file cp AFTER build runners cp # last - concatenate build runners cp AFTER build file cp #output = build.log #uncomment this to activate the logging |
From: Nobody <fas...@us...> - 2007-07-09 18:51:49
|
Update of /cvsroot/mocklib/mocklibExamples/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19502/bldfiles Log Message: Directory /cvsroot/mocklib/mocklibExamples/bldfiles added to the repository |
From: Nobody <fas...@us...> - 2007-05-23 17:21:33
|
Update of /cvsroot/mocklib/mocklib3/bldfiles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22939/bldfiles Modified Files: build.xml Log Message: have mocklib produce jar without all the examples and tests in it. Index: build.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib3/bldfiles/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** build.xml 14 May 2007 14:33:05 -0000 1.11 --- build.xml 23 May 2007 17:21:27 -0000 1.12 *************** *** 18,21 **** --- 18,22 ---- <property name="full.lib.path" location="${lib}"/> + <property name="jar.all.name" value="${name}-all.jar"/> <property name="jar.name" value="${name}.jar"/> *************** *** 378,384 **** <!-- 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"/> </target> --- 379,394 ---- <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.all.name}" basedir="${build}" manifest="${manifest}/MANIFEST.MF"/> ! ! <!-- Put all implementation classes from ${build} into the jar file --> ! <jar jarfile="${jardist}/${jar.name}" manifest="${manifest}/MANIFEST.MF"> ! <fileset dir="${build}"> ! <exclude name="**/examples/**"/> ! <exclude name="**/test/**"/> ! </fileset> ! </jar> ! ! ! <verifydesign jar="${jardist}/${jar.all.name}" design="bldfiles/design.xml"/> </target> *************** *** 521,525 **** <jvmarg value="-Demma.coverage.out.file=${codecov.temp}/coverage.emma" /> <jvmarg value="-Demma.coverage.out.merge=true" /> ! <jvmarg value="-Djar.name=${jardist}/${jar.name}"/> <jvmarg value="-Dversion=${version}"/> --- 531,535 ---- <jvmarg value="-Demma.coverage.out.file=${codecov.temp}/coverage.emma" /> <jvmarg value="-Demma.coverage.out.merge=true" /> ! <jvmarg value="-Djar.name=${jardist}/${jar.all.name}"/> <jvmarg value="-Dversion=${version}"/> *************** *** 573,577 **** output="html" outputFile="${findbugs.report}/index.html"> ! <class location="${jardist}/${jar.name}"/> </findbugs> </target> --- 583,587 ---- output="html" outputFile="${findbugs.report}/index.html"> ! <class location="${jardist}/${jar.all.name}"/> </findbugs> </target> |
From: Nobody <fas...@us...> - 2007-05-15 22:36:49
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs16:/tmp/cvs-serv9806/input/javasrc/biz/xsoftware/mock Modified Files: CloningBehavior.java Behavior.java Log Message: fix documentation. Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Behavior.java 14 May 2007 14:26:14 -0000 1.5 --- Behavior.java 15 May 2007 22:36:43 -0000 1.6 *************** *** 2,15 **** /** ! * A way of providing snippets of code to be run when a method is called. If you want ! * to pass in a Behavior implementation for </br></br> * * public int doSomethingCool(int i, String s, long l); * ! * </br></br> * then your Behavior class must define the same exact method and that method will be * called in your Behavior implementation when the mockobject's doSomethingCool method * is called. You must also return the same value as the doSomethingCool method which ! * in this case is an int. */ public interface Behavior { --- 2,15 ---- /** ! * <p>A way of providing snippets of code to be run when a method is called. If you want ! * to pass in a Behavior implementation for </p> * * public int doSomethingCool(int i, String s, long l); * ! * <p> * then your Behavior class must define the same exact method and that method will be * called in your Behavior implementation when the mockobject's doSomethingCool method * is called. You must also return the same value as the doSomethingCool method which ! * in this case is an int.</p> */ public interface Behavior { Index: CloningBehavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/CloningBehavior.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CloningBehavior.java 14 May 2007 14:26:14 -0000 1.1 --- CloningBehavior.java 15 May 2007 22:36:42 -0000 1.2 *************** *** 2,20 **** /** ! * The same exact thing as the Behavior method except a cloning method must be supplied to. * Sometimes the Behavior method will make modifications to the passed in parameter methods. * The cloning method allows the mockobject to take a snapshot of the parameters passed into * the method before they are modified. Then the test can still verify later the correct ! * parameters were passed in. So, if you are mocking a method ! * </br></br> * public int doSomethingCool(Map map, int i, long l); ! * </br></br> * Then you must have a cloning method of the form ! * </br></br> * public Object[] doSomethingCoolClone(Map map, int i, long l); ! * </br></br> * Notice that you probably only need to clone the Map and would need to return an object * array of all the parameters as so... new Object[] { clonedMap, i, l); ! * * @author dhiller * --- 2,20 ---- /** ! * <p>The same exact thing as the Behavior method except a cloning method must be supplied to. * Sometimes the Behavior method will make modifications to the passed in parameter methods. * The cloning method allows the mockobject to take a snapshot of the parameters passed into * the method before they are modified. Then the test can still verify later the correct ! * parameters were passed in. So, if you are mocking a method</p> ! * * public int doSomethingCool(Map map, int i, long l); ! * <p> * Then you must have a cloning method of the form ! * </p> * public Object[] doSomethingCoolClone(Map map, int i, long l); ! * <p> * Notice that you probably only need to clone the Map and would need to return an object * array of all the parameters as so... new Object[] { clonedMap, i, l); ! * </p> * @author dhiller * |
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock In directory sc8-pr-cvs16:/tmp/cvs-serv20175/input/javasrc/biz/xsoftware/impl/mock Modified Files: MessageHelper.java MethodVerifier.java MockSuperclass.java BehaviorInfo.java MockObjectImpl.java MockObjectFactoryImpl.java Log Message: fix generics warnings and some other stuff. Index: BehaviorInfo.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/BehaviorInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BehaviorInfo.java 1 Oct 2006 04:02:00 -0000 1.3 --- BehaviorInfo.java 14 May 2007 18:31:28 -0000 1.4 *************** *** 12,17 **** private Method clonerMethod; ! public BehaviorInfo(Behavior behavior) { this.behavior = behavior; } --- 12,22 ---- private Method clonerMethod; ! public BehaviorInfo(Behavior behavior, Method method) { ! if(behavior == null) ! throw new IllegalArgumentException("behavior cannot be null"); ! else if(method == null) ! throw new IllegalArgumentException("method should not be null"); this.behavior = behavior; + this.behaviorMethod = method; } *************** *** 30,37 **** return (Object[])clonerMethod.invoke(behavior, args); } - - public void setBehaviorMethod(Method behaviorMethod) { - this.behaviorMethod = behaviorMethod; - } public void setClonerMethod(Method clonerMethod) { --- 35,38 ---- Index: MockObjectFactoryImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockObjectFactoryImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockObjectFactoryImpl.java 12 Sep 2006 02:20:59 -0000 1.1 --- MockObjectFactoryImpl.java 14 May 2007 18:31:30 -0000 1.2 *************** *** 8,13 **** public class MockObjectFactoryImpl extends MockObjectFactory { ! public MockObject createMockImpl(String id, Class[] interfaces) { ! Class[] interfacesPlusMock = new Class[interfaces.length+1]; interfacesPlusMock[0] = MockObject.class; for(int i = 1; i < interfacesPlusMock.length; i++) { --- 8,13 ---- public class MockObjectFactoryImpl extends MockObjectFactory { ! public MockObject createMockImpl(String id, Class<?>[] interfaces) { ! Class<?>[] interfacesPlusMock = new Class[interfaces.length+1]; interfacesPlusMock[0] = MockObject.class; for(int i = 1; i < interfacesPlusMock.length; i++) { Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MockSuperclass.java 14 May 2007 14:26:16 -0000 1.8 --- MockSuperclass.java 14 May 2007 18:31:27 -0000 1.9 *************** *** 124,131 **** public void addIgnore(String method) { ! addIgnore(method, new Class[] {}); } ! public void addIgnore(String method, Class ... argTypes) { ignoreImpl(method); --- 124,131 ---- public void addIgnore(String method) { ! addIgnore(method, new Class<?>[] {}); } ! public void addIgnore(String method, Class<?> ... argTypes) { ignoreImpl(method); *************** *** 134,141 **** public void removeIgnore(String method) { ! removeIgnore(method, new Class[] {}); } ! public void removeIgnore(String method, Class ... argTypes) { removeIgnoreImpl(method); --- 134,141 ---- public void removeIgnore(String method) { ! removeIgnore(method, new Class<?>[] {}); } ! public void removeIgnore(String method, Class<?> ... argTypes) { removeIgnoreImpl(method); *************** *** 519,538 **** 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) throw new IllegalArgumentException("behavior parameter cannot be null"); ! methodToDefaultRetVal.put(method, new BehaviorInfo(b)); } public void setDefaultReturnValue(String method, Object returnValue) { ! setDefaultReturnValue(method, returnValue, new Class[] {}); } ! public void setDefaultReturnValue(String method, Object o, Class... argTypes) { checkMethod(method, argTypes); --- 519,541 ---- 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) throw new IllegalArgumentException("behavior parameter cannot be null"); ! ! BehaviorInfo action = createBehaviorInfo(method, b, argTypes); ! ! methodToDefaultRetVal.put(method, action); } public void setDefaultReturnValue(String method, Object returnValue) { ! setDefaultReturnValue(method, returnValue, new Class<?>[] {}); } ! public void setDefaultReturnValue(String method, Object o, Class<?>... argTypes) { checkMethod(method, argTypes); *************** *** 545,560 **** } ! public void addBehavior(String method, Behavior behavior, Class... argTypes) { ! if(behavior == null) ! throw new IllegalArgumentException("behavior parameter cannot be null"); ! Method m = checkMethod(method, argTypes); ! BehaviorInfo action = new BehaviorInfo(behavior); ! addToActionList(action, method, argTypes); ! //verify behavior has correct methods ! Class clazz = behavior.getClass(); try { ! Method behaviorMethod = clazz.getMethod(m.getName(), (Class[])m.getParameterTypes()); ! action.setBehaviorMethod(behaviorMethod); behaviorMethod.setAccessible(true); } catch (SecurityException e) { --- 548,561 ---- } ! private BehaviorInfo createBehaviorInfo(String method, Behavior behavior, Class<?>... argTypes) { ! BehaviorInfo action = null; ! //verify behavior has correct methods ! Class<?> clazz = behavior.getClass(); ! ! Method m = checkMethod(method, argTypes); try { ! Method behaviorMethod = clazz.getMethod(m.getName(), (Class<?>[])m.getParameterTypes()); ! action = new BehaviorInfo(behavior, behaviorMethod); behaviorMethod.setAccessible(true); } catch (SecurityException e) { *************** *** 562,574 **** "I can't reflect on it and call getClass on it's class object"); } catch (NoSuchMethodException e) { ! String methodSig = MessageHelper.getMethodSignature(m, ""); throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); ! } ! try { if(!(behavior instanceof CloningBehavior)) ! return; ! Method clonerMethod = clazz.getMethod(m.getName()+"Cloner", (Class[])m.getParameterTypes()); action.setClonerMethod(clonerMethod); if(!Object[].class.isAssignableFrom(clonerMethod.getReturnType())) --- 563,575 ---- "I can't reflect on it and call getClass on it's class object"); } catch (NoSuchMethodException e) { ! String methodSig = MessageHelper.getMethodSignature(null, m, ""); throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); ! } ! try { if(!(behavior instanceof CloningBehavior)) ! return action; ! Method clonerMethod = clazz.getMethod(m.getName()+"Cloner", (Class<?>[])m.getParameterTypes()); action.setClonerMethod(clonerMethod); if(!Object[].class.isAssignableFrom(clonerMethod.getReturnType())) *************** *** 579,585 **** "I can't reflect on it and call getClass on it's class object"); } catch (NoSuchMethodException e) { ! String methodSig = MessageHelper.getMethodSignature(m, "Cloner"); throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); } } --- 580,596 ---- "I can't reflect on it and call getClass on it's class object"); } catch (NoSuchMethodException e) { ! String methodSig = MessageHelper.getMethodSignature("Object[]", m, "Cloner"); throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); } + return action; + } + + public void addBehavior(String method, Behavior behavior, Class<?>... argTypes) { + if(behavior == null) + throw new IllegalArgumentException("behavior parameter cannot be null"); + + BehaviorInfo action = createBehaviorInfo(method, behavior, argTypes); + + addToActionList(action, method, argTypes); } *************** *** 611,615 **** } ! private void addToActionList(Action action, String method, Class... argTypes) { List<Action> l = methodToReturnVal.get(method); --- 622,626 ---- } ! private void addToActionList(Action action, String method, Class<?>... argTypes) { List<Action> l = methodToReturnVal.get(method); *************** *** 653,658 **** } ! public Class[] getClasses() { ! return new Class[] {this.getClass()}; } --- 664,669 ---- } ! public Class<?>[] getClasses() { ! return new Class<?>[] {this.getClass()}; } *************** *** 667,671 **** } ! private Method checkMethod(String method, Class[] argTypes) { return MethodVerifier.getMethod(getClasses(), true, method, argTypes); } --- 678,682 ---- } ! private Method checkMethod(String method, Class<?>[] argTypes) { return MethodVerifier.getMethod(getClasses(), true, method, argTypes); } Index: MethodVerifier.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MethodVerifier.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MethodVerifier.java 15 Sep 2006 16:01:17 -0000 1.3 --- MethodVerifier.java 14 May 2007 18:31:26 -0000 1.4 *************** *** 15,54 **** private MethodVerifier() {} ! private static boolean paramsMatch(Method method, Class[] argTypes) { ! Class<?>[] parameterTypes = method.getParameterTypes(); ! if(parameterTypes.length != argTypes.length) ! return false; ! ! for(int i = 0; i < parameterTypes.length; i++) { ! if(!(parameterTypes[i].equals(argTypes[i]))) ! return false; ! } ! return true; ! } ! /** ! * 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; ! for(Method m : classMethods) { ! if(m.getName().equals(method.getName())) ! matches++; ! } ! ! if(matches == 1) ! return true; ! ! return false; ! } ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); --- 15,54 ---- private MethodVerifier() {} ! // private static boolean paramsMatch(Method method, Class<?>[] argTypes) { ! // Class<?>[] parameterTypes = method.getParameterTypes(); ! // if(parameterTypes.length != argTypes.length) ! // return false; ! // ! // for(int i = 0; i < parameterTypes.length; i++) { ! // if(!(parameterTypes[i].equals(argTypes[i]))) ! // return false; ! // } ! // return true; ! // } ! // /** ! // * 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; ! // for(Method m : classMethods) { ! // if(m.getName().equals(method.getName())) ! // matches++; ! // } ! // ! // if(matches == 1) ! // return true; ! // ! // return false; ! // } ! static Method getMethod(Class<?>[] classes, boolean isVerifyArgs, String method, Class<?> ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); *************** *** 58,62 **** 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"); --- 58,62 ---- 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"); *************** *** 65,69 **** List<Method> methods = new ArrayList<Method>(); ! for(Class c : classes) { if(log.isLoggable(Level.FINEST)) log.finest("adding methods for class="+c.getName()); --- 65,69 ---- List<Method> methods = new ArrayList<Method>(); ! for(Class<?> c : classes) { if(log.isLoggable(Level.FINEST)) log.finest("adding methods for class="+c.getName()); *************** *** 87,91 **** 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 " + --- 87,91 ---- String msg = "Too many methods match your method expected='"+method+"'. Methods found:\n"; for(Method m : matchingMethods) { ! msg += MessageHelper.getMethodSignature(null, m, "")+"\n"; } msg += "You need to clarify which method you would like to add the return value to by " + *************** *** 100,104 **** * @return */ ! private static String getMethodSigString(String method, Class... argTypes) { String args = ""; --- 100,104 ---- * @return */ ! private static String getMethodSigString(String method, Class<?> ... argTypes) { String args = ""; *************** *** 106,110 **** int i = 0; for(; i < argTypes.length-1; i++) { ! Class c = argTypes[i]; args += c.getName()+","; } --- 106,110 ---- int i = 0; for(; i < argTypes.length-1; i++) { ! Class<?> c = argTypes[i]; args += c.getName()+","; } *************** *** 120,124 **** * @return */ ! private static String getClassNamesString(Class[] classes) { String classNames = ""; --- 120,124 ---- * @return */ ! private static String getClassNamesString(Class<?>[] classes) { String classNames = ""; *************** *** 135,139 **** * @return */ ! private static List<Method> findMatchingMethods(List<Method> methods, String methodName, Class[] argTypes) { //find all methods with same name first --- 135,139 ---- * @return */ ! private static List<Method> findMatchingMethods(List<Method> methods, String methodName, Class<?>[] argTypes) { //find all methods with same name first *************** *** 176,180 **** * @return */ ! private static boolean isArgTypesMatch(Class< ? >[] types, Class[] argTypes) { if(types.length != argTypes.length) --- 176,180 ---- * @return */ ! private static boolean isArgTypesMatch(Class< ? >[] types, Class<?>[] argTypes) { if(types.length != argTypes.length) Index: MockObjectImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockObjectImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockObjectImpl.java 15 Sep 2006 21:22:56 -0000 1.2 --- MockObjectImpl.java 14 May 2007 18:31:28 -0000 1.3 *************** *** 19,28 **** private static Set<Method> isMethodInSuper = new HashSet<Method>(); ! private static Map<Type, Class> primitiveToClass = new HashMap<Type, Class>(); ! private Class[] classes; static { //reflect and find all the methods of the superclass. ! Class c = MockObject.class; Method[] m = c.getMethods(); for(int i = 0; i < m.length; i++) { --- 19,28 ---- private static Set<Method> isMethodInSuper = new HashSet<Method>(); ! private static Map<Type, Class<?>> primitiveToClass = new HashMap<Type, Class<?>>(); ! private Class<?>[] classes; static { //reflect and find all the methods of the superclass. ! Class<?> c = MockObject.class; Method[] m = c.getMethods(); for(int i = 0; i < m.length; i++) { *************** *** 45,49 **** } ! public MockObjectImpl(String id, Class[] interfaces) { super(id); this.classes = interfaces; --- 45,49 ---- } ! public MockObjectImpl(String id, Class<?>[] interfaces) { super(id); this.classes = interfaces; *************** *** 58,62 **** Object o = methodCalledImpl(method.getName(), args); ! Class returnType = method.getReturnType(); if(returnType == null) --- 58,62 ---- Object o = methodCalledImpl(method.getName(), args); ! Class<?> returnType = method.getReturnType(); if(returnType == null) *************** *** 78,82 **** } else if(returnType.isPrimitive()) { //TODO: this is not working correctly no matter what I do here..... ! Class primitiveClass = primitiveToClass.get(returnType); if(!primitiveClass.isInstance(o)) throw new IllegalArgumentException("You specified an incorrect return type on method\n="+methodString+"\n" --- 78,82 ---- } else if(returnType.isPrimitive()) { //TODO: this is not working correctly no matter what I do here..... ! Class<?> primitiveClass = primitiveToClass.get(returnType); if(!primitiveClass.isInstance(o)) throw new IllegalArgumentException("You specified an incorrect return type on method\n="+methodString+"\n" *************** *** 102,106 **** for(int ii = 0; ii < parameterTypes.length; ii++) { ! Class arg = method.getParameterTypes()[ii]; methodArgs += arg.getName(); if(ii < parameterTypes.length -1) --- 102,106 ---- for(int ii = 0; ii < parameterTypes.length; ii++) { ! Class<?> arg = method.getParameterTypes()[ii]; methodArgs += arg.getName(); if(ii < parameterTypes.length -1) *************** *** 184,188 **** */ @Override ! public Class[] getClasses() { return classes; } --- 184,188 ---- */ @Override ! public Class<?>[] getClasses() { return classes; } Index: MessageHelper.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MessageHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MessageHelper.java 1 Oct 2006 03:18:44 -0000 1.3 --- MessageHelper.java 14 May 2007 18:31:21 -0000 1.4 *************** *** 13,23 **** private MessageHelper() {} ! 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; --- 13,27 ---- private MessageHelper() {} ! public static String getMethodSignature(String retVal, Method method, String postfix) { ! String methodSig = "public "; ! if(retVal == null) ! methodSig += method.getReturnType(); ! else ! methodSig += retVal; methodSig += " "+method.getName(); methodSig += postfix; methodSig += "("; boolean needChop = false; ! for(Class<?> c : method.getParameterTypes()) { methodSig += c.getName()+", "; needChop = true; |
From: Nobody <fas...@us...> - 2007-05-14 18:33:51
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs16:/tmp/cvs-serv20175/input/javasrc/biz/xsoftware/mock Modified Files: CalledMethod.java MockObjectFactory.java MockObject.java Log Message: fix generics warnings and some other stuff. Index: CalledMethod.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/CalledMethod.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CalledMethod.java 14 May 2007 14:26:13 -0000 1.2 --- CalledMethod.java 14 May 2007 18:31:31 -0000 1.3 *************** *** 75,79 **** @Override public String toString() { ! List paramList = null; if(params != null) paramList = Arrays.asList(params); --- 75,79 ---- @Override public String toString() { ! List<Object> paramList = null; if(params != null) paramList = Arrays.asList(params); Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MockObject.java 14 May 2007 14:26:14 -0000 1.11 --- MockObject.java 14 May 2007 18:31:32 -0000 1.12 *************** *** 105,109 **** * @param argTypes The parameters types of the method so overloaded method can be specified */ ! public void setDefaultBehavior(String method, Behavior b, Class ... argTypes); /** --- 105,109 ---- * @param argTypes The parameters types of the method so overloaded method can be specified */ ! public void setDefaultBehavior(String method, Behavior b, Class<?> ... argTypes); /** *************** *** 162,166 **** * @param argTypes The parameters to the method to distinguish between overloaded methods. */ ! public void addBehavior(String method, Behavior behavior, Class... argTypes); /** --- 162,166 ---- * @param argTypes The parameters to the method to distinguish between overloaded methods. */ ! public void addBehavior(String method, Behavior behavior, Class<?>... argTypes); /** Index: MockObjectFactory.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObjectFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MockObjectFactory.java 15 Sep 2006 21:22:56 -0000 1.5 --- MockObjectFactory.java 14 May 2007 18:31:31 -0000 1.6 *************** *** 30,34 **** * cases can call expect event on. */ ! public static MockObject createMock(String id, Class theInterface) { return createMock(new Class[] { theInterface }); } --- 30,34 ---- * cases can call expect event on. */ ! public static MockObject createMock(String id, Class<?> theInterface) { return createMock(new Class[] { theInterface }); } *************** *** 50,55 **** * cases can call expect event on. */ ! public static MockObject createMock(Class theInterface) { ! return createMock(new Class[] { theInterface }); } --- 50,55 ---- * cases can call expect event on. */ ! public static MockObject createMock(Class<?> theInterface) { ! return createMock(new Class<?>[] { theInterface }); } *************** *** 73,77 **** * cases can call expect event on. */ ! public static MockObject createMock(Class[] interfaces) { return createMock("(no id specified)", interfaces); } --- 73,77 ---- * cases can call expect event on. */ ! public static MockObject createMock(Class<?>[] interfaces) { return createMock("(no id specified)", interfaces); } *************** *** 96,100 **** * cases can call expect event on. */ ! public static synchronized MockObject createMock(String id, Class[] interfaces) { if(factory == null) { loadFactory(); --- 96,100 ---- * cases can call expect event on. */ ! public static synchronized MockObject createMock(String id, Class<?>[] interfaces) { if(factory == null) { loadFactory(); *************** *** 117,120 **** } ! public abstract MockObject createMockImpl(String id, Class[] interfaces); } --- 117,120 ---- } ! public abstract MockObject createMockImpl(String id, Class<?>[] interfaces); } |