mocklib-checkins Mailing List for mocklib (Page 11)
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 22:35:27
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32615/input/javasrc/biz/xsoftware/mock/impl Modified Files: ThrowException.java MethodVerifier.java BehaviorInfo.java MessageHelper.java MockSuperclass.java ReturnValue.java Action.java Added Files: MockObjectFactoryImpl.java GenericAction.java Log Message: mocklib3 should be about complete. probably some tweaks it could use later. Index: ReturnValue.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/ReturnValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReturnValue.java 10 Sep 2006 20:45:05 -0000 1.1 --- ReturnValue.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 1,5 **** package biz.xsoftware.mock.impl; ! public class ReturnValue implements Action { private Object retVal; --- 1,5 ---- package biz.xsoftware.mock.impl; ! public class ReturnValue extends GenericAction implements Action { private Object retVal; *************** *** 9,13 **** } ! public Object execute() { return retVal; } --- 9,13 ---- } ! public Object execute(Object[] args) { return retVal; } --- NEW FILE: GenericAction.java --- package biz.xsoftware.mock.impl; import java.lang.reflect.Method; public class GenericAction { private Method method; public Method getMethod() { return method; } public void setMethod(Method method) { this.method = method; } } Index: ThrowException.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/ThrowException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThrowException.java 10 Sep 2006 20:45:05 -0000 1.1 --- ThrowException.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 1,5 **** package biz.xsoftware.mock.impl; ! public class ThrowException implements Action { private Throwable e; --- 1,5 ---- package biz.xsoftware.mock.impl; ! public class ThrowException extends GenericAction implements Action { private Throwable e; *************** *** 9,13 **** } ! public Object execute() throws Throwable { e.fillInStackTrace(); throw e; --- 9,13 ---- } ! public Object execute(Object[] args) throws Throwable { e.fillInStackTrace(); throw e; Index: BehaviorInfo.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/BehaviorInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BehaviorInfo.java 10 Sep 2006 20:45:05 -0000 1.1 --- BehaviorInfo.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 1,21 **** package biz.xsoftware.mock.impl; import biz.xsoftware.mock.Behavior; ! public class BehaviorInfo implements Action { public BehaviorInfo(Behavior behavior) { ! // TODO Auto-generated constructor stub } ! public Object execute() throws Throwable { ! // TODO Auto-generated method stub ! return null; } ! public Object[] runClonerMethod() { ! // TODO Auto-generated method stub ! return null; } } --- 1,32 ---- package biz.xsoftware.mock.impl; + import java.lang.reflect.Method; + import biz.xsoftware.mock.Behavior; ! public class BehaviorInfo extends GenericAction implements Action { ! ! private Behavior behavior; ! private Method behaviorMethod; ! private Method clonerMethod; public BehaviorInfo(Behavior behavior) { ! this.behavior = behavior; } ! public Object execute(Object[] args) throws Throwable { ! return behaviorMethod.invoke(behavior, args); } ! public Object[] runClonerMethod(Object[] args) throws Throwable { ! return (Object[])clonerMethod.invoke(behavior, args); ! } ! ! public void setBehaviorMethod(Method behaviorMethod) { ! this.behaviorMethod = behaviorMethod; } + public void setClonerMethod(Method clonerMethod) { + this.clonerMethod = clonerMethod; + } } --- NEW FILE: MockObjectFactoryImpl.java --- package biz.xsoftware.mock.impl; import java.lang.reflect.Proxy; import biz.xsoftware.mock.MockObject; import biz.xsoftware.mock.MockObjectFactory; public class MockObjectFactoryImpl extends MockObjectFactory { public MockObject createMockImpl(String id, Class[] interfaces) { Class[] interfacesPlusMock = new Class[interfaces.length+1]; interfacesPlusMock[0] = MockObject.class; for(int i = 1; i < interfacesPlusMock.length; i++) { interfacesPlusMock[i] = interfaces[i-1]; } ClassLoader cl = MockObjectFactory.class.getClassLoader(); MockObjectImpl impl = new MockObjectImpl(id, interfaces); Object o = Proxy.newProxyInstance(cl, interfacesPlusMock, impl); MockObject m = (MockObject)o; return m; } } Index: Action.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/Action.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Action.java 10 Sep 2006 20:45:05 -0000 1.1 --- Action.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 1,6 **** package biz.xsoftware.mock.impl; public interface Action { ! public Object execute() throws Throwable; } --- 1,11 ---- package biz.xsoftware.mock.impl; + import java.lang.reflect.Method; + public interface Action { ! public Object execute(Object[] args) throws Throwable; ! ! public void setMethod(Method m); ! public Method getMethod(); } Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/MockSuperclass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockSuperclass.java 10 Sep 2006 20:50:19 -0000 1.2 --- MockSuperclass.java 10 Sep 2006 22:35:21 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- package biz.xsoftware.mock.impl; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; *************** *** 230,234 **** if(action != null) ! return action.execute(); return null; --- 231,235 ---- if(action != null) ! return action.execute(params); return null; *************** *** 513,518 **** if(behavior == null) throw new IllegalArgumentException("behavior parameter cannot be null"); ! Action action = new BehaviorInfo(behavior); addToActionList(action, method, argTypes); } --- 514,548 ---- if(behavior == null) throw new IllegalArgumentException("behavior parameter cannot be null"); ! BehaviorInfo action = new BehaviorInfo(behavior); addToActionList(action, method, argTypes); + + Method m = action.getMethod(); + //verify behavior has correct methods + Class clazz = behavior.getClass(); + try { + Method behaviorMethod = clazz.getMethod(m.getName(), (Class[])m.getParameterTypes()); + action.setBehaviorMethod(behaviorMethod); + behaviorMethod.setAccessible(true); + } catch (SecurityException e) { + throw new RuntimeException("Your Behavior class seems to be too secure. " + + "I can't reflect on it and call getClass on it's class object"); + } catch (NoSuchMethodException e) { + String methodSig = MessageHelper.getMethodSignature(m, ""); + throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); + } + + try { + Method clonerMethod = clazz.getMethod(m.getName()+"Cloner", (Class[])m.getParameterTypes()); + action.setClonerMethod(clonerMethod); + if(!Object[].class.isAssignableFrom(clonerMethod.getReturnType())) + throw new IllegalArgumentException("Method="+clonerMethod+" does not return Object[] which it must do"); + clonerMethod.setAccessible(true); + } catch (SecurityException e) { + throw new RuntimeException("Your Behavior class seems to be too secure. " + + "I can't reflect on it and call getClass on it's class object"); + } catch (NoSuchMethodException e) { + String methodSig = MessageHelper.getMethodSignature(m, "Cloner"); + throw new IllegalArgumentException("You Behavior class is missing the method='"+methodSig); + } } *************** *** 536,540 **** private void addToActionList(Action action, String method, Class... argTypes) { ! checkMethod(method, argTypes); List<Action> l = methodToReturnVal.get(method); if(l == null) { --- 566,571 ---- private void addToActionList(Action action, String method, Class... argTypes) { ! Method m = checkMethod(method, argTypes); ! action.setMethod(m); List<Action> l = methodToReturnVal.get(method); if(l == null) { *************** *** 553,558 **** * @param o * @return */ ! private Object[] clone(String method, Object[] params) { if(params == null) return null; --- 584,590 ---- * @param o * @return + * @throws Throwable */ ! private Object[] clone(String method, Object[] params) throws Throwable { if(params == null) return null; *************** *** 569,573 **** if(action instanceof BehaviorInfo) { BehaviorInfo behavior = (BehaviorInfo)action; ! return behavior.runClonerMethod(); } --- 601,605 ---- if(action instanceof BehaviorInfo) { BehaviorInfo behavior = (BehaviorInfo)action; ! return behavior.runClonerMethod(params); } *************** *** 581,590 **** private void verifyMethodsExist(String[] methods) { for(int i = 0; i < methods.length; i++) { ! MethodVerifier.verifyMethod(getClasses(), false, methods[i]); } } ! private void checkMethod(String method, Class[] argTypes) { ! MethodVerifier.verifyMethod(getClasses(), true, method, argTypes); } } --- 613,622 ---- private void verifyMethodsExist(String[] methods) { for(int i = 0; i < methods.length; i++) { ! MethodVerifier.getMethod(getClasses(), false, methods[i]); } } ! private Method checkMethod(String method, Class[] argTypes) { ! return MethodVerifier.getMethod(getClasses(), true, method, argTypes); } } Index: MethodVerifier.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/MethodVerifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MethodVerifier.java 10 Sep 2006 20:45:05 -0000 1.1 --- MethodVerifier.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 7,12 **** import biz.xsoftware.mock.MockObject; ! public class MethodVerifier { ! private final static Logger log = Logger.getLogger(MethodVerifier.class.getName()); private static boolean paramsMatch(Method method, Class[] argTypes) { --- 7,14 ---- import biz.xsoftware.mock.MockObject; ! public final class MethodVerifier { ! private static final Logger log = Logger.getLogger(MethodVerifier.class.getName()); ! ! private MethodVerifier() {} private static boolean paramsMatch(Method method, Class[] argTypes) { *************** *** 36,40 **** } ! private static boolean methodExistInThisClass(Class c, boolean isVerifyArgs, String method, Class... argTypes) { Method[] methods = c.getMethods(); for(int i = 0; i < methods.length; i++) { --- 38,42 ---- } ! private static Method methodExistInThisClass(Class c, boolean isVerifyArgs, String method, Class... argTypes) { Method[] methods = c.getMethods(); for(int i = 0; i < methods.length; i++) { *************** *** 43,64 **** if(method.equals(methods[i].getName())) { if(!isVerifyArgs) ! return true; else if(paramsNotNeedMatch(c, methods[i])) ! return true; else if(paramsMatch(methods[i], argTypes)) ! return true; } } ! return false; } ! static void verifyMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); else if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) ! return; else if(classes == null) ! return; String classNames = ""; --- 45,66 ---- if(method.equals(methods[i].getName())) { if(!isVerifyArgs) ! return methods[i]; else if(paramsNotNeedMatch(c, methods[i])) ! return methods[i]; else if(paramsMatch(methods[i], argTypes)) ! return methods[i]; } } ! return null; } ! static Method getMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); else if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) ! return null; else if(classes == null) ! return null; String classNames = ""; *************** *** 66,71 **** if(log.isLoggable(Level.FINEST)) log.finest("class="+classes[i].getName()); ! if(methodExistInThisClass(classes[i], isVerifyArgs, method, argTypes)) ! return; classNames += "\n"+classes[i]; } --- 68,74 ---- if(log.isLoggable(Level.FINEST)) log.finest("class="+classes[i].getName()); ! Method m = methodExistInThisClass(classes[i], isVerifyArgs, method, argTypes); ! if(m != null) ! return m; classNames += "\n"+classes[i]; } Index: MessageHelper.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/MessageHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MessageHelper.java 10 Sep 2006 20:45:05 -0000 1.1 --- MessageHelper.java 10 Sep 2006 22:35:21 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- import java.io.PrintWriter; import java.io.StringWriter; + import java.lang.reflect.Method; import java.util.List; import java.util.Set; *************** *** 12,15 **** --- 13,24 ---- private MessageHelper() {} + public static String getMethodSignature(Method method, String postfix) { + String methodSig = "public "+method.getReturnType()+" "+method.getName()+postfix+"("; + for(Class c : method.getParameterTypes()) { + methodSig += c.getName()+", "; + } + return methodSig.substring(0, methodSig.length()-2)+")"; + } + public static String putTogetherReason(String[] methods, Set<String> ignorables, List methodsCalled, String lastLine) { String reason = "\nMethods you expected...\n"; |
From: Nobody <fas...@us...> - 2006-09-10 22:35:26
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32615/input/javasrc/biz/xsoftware/test/mock Removed Files: TestOrderedCalls.java MockOne.java Log Message: mocklib3 should be about complete. probably some tweaks it could use later. --- MockOne.java DELETED --- --- TestOrderedCalls.java DELETED --- |
From: Nobody <fas...@us...> - 2006-09-10 22:35:26
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32615/input/javasrc/biz/xsoftware/mock Modified Files: MockObjectFactory.java Log Message: mocklib3 should be about complete. probably some tweaks it could use later. Index: MockObjectFactory.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObjectFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockObjectFactory.java 10 Sep 2006 20:45:04 -0000 1.2 --- MockObjectFactory.java 10 Sep 2006 22:35:21 -0000 1.3 *************** *** 7,13 **** package biz.xsoftware.mock; - import java.lang.reflect.Proxy; - - import biz.xsoftware.mock.impl.MockObjectImpl; /** --- 7,10 ---- *************** *** 18,22 **** public abstract class MockObjectFactory { ! private MockObjectFactory() {} /** --- 15,21 ---- public abstract class MockObjectFactory { ! private static MockObjectFactory factory; ! ! protected MockObjectFactory() {} /** *************** *** 103,119 **** * cases can call expect event on. */ ! public static MockObject createMock(String id, Class[] interfaces) { ! Class[] interfacesPlusMock = new Class[interfaces.length+1]; ! interfacesPlusMock[0] = MockObject.class; ! for(int i = 1; i < interfacesPlusMock.length; i++) { ! interfacesPlusMock[i] = interfaces[i-1]; } - - ClassLoader cl = MockObjectFactory.class.getClassLoader(); - MockObjectImpl impl = new MockObjectImpl(id, interfaces); - Object o = Proxy.newProxyInstance(cl, interfacesPlusMock, impl); - MockObject m = (MockObject)o; - return m; } } --- 102,126 ---- * cases can call expect event on. */ ! public static synchronized MockObject createMock(String id, Class[] interfaces) { ! if(factory == null) { ! loadFactory(); ! } ! return factory.createMockImpl(id, interfaces); ! } ! ! private static void loadFactory() { ! String className = "biz.xsoftware.mock.impl.MockObjectFactoryImpl"; ! try { ! Class<?> clazz = Class.forName(className); ! factory = (MockObjectFactory) clazz.newInstance(); ! } catch (ClassNotFoundException e) { ! throw new RuntimeException(e); ! } catch (InstantiationException e) { ! throw new RuntimeException(e); ! } catch (IllegalAccessException e) { ! throw new RuntimeException(e); } } + public abstract MockObject createMockImpl(String id, Class[] interfaces); } |
From: Nobody <fas...@us...> - 2006-09-10 22:35:26
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/test In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32615/input/javasrc/biz/xsoftware/mock/impl/test Added Files: ListenerOne.java MockOne.java TestOrderedCalls.java Log Message: mocklib3 should be about complete. probably some tweaks it could use later. --- 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.mock.impl.test; 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: 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.mock.impl.test; import biz.xsoftware.mock.impl.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: 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.mock.impl.test; 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.expect(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.expect(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.expect(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.expect(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.expect(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.expect(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.expect(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(e, MockOne.FIRST); try { one.callMeFirst(324); fail("Should have thrown exception"); } catch(IllegalStateException e2) {} one.callMeSecond("dummy"); String[] methods = new String[] {MockOne.FIRST, MockOne.SECOND }; one.expect(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); } } |
From: Nobody <fas...@us...> - 2006-09-10 22:35:19
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/test In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32606/input/javasrc/biz/xsoftware/mock/impl/test Log Message: Directory /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/test added to the repository |
From: Nobody <fas...@us...> - 2006-09-10 20:50:22
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20893/input/javasrc/biz/xsoftware/mock/impl Modified Files: MockSuperclass.java Log Message: fix everything but behavior. Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl/MockSuperclass.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockSuperclass.java 10 Sep 2006 20:45:05 -0000 1.1 --- MockSuperclass.java 10 Sep 2006 20:50:19 -0000 1.2 *************** *** 222,232 **** Action action = methodToDefaultRetVal.get(method); List<Action> l = methodToReturnVal.get(method); ! if(l != null) action = l.remove(0); ! if(l.size()<=0) ! methodToReturnVal.remove(method); ! ! return action.execute(); } --- 222,236 ---- Action action = methodToDefaultRetVal.get(method); List<Action> l = methodToReturnVal.get(method); ! if(l != null) { action = l.remove(0); + //if that was the last one in the list, remove the list... + if(l.size()<=0) + methodToReturnVal.remove(method); + } ! if(action != null) ! return action.execute(); ! ! return null; } |
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19423/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java TestOrderedCalls.java MockOne.java Added Files: MyTestBehavior.java Removed Files: OldBehavior.java TestUnorderedCalls.java Log Message: changes to implementation. --- TestUnorderedCalls.java DELETED --- Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestMockCreator.java 10 Sep 2006 18:44:06 -0000 1.3 --- TestMockCreator.java 10 Sep 2006 20:45:04 -0000 1.4 *************** *** 252,256 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new OldBehavior(), "doThat"); Identical ident = (Identical)mock; --- 252,256 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new MyTestBehavior(), "doThat"); Identical ident = (Identical)mock; --- NEW FILE: MyTestBehavior.java --- /** * */ package biz.xsoftware.test.mock; import biz.xsoftware.mock.Behavior; class MyTestBehavior implements Behavior { /** * @see biz.xsoftware.mock.Behavior#clone(java.lang.Object[]) */ public Object[] doThatCloner(byte[] bytes) { byte[] newBytes = new byte[bytes.length]; for(int i = 0; i < newBytes.length; i++) { newBytes[i] = bytes[i]; } return new Object[] {newBytes}; } /** * @see biz.xsoftware.mock.Behavior#runMethod(java.lang.Object[]) */ public byte[] doThat(byte[] bytes) { //we know the test does an 4 byte array, so do that 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; } } --- OldBehavior.java DELETED --- Index: MockOne.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/MockOne.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockOne.java 10 Sep 2006 18:25:48 -0000 1.1 --- MockOne.java 10 Sep 2006 20:45:04 -0000 1.2 *************** *** 7,11 **** package biz.xsoftware.test.mock; ! import biz.xsoftware.mock.MockSuperclass; /** --- 7,11 ---- package biz.xsoftware.test.mock; ! import biz.xsoftware.mock.impl.MockSuperclass; /** Index: TestOrderedCalls.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestOrderedCalls.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestOrderedCalls.java 10 Sep 2006 18:44:06 -0000 1.3 --- TestOrderedCalls.java 10 Sep 2006 20:45:04 -0000 1.4 *************** *** 32,36 **** MockOne one = new MockOne(3000); one.callMeFirst(4); ! one.expectCall(MockOne.FIRST); } --- 32,36 ---- MockOne one = new MockOne(3000); one.callMeFirst(4); ! one.expect(MockOne.FIRST); } *************** *** 45,49 **** }; r.start(); ! one.expectCall(MockOne.FIRST); } --- 45,49 ---- }; r.start(); ! one.expect(MockOne.FIRST); } *************** *** 54,58 **** String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; ! one.expectOrderedCalls(evts); } --- 54,58 ---- String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; ! one.expect(evts); } *************** *** 70,74 **** String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; ! one.expectOrderedCalls(evts); } --- 70,74 ---- String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; ! one.expect(evts); } *************** *** 80,84 **** String[] evts = new String[] { MockOne.SECOND, MockOne.FIRST }; try { ! one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } --- 80,84 ---- String[] evts = new String[] { MockOne.SECOND, MockOne.FIRST }; try { ! one.expect(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } *************** *** 98,102 **** try { r.run(); ! one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } --- 98,102 ---- try { r.run(); ! one.expect(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } *************** *** 111,115 **** String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; try { ! one.expectOrderedCalls(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } --- 111,115 ---- String[] evts = new String[] { MockOne.FIRST, MockOne.SECOND }; try { ! one.expect(evts); fail("Should have failed this test case"); } catch(ExpectFailedException e) { /*gulp*/ } *************** *** 129,133 **** one.callMeSecond("dummy"); String[] methods = new String[] {MockOne.FIRST, MockOne.SECOND }; ! one.expectOrderedCalls(methods); } --- 129,133 ---- one.callMeSecond("dummy"); String[] methods = new String[] {MockOne.FIRST, MockOne.SECOND }; ! one.expect(methods); } |
From: Nobody <fas...@us...> - 2006-09-10 20:45:10
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19423/input/javasrc/biz/xsoftware/mock/impl Added Files: ThrowException.java MethodVerifier.java MockObjectImpl.java BehaviorInfo.java MessageHelper.java MockSuperclass.java ReturnValue.java Action.java Log Message: changes to implementation. --- NEW FILE: ReturnValue.java --- package biz.xsoftware.mock.impl; public class ReturnValue implements Action { private Object retVal; public ReturnValue(Object retVal) { this.retVal = retVal; } public Object execute() { return retVal; } } --- NEW FILE: ThrowException.java --- package biz.xsoftware.mock.impl; public class ThrowException implements Action { private Throwable e; public ThrowException(Throwable e) { this.e = e; } public Object execute() throws Throwable { e.fillInStackTrace(); throw e; } } --- NEW FILE: BehaviorInfo.java --- package biz.xsoftware.mock.impl; import biz.xsoftware.mock.Behavior; public class BehaviorInfo implements Action { public BehaviorInfo(Behavior behavior) { // TODO Auto-generated constructor stub } public Object execute() throws Throwable { // TODO Auto-generated method stub return null; } public Object[] runClonerMethod() { // TODO Auto-generated method stub return null; } } --- NEW FILE: Action.java --- package biz.xsoftware.mock.impl; public interface Action { public Object execute() throws Throwable; } --- NEW FILE: MockSuperclass.java --- package biz.xsoftware.mock.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import biz.xsoftware.mock.Behavior; import biz.xsoftware.mock.CalledMethod; import biz.xsoftware.mock.ExpectFailedException; import biz.xsoftware.mock.MockObject; /** * This is a super class for mock Objects. It has the following options * <ol> * <li>Guarantee order of events and that events happen on one object</li> * <li>Guarantee events called with order not mattering on one object</li> * <li>Guarantee order of events is correct between two objects(One mock obj. implements two interfaces)</li> * </ol> * This class will also return the parameters that were passed into the MockObject * so they can be introspected in testing to make sure they were correct. * * The MockObject extending this class can also be told to throw exceptions on certain * methods so we can test error leg behavior. * * Example of how to use * MockActionListener implements ActionListener and extends this class * The only method in MockActionListener * is * <PRE> * public final static ACTION_METHOD = "actionPerformed method"; * public void actionPerformed(ActionEvent evt) { * super.methodCalled(ACTION_METHOD, evt); * } * </PRE> * * In the test, when you expect an ActionEvent, you can call * <PRE> * Object o = MockActionListener.expectEvent(ACTION_METHOD); * ActionEvent evt = (ActionEvent)evt; * assertNonNull(evt.getSource()); * </PRE> * * Another useful behavior is throwing any type of exception using * setExceptionOnMethod(String method, Throwable e). This can test * robustness in a system to make sure listeners or services that * throw exceptions don't affect your system, or at least affect * your system in the proper way. * * @author Dean Hiller (de...@xs...) */ public abstract class MockSuperclass implements MockObject { private static final Logger log = Logger.getLogger(MockSuperclass.class.getName()); /** * List of the current methods that have been called. */ private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>(); /** * A map of queues, containing either * 1. objects to return when methods are called * 2. Behaviors to run which return objects to return * 3. Exceptions to throw */ private Map<String, List<Action>> methodToReturnVal = new HashMap<String, List<Action>>(); /** * A map of default return values, which are used to return if the * queue for the method is empty. */ private Map<String, Action> methodToDefaultRetVal = new HashMap<String, Action>(); private List<String> ignoredMethods = new ArrayList<String>(); /** * Default wait time to wait for a method to be called once expectCall is * called. */ public static final int DEFAULT_WAIT_TIME = 10000; private int waitTime = DEFAULT_WAIT_TIME; private String id; /** * Default constructor of superclass of all mockObjects with a delay of * 10 seconds. This delay is the amount of time the mock object waits for * a method to be called when a client calls expectCall. */ public MockSuperclass() { } /** * The constructor to use to override the default delay({@link #DEFAULT_WAIT_TIME}) * such that the mock object will give methods a longer time to be called * before timing out to fail the test. * * @param delay The amount of time in milliseconds to wait for a method to be * called. */ public MockSuperclass(int delay) { waitTime = delay; } public MockSuperclass(String id) { this.id = id; } public void setExpectTimeout(int delay) { this.waitTime = delay; } public int getExpectTimeout() { return waitTime; } public void addIgnoredMethod(String method, Class ... argTypes) { ignoreImpl(method); } public void removeIgnoredMethod(String method, Class ... argTypes) { removeIgnoreImpl(method); } private void removeIgnoreImpl(String ... methods) { for(String method : methods) { ignoredMethods.remove(method); } } private void ignoreImpl(String ... methods) { addIgnoredMethods(methods); } public void addIgnoredMethods(String[] methods) { if(methods == null) return; verifyMethodsExist(methods); for(String method : methods) { ignoredMethods.add(method); } } public void setIgnoredMethods(String[] methods) { if(methods == null) return; ignoredMethods = new ArrayList<String>(); verifyMethodsExist(methods); for(String method : methods) { ignoredMethods.add(method); } } /** * Subclasses should call this method when a method on their interface * is called. This method is for users to create subclasses and call so * they don't have to wrap it in a try-catch block. * * @param method * @param parameters * @return whatever the client has specified using addReturnValue */ protected Object methodCalled(String method, Object parameters) { try { if(!(parameters instanceof Object[])) { parameters = new Object[] {parameters}; } return methodCalledImpl(method, (Object[])parameters); } catch (Throwable e) { if(e instanceof RuntimeException) throw (RuntimeException)e; throw new RuntimeException("Sorry, must wrap exception, unwrap in " + "your mockobject, or have mockObject call methodCalledImpl instead", e); } } protected synchronized Object methodCalledImpl(String method, Object[] parameters) throws Throwable { method = method.intern(); String params = ""; if(parameters == null) { params = "no params"; } else { Object[] array = parameters; for(int i = 0; i < array.length-1; i++) { params += array[i]+", "; } params += array[array.length-1]; } if (log.isLoggable(Level.FINE)) log.log(Level.FINE, id+"method called="+method+"("+params+") on obj="+this); //sometimes, the contract is for the "code" to give a parameter //to a library and then modify the parameter after the library //is done with it. This means the object the "code" gave to //the MockObject will change out from under the MockObject and be //corrupted meaning you can't write a test to test the contract //without cloning the object so it can't be changed. Object[] newParams = clone(method, parameters); methodsCalled.add(new CalledMethod(method, newParams, new Throwable().fillInStackTrace())); this.notifyAll(); return findNextAction(method, parameters); } private Object findNextAction(String method, Object[] params) throws Throwable { Action action = methodToDefaultRetVal.get(method); List<Action> l = methodToReturnVal.get(method); if(l != null) action = l.remove(0); if(l.size()<=0) methodToReturnVal.remove(method); return action.execute(); } // /** // * @see biz.xsoftware.mock.MockObject#expectUnorderedCalls(java.lang.String[]) // */ // public synchronized CalledMethod[] expectUnorderedCalls(String[] methods) { // if(methods == null) // throw new IllegalArgumentException("methods cannot be null"); // else if(methods.length <= 0) // throw new IllegalArgumentException("methods.length must be >= 1"); // for(int i = 0; i < methods.length; i++) { // if(methods[i] == null) // throw new IllegalArgumentException("None of values in methods " + // "can be null, yet methods["+i+"] was null"); // } // // Map<String, Integer> expectedMethods = new HashMap<String, Integer>(); // for(int i = 0; i < methods.length; i++) { // expectedMethods.put(methods[i], new Integer(i)); // } // // Set<String> ignorables = createIgnorableMap(ignoredMethods); // CalledMethod[] retVal = new CalledMethod[methods.length]; // // List<CalledMethod> methodsCalledList = new ArrayList<CalledMethod>(); // for(int i = 0; i < methods.length; i++) { // if(ANY.equals(methods[i])) // throw new IllegalArgumentException("The parameter 'methods' in " + // "expectUnorderedCalls cannot contain MockSuperclass.ANY(use expectOrderedCalls instead)"); // // CalledMethod o = expectUnignoredCall(ANY, ignorables, methodsCalledList); // if(o == null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, // "timed out on next expected method\n"); // throw new ExpectFailedException("Timed out waiting for a method call\n" // +reason, retVal, ExpectFailedException.TIMED_OUT); // } // Integer index = expectedMethods.remove(o.getMethodName()); // if(index == null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, null); // throw new ExpectFailedException(reason, retVal, ExpectFailedException.UNEXPECTED_CALL_BEFORE); // } // // retVal[index.intValue()] = o; // } // // LeftOverMethods leftOver = getLeftOverMethods(ignorables); // if(leftOver != null) { // String reason = putTogetherReason(methods, ignorables, methodsCalledList, "extra method(s)="+leftOver+"\n"); // throw new ExpectFailedException("There was a method called after your expected methods.\n"+reason, retVal // , ExpectFailedException.UNEXPECTED_CALL_AFTER); // } // // return retVal; // } private CalledMethod[] cleanup(CalledMethod[] methods, int size) { CalledMethod[] retVal = new CalledMethod[size]; for(int i = 0; i < retVal.length; i++) { retVal[i] = methods[i]; } return retVal; } /** * @see biz.xsoftware.mock.MockObject#expect(java.lang.String) */ public CalledMethod expect(String method) { return expectImpl(method)[0]; } /** * @see biz.xsoftware.mock.MockObject#expect(java.lang.String[]) */ public synchronized CalledMethod[] expect(String ... methods) { return expectImpl(methods); } /** * @see biz.xsoftware.mock.MockObject#expectOrderedCalls(java.lang.String[]) */ private synchronized CalledMethod[] expectImpl(String ... methods) { if(methods == null) throw new IllegalArgumentException("methods cannot be null"); else if(methods.length <= 0) throw new IllegalArgumentException("methods.length must be >= 1"); for(int i = 0; i < methods.length; i++) { if(methods[i] == null) throw new IllegalArgumentException("None of values in methods can be null, yet methods["+i+"] was null"); } verifyMethodsExist(methods); Set<String> ignorables = createIgnorableMap(ignoredMethods); List<CalledMethod> methodsCalledList = new ArrayList<CalledMethod>(); CalledMethod[] retVal = new CalledMethod[methods.length]; int i = 0; for(; i < methods.length; i++) { String method = methods[i]; CalledMethod o = null; try { o = expectUnignoredCall(method, ignorables, methodsCalledList); } catch(ExpectFailedException e) { if(!ExpectFailedException.UNEXPECTED_ON_NONE.equals(e.getReason())) { throw e; } CalledMethod[] leftOver = e.getCalledMethods(); throw new ExpectFailedException(e.getMessage(), leftOver, e.getReason()); } if(o == null) { String reason = MessageHelper.putTogetherReason(methods, ignorables, methodsCalledList, "timed out on next expected method\n"); throw new ExpectFailedException("Timed out waiting for call=" +method+"\n"+reason, cleanup(retVal, i), ExpectFailedException.TIMED_OUT); } retVal[i] = o; if(!method.equals(o.getMethodName()) && !ANY.equals(method)) { String reason = MessageHelper.putTogetherReason(methods, ignorables, methodsCalledList, null); reason += MessageHelper.getHowMethodWasCalled(o); throw new ExpectFailedException(reason, cleanup(retVal, i), null); } } LeftOverMethods leftOver = getLeftOverMethods(ignorables); if(leftOver != null) { String reason = MessageHelper.putTogetherReason(methods, ignorables, methodsCalledList, "extra method(s)="+leftOver+"\n"); reason += MessageHelper.getHowMethodWasCalled(leftOver.getMethods()[0]); CalledMethod[] calledOnes = new CalledMethod[retVal.length+1]; System.arraycopy(retVal, 0, calledOnes, 0, retVal.length); calledOnes[retVal.length] = leftOver.getMethods()[0]; throw new ExpectFailedException("There was a method called after your expected methods.\n"+reason, calledOnes , ExpectFailedException.UNEXPECTED_CALL_AFTER); } return retVal; } protected synchronized CalledMethod expectUnignoredCall(String method, Set<String> ignorables, List<CalledMethod> calledMethods) { if(method == null) method = NONE; //kind of dangerous if used with multiple threads because we might miss //a bad event coming in, but if you keep using the same listener for every test //the problem should still manifest itself in a //different test case which sucks but works. if(method.equals(NONE)) { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "method expected="+NONE+" on obj="+this); // we have to strip out all of the ignored methods from methodsCalled CalledMethod[] methods = methodsCalled.toArray(new CalledMethod[0]); for(CalledMethod calledMethod : methods) { if(ignorables.contains(calledMethod.getMethodName())) { while(methodsCalled.contains(calledMethod)) { methodsCalled.remove(calledMethod); } } } LeftOverMethods leftOver = getLeftOverMethods(ignorables); if(leftOver != null) { String reason = "You were expecting no methods to be called, but method(s) not\n" +"in the ignore list were called earlier. method(s)="+leftOver; reason += MessageHelper.getHowMethodWasCalled(leftOver.getMethods()[0]); throw new ExpectFailedException(reason, leftOver.getMethods(), ExpectFailedException.UNEXPECTED_ON_NONE); } return new CalledMethod(NONE, null, null); } try { return waitForUnignoredCall(method, ignorables, calledMethods); } catch (InterruptedException e) { throw new RuntimeException(e); } } private CalledMethod waitForUnignoredCall( String logM, Set<String> ignorables, List<CalledMethod> calledMethods) throws InterruptedException { long waitTime2 = waitTime+50; long currentTime; //only while waitTime is greater than 50 milliseconds while(waitTime2 >= 50) { //if there are no methods called yet, begin waiting if(methodsCalled.size() <= 0) { currentTime = System.currentTimeMillis(); if (log.isLoggable(Level.FINE)) log.fine("method expected(not called yet-waiting)="+logM+" on obj="+this+" wait="+waitTime2); this.wait(waitTime2); long waitedOnWait = System.currentTimeMillis() - currentTime; waitTime2 -= waitedOnWait; } //check for new methods to be called now...if no non-ignorable methods, then //continue while loop. for(int i = 0; i < methodsCalled.size(); i++) { CalledMethod calledMethod = methodsCalled.remove(0); calledMethods.add(calledMethod); if(!ignorables.contains(calledMethod.getMethodName())) { if(log.isLoggable(Level.FINE)) log.fine("method expected and was called="+logM+" on obj="+this); return calledMethod; } } } //return null means timeout.... return null; } private Set<String> createIgnorableMap(List<String> ignorableMethods) { Set<String> ignorables = new HashSet<String>(); if(ignorableMethods != null) { for(String method : ignorableMethods) { ignorables.add(method); } } return ignorables; } private LeftOverMethods getLeftOverMethods(Set<String> ignorables) { List<CalledMethod> leftOver = new ArrayList<CalledMethod>(); for(int i = 0; i < methodsCalled.size(); i++) { CalledMethod o = methodsCalled.get(i); if(!ignorables.contains(o.getMethodName()) && o != null) { leftOver.add(o); } } if(leftOver.size() <= 0) return null; CalledMethod[] m = new CalledMethod[0]; m = leftOver.toArray(m); return new LeftOverMethods(m); } private class LeftOverMethods { private CalledMethod[] leftOver; public LeftOverMethods(CalledMethod[] m) { leftOver = m; } /** */ public CalledMethod[] getMethods() { return leftOver; } @Override public String toString() { String retVal = ""; for(int i = 0; i < leftOver.length; i++) { retVal+="\n"+leftOver[i]; } return retVal; } } public void setDefaultBehavior(Behavior b, String method, Class... argTypes) { checkMethod(method, argTypes); if(b == null) throw new IllegalArgumentException("behavior parameter cannot be null"); methodToDefaultRetVal.put(method, new BehaviorInfo(b)); } public void setDefaultReturnValue(Object o, String method, Class... argTypes) { checkMethod(method, argTypes); methodToDefaultRetVal.put(method, new ReturnValue(o)); } public void addBehavior(Behavior behavior, String method, Class... argTypes) { if(behavior == null) throw new IllegalArgumentException("behavior parameter cannot be null"); Action action = new BehaviorInfo(behavior); addToActionList(action, method, argTypes); } /** * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.Throwable, java.lang.String, Class...) */ public synchronized void addThrowException(Throwable e, String method, Class... argTypes) { if(e == null) throw new IllegalArgumentException("e parameter to this method cannot be null"); Action action = new ThrowException(e); addToActionList(action, method, argTypes); } /** * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.Object, java.lang.String, Class...) */ public synchronized void addReturnValue(Object o, String method, Class... argTypes) { Action action = new ReturnValue(o); addToActionList(action, method, argTypes); } private void addToActionList(Action action, String method, Class... argTypes) { checkMethod(method, argTypes); List<Action> l = methodToReturnVal.get(method); if(l == null) { l = new ArrayList<Action>(); methodToReturnVal.put(method, l); } l.add(action); } /** * This is the method that calls the cloner to clone * objects like ByteBuffer that can change after * they are called. * * @param o * @return */ private Object[] clone(String method, Object[] params) { if(params == null) return null; Action action = methodToDefaultRetVal.get(method); //now override the default if there is an override specified... List<Action> actions = methodToReturnVal.get(method); if(actions != null) { action = actions.get(0); } //check if action is a behaviorInfo object if(action instanceof BehaviorInfo) { BehaviorInfo behavior = (BehaviorInfo)action; return behavior.runClonerMethod(); } return params; } public Class[] getClasses() { return new Class[] {this.getClass()}; } private void verifyMethodsExist(String[] methods) { for(int i = 0; i < methods.length; i++) { MethodVerifier.verifyMethod(getClasses(), false, methods[i]); } } private void checkMethod(String method, Class[] argTypes) { MethodVerifier.verifyMethod(getClasses(), true, method, argTypes); } } --- NEW FILE: MethodVerifier.java --- package biz.xsoftware.mock.impl; import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; import biz.xsoftware.mock.MockObject; public class MethodVerifier { private final static Logger log = Logger.getLogger(MethodVerifier.class.getName()); private static boolean paramsMatch(Method method, Class[] argTypes) { Class<?>[] parameterTypes = method.getParameterTypes(); if(parameterTypes.length != argTypes.length) return false; for(int i = 0; i < parameterTypes.length; i++) { if(!(parameterTypes[i].equals(argTypes[i]))) return false; } return true; } private static boolean paramsNotNeedMatch(Class c, Method method) { Method[] classMethods = c.getMethods(); int matches = 0; for(Method m : classMethods) { if(m.getName().equals(method.getName())) matches++; } if(matches == 1) return true; return false; } private static boolean methodExistInThisClass(Class c, boolean isVerifyArgs, String method, Class... argTypes) { Method[] methods = c.getMethods(); for(int i = 0; i < methods.length; i++) { if(log.isLoggable(Level.FINEST)) log.finest("method in class='"+methods[i].getName()+"' expected='"+method+"'"); if(method.equals(methods[i].getName())) { if(!isVerifyArgs) return true; else if(paramsNotNeedMatch(c, methods[i])) return true; else if(paramsMatch(methods[i], argTypes)) return true; } } return false; } static void verifyMethod(Class[] classes, boolean isVerifyArgs, String method, Class ... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); else if(MockObject.ANY.equals(method) || MockObject.NONE.equals(method)) return; else if(classes == null) return; String classNames = ""; for(int i = 0; i < classes.length; i++) { if(log.isLoggable(Level.FINEST)) log.finest("class="+classes[i].getName()); if(methodExistInThisClass(classes[i], isVerifyArgs, method, argTypes)) return; classNames += "\n"+classes[i]; } String args = ""; if(argTypes != null && argTypes.length > 0) { int i = 0; for(; i < argTypes.length-1; i++) { Class c = argTypes[i]; args += c.getName()+","; } args+=argTypes[i].getName(); } String methodSig = method+"("+args+")"; throw new IllegalArgumentException("method='"+methodSig+"' is not a public method on any of the" + "\nfollowing Classes/Interfaces"+classNames); } } --- NEW FILE: MockObjectImpl.java --- /* * Created on Jun 7, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package biz.xsoftware.mock.impl; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import biz.xsoftware.mock.MockObject; /** * @author Dean Hiller */ public class MockObjectImpl extends MockSuperclass implements InvocationHandler { private static Set<Method> isMethodInSuper = new HashSet<Method>(); private static Map<Type, Class> primitiveToClass = new HashMap<Type, Class>(); private Class[] classes; static { //reflect and find all the methods of the superclass. Class c = MockObject.class; Method[] m = c.getMethods(); for(int i = 0; i < m.length; i++) { isMethodInSuper.add(m[i]); } c = Object.class; m = c.getMethods(); for(int i = 0; i < m.length; i++) { isMethodInSuper.add(m[i]); } primitiveToClass.put(Integer.TYPE, Integer.class); primitiveToClass.put(Double.TYPE, Double.class); primitiveToClass.put(Float.TYPE, Float.class); primitiveToClass.put(Boolean.TYPE, Boolean.class); primitiveToClass.put(Character.TYPE, Character.class); primitiveToClass.put(Byte.TYPE, Byte.class); primitiveToClass.put(Short.TYPE, Short.class); primitiveToClass.put(Long.TYPE, Long.class); } public MockObjectImpl(String id, Class[] interfaces) { super(id); this.classes = interfaces; } /* (non-Javadoc) * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if(isMethodInSuper.contains(method)) return callSuperMethod(proxy, method, args); Object o = methodCalledImpl(method.getName(), args); Class returnType = method.getReturnType(); if(returnType == null) throw new RuntimeException("This is a bug or something"); String methodString = getCleanMethodString(method); if(returnType.equals(void.class)) { //The return type is void if(o != null) throw new IllegalArgumentException("You are trying to return something on a method that returns void.\n" + "Method="+methodString+" value you tried to return="+o); } else { //Return type is not void...(could be primitive or Object) if(o == null) { if(returnType.isPrimitive()) throw new IllegalArgumentException("Must call addReturnValue and " + "specify a non-null value as method="+methodString+" returns a primitive value"); } else if(returnType.isPrimitive()) { //TODO: this is not working correctly no matter what I do here..... Class primitiveClass = primitiveToClass.get(returnType); if(!primitiveClass.isInstance(o)) throw new IllegalArgumentException("You specified an incorrect return type on method\n="+methodString+"\n" +"You specified a return type of="+o.getClass() +" which needs to be or extend type="+returnType); } else if(!returnType.isInstance(o)) //if not a primitive, make sure is assignable.... throw new IllegalArgumentException("You specified an incorrect return type on method\n="+methodString+"\n" +"You specified a return type of="+o.getClass()+" which needs to be or extend type="+returnType); } return o; } /** * @param method * @return */ private String getCleanMethodString(Method method) { String retType = method.getReturnType().getName(); String methodArgs = retType+" "+method.getName()+"("; Class<?>[] parameterTypes = method.getParameterTypes(); for(int ii = 0; ii < parameterTypes.length; ii++) { Class arg = method.getParameterTypes()[ii]; methodArgs += arg.getName(); if(ii < parameterTypes.length -1) methodArgs += ", "; } return methodArgs+")"; } // private void handlePrimitiveReturns(String methodName, Object ret, Class<?> expectedReturnType) // { // Class<?>[] primitiveTypes = {Integer.TYPE, Double.TYPE, Float.TYPE, Boolean.TYPE, // Character.TYPE, Byte.TYPE, Short.TYPE, Long.TYPE}; // Object[] primitiveClasses = {Integer.class, Double.class, Float.class, Boolean.class, // Character.class, Byte.class, Short.class, Long.class}; // if(ret.getClass().isPrimitive() && expectedReturnType.isPrimitive()) // { // for(Class<?> currentType : primitiveTypes) // { // if(ret.getClass() == currentType && expectedReturnType != currentType) // { // throwTypeException(methodName, ret, ret.getClass().getName(), expectedReturnType.getName()); // } // } // } // else if(ret.getClass().isPrimitive()) // { // for(int ii = 0; ii < primitiveTypes.length; ii++) // { // if(ret.getClass() == primitiveTypes[ii] && expectedReturnType != primitiveClasses[ii]) // { // throwTypeException(methodName, ret, ret.getClass().getName(), expectedReturnType.getName()); // } // } // } // else // { // for(int ii = 0; ii < primitiveTypes.length; ii++) // { // if(expectedReturnType == primitiveTypes[ii] && ret.getClass() != primitiveClasses[ii]) // { // throwTypeException(methodName, ret, ret.getClass().getName(), expectedReturnType.getName()); // } // } // } // } // // private void throwTypeException(String methodName, Object returnValue, // String returnType, String expectedReturnType) // { // throw new RuntimeException("You specified an incorrect return type for " + // "ignored or expected method " + methodName + "()" + // "\nYou specified: \"" + returnValue + "\" of type " + // returnType + " but should have been of type " + expectedReturnType); // } /** * * @param proxy The method was invoked on this object. This is the dynamicly * created class * @param m This is the method that was invoked * @param args These are the arguments that were passed to the method * @throws Throwable */ private Object callSuperMethod(Object proxy, Method m, Object[] args) throws Throwable { try { if("equals".equals(m.getName())) return new Boolean(proxy == args[0]); else if("toString".equals(m.getName())) return ""+this; return m.invoke(this, args); } catch(InvocationTargetException e) { if(e.getCause() != null) throw e.getCause(); throw e; } } /* (non-Javadoc) * @see biz.xsoftware.mock.MockSuperclass#getClasses() */ @Override public Class[] getClasses() { return classes; } public Object inst() { // TODO Auto-generated method stub return null; } } --- NEW FILE: MessageHelper.java --- package biz.xsoftware.mock.impl; import java.io.PrintWriter; import java.io.StringWriter; import java.util.List; import java.util.Set; import biz.xsoftware.mock.CalledMethod; public final class MessageHelper { private MessageHelper() {} public static String putTogetherReason(String[] methods, Set<String> ignorables, List methodsCalled, String lastLine) { String reason = "\nMethods you expected...\n"; for(int i = 0; i < methods.length; i++) { reason += "method["+i+"]="+methods[i]+"\n"; } reason += "Methods you ignored...\n"; String[] ignored = ignorables.toArray(new String[0]); if(ignored.length <= 0) reason += "no ignored methods\n"; for(int i = 0; i < ignored.length; i++) { reason += "ignored["+i+"]="+ignored[i]+"\n"; } reason += "\nMethods that were called...\n"; for(int i = 0; i < methodsCalled.size(); i++) { if(ignorables.contains(methodsCalled.get(i))) reason += "method["+i+"](ignored)="; else reason += "method["+i+"]="; reason += methodsCalled.get(i)+"\n"; } if(lastLine == null) reason += "(possibly more but we quit after finding unexpected methods)\n"; else reason += lastLine+"\n"; return reason; } public static String getHowMethodWasCalled(CalledMethod method) { Throwable t = method.getHowItWasCalled(); String retVal = "\nThe last method was="+method.getMethodName(); retVal += "\nHere is a stack trace showing "; retVal += "you how it was called...\n"; retVal += "--------BEGIN="+method.getMethodName()+"---------------\n"; StringWriter s = new StringWriter(); PrintWriter p = new PrintWriter(s); t.printStackTrace(p); retVal += s.toString(); retVal += "--------END="+method.getMethodName() +"---------------\n"; return retVal; } } |
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19423/input/javasrc/biz/xsoftware/mock Modified Files: MockObjectFactory.java Behavior.java Removed Files: MockSuperclass.java MockObjectImpl.java Cloner.java Log Message: changes to implementation. --- Cloner.java DELETED --- Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Behavior.java 10 Sep 2006 18:44:06 -0000 1.2 --- Behavior.java 10 Sep 2006 20:45:04 -0000 1.3 *************** *** 5,9 **** /** - * Use MethodBehavior interface instead of Behavior interface */ public interface Behavior --- 5,8 ---- --- MockSuperclass.java DELETED --- --- MockObjectImpl.java DELETED --- Index: MockObjectFactory.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObjectFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockObjectFactory.java 10 Sep 2006 18:25:52 -0000 1.1 --- MockObjectFactory.java 10 Sep 2006 20:45:04 -0000 1.2 *************** *** 9,12 **** --- 9,14 ---- import java.lang.reflect.Proxy; + import biz.xsoftware.mock.impl.MockObjectImpl; + /** * The factory class used to create MockObjects from one or many interfaces. |
From: Nobody <fas...@us...> - 2006-09-10 20:45:03
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19399/input/javasrc/biz/xsoftware/mock/impl Log Message: Directory /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/impl added to the repository |
From: Nobody <fas...@us...> - 2006-09-10 18:44:21
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2219/input/javasrc/biz/xsoftware/examples/advanced Modified Files: TestExample.java Log Message: api is ready for review....implementation does not work however. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced/TestExample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestExample.java 10 Sep 2006 18:35:13 -0000 1.2 --- TestExample.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 64,69 **** //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("foo", "addTaskDone", null); ! mockRecord.addReturnValue(mockUser, "getUser", null); //have mockTaskSvc fire an event that should cause sysUnderTest --- 64,69 ---- //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("foo", "addTaskDone"); ! mockRecord.addReturnValue(mockUser, "getUser"); //have mockTaskSvc fire an event that should cause sysUnderTest |
From: Nobody <fas...@us...> - 2006-09-10 18:44:20
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2219/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java TestOrderedCalls.java Log Message: api is ready for review....implementation does not work however. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestMockCreator.java 10 Sep 2006 18:35:13 -0000 1.2 --- TestMockCreator.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 95,99 **** MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue(car, "createCar", null); //now we would normally tweak code on the subsystem which --- 95,99 ---- MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue(car, "createCar"); //now we would normally tweak code on the subsystem which *************** *** 108,112 **** public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException(new IOException("test throwing IOException"), "callMeSecond", null); ListenerOne l = (ListenerOne)mockList; --- 108,112 ---- public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException(new IOException("test throwing IOException"), "callMeSecond"); ListenerOne l = (ListenerOne)mockList; *************** *** 153,157 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat", null); Identical ident = (Identical)mock; --- 153,157 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat"); Identical ident = (Identical)mock; *************** *** 167,173 **** { MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addReturnValue(new byte[] {3}, "doThat", null); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat", null); ! mock.addReturnValue(new byte[] {5}, "doThat", null); Identical ident = (Identical)mock; --- 167,173 ---- { MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addReturnValue(new byte[] {3}, "doThat"); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat"); ! mock.addReturnValue(new byte[] {5}, "doThat"); Identical ident = (Identical)mock; *************** *** 197,201 **** FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue(new CarImpl(), "createCar", null); Car car = factory.createCar("id"); --- 197,201 ---- FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue(new CarImpl(), "createCar"); Car car = factory.createCar("id"); *************** *** 221,225 **** Car car = (Car)mock; try { ! mock.addReturnValue(new Long(56), "getWheelCount", null); car.getWheelCount(); fail("should have thrown exception"); --- 221,225 ---- Car car = (Car)mock; try { ! mock.addReturnValue(new Long(56), "getWheelCount"); car.getWheelCount(); fail("should have thrown exception"); *************** *** 243,247 **** Car car = (Car)mock; ! mock.addReturnValue(new Integer(5), "getWheelCount", null); car.getWheelCount(); --- 243,247 ---- Car car = (Car)mock; ! mock.addReturnValue(new Integer(5), "getWheelCount"); car.getWheelCount(); *************** *** 252,256 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new OldBehavior(), "doThat", null); Identical ident = (Identical)mock; --- 252,256 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new OldBehavior(), "doThat"); Identical ident = (Identical)mock; *************** *** 280,284 **** { MockObject mock = MockObjectFactory.createMock(Car.class); ! mock.addIgnore("openDoor", "closeDoor"); Car car = (Car)mock; --- 280,285 ---- { MockObject mock = MockObjectFactory.createMock(Car.class); ! mock.addIgnoredMethod("openDoor"); ! mock.addIgnoredMethod("closeDoor"); Car car = (Car)mock; *************** *** 288,292 **** mock.expect(MockObject.NONE); ! mock.removeIgnore("closeDoor"); car.closeDoor(); --- 289,293 ---- mock.expect(MockObject.NONE); ! mock.removeIgnoredMethod("closeDoor"); car.closeDoor(); Index: TestOrderedCalls.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestOrderedCalls.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestOrderedCalls.java 10 Sep 2006 18:35:13 -0000 1.2 --- TestOrderedCalls.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 120,124 **** RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(e, MockOne.FIRST, null); try { --- 120,124 ---- RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(e, MockOne.FIRST); try { |
From: Nobody <fas...@us...> - 2006-09-10 18:44:17
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2219/input/javasrc/biz/xsoftware/examples/basic Modified Files: TestExample.java Log Message: api is ready for review....implementation does not work however. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic/TestExample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestExample.java 10 Sep 2006 18:35:12 -0000 1.2 --- TestExample.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 72,76 **** */ public void testFailureOfAuthorization() { ! mockCreditSvc.addThrowException(new RuntimeException("test robustness of StoreUnderTest"), "authorize", null); String user = "user1"; --- 72,76 ---- */ public void testFailureOfAuthorization() { ! mockCreditSvc.addThrowException(new RuntimeException("test robustness of StoreUnderTest"), "authorize"); String user = "user1"; *************** *** 94,98 **** */ public void testFailureOfBuyingGiftCard() { ! mockGiftSvc.addThrowException(new RuntimeException("cause failure in subsystem"), "putMoneyOnCard", null); String user = "userXXX"; --- 94,98 ---- */ public void testFailureOfBuyingGiftCard() { ! mockGiftSvc.addThrowException(new RuntimeException("cause failure in subsystem"), "putMoneyOnCard"); String user = "userXXX"; |
From: Nobody <fas...@us...> - 2006-09-10 18:44:16
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2219/input/javasrc/biz/xsoftware/mock Modified Files: MockSuperclass.java MockObject.java Behavior.java Log Message: api is ready for review....implementation does not work however. Index: Behavior.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/Behavior.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Behavior.java 10 Sep 2006 18:25:52 -0000 1.1 --- Behavior.java 10 Sep 2006 18:44:06 -0000 1.2 *************** *** 9,23 **** public interface Behavior { - /** - * @param params - * @return - */ - public Object[] clone(Object[] params); - - /** - * @param params - */ - public Object runMethod(Object[] params); } --- 9,13 ---- Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockSuperclass.java 10 Sep 2006 18:35:12 -0000 1.2 --- MockSuperclass.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 119,142 **** } ! public void addIgnore(String method) { ignoreImpl(method); } ! public void addIgnore(String ... methods) ! { ! ignoreImpl(methods); ! } ! ! public void removeIgnore(String method) { removeIgnoreImpl(method); } - public void removeIgnore(String ... methods) - { - removeIgnoreImpl(methods); - } - private void removeIgnoreImpl(String ... methods) { --- 119,132 ---- } ! public void addIgnoredMethod(String method, Class ... argTypes) { ignoreImpl(method); } ! public void removeIgnoredMethod(String method, Class ... argTypes) { removeIgnoreImpl(method); } private void removeIgnoreImpl(String ... methods) { *************** *** 243,247 **** if(retVal instanceof Behavior) { ! return ((Behavior)retVal).runMethod(params); } else if(retVal instanceof Throwable) { Throwable t = (Throwable)retVal; --- 233,237 ---- if(retVal instanceof Behavior) { ! throw new UnsupportedOperationException("not supported yet"); } else if(retVal instanceof Throwable) { Throwable t = (Throwable)retVal; *************** *** 634,637 **** --- 624,630 ---- } + public void setDefaultBehavior(Behavior b, String method, Class... argTypes) { + methodToDefaultRetVal.put(method, b); + } public void setDefaultReturnValue(Object o, String method, Class... argTypes) { methodToDefaultRetVal.put(method, o); *************** *** 655,660 **** Object action = actions.get(0); if(action instanceof Behavior) { ! Behavior behavior = (Behavior)action; ! return behavior.clone(params); } } --- 648,653 ---- Object action = actions.get(0); if(action instanceof Behavior) { ! //Behavior behavior = (Behavior)action; ! throw new UnsupportedOperationException("not supported yet"); } } Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockObject.java 10 Sep 2006 18:35:12 -0000 1.2 --- MockObject.java 10 Sep 2006 18:44:06 -0000 1.3 *************** *** 26,39 **** public static String ANY = "'Any method'"; ! // /** ! // * Waits for one and only one method to be called. If any methods are ! // * called before or after this one(after can sometimes be caught by ! // * the MockObject when the threading is not synchronous), then ! // * this call will throw an ExpectFailedException. ! // * ! // * @param method The expected method. ! // * @return An array of params that were passed to the methods called ! // */ ! // public CalledMethod expect(String method); /** --- 26,39 ---- public static String ANY = "'Any method'"; ! /** ! * Waits for one and only one method to be called. If any methods are ! * called before or after this one(after can sometimes be caught by ! * the MockObject when the threading is not synchronous), then ! * this call will throw an ExpectFailedException. ! * ! * @param method The expected method. ! * @return An array of params that were passed to the methods called ! */ ! public CalledMethod expect(String method); //, Class ... argTypes); /** *************** *** 104,113 **** * called, it will not result in an exception. */ ! public void addIgnoredMethods(String ... methods); /** * Removes the method from the ignored methods set. */ ! public void removeIgnoredMethods(String ... method); public void setExpectTimeout(int timeout); --- 104,113 ---- * called, it will not result in an exception. */ ! public void addIgnoredMethod(String method, Class ... argTypes); /** * Removes the method from the ignored methods set. */ ! public void removeIgnoredMethod(String method, Class ... argTypes); public void setExpectTimeout(int timeout); |
From: Nobody <fas...@us...> - 2006-09-10 18:35:19
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31015/input/javasrc/biz/xsoftware/mock Modified Files: MockSuperclass.java MockObject.java Log Message: take a guess at the new mocklib3 api. Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockSuperclass.java 10 Sep 2006 18:25:51 -0000 1.1 --- MockSuperclass.java 10 Sep 2006 18:35:12 -0000 1.2 *************** *** 605,611 **** } /** ! * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.String, java.lang.Throwable) */ ! public synchronized void addThrowException(String method, Throwable e) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); --- 605,611 ---- } /** ! * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.Throwable, java.lang.String, Class...) */ ! public synchronized void addThrowException(Throwable e, String method, Class... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); *************** *** 621,627 **** /** ! * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.String, java.lang.Object) */ ! public synchronized void addReturnValue(String method, Object o) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); --- 621,627 ---- /** ! * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.Object, java.lang.String, Class...) */ ! public synchronized void addReturnValue(Object o, String method, Class... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); *************** *** 634,638 **** } ! public void setDefaultReturnValue(String method, Object o) { methodToDefaultRetVal.put(method, o); } --- 634,638 ---- } ! public void setDefaultReturnValue(Object o, String method, Class... argTypes) { methodToDefaultRetVal.put(method, o); } *************** *** 675,679 **** } ! public void addBehavior(String method, Behavior behavior) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); --- 675,679 ---- } ! public void addBehavior(Behavior behavior, String method, Class... argTypes) { if(method == null) throw new IllegalArgumentException("method parameter cannot be null"); Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockObject.java 10 Sep 2006 18:25:52 -0000 1.1 --- MockObject.java 10 Sep 2006 18:35:12 -0000 1.2 *************** *** 26,52 **** public static String ANY = "'Any method'"; ! /** ! * Waits for one and only one method to be called. If any methods are ! * called before or after this one(after can sometimes be caught by ! * the MockObject when the threading is not synchronous), then ! * this call will throw an ExpectFailedException. ! * ! * @param method The expected method. ! * @return An array of params that were passed to the methods called ! * ! * @deprecated please use expect(String method) ! */ ! public CalledMethod expectCall(String method); ! ! /** ! * Waits for one and only one method to be called. If any methods are ! * called before or after this one(after can sometimes be caught by ! * the MockObject when the threading is not synchronous), then ! * this call will throw an ExpectFailedException. ! * ! * @param method The expected method. ! * @return An array of params that were passed to the methods called ! */ ! public CalledMethod expect(String method); /** --- 26,39 ---- public static String ANY = "'Any method'"; ! // /** ! // * Waits for one and only one method to be called. If any methods are ! // * called before or after this one(after can sometimes be caught by ! // * the MockObject when the threading is not synchronous), then ! // * this call will throw an ExpectFailedException. ! // * ! // * @param method The expected method. ! // * @return An array of params that were passed to the methods called ! // */ ! // public CalledMethod expect(String method); /** *************** *** 64,93 **** /** ! * Waits for all the methods to be called. If any of the methods ! * are not called or are called out of order, this method throws ! * an exception which will fail the test case. For each method, ! * this will wait WAIT_TIME milliseconds for each method to be called. ! * If the method is not called within this period, an exception will ! * be thrown saying 'method' was not called within timeout period. ! * ! * @param methods The expected methods in the correct order. ! * @return An array or arrays of params that were passed to the methods called ! * ! * @deprecated please use expectCall(String ... methods) ! */ ! public CalledMethod[] expectOrderedCalls(String[] methods); ! ! /** ! * Expect many methods to be called irrelevant of the order in which they are ! * called. ! * ! * @param methods The methods to be called in no particular order ! * @return An array of params that were passed to the methods called. This ! * array lines up with the methods array passed in. ! * ! * @deprecated this will go away soon, unless you email me that you depend on it. */ ! public CalledMethod[] expectUnorderedCalls(String[] methods); ! /** * Add an exception to throw when a method on the mockObject is called. --- 51,63 ---- /** ! * Set the DefaultReturnValue for a 'method' ! * @param method The method ! * @param argTypes TODO */ ! public void setDefaultReturnValue(Object o, String method, Class... argTypes); ! ! ! public void setDefaultBehavior(Behavior b, String method, Class ... argTypes); ! /** * Add an exception to throw when a method on the mockObject is called. *************** *** 106,114 **** * <li> RuntimeException for Subclasses of MockSuperclass</li> * </ol> - * - * @param method The method to throw the exception on when it is called. * @param e The exception to throw on method. */ ! public void addThrowException(String method, Throwable e); /** * Add a return value to return when 'method' is called. --- 76,84 ---- * <li> RuntimeException for Subclasses of MockSuperclass</li> * </ol> * @param e The exception to throw on method. + * @param method The method to throw the exception on when it is called. + * @param argTypes TODO */ ! public void addThrowException(Throwable e, String method, Class... argTypes); /** * Add a return value to return when 'method' is called. *************** *** 121,146 **** * <br></br> * Use Integer to return int, Long for long, etc. - * - * @param method The method that when called returns first value on queue * @param o The object to return that is added to the queue */ ! public void addReturnValue(String method, Object o); ! ! /** ! * When calling expectCall, the MockObject will ignore the methods ! * in 'methods' variable so if one of the methods in this array is ! * called, it will not result in an exception. ! * ! * @deprecated please use ignore(String ... methods) ! */ ! public void setIgnoredMethods(String[] methods); ! ! ! /** ! * When calling expect, the MockObject will ignore this method, ! * so it will not result in an exception. ! */ ! public void addIgnore(String method); ! /** * When calling expect, the MockObject will ignore the methods --- 91,102 ---- * <br></br> * Use Integer to return int, Long for long, etc. * @param o The object to return that is added to the queue + * @param method The method that when called returns first value on queue + * @param argTypes TODO */ ! public void addReturnValue(Object o, String method, Class... argTypes); ! ! public void addBehavior(Behavior behavior, String string, Class... argTypes); ! /** * When calling expect, the MockObject will ignore the methods *************** *** 148,170 **** * called, it will not result in an exception. */ ! public void addIgnore(String ... methods); ! /** * Removes the method from the ignored methods set. */ ! public void removeIgnore(String method); ! ! /** ! * Removes the methods from the ignored methods set. ! */ ! public void removeIgnore(String ... methods); ! ! public void setCloner(Cloner c); ! /** ! * Set the DefaultReturnValue for a 'method' ! * @param method The method ! */ ! public void setDefaultReturnValue(String method, Object o); public void setExpectTimeout(int timeout); --- 104,113 ---- * called, it will not result in an exception. */ ! public void addIgnoredMethods(String ... methods); /** * Removes the method from the ignored methods set. */ ! public void removeIgnoredMethods(String ... method); public void setExpectTimeout(int timeout); *************** *** 172,176 **** public int getExpectTimeout(); - public void addBehavior(String string, Behavior behavior); - } --- 115,117 ---- |
From: Nobody <fas...@us...> - 2006-09-10 18:35:17
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31015/input/javasrc/biz/xsoftware/examples/advanced Modified Files: TestExample.java Log Message: take a guess at the new mocklib3 api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/advanced/TestExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestExample.java 10 Sep 2006 18:25:58 -0000 1.1 --- TestExample.java 10 Sep 2006 18:35:13 -0000 1.2 *************** *** 64,69 **** //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("addTaskDone", "foo"); ! mockRecord.addReturnValue("getUser", mockUser); //have mockTaskSvc fire an event that should cause sysUnderTest --- 64,69 ---- //that a call to getUser results from an event MockObject mockUser = MockObjectFactory.createMock(User.class); ! mockUser.addReturnValue("foo", "addTaskDone", null); ! mockRecord.addReturnValue(mockUser, "getUser", null); //have mockTaskSvc fire an event that should cause sysUnderTest |
From: Nobody <fas...@us...> - 2006-09-10 18:35:17
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31015/input/javasrc/biz/xsoftware/test/mock Modified Files: TestMockCreator.java TestOrderedCalls.java Log Message: take a guess at the new mocklib3 api. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestMockCreator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMockCreator.java 10 Sep 2006 18:25:48 -0000 1.1 --- TestMockCreator.java 10 Sep 2006 18:35:13 -0000 1.2 *************** *** 95,99 **** MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue("createCar", car); //now we would normally tweak code on the subsystem which --- 95,99 ---- MockObject car = MockObjectFactory.createMock(Car.class); ! factory.addReturnValue(car, "createCar", null); //now we would normally tweak code on the subsystem which *************** *** 108,112 **** public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException("callMeSecond", new IOException("test throwing IOException")); ListenerOne l = (ListenerOne)mockList; --- 108,112 ---- public void testThrowCheckedException() throws Exception { MockObject mockList = MockObjectFactory.createMock(ListenerOne.class); ! mockList.addThrowException(new IOException("test throwing IOException"), "callMeSecond", null); ListenerOne l = (ListenerOne)mockList; *************** *** 153,157 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue("doThat", new byte[] {4}); Identical ident = (Identical)mock; --- 153,157 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat", null); Identical ident = (Identical)mock; *************** *** 167,173 **** { 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; --- 167,173 ---- { MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addReturnValue(new byte[] {3}, "doThat", null); ! mock.setDefaultReturnValue(new byte[] {4}, "doThat", null); ! mock.addReturnValue(new byte[] {5}, "doThat", null); Identical ident = (Identical)mock; *************** *** 197,201 **** FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue("createCar", new CarImpl()); Car car = factory.createCar("id"); --- 197,201 ---- FactoryInterface factory = (FactoryInterface)mock; ! mock.addReturnValue(new CarImpl(), "createCar", null); Car car = factory.createCar("id"); *************** *** 221,225 **** Car car = (Car)mock; try { ! mock.addReturnValue("getWheelCount", new Long(56)); car.getWheelCount(); fail("should have thrown exception"); --- 221,225 ---- Car car = (Car)mock; try { ! mock.addReturnValue(new Long(56), "getWheelCount", null); car.getWheelCount(); fail("should have thrown exception"); *************** *** 243,247 **** Car car = (Car)mock; ! mock.addReturnValue("getWheelCount", new Integer(5)); car.getWheelCount(); --- 243,247 ---- Car car = (Car)mock; ! mock.addReturnValue(new Integer(5), "getWheelCount", null); car.getWheelCount(); *************** *** 252,256 **** MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior("doThat", new OldBehavior()); Identical ident = (Identical)mock; --- 252,256 ---- MockObject mock = MockObjectFactory.createMock(Identical.class); ! mock.addBehavior(new OldBehavior(), "doThat", null); Identical ident = (Identical)mock; Index: TestOrderedCalls.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/test/mock/TestOrderedCalls.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestOrderedCalls.java 10 Sep 2006 18:25:48 -0000 1.1 --- TestOrderedCalls.java 10 Sep 2006 18:35:13 -0000 1.2 *************** *** 120,124 **** RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(MockOne.FIRST, e); try { --- 120,124 ---- RuntimeException e = new IllegalStateException("Test for robustness"); ! one.addThrowException(e, MockOne.FIRST, null); try { |
From: Nobody <fas...@us...> - 2006-09-10 18:35:17
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31015/input/javasrc/biz/xsoftware/examples/basic Modified Files: TestExample.java Log Message: take a guess at the new mocklib3 api. Index: TestExample.java =================================================================== RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/basic/TestExample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestExample.java 10 Sep 2006 18:25:52 -0000 1.1 --- TestExample.java 10 Sep 2006 18:35:12 -0000 1.2 *************** *** 72,76 **** */ public void testFailureOfAuthorization() { ! mockCreditSvc.addThrowException("authorize", new RuntimeException("test robustness of StoreUnderTest")); String user = "user1"; --- 72,76 ---- */ public void testFailureOfAuthorization() { ! mockCreditSvc.addThrowException(new RuntimeException("test robustness of StoreUnderTest"), "authorize", null); String user = "user1"; *************** *** 94,98 **** */ public void testFailureOfBuyingGiftCard() { ! mockGiftSvc.addThrowException("putMoneyOnCard", new RuntimeException("cause failure in subsystem")); String user = "userXXX"; --- 94,98 ---- */ public void testFailureOfBuyingGiftCard() { ! mockGiftSvc.addThrowException(new RuntimeException("cause failure in subsystem"), "putMoneyOnCard", null); String user = "userXXX"; |
From: Nobody <fas...@us...> - 2006-09-10 18:30:16
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/socket In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29004/input/javasrc/biz/xsoftware/examples/socket Added Files: TCPSocketMock.java.bak MockServer.java.bak TesExample.java.bak SysUnderTest.java.bak OtherSubsystem.java.bak TCPSocket.java.bak TCPSocketImpl.java.bak Log Message: add files that will be used later. --- NEW FILE: MockServer.java.bak --- /* * 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.socket; import java.net.InetSocketAddress; /** * The MockServer that the SysUnderTest talks to. * * @author Dean Hiller */ public class MockServer { /** * @showcode */ public InetSocketAddress start() { return null; } /** * @showcode */ public void stop() { } /** * @showcode */ public void closeSocket() { } } --- NEW FILE: TCPSocket.java.bak --- /* * 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.socket; import java.io.IOException; import java.nio.ByteBuffer; /** * Abstraction of a Socket to allow testing. * * @author Dean Hiller */ public interface TCPSocket { public int read(ByteBuffer b) throws IOException; public int write(ByteBuffer b) throws IOException; } --- NEW FILE: TCPSocketMock.java.bak --- /* * 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.socket; import java.io.IOException; import java.nio.ByteBuffer; import biz.xsoftware.mock.MockSuperclass; /** * A mock TCPSocket. * @see TCPSocket * @author Dean Hiller */ public class TCPSocketMock extends MockSuperclass implements TCPSocket { public final static String READ_METHOD = "read method"; public final static String WRITE_METHOD = "write method"; private TCPSocketImpl socket; /** * @showcode */ public TCPSocketMock(TCPSocketImpl socket) { this.socket = socket; } /** * @showcode */ public int read(ByteBuffer b) throws IOException { //allows us to throw Exceptions like the network went down!!! methodCalled(READ_METHOD, b); return socket.read(b); } /** * @showcode */ public int write(ByteBuffer b) throws IOException { //allows us to throw Exceptions like the network went down!!! methodCalled(WRITE_METHOD, b); return socket.read(b); } /* (non-Javadoc) * @see biz.xsoftware.mock.MockSuperclass#getClasses() */ public Class[] getClasses() { return null; } public Object inst() { // TODO Auto-generated method stub return null; } } --- NEW FILE: TCPSocketImpl.java.bak --- /* * 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.socket; import java.io.IOException; import java.net.Socket; import java.nio.ByteBuffer; /** * The real implementation behind TCPSocket. * * @author Dean Hiller */ public class TCPSocketImpl implements TCPSocket { private Socket socket; /** * @showcode */ public TCPSocketImpl(Socket s) { socket = s; } /** * @see biz.xsoftware.examples.socket.TCPSocket#read(java.nio.ByteBuffer) * @showcode */ public int read(ByteBuffer b) throws IOException { return socket.getChannel().read(b); } /** * @see biz.xsoftware.examples.socket.TCPSocket#write(java.nio.ByteBuffer) * @showcode */ public int write(ByteBuffer b) throws IOException { return socket.getChannel().write(b); } } --- NEW FILE: SysUnderTest.java.bak --- /* * 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.socket; /** * SysUnderTest that uses TCPSockets to talk to a server. * * @author Dean Hiller */ public class SysUnderTest { /** * @showcode */ public SysUnderTest(TCPSocket s, OtherSubsystem mockSubsys) { } /** * @showcode */ public void sendDataToServer() { } } --- NEW FILE: TesExample.java.bak --- /* * 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.socket; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import junit.framework.TestCase; import biz.xsoftware.mock.MockObjectFactory; import biz.xsoftware.mock.MockObject; /** * JUnit Suite of TestCases for demonstrating mocking out socket * interfaces to test network failures. * * @author Dean Hiller */ public class TesExample extends TestCase { private SysUnderTest sysUnderTest; private MockObject mockSubsys; private TCPSocketMock mockSocket; private MockServer mockServer; private Socket s; /** * @showcode */ public TesExample(String name) { super(name); } /** * @showcode */ public void setUp() throws Exception { s = new Socket(); mockServer = new MockServer(); InetSocketAddress serverAddr = mockServer.start(); InetAddress localHost = InetAddress.getLocalHost(); s.bind(new InetSocketAddress(localHost, 0)); s.connect(serverAddr); TCPSocketImpl tcpSock = new TCPSocketImpl(s); mockSocket = new TCPSocketMock(tcpSock); mockSubsys = MockObjectFactory.createMock(OtherSubsystem.class); sysUnderTest = new SysUnderTest(mockSocket, (OtherSubsystem)mockSubsys); } /** * @showcode */ public void tearDown() throws IOException { mockServer.stop(); s.close(); } /** * Test that upon network problems like IOException when writing to server * that other subsystems get cleaned up properly. The simple test below * shows how this can be done and extended to more complicated network * recovery algorithms. * * @showcode */ public void testNetworkProblems() { mockSocket.addThrowException("write", new IOException("problems writing to server")); sysUnderTest.sendDataToServer(); mockSubsys.expectCall("cleanup"); } /** * Test that when the server unexpectedly closes it's socket, the system * tears down correctly on this unexpected event. * * @showcode */ public void testServerClosingSocket() { mockServer.closeSocket(); mockSubsys.expectCall("cleanup"); } } --- NEW FILE: OtherSubsystem.java.bak --- /* * 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.socket; /** * Some other subsystem. * @author Dean Hiller */ public interface OtherSubsystem { public void cleanup(); } |
From: Nobody <fas...@us...> - 2006-09-10 18:29:57
|
Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/socket In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28590/input/javasrc/biz/xsoftware/examples/socket Log Message: Directory /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/examples/socket added to the repository |
From: Nobody <fas...@us...> - 2006-09-10 18:26:09
|
Update of /cvsroot/mocklib/mocklib3/bldfiles/bak In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/bldfiles/bak Added Files: createdist.xml directories.txt release.xml ant.properties dependencies.xml Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: directories.txt --- # # NOTE: These are the properties used by build.xml and dist.xml # override them in ant.properties. Overriding them here will not # affect the build in any way. These are purely documentation here. #----------------------------------------------------------------------- # OUTPUT DIRECTORIES #----------------------------------------------------------------------- generated =output intermediate =${generated}/misc #will contain a generated manifest #any other intermediate files will go here too(none yet) build =${generated}/build #will contain all the *.class files after compile #will contain all the *.jpg files from ${properties} #will contain all the *.properties files from ${properties} #will contain all the *.gif files from ${properties} #will contain all the *.html files from ${properties} #will contain all the *.* files from ${properties} #will NOT contain *.html, *.htm, *.jpg, *.gif from ${javacode} jardist =${generated}/jardist #will contain a *.jar containing everything in ${build} dist =${generated}/dist #contains the release that gets released to the world codecov =${generated}/codecoverage #contains the code coverage reports of what the unit tests #covered codecov.temp =${generated}/codecoveragetemp #intermediate directory that contains instrumented classes to #run testall against so a code coverage report can be spit out. javadoc =${generated}/javadoc #contains the javadoc of biz.xsoftware.api junit.results =${generated}/test_results #contains junit test results staging =${generated}/staging projstaging =${generated}/staging/${name} #will contain all *.html generated by javadoc #will contain all *.html from ${javacode} directory(such as package.html) #will contain all *.jpg from ${javacode} directory #will contain all *.gif from ${javacode} directory rmi.stubs =${generated}/rmistubs #contains all Remote*.class files copied from ${build} #contains all *_stub.class files copied from ${build} #contains all *_skel.class files copied from ${build} #this directory is only created if RMI*.class exists test.area =${generated}/tests #This is sometimes created by JUnit tests to do temporary #testing. It usually gets deleted afterwards. #----------------------------------------------------------------------- # INPUT DIRECTORIES - don't change these after the project is started. #----------------------------------------------------------------------- input =input #contains all stuff that is an input into the build config =${input} #contains build.xml for the module, and any other build scripts #plus build property files javacode =${input}/javasrc #Contains all *.java source files #Contains all *.html files needed by javadoc #Contains all *.jpg files needed by javadoc #Contains all *.gif files needed by javadoc #Contains all *.* files needed by javadoc #Will NOT contain any *.jpg, *.gif, *.html, *.htm needed by application #Use ${properties} for *.jpg, *.gif, *.html, *.htm needed by application properties =${input}/properties #contains *.property files for i18n #contains *.gif needed for application #contains *.* any other resource files needed for application lib =${input}/lib #contains all *.jar needed to run the app #does not contain *.jars needed to compile the app(such as junit.jar) staging.in =${input}/staging #build copies everything from here to ${staging} so staging area can just be #zipped up or rpm'd up or whatever during the dist target. #typically, there will be another directory in here called <project> #or something. Some projects won't but most will. scripts =${input}/tests/scripts #DO NOT MODIFY. This is hardcoded in TestSuiteAllScripts.java. #contains all *.xml abbot scripts to do GUI testing. test.input =${input}/tests/input #for miscellaneous input to junit tests. #----------------------------------------------------------------------- # MISCELLANEOUS #----------------------------------------------------------------------- junit.pattern1=biz/xsoftware/test/**/Test*.class junit.pattern2=**/test/Test*.class build.sysclasspath=ignore # Change this value and I call you a complete idiot(cp = classpath) # ignore - trust build file to get the cp right # first - concatenate build file cp AFTER build runners cp # last - concatenate build runners cp AFTER build file cp #output = build.log #uncomment this to activate the logging --- NEW FILE: ant.properties --- #----------------------------------------------------------------------- # MANIFEST and JAR properties - Make sure you change these to your settings. #----------------------------------------------------------------------- name = mocklib #used as the jar file name(ie. ${name}.jar) #used as zip file name(ie. ${name}-version.jar) #used as the directory staging name #version info may be retrieved using java -jar ${name}.jar -version manifest.mainclass = TOOLS.JAVA.Main #The class that is run when java -jar xxxx.jar is run manifest.title = MockLib manifest.vendor = http://sourceforge.net/projects/mockobject manifest.builder = Dean Hiller copyright = Copyright © 2000 Dean Hiller All Rights Reserved. javadoc.title = MockObject javadoc.bottom = If you would like a shared copyright, contact me at dea...@us...<br> \ <a href=http://sourceforge.net> \ <IMG src=http://sourceforge.net/sflogo.php?group_id=113040 width=210 height=62 border=0 alt=SourceForge Logo> \ </a> #----------------------------------------------------------------------- # Properties to run the program using the "run" target in build.xml(ie. build run) # Just try ./build run to execute org.NO.MAIN.YET below(of course, that class # doesn't exist, so I would suggest changing that. #----------------------------------------------------------------------- client.to.run = org.NO.MAIN.YET #Class run when "build run" target is used client.args = #params to the java app for the run target to run the application client.jvm.args = -enableassertions #params to the JVM for the run target to run the application junit.pattern2=**/examples/**/Test*.class --- NEW FILE: release.xml --- <!-- This file is run after testall. It is primarily so you can move the distribution built in createdist.xml and code coverage web pages anywhere you want after the build is done --> <project name="std_buildfile" default="release" basedir=".."> <property name="misc" value="${input}/misc"/> <property name="javadoc.examples.title" value="MockLib Examples"/> <!-- temporary until we fix buildtemplate to not erase every folder in tools --> <property name="taglet" value="${tool.dir}/taglet"/> <property name="user" value="fastdragon"/> <!-- *********************************************************************** JAVADOC TARGET *********************************************************************** --> <target name="javadocimpl" description="Generate JavaDoc"> <mkdir dir="${projstaging}/impl"/> <copy todir="${projstaging}/impl"> <fileset dir="${javacode}" excludes="**\*.java"/> </copy> <echo message="list is at ${misc}"/> <echo message="package lists in=${package.list}"/> <javadoc packagenames="biz.xsoftware.mock.*" sourcepath="${javacode}" destdir="${projstaging}/impl" author="true" version="true" use="true" public="yes" overview="${misc}/mockoverview.html" windowtitle="${javadoc.title} ${version}" doctitle="${javadoc.title} ${version}" Verbose="true"> <!-- classpath needed to link up to third_party libs without 100's of warnings --> <classpath> <path refid="tool.and.lib"/> </classpath> <fileset dir="${javacode}"> <include name="**/.java"/> </fileset> <doctitle><![CDATA[<h1>${javadoc.title} ${version}</h1>]]></doctitle> <bottom><![CDATA[<i>${copyright}</i><br> ${javadoc.bottom}]]> </bottom> <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api" packagelistLoc="${package.list}/jdk"/> <link offline="true" href="http://www.junit.org/junit/javadoc/3.8.1" packagelistLoc="${package.list}/junit"/> </javadoc> </target> <target name="javadocexamples" depends="javadocimpl" description="Generate JavaDoc"> <mkdir dir="${projstaging}/examples"/> <copy todir="${projstaging}/examples"> <fileset dir="${javacode}" excludes="**\*.java"/> </copy> <echo message="list is at ${misc}"/> <javadoc packagenames="biz.xsoftware.examples.*" sourcepath="${javacode}" destdir="${projstaging}/examples" author="true" version="true" use="true" private="yes" overview="${misc}/examplesoverview.html" windowtitle="${javadoc.examples.title} ${version}" doctitle="${javadoc.examples.title} ${version}" Verbose="true" breakiterator="yes" stylesheetfile="${taglet}/stylesheet.css"> <taglet name="biz.xsoftware.showcode.ShowCodeTaglet" path="${taglet}/showcode.jar"/> <!-- classpath needed to link up to third_party libs without 100's of warnings --> <classpath> <path refid="tool.and.lib"/> </classpath> <fileset dir="${javacode}"> <include name="**/.java"/> </fileset> <doctitle><![CDATA[<h1>${javadoc.examples.title} ${version}</h1>]]></doctitle> <bottom><![CDATA[<i>${copyright}</i><br> ${javadoc.bottom}]]> </bottom> <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api" packagelistLoc="${package.list}/jdk"/> <link offline="true" href="http://www.junit.org/junit/javadoc/3.8.1" packagelistLoc="${package.list}/junit"/> <link offline="false" href="../impl"/> </javadoc> </target> <target name="createdist" depends="javadocexamples"> <copy todir="${projstaging}"> <fileset dir="${codecov}"/> <fileset dir="${jardist}" includes="${jar.name}"/> </copy> <!-- <copy file="README" tofile="${dist.build.dir}/README" overwrite="yes" /> <copy file="LICENSE" tofile="${dist.build.dir}/LICENSE" overwrite="yes" /> --> <!-- package everything up nice and tidy --> <zip zipfile="${dist}/${name}-${version}.zip" basedir="${staging}" includes="**" update="yes" /> <!--tar tarfile="${dist.dir}/${name}-${version}.tar" basedir="${dist.build.dir}" includes="**" /> <gzip zipfile="${dist.dir}/${name}-${version}.tar.gz" src="${dist.dir}/${name}-${version}.tar" /--> </target> <!-- this is run after createdist is run and after testall is run so codecoverage, the release, can all be posted to some website --> <target name="release" depends="createdist" if="pw"> <echo message="***************************************************************"/> <echo message="***************************************************************"/> <echo message=" Delivering zip=${name}-${version}.zip to"/> <echo message=" sourceforge ftp site, and to ${name} website"/> <echo message=" The website will be updated at mocklib.sourceforge.net"/> <echo message=" Please finish this and go to sourceforge.net/projects/mocklib"/> <echo message=" to pick up the release and release it to the world"/> <echo message=""/> <echo message=" ps. This will take a while"/> <echo message="***************************************************************"/> <echo message="***************************************************************"/> <ftp server="upload.sourceforge.net" remotedir="incoming" userid="anonymous" password="${user}@user.sourceforge.net"> <fileset dir="${dist}"> <include name="${name}-${version}.zip"/> </fileset> </ftp> <scp file="${dist}/${name}-${version}.zip" todir="${user}@shell.sourceforge.net:/home/groups/m/mo/mocklib" password="${pw}"/> <sshexec host="shell.sourceforge.net" username="${user}" password="${pw}" command="rm -rf /home/groups/m/mo/mocklib/htdocs/*"/> <sshexec host="shell.sourceforge.net" username="${user}" password="${pw}" command="unzip /home/groups/m/mo/mocklib/${name}-${version}.zip -d /home/groups/m/mo/mocklib/htdocs/"/> <sshexec host="shell.sourceforge.net" username="${user}" password="${pw}" command="mv /home/groups/m/mo/mocklib/htdocs/${name}/* /home/groups/m/mo/mocklib/htdocs"/> <sshexec host="shell.sourceforge.net" username="${user}" password="${pw}" command="rm /home/groups/m/mo/mocklib/${name}*.zip"/> </target> </project> --- NEW FILE: dependencies.xml --- <walls> <!-- DO NOT MODIFY NEXT TWO LINES --> <package name="manifest" package="biz.xsoftware.manifest.**"/> <!-- Fill this file in with your package design --> <package name="impl" package="biz.xsoftware.mock.**"/> <package name="examples" package="biz.xsoftware.examples.**" depends="impl"/> <package name="tests" package="biz.xsoftware.test.**" depends="impl"/> </walls> --- NEW FILE: createdist.xml --- <project name="std_buildfile" default="createdist" basedir=".."> <!-- ================================================================================ Creates the distribution ================================================================================ --> <target name="createdist" description="Creates the project specific distribution"> <!-- The following commented out code already happens in the build.xml file --> <!--mkdir dir="${dist}"/> <mkdir dir="${staging}"/> <copy todir="${staging}"> <fileset dir="${staging.in}" includes="**/*"/> </copy--> </target> </project> |
From: Nobody <fas...@us...> - 2006-09-10 18:26:09
|
Update of /cvsroot/mocklib/mocklib3/tools In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools Added Files: version-${version}.txt Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: version-${version}.txt --- |
From: Nobody <fas...@us...> - 2006-09-10 18:26:08
|
Update of /cvsroot/mocklib/mocklib3/tools/checkstyle In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/checkstyle Added Files: checkstyle-all-4.1.jar config.xml Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: config.xml --- <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> <!-- Checkstyle configuration that checks the sun coding conventions from: - the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html - the Sun Code Conventions at http://java.sun.com/docs/codeconv/ - the Javadoc guidelines at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html - some best practices Checkstyle is very configurable. Be sure to read the documentation at http://checkstyle.sf.net (or in your downloaded distribution). Most Checks are configurable, be sure to consult the documentation. To completely disable a check, just comment it out or delete it from the file. Finally, it is worth reading the documentation. --> <module name="Checker"> <!-- Checks that a package.html file exists for each package. --> <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> <!--module name="PackageHtml"/--> <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> <!--module name="NewlineAtEndOfFile"/--> <!-- Checks that property files contain the same keys. --> <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <module name="Translation"/> <module name="TreeWalker"> <!-- Checks for Javadoc comments. --> <!-- See http://checkstyle.sf.net/config_javadoc.html --> <!--module name="JavadocMethod"/> <module name="JavadocType"/> <module name="JavadocVariable"/> <module name="JavadocStyle"/--> <!-- Checks for Naming Conventions. --> <!-- See http://checkstyle.sf.net/config_naming.html --> <module name="ConstantName"> <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$|^log$|^apiLog$"/> </module> <module name="LocalFinalVariableName"/> <module name="LocalVariableName"/> <module name="MemberName"/> <module name="MethodName"/> <module name="PackageName"/> <module name="ParameterName"/> <module name="StaticVariableName"/> <module name="TypeName"/> <!-- Checks for Headers --> <!-- See http://checkstyle.sf.net/config_header.html --> <!-- <module name="Header"> --> <!-- The follow property value demonstrates the ability --> <!-- to have access to ANT properties. In this case it uses --> <!-- the ${basedir} property to allow Checkstyle to be run --> <!-- from any directory within a project. See property --> <!-- expansion, --> <!-- http://checkstyle.sf.net/config.html#properties --> <!-- <property --> <!-- name="headerFile" --> <!-- value="${basedir}/java.header"/> --> <!-- </module> --> <!-- Following interprets the header file as regular expressions. --> <!-- <module name="RegexpHeader"/> --> <!-- Checks for imports --> <!-- See http://checkstyle.sf.net/config_import.html --> <module name="AvoidStarImport"/> <module name="IllegalImport"/> <!-- defaults to sun.* packages --> <module name="RedundantImport"/> <module name="UnusedImports"/> <!-- Checks for Size Violations. --> <!-- See http://checkstyle.sf.net/config_sizes.html --> <module name="FileLength"> <property name="max" value="700"/> </module> <module name="LineLength"> <property name="max" value="150"/> </module> <module name="MethodLength"> <property name="max" value="75"/> </module> <module name="ParameterNumber"/> <!-- Checks for whitespace --> <!-- See http://checkstyle.sf.net/config_whitespace.html --> <!--module name="EmptyForIteratorPad"/> <module name="MethodParamPad"/> <module name="NoWhitespaceAfter"/> <module name="NoWhitespaceBefore"/> <module name="OperatorWrap"/> <module name="ParenPad"/> <module name="TypecastParenPad"/> <module name="TabCharacter"/> <module name="WhitespaceAfter"/> <module name="WhitespaceAround"/--> <!-- Modifier Checks --> <!-- See http://checkstyle.sf.net/config_modifiers.html --> <module name="ModifierOrder"/> <!--module name="RedundantModifier"/--> <!-- Checks for blocks. You know, those {}'s --> <!-- See http://checkstyle.sf.net/config_blocks.html --> <!--module name="AvoidNestedBlocks"/> <module name="EmptyBlock"/> <module name="LeftCurly"/> <module name="NeedBraces"/> <module name="RightCurly"/--> <!-- Checks for common coding problems --> <!-- See http://checkstyle.sf.net/config_coding.html --> <module name="AvoidInlineConditionals"/> <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE --> <module name="EmptyStatement"/> <module name="EqualsHashCode"/> <!--module name="HiddenField"/--> <module name="IllegalInstantiation"/> <module name="InnerAssignment"/> <!--module name="MagicNumber"/--> <module name="MissingSwitchDefault"/> <module name="RedundantThrows"/> <module name="SimplifyBooleanExpression"/> <module name="SimplifyBooleanReturn"/> <!-- Checks for class design --> <!-- See http://checkstyle.sf.net/config_design.html --> <!--module name="DesignForExtension"/--> <module name="FinalClass"/> <module name="HideUtilityClassConstructor"/> <module name="InterfaceIsType"/> <module name="VisibilityModifier"/> <!-- Miscellaneous other checks. --> <!-- See http://checkstyle.sf.net/config_misc.html --> <module name="ArrayTypeStyle"/> <!--module name="FinalParameters"/--> <!--module name="GenericIllegalRegexp"> <property name="format" value="System\.out\.println"/> <property name="message" value="User Logger class instead."/> </module--> <!--module name="GenericIllegalRegexp"> <property name="format" value="\s+$"/> <property name="message" value="Line has trailing spaces."/> </module--> <!--module name="TodoComment"/--> <module name="UpperEll"/> </module> </module> --- NEW FILE: checkstyle-all-4.1.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:26:07
|
Update of /cvsroot/mocklib/mocklib3/tools/taglet In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/taglet Added Files: showcode.jar example_taglet.jar stylesheet.css Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: example_taglet.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: stylesheet.css --- /* Javadoc style sheet */ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ body { background-color: #FFFFFF } /* Table colors */ .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ .TableRowColor { background: #FFFFFF } /* White */ /* Font used in left-hand frame lists */ .FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } .FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif } /* Example of smaller, sans-serif font in frames */ /* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ /* Navigation bar fonts and colors */ .NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ .NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} /* the example body */ .example { background: #F8f8f8; padding: 4px; border-style: solid; border-width: 1px; border-color: black } .example A:link { color: blue; } .example A:visited { color: blue; } .example A:hover { color: blue; background: #f0f0f0; } /* the title of the example */ .example_title { font-weight: bold; } /* comments */ .example_comment { color: #008000; } /* primary types: int, boolean, float */ .example_type { font-weight: bold; } /* identifiers beginning with capitals */ .example_class { color: #000080; } .example_class A:link { color: #000080; } .example_class A:visited { color: #000080; } .example_class A:hover { color: #000080; background: #f0f0f0; } /* public, protected, private */ .example_modifier { font-weight: bold; color: #606060; } /* class definition: class, extends, implements */ .example_proclamation { font-weight: bold; color: #b04090; } /* flow control: if, for, return */ .example_control { color: #800080; font-weight: bold; } /* strings */ .example_string { color:blue; } /* true, false */ .example_literal { color:blue; } --- NEW FILE: showcode.jar --- (This appears to be a binary file; contents omitted.) |
From: Nobody <fas...@us...> - 2006-09-10 18:26:06
|
Update of /cvsroot/mocklib/mocklib3/tools/package-list/jdk In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24740/tools/package-list/jdk Added Files: package-list Log Message: original commit of mocklib2 that will become mocklib3 --- NEW FILE: package-list --- java.applet java.awt java.awt.color java.awt.datatransfer java.awt.dnd java.awt.event java.awt.font java.awt.geom java.awt.im java.awt.im.spi java.awt.image java.awt.image.renderable java.awt.print java.beans java.beans.beancontext java.io java.lang java.lang.ref java.lang.reflect java.math java.net java.nio java.nio.channels java.nio.channels.spi java.nio.charset java.nio.charset.spi java.rmi java.rmi.activation java.rmi.dgc java.rmi.registry java.rmi.server java.security java.security.acl java.security.cert java.security.interfaces java.security.spec java.sql java.text java.util java.util.jar java.util.logging java.util.prefs java.util.regex java.util.zip javax.accessibility javax.crypto javax.crypto.interfaces javax.crypto.spec javax.imageio javax.imageio.event javax.imageio.metadata javax.imageio.plugins.jpeg javax.imageio.spi javax.imageio.stream javax.naming javax.naming.directory javax.naming.event javax.naming.ldap javax.naming.spi javax.net javax.net.ssl javax.print javax.print.attribute javax.print.attribute.standard javax.print.event javax.rmi javax.rmi.CORBA javax.security.auth javax.security.auth.callback javax.security.auth.kerberos javax.security.auth.login javax.security.auth.spi javax.security.auth.x500 javax.security.cert javax.sound.midi javax.sound.midi.spi javax.sound.sampled javax.sound.sampled.spi javax.sql javax.swing javax.swing.border javax.swing.colorchooser javax.swing.event javax.swing.filechooser javax.swing.plaf javax.swing.plaf.basic javax.swing.plaf.metal javax.swing.plaf.multi javax.swing.table javax.swing.text javax.swing.text.html javax.swing.text.html.parser javax.swing.text.rtf javax.swing.tree javax.swing.undo javax.transaction javax.transaction.xa javax.xml.parsers javax.xml.transform javax.xml.transform.dom javax.xml.transform.sax javax.xml.transform.stream org.ietf.jgss org.omg.CORBA org.omg.CORBA.DynAnyPackage org.omg.CORBA.ORBPackage org.omg.CORBA.TypeCodePackage org.omg.CORBA.portable org.omg.CORBA_2_3 org.omg.CORBA_2_3.portable org.omg.CosNaming org.omg.CosNaming.NamingContextExtPackage org.omg.CosNaming.NamingContextPackage org.omg.Dynamic org.omg.DynamicAny org.omg.DynamicAny.DynAnyFactoryPackage org.omg.DynamicAny.DynAnyPackage org.omg.IOP org.omg.IOP.CodecFactoryPackage org.omg.IOP.CodecPackage org.omg.Messaging org.omg.PortableInterceptor org.omg.PortableInterceptor.ORBInitInfoPackage org.omg.PortableServer org.omg.PortableServer.CurrentPackage org.omg.PortableServer.POAManagerPackage org.omg.PortableServer.POAPackage org.omg.PortableServer.ServantLocatorPackage org.omg.PortableServer.portable org.omg.SendingContext org.omg.stub.java.rmi org.w3c.dom org.xml.sax org.xml.sax.ext org.xml.sax.helpers |