mocklib-checkins Mailing List for mocklib (Page 12)
Brought to you by:
bittwidler,
fastdragon
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(1) |
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(54) |
Feb
(120) |
Mar
(31) |
Apr
(11) |
May
(8) |
Jun
(5) |
Jul
|
Aug
(22) |
Sep
(295) |
Oct
(6) |
Nov
(10) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(8) |
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
(8) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
(17) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Nobody <fas...@us...> - 2006-09-10 18:26:06
|
Update of /cvsroot/mocklib/mocklib3/input/misc In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/misc Added Files: mockoverview.html examplesoverview.html Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: examplesoverview.html --- <HTML> <TITLE>MockObject Examples</TITLE> <BODY> These are the mockobject examples. Each package has a different example. Pick the one that is closest to your needs which will show you how to utilize the mockobject library. </BODY> </HTML> --- NEW FILE: mockoverview.html --- <HTML> <TITLE>MockObject</TITLE> <BODY> This is the MockObject library, a very small library that can create mock objects for you, or allows you to create more complicated mockobjects. </BODY> </HTML> |
From: Nobody <fas...@us...> - 2006-09-10 18:26:06
|
Update of /cvsroot/mocklib/mocklib3/tools/package-list/junit In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/package-list/junit Added Files: package-list Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: package-list --- junit.awtui junit.extensions junit.framework junit.runner junit.samples junit.samples.money junit.swingui junit.tests junit.tests.extensions junit.tests.framework junit.tests.runner junit.textui |
From: Nobody <fas...@us...> - 2006-09-10 18:26:05
|
Update of /cvsroot/mocklib/mocklib3/tools/ant-optional In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/ant-optional Added Files: optional.jar README.txt Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: optional.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: README.txt --- Why put ant optional tasks here. Well first read the FAQ at ant.apache.org http://ant.apache.org/faq.html#delegating-classloader. I am following option 2. If I don't, I have to put junit.jar in two places tools/ant/lib with the ant-junit task AND input/lib for application developers to use the junit.jar Instead, I separate out the ant-junit.jar and put it in the tools/ant-optional folder. Then I taskdef junit against the ant-junit.jar with junit in it's classpath which I put in input/lib/tools If anyone has a better suggestion, I am all ears as this is not the optimal solution I think. nonetheless, it works for now. thanks, dean |
From: Nobody <fas...@us...> - 2006-09-10 18:26:04
|
Update of /cvsroot/mocklib/mocklib3/tools/ant-osgi In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/ant-osgi Added Files: bcel-head.jar osgi-ant.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: bcel-head.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: osgi-ant.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:26:04
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/timer In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/examples/timer Added Files: ScheduleListener.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: ScheduleListener.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.timer; import java.util.EventListener; /** * Listener interface to notify client of an event starting. * * @author Dean Hiller */ public interface ScheduleListener extends EventListener { /** * @param title */ void eventStarted(String title); } |
From: Nobody <fas...@us...> - 2006-09-10 18:26:04
|
Update of /cvsroot/mocklib/mocklib3/tools/old In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/old Added Files: buildtemplate.version Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: buildtemplate.version --- #DO NOT EDIT THIS FILE, IT IS GENERATED #Mon Sep 20 22:27:36 MDT 2004 bldfiles/dist.xml=1095740836153 version=Developer-Build file0=bldfiles/dist.xml |
From: Nobody <fas...@us...> - 2006-09-10 18:26:04
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/manifest In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/manifest Added Files: TestManifestInfo.java ManifestInfo.java ManifestUtilImpl.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: ManifestUtilImpl.java --- /* * Created on Sep 19, 2004 * * FIXME To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package biz.xsoftware.manifest; import java.io.File; import java.net.URL; import java.util.jar.Attributes; import java.util.jar.Manifest; import java.util.logging.Logger; /** * @author Dean Hiller * * FIXME To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class ManifestUtilImpl implements ManifestInfo.ManifestUtil { private static final Logger log = Logger.getLogger(ManifestUtilImpl.class.getName()); public File getFile(URL url) { log.finest("url="+url); String filePart = url.getFile(); log.finest("filePart from url="+filePart); String nameWithClass = filePart.substring(5, filePart.length()); log.finest("nameWithClass="+nameWithClass); int index = nameWithClass.indexOf("!"); log.finest("index="+index); String fileName = nameWithClass.substring(0, index); log.finest("fileName of buildtemplate="+fileName); File f = new File(fileName); if(!f.exists()) { log.warning("Bug, Exiting System. Could not find file="+fileName); System.exit(1); } log.finer("returning file="+f.getAbsolutePath()); return f; } /* (non-Javadoc) * @see biz.xsoftware.manifest.ManifestInfo.SystemInterface#exit(int) */ public void exit(int code) { System.exit(code); } public String getMainClass(Manifest manifest) { Attributes attr = manifest.getMainAttributes(); String s = attr.getValue("SubMain-Class"); return s.trim(); } //dummy main for testing purposes!!! public static void main(String[] args) { log.fine("just throwing an exception for testing purposes"); throw new RuntimeException("Just for testing only"); } } --- NEW FILE: TestManifestInfo.java --- /* * Created on Sep 11, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package biz.xsoftware.manifest; import java.io.File; import java.net.URL; import java.util.jar.Manifest; import junit.framework.TestCase; /** * This is purely so emma always always reports code coverage * numbers on everything */ public class TestManifestInfo extends TestCase { private static final String DUMMY = "dummy"; private File jarFile; /** * @param arg0 */ public TestManifestInfo(String arg0) { super(arg0); } @Override public void setUp() { String jarLoc = System.getProperty("jar.name"); if(jarLoc != null) //for tests run from ant jarFile = new File(jarLoc); else //for tests run from eclipse jarFile = new File("output/jardist/projectname.jar"); } public void testManifestInfo() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, "should.not.matter.class"); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[] {"-version"}); ManifestInfo.main(new String[] {"-manifest"}); String version = new ManifestInfo().getVersion(); assertEquals("version from build.xml should equal version in jar", System.getProperty("version"), version); } public void testRunMainClass() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, TestManifestInfo.class.getName()); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[] {DUMMY}); assertTrue("should have one argument", argsLen == 1); assertEquals("variable should have been passed through", DUMMY, dummyArg); } public void testExceptionFromMainClass() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, ManifestUtilImpl.class.getName()); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[0]); } public void testClassNotFound() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, "this.class.is.not.found"); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[0]); } public void testTOOLSJAVAMain() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, " TOOLS.JAVA.Main "); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[0]); } public void testNullClassName() throws Throwable { FakeJarLocator mock = new FakeJarLocator(jarFile, null); ManifestInfo.setJarLocator(mock); ManifestInfo.main(new String[0]); } public void testGetMainClass() { Manifest mf = new Manifest(); mf.getMainAttributes().putValue("SubMain-Class", " xx "); ManifestUtilImpl util = new ManifestUtilImpl(); String s = util.getMainClass(mf); assertEquals("should have trimmed the value", "xx", s); } public void testGetFile() throws Exception { File f = jarFile; assertTrue("file should exist before we test this", f.exists()); URL url = f.toURL(); URL urlToClassFile = new URL("file", null, -1, url+"!/biz/xsoftware/buildtemplate/Util.class"); File tmp = new ManifestUtilImpl().getFile(urlToClassFile); assertNotNull("Should return a real file", tmp); assertTrue("file should still exist", tmp.exists()); } private class FakeJarLocator implements ManifestInfo.ManifestUtil { private File file; private String mainClass; public FakeJarLocator(File f, String mainClass) { this.file = f; this.mainClass = mainClass; } public File getFile(URL url) { return file; } public void exit(int code) { //do nothing!!! } public String getMainClass(Manifest manifest) { return mainClass; } } //dummy main method for testing!!! public static void main(String[] args) { argsLen = args.length; dummyArg = args[0]; } private static int argsLen; private static String dummyArg; } --- NEW FILE: ManifestInfo.java --- /* * Created on Jul 9, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.manifest; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.util.Iterator; import java.util.Set; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.logging.Level; import java.util.logging.Logger; /** * Miscellaneous class that just prints the version of the mock object jar * getting it from the manifest file. * * @author Dean Hiller */ public class ManifestInfo { private static final Logger log = Logger.getLogger(ManifestInfo.class.getName()); private static ManifestUtil util = new ManifestUtilImpl(); //private Package thePackage; private Manifest manifest; /** * The main program for Version that prints the version info from * the manifest file. * * java -jar xxx.jar * 1. runs SubMain-Class in manifest file * 2. If SubMain-Class is default value or "", prints usage info * for -manifest and -version * * java -jar xxx.jar -version * 1. prints version info * * java -jar xxx.jar -manifest * 1. prints all manifest contents. * * @param args Ignores all arguments. */ public static void main(String[] args) throws Throwable { try { run(args); } catch(Throwable e) { log.log(Level.WARNING, "Exception occurred", e); throw e; } } public static void run(String[] args) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); if(args.length > 0) { if("-manifest".equals(args[0])) { System.out.println(""+manifestInfo); return; } else if("-version".equals(args[0])) { System.out.println(manifestInfo.getFullVersionInfo()); return; } } String className = util.getMainClass(manifestInfo.getManifest()); if(className == null) className = ""; if("TOOLS.JAVA.Main".equals(className.trim()) || "".equals(className)) { System.err.println("Usage:"); System.err.println("1. java -jar <jarfile> -version"); System.err.println("2. java -jar <jarfile> -manifest"); } else { runProgram(className, args); } util.exit(1); } static void runProgram(String className, String[] args) { String msg = ""; ClassLoader cl = ManifestInfo.class.getClassLoader(); try { Class c = cl.loadClass(className); log.finest("class="+c); Method m = c.getMethod("main", new Class[] {String[].class}); m.invoke(null, new Object[] { args }); } catch(ClassNotFoundException e) { msg = "Class in manifest not found in classpath\n" +"Fix the ant.properties file to refer to the\n" +"main class or refer to nothing\n" +"class="+className; System.out.println(msg); } catch(NoSuchMethodException e) { msg = "You have specified a class that doesn't" +"have a main method in ant.properties file." +"class="+className; System.out.println(msg); } catch(Exception e) { msg = "\n\n2. Unknown failure. Contact buildtemplate owner"; log.log(Level.WARNING, "Exception occurred", e); System.out.println(msg); } util.exit(1); } public static void setJarLocator(ManifestUtil l) { util = l; } /** * Constructor that takes a class to get the version information * from out of the manifest. Uses the class's package to retrieve * the manifest version info. */ public ManifestInfo() throws IOException { URL url = ManifestInfo.class.getResource("ManifestInfo.class"); //set manifest from jar file File f = util.getFile(url); JarFile jarFile = new JarFile(f); manifest = jarFile.getManifest(); //set the package of this guy(not really needed as we could get all this info //directly from manifest) //String name = ManifestInfo.class.getName(); //int index = name.lastIndexOf("."); //String packageName = name.substring(0, index); //thePackage = Package.getPackage(packageName); } private Manifest getManifest() { return manifest; } public String getVersion() { Attributes attr = manifest.getMainAttributes(); String version = attr.getValue("Implementation-Version"); version = version.trim(); int index = version.indexOf(" "); version = version.substring(0, index); return version; } public String getFullVersionInfo() { Attributes attr = manifest.getMainAttributes(); String retVal = attr.getValue("Implementation-Title")+" information..."; retVal += "\nwebsite= "+attr.getValue("Implementation-Vendor"); retVal += "\nbuilt by= "+attr.getValue("Built-By"); retVal += "\nclasspath= "+attr.getValue("Class-Path"); retVal += "\nversion= "+attr.getValue("Implementation-Version")+"\n"; return retVal; } /** * Prints the version info the Version represents. * * @see java.lang.Object#toString() */ @Override public String toString() { String manifestInfo = "\nManifest information...\n"; Attributes attr = manifest.getMainAttributes(); Set s = attr.keySet(); Iterator iter = s.iterator(); while(iter.hasNext()) { Object o = iter.next(); manifestInfo += o+"="+attr.get(o)+"\n"; } return manifestInfo; } public interface ManifestUtil { public File getFile(URL url); public String getMainClass(Manifest manifest); public void exit(int code); } } |
From: Nobody <fas...@us...> - 2006-09-10 18:26:03
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc Added Files: overview.html Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: overview.html --- <html> <body> </body> </html> |
From: Nobody <fas...@us...> - 2006-09-10 18:26:02
|
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/bin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/findbugs/bin Added Files: fbwrap addMessages unionBugs defectDensity findbugs setBugDatabaseInfo computeBugHistory filterBugs mineBugHistory xpathFind printAppVersion listBugDatabaseInfo convertXmlToText findbugs.bat Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: computeBugHistory --- #! /bin/sh # Merge a historical bug collection and a bug collection, producing an updated # historical bug collection program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.Update fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: unionBugs --- #! /bin/sh # Deprecated # Create the union of two results files, preserving # annotations in both files in the result. program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.UnionResults fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: setBugDatabaseInfo --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.SetBugDatabaseInfo fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: xpathFind --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.xml.XPathFind fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: defectDensity --- #! /bin/sh # Generate a defect density table from a bug collection program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.DefectDensity fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: listBugDatabaseInfo --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.ListBugDatabaseInfo fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: mineBugHistory --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.MineBugHistory fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs --- NEW FILE: findbugs.bat --- @echo off :: Launch FindBugs on a Windows system. :: Adapted from scripts found at http://www.ericphelps.com/batch/ :: This will only work on Windows NT or later! :: Don't affect environment outside of this invocation setlocal :: ---------------------------------------------------------------------- :: Set up default values :: ---------------------------------------------------------------------- set appjar=findbugsGUI.jar set javahome= set launcher=javaw.exe set start=start "FindBugs" set jvmargs= set debugArg= set conserveSpaceArg= set workHardArg= set args= set javaProps= set maxheap=256 :: Try finding the default FINDBUGS_HOME directory :: from the directory path of this script set default_findbugs_home=%~dp0.. :: Honor JAVA_HOME environment variable if it is set if "%JAVA_HOME%"=="" goto nojavahome if not exist "%JAVA_HOME%\bin\javaw.exe" goto nojavahome set javahome=%JAVA_HOME%\bin\ :nojavahome goto loop :: ---------------------------------------------------------------------- :: Process command-line arguments :: ---------------------------------------------------------------------- :shift2 shift :shift1 shift :loop :: Remove surrounding quotes from %1 and %2 set firstArg=%~1 set secondArg=%~2 if not "%firstArg%"=="-gui" goto notGui set appjar=findbugsGUI.jar set launcher=javaw.exe goto shift1 :notGui if not "%firstArg%"=="-textui" goto notTextui set appjar=findbugs.jar set launcher=java.exe set start= goto shift1 :notTextui if not "%firstArg%"=="-debug" goto notDebug set launcher=java.exe set start= set debugArg=-Dfindbugs.debug=true goto shift1 :notDebug if "%firstArg%"=="-home" set FINDBUGS_HOME=%secondArg% if "%firstArg%"=="-home" goto shift2 if "%firstArg%"=="-jvmArgs" set jvmargs=%secondArg% if "%firstArg%"=="-jvmArgs" goto shift2 if "%firstArg%"=="-maxHeap" set maxheap=%secondArg% if "%firstArg%"=="-maxHeap" goto shift2 if "%firstArg%"=="-conserveSpace" set conserveSpaceArg=-Dfindbugs.conserveSpace=true if "%firstArg%"=="-conserveSpace" goto shift1 if "%firstArg%"=="-workHard" set workHardArg=-Dfindbugs.workHard=true if "%firstArg%"=="-workHard" goto shift1 if "%firstArg%"=="-javahome" set javahome=%secondArg%\bin\ if "%firstArg%"=="-javahome" goto shift2 if "%firstArg%"=="-property" set javaProps=-D%secondArg% %javaProps% if "%firstArg%"=="-property" goto shift2 if "%firstArg%"=="-help" goto help if "%firstArg%"=="" goto launch set args=%args% "%firstArg%" goto shift1 :: ---------------------------------------------------------------------- :: Launch FindBugs :: ---------------------------------------------------------------------- :launch :: Make sure FINDBUGS_HOME is set. :: If it isn't, try using the default value based on the :: directory path of the invoked script. :: Note that this will fail miserably if the value of FINDBUGS_HOME :: has quote characters in it. if not "%FINDBUGS_HOME%"=="" goto checkHomeValid set FINDBUGS_HOME=%default_findbugs_home% :checkHomeValid if not exist "%FINDBUGS_HOME%\lib\%appjar%" goto homeNotSet :found_home :: Launch FindBugs! %start% "%javahome%%launcher%" %debugArg% %conserveSpaceArg% %workHardArg% %javaProps% "-Dfindbugs.home=%FINDBUGS_HOME%" -Xmx%maxheap%m %jvmargs% -jar "%FINDBUGS_HOME%\lib\%appjar%" %args% goto end :: ---------------------------------------------------------------------- :: Display usage information :: ---------------------------------------------------------------------- :help echo Usage: findbugs [options] echo -home dir Use dir as FINDBUGS_HOME echo -gui Use the Graphical UI (default behavior) echo -textui Use the Text UI echo -jvmArgs args Pass args to JVM echo -maxHeap size Set maximum Java heap size in megabytes (default %maxheap%) echo -javahome dir Specify location of JRE echo -help Display this message echo -debug Enable debug tracing in FindBugs echo -conserveSpace Conserve memory at the expense of precision echo All other options are passed to the FindBugs application goto end :: ---------------------------------------------------------------------- :: Report that FINDBUGS_HOME is not set (and was not specified) :: ---------------------------------------------------------------------- :homeNotSet echo Could not find FindBugs home directory. There may be a problem echo with the FindBugs installation. Try setting FINDBUGS_HOME, or echo re-installing. goto end :end --- NEW FILE: filterBugs --- #! /bin/sh # General purpose utility for filtering/transforming # bug collection and/or historical bug collections program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.Filter fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: addMessages --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.AddMessages fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs --- NEW FILE: convertXmlToText --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.PrintingBugReporter fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs --- NEW FILE: printAppVersion --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.PrintAppVersion fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: findbugs --- #! /bin/sh # Launch FindBugs from the command line. escape_arg() { echo "$1" | sed -e "s,\\([\\\"' ]\\),\\\\\\1,g" } program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi maxheap=768 ShowHelpAndExit() { fb_appjar="$findbugs_home/lib/findbugsGUI.jar" fb_mainclass="edu.umd.cs.findbugs.ShowHelp" fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs exit 0 } # Set defaults fb_appjar="$findbugs_home/lib/findbugsGUI.jar" fb_mainclass="edu.umd.cs.findbugs.gui.FindBugsFrame" user_jvmargs='' debug_arg='' conservespace_arg='' workhard_arg='' user_props='' # Handle command line arguments. while [ $# -gt 0 ]; do case $1 in -gui) fb_appjar="$findbugs_home/lib/findbugsGUI.jar" fb_mainclass="edu.umd.cs.findbugs.gui.FindBugsFrame" ;; -textui) fb_appjar="$findbugs_home/lib/findbugs.jar" fb_mainclass="edu.umd.cs.findbugs.FindBugs" ;; -jvmArgs) shift user_jvmargs="$1" ;; -maxHeap) shift maxheap="$1" ;; -javahome) shift fb_javacmd="$1/bin/java" ;; -debug) debug_arg="-Dfindbugs.debug=true" ;; -conserveSpace) conservespace_arg="-Dfindbugs.conserveSpace=true" ;; -property) shift user_props="-D$1 $user_props" ;; -D*=*) user_props="$1 $user_props" ;; -version) fb_mainclass=edu.umd.cs.findbugs.Version fb_appargs="-release" while [ $# -gt 0 ]; do shift done fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs exit 0 ;; -help) ShowHelpAndExit ;; # All unrecognized arguments will be accumulated and # passed to the application. *) fb_appargs="$fb_appargs `escape_arg "$1"`" ;; esac shift done fb_jvmargs="$user_jvmargs $debug_arg $conservespace_arg $workhard_arg $user_props" fb_maxheap="-Xmx${maxheap}m" # Extra JVM args for MacOSX. if [ $fb_osname = "Darwin" ]; then fb_jvmargs="$fb_jvmargs \ -Xdock:name=FindBugs -Xdock:icon=${findbugs_home}/lib/buggy.icns \ -Dapple.laf.useScreenMenuBar=true" fi fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: fbwrap --- #! /bin/sh # A convenient way to call the main() method of a class # in findbugs.jar. program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi if [ $# -eq 0 ]; then echo "Usage: fbwrap <main class name> <args...>" exit 1 fi fb_mainclass="$1" shift fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 |
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/examples/advanced Added Files: User.java Location.java TaskSystem.java TestExample.java TaskRecordService.java SysUnderTest.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: TaskSystem.java --- /* * Created on Jul 15, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; import biz.xsoftware.examples.timer.ScheduleListener; /** * * @author Dean Hiller */ public interface TaskSystem { public void addScheduleListener(ScheduleListener l); public void removeScheduleListener(ScheduleListener l); } --- NEW FILE: TestExample.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; import junit.framework.TestCase; import biz.xsoftware.examples.timer.ScheduleListener; import biz.xsoftware.mock.MockObjectFactory; import biz.xsoftware.mock.MockObject; /** * JUnit Suite of TestCases for demonstrating mocking out a more * complex api. * * @author Dean Hiller */ public class TestExample extends TestCase { private SysUnderTest sysUnderTest; private MockObject mockTaskSvc; private MockObject mockRecord; /** * @showcode */ public TestExample(String name) { super(name); } /** * @showcode */ @Override public void setUp() { mockTaskSvc = MockObjectFactory.createMock(TaskSystem.class); mockRecord = MockObjectFactory.createMock(TaskRecordService.class); sysUnderTest = new SysUnderTest((TaskRecordService)mockRecord, (TaskSystem)mockTaskSvc); } /** * Some api's can be more OO oriented then others and have no * one facade into the whole subsystem as it may be too large, * so this demonstrates how even those api's can be mocked out. * * This also demonstrates a susbystem that relies on two subsystems * such that you can trigger an event in one subsystem and test * the interaction with the other subsystem. * * @showcode */ public void testSystemInteractionWithSubsytemsAPI() { String expectedName = "joe"; String expectedTask = "printpaper"; sysUnderTest.sendUserMailWhenTaskStarted(expectedName, expectedTask); Object o = mockTaskSvc.expect("addScheduleListener").getAllParams()[0]; ScheduleListener l = (ScheduleListener)o; //set an object to return from mockRecord as we know we are testing //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); mockUser.addReturnValue("addTaskDone", "foo"); mockRecord.addReturnValue("getUser", mockUser); //have mockTaskSvc fire an event that should cause sysUnderTest //to interact with mockMessaging l.eventStarted(null); String actualUserId = (String)mockRecord.expect("getUser").getAllParams()[0]; assertEquals("User id was incorrect", expectedName, actualUserId); String actualTask = (String)mockUser.expect("addTaskDone").getAllParams()[0]; assertEquals("task name was incorrect", expectedTask, actualTask); } } --- NEW FILE: SysUnderTest.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; import biz.xsoftware.examples.timer.ScheduleListener; /** * The SysUnderTest here is a WebStore or something which needs * to authorize purchases. */ public class SysUnderTest { private TaskRecordService msgSystem; private TaskSystem taskSystem; /** * @showcode */ public SysUnderTest(TaskRecordService msgSystem, TaskSystem t) { this.msgSystem = msgSystem; this.taskSystem = t; } /** * @showcode */ public void sendUserMailWhenTaskStarted(String id, String taskName) { taskSystem.addScheduleListener(new TaskStartedListener(id, taskName)); } private class TaskStartedListener implements ScheduleListener { private String name; private String userId; /** * @showcode */ public TaskStartedListener(String userId, String name) { this.name = name; this.userId = userId; } /** * @showcode * @see biz.xsoftware.examples.timer.ScheduleListener#eventStarted(java.lang.String) */ public void eventStarted(String title) { User u = msgSystem.getUser(userId); u.addTaskDone(name); } } } --- NEW FILE: TaskRecordService.java --- /* * Created on Jul 15, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public interface TaskRecordService { public User getUser(String id); } --- NEW FILE: User.java --- /* * Created on Jul 15, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; /** * An interface defining the more complex api we are mocking out. * * @author Dean Hiller */ public interface User { public String addTaskDone(String taskName); } --- NEW FILE: Location.java --- /* * Created on Jul 15, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.advanced; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public interface Location { public String getOfficeNumber(); public String getStreet(); public String getStreetNumber(); public String getZipCode(); } |
From: Nobody <fas...@us...> - 2006-09-10 18:26:00
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/timer2 In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/examples/timer2 Added Files: TestExample.java TimerInterface.java SysUnderTest.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: TimerInterface.java --- /* * Created on Jun 20, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.timer2; import java.util.Date; import java.util.TimerTask; /** * A user created Timer interface to make testing easier. * * @author Dean Hiller */ public interface TimerInterface { public void cancel(); public int purge(); public void schedule(TimerTask task, Date time); public void schedule(TimerTask task, Date firstTime, long period); public void schedule(TimerTask task, long delay); public void schedule(TimerTask task, long delay, long period) ; public void scheduleAtFixedRate(TimerTask task, Date firstTime, long period); public void scheduleAtFixedRate(TimerTask task, long delay, long period); } --- NEW FILE: TestExample.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.timer2; import java.util.TimerTask; import junit.framework.TestCase; import biz.xsoftware.examples.timer.ScheduleListener; import biz.xsoftware.mock.CalledMethod; import biz.xsoftware.mock.MockObjectFactory; import biz.xsoftware.mock.MockObject; /** * JUnit Suite of TestCases for demonstrating mocking out a user * created Timer interface. * * @author Dean Hiller */ public class TestExample extends TestCase { private MockObject mockListener; private MockObject mockTimer; private SysUnderTest calendar; /** * @showcode */ public TestExample(String name) { super(name); } /** * @showcode */ @Override public void setUp() { mockTimer = MockObjectFactory.createMock(TimerInterface.class); calendar = new SysUnderTest((TimerInterface) mockTimer); mockListener = MockObjectFactory.createMock(ScheduleListener.class); calendar.addScheduleListener((ScheduleListener)mockListener); } /** * @showcode */ @Override public void tearDown() { calendar.removeScheduleListener((ScheduleListener)mockListener); } /** * @showcode */ public void testBasicCalendar() { String title = "some event"; long delay = 50000; calendar.addEvent(title, delay); CalledMethod method = mockTimer.expect("schedule"); //param[0] is a timer task TimerTask task = (TimerTask)method.getParameter(0); assertEquals("Should have set the timer for "+delay+" ms", new Long(delay), method.getParameter(1)); //run the task now instead of waiting 50000ms task.run(); method = mockListener.expect("eventStarted"); assertEquals("title should be the same", title, method.getParameter(0)); } } --- NEW FILE: SysUnderTest.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.timer2; import java.util.TimerTask; import javax.swing.event.EventListenerList; import biz.xsoftware.examples.timer.ScheduleListener; /** * The SysUnderTest here is a Calendar which notifies users of a * scheduled event. */ public class SysUnderTest { private TimerInterface timer; private EventListenerList listenerList = new EventListenerList(); /** * @showcode */ public SysUnderTest(TimerInterface t) { timer = t; } /** * @showcode */ public void addEvent(String title, long delay) { timer.schedule(new CalendarEvent(title), delay); } /** * @showcode */ public void addScheduleListener(ScheduleListener l) { listenerList.add(ScheduleListener.class, l); } /** * @showcode */ public void removeScheduleListener(ScheduleListener l) { listenerList.remove(ScheduleListener.class, l); } private class CalendarEvent extends TimerTask { private String title; /** * @showcode */ public CalendarEvent(String title) { this.title = title; } /** * @showcode */ @Override public void run() { fireEventStarted(title); } } /** * @showcode */ protected void fireEventStarted(String title) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==ScheduleListener.class) { ((ScheduleListener)listeners[i+1]).eventStarted(title); } } } } |
From: Nobody <fas...@us...> - 2006-09-10 18:26:00
|
Update of /cvsroot/mocklib/mocklib3/tools/ant-contrib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/ant-contrib Added Files: bcel-head.jar ant-contrib.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: bcel-head.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-contrib.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:26:00
|
Update of /cvsroot/mocklib/mocklib3/tools/ant-junit In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/ant-junit Added Files: ant-junit.jar junit.jar README.txt Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: junit.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-junit.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: README.txt --- Why put ant optional tasks here. Well first read the FAQ at ant.apache.org http://ant.apache.org/faq.html#delegating-classloader. I am following option 2. If I don't, I have to put junit.jar in two places tools/ant/lib with the ant-junit task AND input/lib for application developers to use the junit.jar Instead, I separate out the ant-junit.jar and put it in the tools/ant-optional folder. Then I taskdef junit against the ant-junit.jar with junit in it's classpath which I put in input/lib/tools If anyone has a better suggestion, I am all ears as this is not the optimal solution I think. nonetheless, it works for now. Also, junit.jar is a special version of junit. It is 3.8.1 plus a change that Kent Beck made for me. IT should be checked into cvs though the change he checked in was not mine and broke junit very badly. I have to request a fix from him. The break was every test passing no matter what. thanks, dean |
From: Nobody <fas...@us...> - 2006-09-10 18:26:00
|
Update of /cvsroot/mocklib/mocklib3/tools/emma In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/emma Added Files: emma.jar emma_ant.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: emma.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: emma_ant.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:25:59
|
Update of /cvsroot/mocklib/mocklib3 In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740 Added Files: .classpath build .cvsignore build.bat .project Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: .cvsignore --- output eclipsegen --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>mocklib2</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> <linkedResources> </linkedResources> </projectDescription> --- NEW FILE: build --- #************************************ # Generated file. Do not modify # # TODO: check for JAVA_HOME. if not set show error as this is # the one and only thing that has to be set!!!! #************************************ export ANT_HOME=$PWD/tools/ant chmod 755 tools/ant/bin/ant tools/ant/bin/ant -f bldfiles/build.xml $@ --- NEW FILE: build.bat --- rem ************************************** rem Generated file, do not modify!!!! rem rem rem ************************************** @echo off if "%JAVA_HOME%" == "" goto noJavaHome set ANT_HOME=%CD%\tools\ant tools\ant\bin\ant -f bldfiles\build.xml %1 %2 %3 %4 %5 %6 %7 %8 %9 goto end :noJavaHome if "%_JAVACMD%" == "" set _JAVACMD=java echo. echo Error: JAVA_HOME environment variable is not set. echo It must be set to the jdk1.4 directory echo. :end pause --- NEW FILE: .classpath --- <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="input/javasrc"/> <classpathentry kind="lib" path="tools/ant-junit/junit.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="eclipsegen"/> </classpath> |
From: Nobody <fas...@us...> - 2006-09-10 18:25:59
|
Update of /cvsroot/mocklib/mocklib3/input/staging/mocklib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/staging/mocklib Added Files: index.html README.html Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: README.html --- <HTML> <h1><a href="index.html">Click here for documentation</a></h1> </HTML> --- NEW FILE: index.html --- <HTML> <TITLE>MockLib</TITLE> <BODY> <h1>MockLib</h1> This is a very small library but powerful enough to create most of your mockobjects for you. The ones it can't create, you can leverage the library to create. <br/><br/> <a href="http://sourceforge.net/projects/mockobject">MockLib</a> <br/><br/> <a href="http://sourceforge.net/project/showfiles.php?group_id=113040&package_id=122340">Download MockLib library plus these web pages</a> <br/> <a href="coverage.html">Test coverage report</a> <br/> <a href="impl/index.html">MockLib Javadoc</a> <br/><br/> <h3>All MockLib Examples</h3> <ol> <li>Basic Examples - Basic Examples to help get started</li> <ul> <li><a href="examples/biz/xsoftware/examples/basic/TestExample.html#testBasicSysUnderTest()">Example code for basic success</a></li> <li><a href="examples/biz/xsoftware/examples/basic/TestExample.html#testFailureOfAuthorization()">Example code for basic failure</a></li> <li><a href="examples/biz/xsoftware/examples/basic/TestExample.html#testFailureOfBuyingGiftCard()">Example code for more advanced failure</a></li> </ul> <li>Listener Example - How to mock listeners and verify events were received under certain conditions</li> <ul> <li><a href="examples/biz/xsoftware/examples/listener/TestExample.html#testBasicListener()">Example code for listener</a></li> </ul> <li>Timer Example - How to mock out the java.util.Timer class which already exists in your code</li> <ul> <li><a href="examples/biz/xsoftware/examples/timer/TestExample.html#testBasicCalendar()">Example code for timer</a></li> </ul> <li>Timer 2 Example - How to use your own Timer interface instead and mock that out</li> <ul> <li><a href="examples/biz/xsoftware/examples/timer2/TestExample.html#testBasicCalendar()">Example code for timer interface</a></li> </ul> <li>Socket Example - How to create bad network conditions and test your systems reaction to them</li> <ul> <li><a href="examples/biz/xsoftware/examples/socket/TestExample.html#testNetworkProblems()">Example code for testing if system behaves when their are network problems</a></li> <li><a href="examples/biz/xsoftware/examples/socket/TestExample.html#testServerClosingSocket()">Example code for testing if system behaves if other end closes the socket</a></li> </ul> <li>Advanced Example - How to mock our a more complicated api, and trigger events from one system and make sure things happen to another system based on those events</li> <ul> <li><a href="examples/biz/xsoftware/examples/advanced/TestExample.html#testSystemInteractionWithSubsytemsAPI()">Example code for complex apis</a></li> </ul> </ol> <a href="examples/index.html">All MockLib Examples</a> <br/><br/><br/><br/> <a href=http://sourceforge.net> <IMG src=http://sourceforge.net/sflogo.php?group_id=113040 width=210 height=62 border=0 alt=SourceForge Logo> </a> </BODY> </HTML> |
From: Nobody <fas...@us...> - 2006-09-10 18:25:58
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/examples/basic Added Files: package.html SysUnderTest.java PurchaseException.java GiftCardAccountSvc.java TestExample.java CreditAuthorizationSvc.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: TestExample.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.basic; import junit.framework.TestCase; import biz.xsoftware.mock.CalledMethod; import biz.xsoftware.mock.MockObjectFactory; import biz.xsoftware.mock.MockObject; /** * This is the class actually holding the test Examples for you to look at. * * @author Dean Hiller */ public class TestExample extends TestCase { private SysUnderTest sysUnderTest; private MockObject mockCreditSvc; private MockObject mockGiftSvc; /** * @param name The name of the test * @showcode */ public TestExample(String name) { super(name); } /** * @showcode * @see junit.framework.TestCase#setUp() */ @Override public void setUp() { mockCreditSvc = MockObjectFactory.createMock(CreditAuthorizationSvc.class); mockGiftSvc = MockObjectFactory.createMock(GiftCardAccountSvc.class); CreditAuthorizationSvc credit = (CreditAuthorizationSvc)mockCreditSvc; GiftCardAccountSvc gift = (GiftCardAccountSvc)mockGiftSvc; sysUnderTest = new SysUnderTest(credit, gift); } /** * Test that when we purchase an item from the SysUnderTest * that the CreditAuthorization Svc is used to verify the * customer has that amount of money on his credit card. * * @see SysUnderTest#purchase * @showcode */ public void testBasicSysUnderTest() { String user = "user1"; double amount = 340.99; sysUnderTest.purchase("itemA", user, amount); Object[] paramsToAuthorize = mockCreditSvc.expect("authorize").getAllParams(); assertEquals("User should be the same", user, paramsToAuthorize[0]); assertEquals("Amount should have been the same", new Double(amount), paramsToAuthorize[1]); } /** * In this test we test that a failure from CreditAuthSvc * results in the correct StoreUnderTest behavior which in this * instance is to throw an exception to the user. * * @see SysUnderTest#purchase * @showcode */ public void testFailureOfAuthorization() { mockCreditSvc.addThrowException("authorize", new RuntimeException("test robustness of StoreUnderTest")); String user = "user1"; double amount = 340.99; try { sysUnderTest.purchase("itemA", user, amount); fail("Expecting exactly the IllegalStateException for some odd reason(didn't want to define my own)"); } catch(PurchaseException e) {} } /** * Test that * <ol> * <li>Money is taken from users credit account</li> * <li>Put money on card, but cause failure</li> * <li>Assert that money is put back in users credit account</li> * </ol> * * @see SysUnderTest#buyGiftCard * @showcode */ public void testFailureOfBuyingGiftCard() { mockGiftSvc.addThrowException("putMoneyOnCard", new RuntimeException("cause failure in subsystem")); String user = "userXXX"; double amount = 40.01; try { sysUnderTest.buyGiftCard(user, amount); fail("Should have thrown exception"); } catch(PurchaseException e) {} //make sure takeMoney then return money was called which would happen //in a failure case. Also could have made takeMoney ignored instead so //we didn't test the takeMoney and just tested returnMoney. CalledMethod[] methods = mockCreditSvc.expect("takeMoney", "returnMoney"); CalledMethod takeMoney = methods[0]; assertEquals("Took from correct user", user, takeMoney.getParameter(0)); assertEquals("Took 40 dollars", new Double(amount), takeMoney.getParameter(1)); CalledMethod returnMoney = methods[1]; assertEquals("Gave money back to correct user", user, returnMoney.getParameter(0)); assertEquals("amount put back on card is correct", new Double(amount), returnMoney.getParameter(1)); } } --- NEW FILE: SysUnderTest.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.basic; /** * The SysUnderTest here is a WebStore or something which needs * to authorize purchases. */ public class SysUnderTest { private CreditAuthorizationSvc creditSvc; private GiftCardAccountSvc giftSvc; /** * @showcode */ public SysUnderTest(CreditAuthorizationSvc c, GiftCardAccountSvc g) { creditSvc = c; giftSvc = g; } /** * @showcode */ public void purchase(String item, String user, double usDollars) { try { creditSvc.authorize(user, usDollars); } catch(RuntimeException e) { throw new PurchaseException(e); } //if authorize succeeded, go delete an item from the //Inventory as we successfully sold it. } /** * @showcode */ public void buyGiftCard(String user, double usDollars) { creditSvc.takeMoney(user, usDollars); try { giftSvc.putMoneyOnCard(456, usDollars); } catch(Throwable e) { creditSvc.returnMoney(user, usDollars); throw new PurchaseException(e); } return; } } --- NEW FILE: package.html --- <HTML> <BODY> Basic Example using a WebStore(See bottom of page for description). <br/><br/> Basic Example using a WebStore(SysUnderTest) to test the following features of the webstore <OL> <LI><a href="TestExample.html#testBasicSysUnderTest()">testBasicSysUnderTest</a> - Tests that when purchase is made, amount is authorized with a credit service</LI> <LI><a href="TestExample.html#testFailureOfAuthorization()">testFailureOfAuthorization</a> - Tests that if authorization fails, SysUnderTest throws a PurchaseException to indicate it failed</LI> <LI><a href="TestExample.html#testFailureOfBuyingGiftCard()">testFailureOfBuyingGiftCard</a> - A more complicated failure that tests when putting money on a gift card through the GiftCard Svc fails, the money is returned to the credit account</LI> </OL> </BODY> </HTML> --- NEW FILE: GiftCardAccountSvc.java --- /* * Created on Jul 3, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.basic; /** * Interface to what would normally be a real GiftCarAccountSvc. * @author Dean Hiller */ public interface GiftCardAccountSvc { public void putMoneyOnCard(int cardId, double money); public void takeMoneyFromCard(int cardId, double money); } --- NEW FILE: PurchaseException.java --- /* * Created on Jul 3, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.basic; /** * An Exception the SysUnderTest(WebStore) generates when a purchase goes * bad. * @author Dean Hiller */ public class PurchaseException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; /** * @param e */ public PurchaseException(Throwable e) { super(e); } } --- NEW FILE: CreditAuthorizationSvc.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.basic; /** * Interface to what would normally be a real Credit Authorization Service. * * @author Dean Hiller */ public interface CreditAuthorizationSvc { /** * @param user * @param usDollars */ public void authorize(String user, double usDollars); public void takeMoney(String user, double usDollars); public void returnMoney(String user, double usDollars); } |
Update of /cvsroot/mocklib/mocklib3/tools/ant/lib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/ant/lib Added Files: xercesImpl.jar ant-xalan1.jar ant-jai.jar ant-javamail.jar ant-jdepend.jar ant-starteam.jar ant-jmf.jar ant-jakarta-oro.jar ant-apache-log4j.jar ant-icontract.jar ant-jakarta-regexp.jar ant-vaj.jar xerces-130.jar ant-apache-regexp.jar ant-xslp.jar ant-jakarta-log4j.jar ant-apache-oro.jar README ant-apache-bcel.jar crimson.jar ant-stylebook.jar jaxp.jar ant-jakarta-bcel.jar ant-jsch.jar ant-netrexx.jar ant.jar ant-antlr.jar ant-swing.jar commons-net-1.2.2.jar jsch-0.1.17.jar example.jar ant-commons-logging.jar ant-apache-resolver.jar ant-launcher.jar ant-testutil.jar xml-apis.jar ant-apache-bsf.jar ant-trax.jar ant-weblogic.jar ant-xalan2.jar jdom-1.0b8.jar ant-commons-net.jar ant-nodeps.jar gnu-regexp-110.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: ant-nodeps.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-netrexx.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: commons-net-1.2.2.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-stylebook.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-weblogic.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-resolver.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-xalan1.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jaxp.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jsch-0.1.17.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jakarta-regexp.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xml-apis.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-regexp.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xercesImpl.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: crimson.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xerces-130.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-commons-net.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-testutil.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: README --- Please refer to the Ant manual under Installing Ant / Library Dependencies for a list of the jar requirements for various optional tasks and features. This directory contains xercesImpl.jar from the 2.5.0 release of Apache Xerces. For more information or newer releases see <http://xml.apache.org/xerces2-j/>. See the file LICENSE.xerces for the terms of distribution. It also contains xml-apis.jar, an Apache-controlled collection of standard classes from the 1.0b2 release of the Apache XML-Commons release. For more information or newer releases see <http://xml.apache.org/commons/>. See the files LICENSE.dom and LICENSE.sax for the terms of distribution. --- NEW FILE: ant-jakarta-bcel.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jakarta-log4j.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-log4j.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: gnu-regexp-110.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jmf.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-xalan2.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-xslp.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-commons-logging.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jdepend.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-bsf.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-oro.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-vaj.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jai.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-swing.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-starteam.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: example.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jsch.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jdom-1.0b8.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-icontract.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-antlr.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-apache-bcel.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-trax.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-javamail.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-jakarta-oro.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ant-launcher.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:25:57
|
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/plugin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/findbugs/plugin Added Files: coreplugin.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: coreplugin.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:25:52
|
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/bin/deprecated In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/findbugs/bin/deprecated Added Files: updateBugs unionBugs unionResults bugHistory Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: updateBugs --- #! /bin/sh # Merge a historical bug collection and a bug collection, producing an updated # historical bug collection program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.Update fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: unionResults --- #! /bin/sh # Deprecated # Create the union of two results files, preserving # annotations in both files in the result. program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.UnionResults fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: bugHistory --- #! /bin/sh program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.workflow.BugHistory fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 --- NEW FILE: unionBugs --- #! /bin/sh # Create the union of two results files, preserving # annotations in both files in the result. program="$0" # Follow symlinks until we get to the actual file. while [ -h "$program" ]; do link=`ls -ld "$program"` link=`expr "$link" : '.*-> \(.*\)'` if [ "`expr "$link" : '/.*'`" = 0 ]; then # Relative dir=`dirname "$program"` program="$dir/$link" else # Absolute program="$link" fi done # Assume findbugs home directory is the parent # of the directory containing the script (which should # normally be "$findbugs_home/bin"). dir=`dirname $program` findbugs_home="$dir/.." # Handle FHS-compliant installations (e.g., Fink) if [ -d "$findbugs_home/share/findbugs" ]; then findbugs_home="$findbugs_home/share/findbugs" fi # Make absolute findbugs_home=`cd $findbugs_home && /bin/pwd` fb_pathsep=':' # Handle cygwin, courtesy of Peter D. Stout fb_osname=`uname` if [ `expr "$fb_osname" : CYGWIN` -ne 0 ]; then findbugs_home=`cygpath --mixed "$findbugs_home"` fb_pathsep=';' fi if [ ! -d "$findbugs_home" ]; then echo "The path $findbugs_home," echo "which is where I think FindBugs is located," echo "does not seem to be a directory." exit 1 fi # Choose default java binary fb_javacmd=java if [ ! -z "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then fb_javacmd=$JAVA_HOME/bin/java fi fb_mainclass=edu.umd.cs.findbugs.UnionResults fb_javacmd=${fb_javacmd:-"java"} fb_maxheap=${fb_maxheap:-"-Xmx256m"} fb_appjar=${fb_appjar:-"$findbugs_home/lib/findbugs.jar"} set -f #echo command: \ exec $fb_javacmd \ -classpath $fb_appjar$fb_pathsep$CLASSPATH \ -Dfindbugs.home="$findbugs_home"\ $fb_maxheap $fb_jvmargs $fb_mainclass ${@:+"$@"} $fb_appargs # vim:ts=3 |
From: Nobody <fas...@us...> - 2006-09-10 18:25:52
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/test/mock Added Files: TestUnorderedCalls.java FactoryInterface.java MockOne.java Identical.java Car.java CarImpl.java TestOrderedCalls.java OldBehavior.java TestMockCreator.java ListenerOne.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: TestUnorderedCalls.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import biz.xsoftware.mock.ExpectFailedException; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class TestUnorderedCalls extends TestCase { //private final static Logger log = Logger.getLogger(TestUnorderedCalls.class.getName()); /** * @param name */ public TestUnorderedCalls(String name) { super(name); } public void testUnorderedWorks() { MockOne one = new MockOne(10); one.callMeSecond("dummy"); one.callMeFirst(324); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; one.expectUnorderedCalls(evts); } public void testExtraInUnorderedExpect() { MockOne one = new MockOne(3000); one.callMeSecond("dummy"); one.callMeExtra(); one.callMeFirst(5544); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; try { one.expectUnorderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } } public void testExtraAfterUnorderedExpect() { MockOne one = new MockOne(10); one.callMeSecond("dummy"); one.callMeFirst(322); one.callMeExtra(); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; try { one.expectUnorderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } } public void testTimeout() { MockOne one = new MockOne(10); one.callMeSecond("dummy"); try { String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; one.expectUnorderedCalls(evts); } catch(ExpectFailedException e) { assertEquals("reason must be correct", ExpectFailedException.TIMED_OUT, e.getReason()); } } public static void main(String[] args) { TestSuite suite = new TestSuite(); // suite.addTest(new TestUnorderedCalls("testExceptionThrown")); // suite.addTest(new TestUnorderedCalls("testMockCreator")); // suite.addTest(new TestUnorderedCalls("testMockCreatorFail")); // suite.addTest(new TestUnorderedCalls("testMockCreatorCreatesCar")); suite.addTest(new TestUnorderedCalls("testTimeout")); TestRunner.run(suite); } } --- NEW FILE: TestMockCreator.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; import java.io.IOException; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import biz.xsoftware.mock.CalledMethod; import biz.xsoftware.mock.ExpectFailedException; import biz.xsoftware.mock.MockObject; import biz.xsoftware.mock.MockObjectFactory; /** * @author Dean Hiller */ public class TestMockCreator extends TestCase { //private final static Logger log = Logger.getLogger(TestMockCreator.class.getName()); /** * @param name */ public TestMockCreator(String name) { super(name); } public void testMockCreator() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)m; String param1 = "some param"; l.callMeSecond(param1); String methodName = "callMeSecond"; CalledMethod method = m.expect(methodName); assertEquals("method name should be the same", methodName, method.getMethodName()); assertEquals("params should equal", param1, method.getParameter(0)); assertEquals("param count should be 1", 1, method.getParameterCount()); assertEquals("1st param should be equal", param1, method.getAllParams()[0]); } public void testEqualsAndToString() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)m; assertTrue("These should not be equal", !l.equals(new Integer(4))); assertTrue("These should be equal", l.equals(l)); } public void testNoneFailure() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)m; String param1 = "some param"; l.callMeSecond(param1); try { m.expect(MockObject.NONE); fail("Should have failed with ExpectFailedException"); } catch(ExpectFailedException e) { //gulp } } public void testMultipleParams() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)m; String param1 = "someparam2"; Integer param2 = new Integer(2345); l.multipleParams(param1, param2); CalledMethod method = m.expect("multipleParams"); assertEquals("param1 is not correct", param1, method.getParameter(0)); assertEquals("param2 is not correct", param2, method.getParameter(1)); } public void testMockCreatorFail() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)m; l.callMeSecond("dummy"); try { m.expect("callMeFirst"); fail("should have thrown exception"); } catch(ExpectFailedException e) {} } public void testMockCreatorCreatesCar() throws Exception { MockObject factory = MockObjectFactory.createMock(FactoryInterface.class); MockObject car = MockObjectFactory.createMock(Car.class); factory.addReturnValue("createCar", car); //now we would normally tweak code on the subsystem which //would call createcar but we are only unit testing MockCreator Car c = ((FactoryInterface)factory).createCar("someid"); factory.expect("createCar"); c.openDoor(); car.expect("openDoor"); } public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); mockList.addThrowException("callMeSecond", new IOException("test throwing IOException")); ListenerOne l = (ListenerOne)mockList; try { l.callMeSecond("dummy"); fail("should have thrown IOException"); } catch(IOException e) {} } public void testUsingANY() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)mockList; int expected = 1; l.callMeFirst(expected); CalledMethod m = mockList.expect(MockObject.ANY); Integer i = (Integer)m.getAllParams()[0]; assertEquals("param should be 1", new Integer(expected), i); } public void testMultipleANYs() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l = (ListenerOne)mockList; l.callMeFirst(1); l.callMeSecond("second"); String[] methods = new String[] { MockObject.ANY, "callMeSecond" }; mockList.expect(methods); } public void testWrongMethod() { MockObject mock = MockObjectFactory.createMock(ListenerOne.class); try { mock.expect("noSuchMethod"); fail("This should throw an exception"); } catch(IllegalArgumentException e) { } } public void testDefaultRetVal() { MockObject mock = MockObjectFactory.createMock(Identical.class); mock.setDefaultReturnValue("doThat", new byte[] {4}); Identical ident = (Identical)mock; byte[] retVal = ident.doThat(null); mock.expect("doThat"); assertEquals(1, retVal.length); assertEquals(4, retVal[0]); } public void testDefaultReturnWithOtherReturns() { MockObject mock = MockObjectFactory.createMock(Identical.class); mock.addReturnValue("doThat", new byte[] {3}); mock.setDefaultReturnValue("doThat", new byte[] {4}); mock.addReturnValue("doThat", new byte[] {5}); Identical ident = (Identical)mock; byte[] retVal = ident.doThat(null); mock.expect("doThat"); assertEquals(1, retVal.length); assertEquals(3, retVal[0]); retVal = ident.doThat(null); mock.expect("doThat"); assertEquals(1, retVal.length); assertEquals(5, retVal[0]); retVal = ident.doThat(null); mock.expect("doThat"); assertEquals(1, retVal.length); assertEquals(4, retVal[0]); } public void testReturnInterface() { MockObject mock = MockObjectFactory.createMock(FactoryInterface.class); FactoryInterface factory = (FactoryInterface)mock; mock.addReturnValue("createCar", new CarImpl()); Car car = factory.createCar("id"); assertEquals(car.getClass(), CarImpl.class); mock.expect("createCar"); } public void testReturnNull() { MockObject mock = MockObjectFactory.createMock(FactoryInterface.class); FactoryInterface factory = (FactoryInterface)mock; factory.createCar("aaa"); mock.expect("createCar"); } public void testBadPrimitive() { MockObject mock = MockObjectFactory.createMock(Car.class); Car car = (Car)mock; try { mock.addReturnValue("getWheelCount", new Long(56)); car.getWheelCount(); fail("should have thrown exception"); } catch(IllegalArgumentException e) { } } public void testNullPrimitive() { MockObject mock = MockObjectFactory.createMock(Car.class); Car car = (Car)mock; try { car.getWheelCount(); fail("should have thrown exception"); } catch(IllegalArgumentException e) { } } public void testPrimitive() { MockObject mock = MockObjectFactory.createMock(Car.class); Car car = (Car)mock; mock.addReturnValue("getWheelCount", new Integer(5)); car.getWheelCount(); mock.expect("getWheelCount"); } public void testBehavior() { MockObject mock = MockObjectFactory.createMock(Identical.class); mock.addBehavior("doThat", new OldBehavior()); Identical ident = (Identical)mock; byte[] original = new byte[] { 1, 2, 3, 4, 0, 0, 0, 0}; byte[] bytes = new byte[] { 1, 2, 3, 4, 0 ,0,0,0}; byte[] newBytes = ident.doThat(bytes); CalledMethod m = mock.expect("doThat"); byte[] passedIn = (byte[])m.getAllParams()[0]; assertEquals(original.length, passedIn.length); for(int i = 0; i < original.length; i++) { assertEquals(original[i], passedIn[i]); } //make sure this is the same byte array we passed in assertSame(bytes, newBytes); for(int i = 0; i < 4; i++) { assertEquals(newBytes[i], newBytes[i+4]); } } public void testAddRemoveIgnore() { MockObject mock = MockObjectFactory.createMock(Car.class); mock.addIgnore("openDoor", "closeDoor"); Car car = (Car)mock; car.openDoor(); car.closeDoor(); mock.expect(MockObject.NONE); mock.removeIgnore("closeDoor"); car.closeDoor(); mock.expect("closeDoor"); } public static void main(String[] args) { TestSuite suite = new TestSuite(); suite.addTest(new TestMockCreator("testWrongMethod")); // suite.addTest(new TestMockSuperclass("testMockCreator")); // suite.addTest(new TestMockSuperclass("testMockCreatorFail")); // suite.addTest(new TestMockSuperclass("testMockCreatorCreatesCar")); // suite.addTest(new TestMockSuperclass("testThrowCheckedException")); TestRunner.run(suite); } } --- NEW FILE: CarImpl.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.test.mock; /** */ public class CarImpl implements Car { /** * @see biz.xsoftware.test.mock.Car#openDoor() */ public void openDoor() { } /** * @see biz.xsoftware.test.mock.Car#closeDoor() */ public void closeDoor() { } /** * @see biz.xsoftware.test.mock.Car#getWheelCount() */ public int getWheelCount() { return 0; } } --- NEW FILE: ListenerOne.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; import java.io.IOException; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public interface ListenerOne { public void callMeFirst(int s); public void callMeSecond(String s) throws IOException; public void multipleParams(String x, Integer i); } --- NEW FILE: Identical.java --- /** * Copyright (C) 2006 Carrier Access, Corp. */ package biz.xsoftware.test.mock; /** */ public interface Identical { public byte[] doThat(byte[] data); } --- NEW FILE: OldBehavior.java --- /** * */ package biz.xsoftware.test.mock; import biz.xsoftware.mock.Behavior; class OldBehavior implements Behavior { /** * @see biz.xsoftware.mock.Behavior#clone(java.lang.Object[]) */ public Object[] clone(Object[] params) { Object[] retVal = new Object[params.length]; for(int i = 0; i < retVal.length; i++) { Object val = params[i]; if(val instanceof byte[]) { retVal[i] = cloneBytes((byte[])val); } } return retVal; } private Object cloneBytes(byte[] bytes) { byte[] newBytes = new byte[bytes.length]; for(int i = 0; i < newBytes.length; i++) { newBytes[i] = bytes[i]; } return newBytes; } /** * @see biz.xsoftware.mock.Behavior#runMethod(java.lang.Object[]) */ public Object runMethod(Object[] params) { //we know the test does an 4 byte array, so do that byte[] bytes = (byte[])params[0]; for(int i = 0; i < 4; i++) { bytes[i+4] = bytes[i]; } //make sure to return the same byte buffer so we are really testing this... return bytes; } } --- NEW FILE: MockOne.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; import biz.xsoftware.mock.MockSuperclass; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class MockOne extends MockSuperclass implements ListenerOne { public static final String FIRST = "callMeFirst"; public static final String SECOND = "callMeSecond"; public static final String EXTRA = "callMeExtra"; public static final String MULTIPLE_PARAMS = "multipleParams"; public MockOne(int delay) { super(delay); } /* (non-Javadoc) * @see test.biz.xsoftware.testlib.test.ListenerOne#callMeFirst() */ public void callMeFirst(int s) { methodCalled(FIRST, new Integer(s)); } /* (non-Javadoc) * @see test.biz.xsoftware.testlib.test.ListenerOne#callMeSecond() */ public void callMeSecond(String s) { methodCalled(SECOND, s); } public void callMeExtra() { methodCalled(EXTRA, null); } /* (non-Javadoc) * @see biz.xsoftware.test.ListenerOne#multipleParams(java.lang.String, java.lang.Integer) */ public void multipleParams(String x, Integer i) { methodCalled(MULTIPLE_PARAMS, new Object[] { x, i }); } /* (non-Javadoc) * @see biz.xsoftware.mock.MockSuperclass#getClasses() */ @Override public Class[] getClasses() { return new Class[] { MockOne.class }; } public Object inst() { // TODO Auto-generated method stub return null; } } --- NEW FILE: FactoryInterface.java --- /* * Created on Jun 8, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public interface FactoryInterface { public Car createCar(String id); } --- NEW FILE: Car.java --- /* * Created on Jun 8, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public interface Car { public void openDoor(); public void closeDoor(); public int getWheelCount(); } --- NEW FILE: TestOrderedCalls.java --- /* * Created on Apr 24, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.test.mock; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import biz.xsoftware.mock.ExpectFailedException; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class TestOrderedCalls extends TestCase { //private final static Logger log = Logger.getLogger(TestOrderedCalls.class.getName()); /** * @param name */ public TestOrderedCalls(String name) { super(name); } public void testBasicEventBeforeExpect() { MockOne one = new MockOne(3000); one.callMeFirst(4); one.expectCall(MockOne.FIRST); } public void testBasicExpectBeforeEvent() { final MockOne one = new MockOne(3000); Thread r = new Thread() { @Override public void run() { delay(1000); one.callMeFirst(4); } }; r.start(); one.expectCall(MockOne.FIRST); } public void testOrderAfter() { MockOne one = new MockOne(3000); one.callMeFirst(4); one.callMeSecond("dummy"); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; one.expectOrderedCalls(evts); } public void testOrderBefore() { final MockOne one = new MockOne(3000); Thread r = new Thread() { @Override public void run() { delay(1000); one.callMeFirst(4); one.callMeSecond("dummy"); } }; r.start(); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; one.expectOrderedCalls(evts); } public void testOrderAfterFails() { MockOne one = new MockOne(3000); one.callMeFirst(7); one.callMeSecond("dummy"); String[] evts = new String[] { MockOne.SECOND, MockOne.FIRST }; try { one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } } public void testOrderBeforeFails() { final MockOne one = new MockOne(3000); Thread r = new Thread() { @Override public void run() { delay(1000); one.callMeFirst(14); one.callMeSecond("dummy"); } }; String[] evts = new String[] { MockOne.SECOND, MockOne.FIRST }; try { r.run(); one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } } public void testLeftOverEventFails() { MockOne one = new MockOne(3000); one.callMeFirst(234); one.callMeSecond("dummy"); one.callMeFirst(43); String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; try { one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } } public void testExceptionThrown() { MockOne one = new MockOne(3000); RuntimeException e = new IllegalStateException("Test for robustness"); one.addThrowException(MockOne.FIRST, e); try { one.callMeFirst(324); fail("Should have thrown exception"); } catch(IllegalStateException e2) {} one.callMeSecond("dummy"); String[] methods = new String[] {MockOne.FIRST, MockOne.SECOND }; one.expectOrderedCalls(methods); } private void delay(int time) { try { Thread.sleep(time); } catch (InterruptedException e) { throw new RuntimeException("Sleep ended abrubtly"); } } public static void main(String[] args) { TestSuite suite = new TestSuite(); suite.addTest(new TestOrderedCalls("testExceptionThrown")); // suite.addTest(new TestMockSuperclass("testMockCreator")); // suite.addTest(new TestMockSuperclass("testMockCreatorFail")); // suite.addTest(new TestMockSuperclass("testMockCreatorCreatesCar")); // suite.addTest(new TestMockSuperclass("testThrowCheckedException")); TestRunner.run(suite); } } |
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/lib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/findbugs/lib Added Files: buggy.icns findbugsGUI.jar findbugs-ant.jar findbugs.jar dom4j-full.jar annotations.jar bcel.jar Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: findbugs.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: findbugs-ant.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: buggy.icns --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bcel.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: findbugsGUI.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dom4j-full.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: annotations.jar --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/listener In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/input/javasrc/biz/xsoftware/examples/listener Added Files: LegacySystemListener.java package.html TestExample.java LegacySystem.java SysUnderTest.java Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: package.html --- <HTML> <BODY> Examples which mock out listeners to test for events under the correct circumstances. </BODY> </HTML> --- NEW FILE: TestExample.java --- /* * Created on Jun 28, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.listener; import junit.framework.TestCase; import biz.xsoftware.mock.MockObjectFactory; import biz.xsoftware.mock.MockObject; /** * JUnit Suite of TestCases for demonstrating mocking out listeners to * test for events under certain circumstances. * * @author Dean Hiller */ public class TestExample extends TestCase { private MockObject mockLegacy; private MockObject mockListener1; private MockObject mockListener2; private SysUnderTest sysUnderTest; private LegacySystemListener legacyListener; /** * @showcode */ public TestExample(String name) { super(name); } /** * @showcode */ @Override public void setUp() { mockLegacy = MockObjectFactory.createMock(LegacySystem.class); mockListener1 = MockObjectFactory.createMock(LegacySystemListener.class); mockListener2 = MockObjectFactory.createMock(LegacySystemListener.class); sysUnderTest = new SysUnderTest((LegacySystem)mockLegacy); Object[] params = mockLegacy.expect("setLegacyListener").getAllParams(); legacyListener = (LegacySystemListener)params[0]; } @Override public void tearDown() { } /** * Tests that when the legacy system fires and event to it's only * legacy listener, all listeners on the sysUnderTest that were added * receive the event. No matter what the threading model, this test * will pass since expect call will wait until the event happens. If * the event never happens, the expectCall will timeout and throw an * ExpectFailedException claiming it never got the event. * * @showcode * @see SysUnderTest#addLegacyListener * @see LegacySystemListener#legacyEventOccurred */ public void testBasicListener() { sysUnderTest.addLegacyListener((LegacySystemListener)mockListener1); sysUnderTest.addLegacyListener((LegacySystemListener)mockListener2); //have legacy system fire event to it's one and only listener legacyListener.legacyEventOccurred(5); mockListener1.expect("legacyEventOccurred"); mockListener2.expect("legacyEventOccurred"); } } --- NEW FILE: LegacySystemListener.java --- /* * Created on Jul 3, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.listener; import java.util.EventListener; /** * Listener interface that listens for legacy events. * * @author Dean Hiller */ public interface LegacySystemListener extends EventListener { public void legacyEventOccurred(int i); } --- NEW FILE: SysUnderTest.java --- /* * Created on Jul 3, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.listener; import javax.swing.event.EventListenerList; /** * The SysUnderTest here is an adapter to a legacy system. The SysUnderTest * might be on a different thread or the same thread. For events from * a legacy system, the SysUnderTest alot of the time may be on a different * thread listening on some socket to the legacy system. * * @author Dean Hiller */ public class SysUnderTest { private EventListenerList listenerList = new EventListenerList(); private LegacySystem legacySys; public SysUnderTest(LegacySystem sys) { legacySys = sys; legacySys.setLegacyListener(new LegacyListener()); } private class LegacyListener implements LegacySystemListener { public void legacyEventOccurred(int i) { fireLegacyEvent(i); } } public void addLegacyListener(LegacySystemListener l) { listenerList.add(LegacySystemListener.class, l); } public void removeLegacyListener(LegacySystemListener l) { listenerList.remove(LegacySystemListener.class, l); } protected void fireLegacyEvent(int num) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==LegacySystemListener.class) { // Lazily create the event: ((LegacySystemListener)listeners[i+1]).legacyEventOccurred(num); } } } } --- NEW FILE: LegacySystem.java --- /* * Created on Jul 3, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.examples.listener; /** * Interface to what would normally be a real LegacySystemAdapter. * @author Dean Hiller */ public interface LegacySystem { /** * @param listener */ void setLegacyListener(LegacySystemListener listener); } |
From: Nobody <fas...@us...> - 2006-09-10 18:20:47
|
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/doc/manual In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24474/tools/findbugs/doc/manual Log Message: Directory /cvsroot/mocklib/mocklib3/tools/findbugs/doc/manual added to the repository |
From: Nobody <fas...@us...> - 2006-09-10 18:20:47
|
Update of /cvsroot/mocklib/mocklib3/tools/findbugs/src/xsl In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24474/tools/findbugs/src/xsl Log Message: Directory /cvsroot/mocklib/mocklib3/tools/findbugs/src/xsl added to the repository |