mocklib-checkins Mailing List for mocklib (Page 23)
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: Jay <ja...@us...> - 2006-02-16 15:37:44
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14392/input/javasrc/biz/xsoftware/mock2 Modified Files: MockObjectFactory.java MockObject.java Added Files: Messages.java Log Message: merge brachForOffice to HEAD Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/MockObject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockObject.java 7 Jan 2006 15:13:39 -0000 1.2 --- MockObject.java 16 Feb 2006 15:37:35 -0000 1.3 *************** *** 141,146 **** /** * Verifies that the expected methods are called within the timeout. */ ! public void verify(); /** --- 141,149 ---- /** * Verifies that the expected methods are called within the timeout. + * @param timeout + * the time set for waitting the call + * @throws InterruptedException */ ! public void verify() throws InterruptedException; /** Index: MockObjectFactory.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/MockObjectFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockObjectFactory.java 13 Jan 2006 15:45:00 -0000 1.4 --- MockObjectFactory.java 16 Feb 2006 15:37:35 -0000 1.5 *************** *** 10,17 **** */ public abstract class MockObjectFactory { ! private static MockObjectFactory singleton() { ! //fix this using reflection.... ! return null; } --- 10,30 ---- */ public abstract class MockObjectFactory { ! ! private static MockObjectFactory singleton() { ! //fix this using reflection.... ClassLoader cl=MockObjectFactory.class.getClassLoader(); ! MockObjectFactory factory=null; ! try{ ! String className="biz.xsoftware.mock2.impl.MockObjectFactoryImpl"; ! Class<? extends MockObjectFactory> c=Class.forName(className).asSubclass(MockObjectFactory.class); ! factory=c.newInstance(); ! }catch(ClassNotFoundException e){ ! throw new RuntimeException("create mockFactory failed", e); ! }catch(IllegalAccessException e){ ! throw new RuntimeException("create mockFactory failed", e); ! }catch(InstantiationException e){ ! throw new RuntimeException("create mockFactory failed", e); ! } ! return factory; } --- NEW FILE: Messages.java --- package biz.xsoftware.mock2; public class Messages { private Messages() {} public static final String VERIFY_NOT_CALLED = "MockObject.verify() must be called before accessing and of the methods on CalledMethod object"; } |
From: Jay <ja...@us...> - 2006-02-16 15:37:43
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14392/input/javasrc/biz/xsoftware/test/mock2 Modified Files: ListenerOne.java Added Files: TestProxyClass.java TestMockCreator.java MyProxyImpl.java Log Message: merge brachForOffice to HEAD --- NEW FILE: TestProxyClass.java --- package biz.xsoftware.test.mock2; import java.lang.reflect.Proxy; import java.util.logging.Logger; import junit.framework.TestCase; public class TestProxyClass extends TestCase { private static final Logger log = Logger.getLogger(TestProxyClass.class.getName()); public TestProxyClass(String arg0) { super(arg0); } public void testProxyFields() { ClassLoader cl = TestProxyClass.class.getClassLoader(); MyProxyImpl impl = new MyProxyImpl(); //change value through impl first impl.setField(5); ListenerOne one = (ListenerOne)Proxy.newProxyInstance( cl, new Class[] {ListenerOne.class}, impl); assertEquals(5, impl.getField()); assertEquals(impl.getField(), one.getField()); //now change value through proxy one.callMeFirst(6); assertEquals(6, impl.getField()); assertEquals(impl.getField(), one.getField()); } } --- NEW FILE: MyProxyImpl.java --- package biz.xsoftware.test.mock2; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.logging.Logger; public class MyProxyImpl implements InvocationHandler { private static final Logger log = Logger.getLogger(MyProxyImpl.class.getName()); private int someField = 0; public void setField(int i) { someField = i; } public int getField() { return someField; } public Object invoke(Object instance, Method m, Object[] params) throws Throwable { log.info("instance="+instance.getClass().getName()); log.info("is instanceof ListenerOne="+(instance instanceof ListenerOne)); log.info("is instanceof MyProxyImpl="+(instance instanceof MyProxyImpl)); if(params != null && params.length > 0 && params[0] instanceof Integer) someField = (Integer)params[0]; else if("getField".equals(m.getName())) return someField; return null; } } --- NEW FILE: TestMockCreator.java --- package biz.xsoftware.test.mock2; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import junit.framework.TestCase; import biz.xsoftware.mock2.CalledMethod; import biz.xsoftware.mock2.Messages; import biz.xsoftware.mock2.MockObject; import biz.xsoftware.mock2.MockObjectFactory; public class TestMockCreator extends TestCase { private static final Logger log = Logger.getLogger(TestMockCreator.class.getName()); public TestMockCreator(String name){ super(name); } public void testMockCreator()throws Exception{ MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; String methodName="callMeSecond"; CalledMethod method=m.expect(methodName); // String param="some params"; // l.callMeSecond(param); try { method.getParameters(); fail("Since verify was not called, CalledMethod methods should not work"); } catch(IllegalStateException e) { } //assertEquals("the methodName should be the same",methodName,method.getMethodName()); //assertEquals("params should equal", param, method.getParameters()[0]); //assertEquals("param count should be 1", 1, method.getParameters().length); } public void testNoVerifyCalled() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; String methodName1 = "callMeFirst"; String methodName2="callMeSecond"; CalledMethod callMeFirst =m.expect(methodName1); CalledMethod callMeSecond=m.expect(methodName2); try { callMeFirst.getParameters(); fail("The method was not called yet and verify() was not called, so above should throw exceptoin"); } catch(IllegalStateException e) { } } public void testTwoMethods() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; String methodName1 = "callMeFirst"; String methodName2="callMeSecond"; CalledMethod callMeFirst =m.expect(methodName1); CalledMethod callMeSecond=m.expect(methodName2); int var1 = 4; l.callMeFirst(var1); String param="some params"; l.callMeSecond(param); m.verify(); assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); Object[] array = callMeFirst.getParameters(); assertEquals("params should equal", var1, array[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); assertEquals("the methodName should be the same",methodName2,callMeSecond.getMethodName()); assertEquals("params should equal", param, callMeSecond.getParameters()[0]); assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); } public void testTwoMethodsOnThread() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); final ListenerOne l = (ListenerOne) m; String methodName1 = "callMeFirst"; String methodName2 = "callMeSecond"; CalledMethod callMeFirst = m.expect(methodName1); CalledMethod callMeSecond = m.expect(methodName2); final int var1 = 4; final String param = "some params"; Thread t = new Thread() { public void run() { try { Thread.sleep(1000); l.callMeFirst(var1); l.callMeSecond(param); } catch (Exception e) { log.log(Level.WARNING, "exception", e); throw new RuntimeException(e); } } }; t.start(); m.verify(); assertEquals("the methodName should be the same", methodName1, callMeFirst.getMethodName()); assertEquals("params should equal", var1, callMeFirst.getParameters()[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); assertEquals("the methodName should be the same", methodName2, callMeSecond.getMethodName()); assertEquals("params should equal", param, callMeSecond.getParameters()[0]); assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); } public void testFailure() throws Exception { MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; String param="some params"; l.callMeSecond(param); String methodName="callMeSecond"; CalledMethod method=m.expect(methodName); try { assertEquals("params should equal", param, method.getParameters()[0]); fail("This should fail since m.verify() is not called"); } catch(IllegalStateException e) { assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage()); } } public void testExpectWithRetVal() throws Exception{ MockObject m=MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; Object returnVal="OK"; String methodName="callWithRetVal"; CalledMethod method=m.expect(returnVal,methodName); String param="some params"; String retVal=l.callWithRetVal(param); m.verify(); assertEquals("The method name should be equal",method.getMethodName(),methodName); assertEquals("the params should be the same ",method.getParameters()[0],param); assertEquals("the length of param should be equal",1,method.getParameters().length); assertEquals("the return value should be the same",returnVal,retVal); } public void testRemoveCalledMethod(){ } } Index: ListenerOne.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/ListenerOne.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListenerOne.java 1 Jan 2006 00:35:57 -0000 1.1 --- ListenerOne.java 16 Feb 2006 15:37:35 -0000 1.2 *************** *** 22,31 **** public void callMeSecond(String s) throws IOException; ! public void multipleParams(String x, Integer i); ! ! public int respondTo(Map map); ! ! public boolean responsd(); public void noParams(); } --- 22,30 ---- public void callMeSecond(String s) throws IOException; ! public String callWithRetVal(String s); public void noParams(); + + public int getField(); + } |
From: Jay <ja...@us...> - 2006-02-15 14:45:14
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28877/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice MockObjectSuperImpl.java Log Message: Index: MockObjectSuperImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v retrieving revision 1.3.2.6 retrieving revision 1.3.2.7 diff -C2 -d -r1.3.2.6 -r1.3.2.7 *** MockObjectSuperImpl.java 6 Feb 2006 16:02:54 -0000 1.3.2.6 --- MockObjectSuperImpl.java 15 Feb 2006 14:44:57 -0000 1.3.2.7 *************** *** 29,34 **** * List of the methods been called ,and store them */ ! // private List<CalledMethod> calledMethodsStore=new ! // LinkedList<CalledMethod>(); /** * List of the methods that have been expected --- 29,33 ---- * List of the methods been called ,and store them */ ! Map retVal=new HashMap(); /** * List of the methods that have been expected *************** *** 78,83 **** public CalledMethod expect(Object returnValue, String methodName, long timeout, Class... vargs) { ! // TODO Auto-generated method stub ! return null; } --- 77,86 ---- public CalledMethod expect(Object returnValue, String methodName, long timeout, Class... vargs) { ! if(methodName==null) ! throw new IllegalArgumentException("method name can not be null"); ! CalledMethod calledMethod=new CalledMethodImpl(methodName); ! methodsExpected.add(calledMethod); ! retVal.put(methodName,returnValue); ! return calledMethod; } *************** *** 113,116 **** --- 116,120 ---- m.setParameters(calledMethod.getParameters()); m.setStackTrace(calledMethod.getStackTrace()); + } *************** *** 129,133 **** public void setDefaultReturnValue(Object returnValue, String methodName, Class... vargs) { ! // TODO Auto-generated method stub } --- 133,137 ---- public void setDefaultReturnValue(Object returnValue, String methodName, Class... vargs) { ! } *************** *** 158,161 **** --- 162,166 ---- CalledMethod calledMethod = new CalledMethodImpl(methodName, parameters, stackTrace); + methodsCalled.add(calledMethod); *************** *** 166,180 **** private Object getReturnValue(String methodName) { ! ! List l = (List) methodToReturnVal.get(methodName); ! if (l != null) { ! Object retVal = l.remove(0); ! if (l.size() <= 0) ! methodToReturnVal.remove(methodName); ! return retVal; } ! // next line returns null if setDefaultReturnValue not called by test ! // case... ! return methodToDefaultRetVal.get(methodName); } --- 171,184 ---- private Object getReturnValue(String methodName) { ! if(retVal.size()==0){ ! String returnValue="No return value is set"; ! setDefaultReturnValue(returnValue,methodName); } ! if(retVal.containsKey(methodName)){ ! return retVal.get(methodName); ! } ! ! return null; ! } |
From: Jay <ja...@us...> - 2006-02-15 14:45:14
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28877/input/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -C2 -d -r1.1.2.10 -r1.1.2.11 *** TestMockCreator.java 7 Feb 2006 05:51:19 -0000 1.1.2.10 --- TestMockCreator.java 15 Feb 2006 14:44:57 -0000 1.1.2.11 *************** *** 1,4 **** --- 1,7 ---- package biz.xsoftware.test.mock2; + import java.io.IOException; + import java.util.HashMap; + import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; *************** *** 142,145 **** --- 145,172 ---- } } + + public void testExpectWithRetVal() throws Exception{ + MockObject m=MockObjectFactory.createMock(ListenerOne.class); + ListenerOne l=(ListenerOne)m; + + Object returnVal="OK"; + String methodName="callWithRetVal"; + CalledMethod method=m.expect(returnVal,methodName); + + String param="some params"; + String retVal=l.callWithRetVal(param); + + m.verify(); + + assertEquals("The method name should be equal",method.getMethodName(),methodName); + assertEquals("the params should be the same ",method.getParameters()[0],param); + assertEquals("the length of param should be equal",1,method.getParameters().length); + assertEquals("the return value should be the same",returnVal,retVal); + + } + + public void testRemoveCalledMethod(){ + + } } |
From: Jay <ja...@us...> - 2006-02-15 14:44:27
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28739/input/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice ListenerOne.java Log Message: add method callWithRetVal Index: ListenerOne.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/ListenerOne.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ListenerOne.java 7 Feb 2006 00:59:06 -0000 1.1.2.1 --- ListenerOne.java 15 Feb 2006 14:44:10 -0000 1.1.2.2 *************** *** 22,33 **** public void callMeSecond(String s) throws IOException; ! public void multipleParams(String x, Integer i); ! ! public int respondTo(Map map); ! ! public boolean responsd(); public void noParams(); public int getField(); } --- 22,30 ---- public void callMeSecond(String s) throws IOException; ! public String callWithRetVal(String s); public void noParams(); public int getField(); + } |
From: Jay <ja...@us...> - 2006-02-07 05:51:32
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23494/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice CalledMethodImpl.java Log Message: add message for verify not called Index: CalledMethodImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/CalledMethodImpl.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** CalledMethodImpl.java 6 Feb 2006 16:02:54 -0000 1.1.2.4 --- CalledMethodImpl.java 7 Feb 2006 05:51:24 -0000 1.1.2.5 *************** *** 33,37 **** if(parameters==null) { ! throw new IllegalStateException(); } return parameters; --- 33,37 ---- if(parameters==null) { ! throw new IllegalStateException("MockObject.verify() must be called before accessing and of the methods on CalledMethod object"); } return parameters; |
From: Jay <ja...@us...> - 2006-02-07 05:51:27
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23477/input/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: add message for verify not called Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -d -r1.1.2.9 -r1.1.2.10 *** TestMockCreator.java 6 Feb 2006 16:02:30 -0000 1.1.2.9 --- TestMockCreator.java 7 Feb 2006 05:51:19 -0000 1.1.2.10 *************** *** 6,9 **** --- 6,10 ---- import junit.framework.TestCase; import biz.xsoftware.mock2.CalledMethod; + import biz.xsoftware.mock2.Messages; import biz.xsoftware.mock2.MockObject; import biz.xsoftware.mock2.MockObjectFactory; *************** *** 138,142 **** fail("This should fail since m.verify() is not called"); } catch(IllegalStateException e) { ! //assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage()); } } --- 139,143 ---- fail("This should fail since m.verify() is not called"); } catch(IllegalStateException e) { ! assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage()); } } |
From: Nobody <fas...@us...> - 2006-02-07 00:59:14
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18160/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice ListenerOne.java Added Files: Tag: branchForOffice MyProxyImpl.java TestProxyClass.java Log Message: quick test on proxy stuff. --- NEW FILE: TestProxyClass.java --- package biz.xsoftware.test.mock2; import java.lang.reflect.Proxy; import java.util.logging.Logger; import junit.framework.TestCase; public class TestProxyClass extends TestCase { private static final Logger log = Logger.getLogger(TestProxyClass.class.getName()); public TestProxyClass(String arg0) { super(arg0); } public void testProxyFields() { ClassLoader cl = TestProxyClass.class.getClassLoader(); MyProxyImpl impl = new MyProxyImpl(); //change value through impl first impl.setField(5); ListenerOne one = (ListenerOne)Proxy.newProxyInstance( cl, new Class[] {ListenerOne.class}, impl); assertEquals(5, impl.getField()); assertEquals(impl.getField(), one.getField()); //now change value through proxy one.callMeFirst(6); assertEquals(6, impl.getField()); assertEquals(impl.getField(), one.getField()); } } --- NEW FILE: MyProxyImpl.java --- package biz.xsoftware.test.mock2; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.logging.Logger; public class MyProxyImpl implements InvocationHandler { private static final Logger log = Logger.getLogger(MyProxyImpl.class.getName()); private int someField = 0; public void setField(int i) { someField = i; } public int getField() { return someField; } public Object invoke(Object instance, Method m, Object[] params) throws Throwable { log.info("instance="+instance.getClass().getName()); log.info("is instanceof ListenerOne="+(instance instanceof ListenerOne)); log.info("is instanceof MyProxyImpl="+(instance instanceof MyProxyImpl)); if(params != null && params.length > 0 && params[0] instanceof Integer) someField = (Integer)params[0]; else if("getField".equals(m.getName())) return someField; return null; } } Index: ListenerOne.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/ListenerOne.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** ListenerOne.java 1 Jan 2006 00:35:57 -0000 1.1 --- ListenerOne.java 7 Feb 2006 00:59:06 -0000 1.1.2.1 *************** *** 29,31 **** --- 29,33 ---- public void noParams(); + + public int getField(); } |
From: Jay <ja...@us...> - 2006-02-06 16:03:16
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9156/input/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: pass Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** TestMockCreator.java 5 Feb 2006 12:35:43 -0000 1.1.2.8 --- TestMockCreator.java 6 Feb 2006 16:02:30 -0000 1.1.2.9 *************** *** 21,30 **** ListenerOne l=(ListenerOne)m; ! String param="some params"; ! l.callMeSecond(param); String methodName="callMeSecond"; CalledMethod method=m.expect(methodName); try { --- 21,32 ---- ListenerOne l=(ListenerOne)m; ! String methodName="callMeSecond"; CalledMethod method=m.expect(methodName); + + // String param="some params"; + // l.callMeSecond(param); try { *************** *** 41,45 **** MockObject m = MockObjectFactory.createMock(ListenerOne.class); ListenerOne l=(ListenerOne)m; - String methodName1 = "callMeFirst"; String methodName2="callMeSecond"; --- 43,46 ---- *************** *** 72,76 **** assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); Object[] array = callMeFirst.getParameters(); ! assertEquals("params should equal", param, array[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); --- 73,77 ---- assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); Object[] array = callMeFirst.getParameters(); ! assertEquals("params should equal", var1, array[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); *************** *** 80,143 **** } ! // public void testTwoMethodsOnThread() throws Exception { ! // MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! // final ListenerOne l = (ListenerOne) m; ! // ! // String methodName1 = "callMeFirst"; ! // String methodName2 = "callMeSecond"; ! // CalledMethod callMeFirst = m.expect(methodName1); ! // CalledMethod callMeSecond = m.expect(methodName2); ! // ! // final int var1 = 4; ! // final String param = "some params"; ! // Thread t = new Thread() { ! // public void run() { ! // try { ! // Thread.sleep(1000); ! // l.callMeFirst(var1); ! // l.callMeSecond(param); ! // } catch (Exception e) { ! // log.log(Level.WARNING, "exception", e); ! // throw new RuntimeException(e); ! // } ! // } ! // }; ! // t.start(); ! // ! // m.verify(); ! // ! // assertEquals("the methodName should be the same", methodName1, ! // callMeFirst.getMethodName()); ! // assertEquals("params should equal", param, ! // callMeFirst.getParameters()[0]); ! // assertEquals("param count should be 1", 1, ! // callMeFirst.getParameters().length); ! // ! // assertEquals("the methodName should be the same", methodName2, ! // callMeSecond.getMethodName()); ! // assertEquals("params should equal", param, ! // callMeSecond.getParameters()[0]); ! // assertEquals("param count should be 1", 1, ! // callMeSecond.getParameters().length); ! // } ! // public void testFailure() throws Exception { ! // MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! // ListenerOne l=(ListenerOne)m; ! // ! // String param="some params"; ! // l.callMeSecond(param); ! // ! // String methodName="callMeSecond"; ! // ! // CalledMethod method=m.expect(methodName); ! // ! // try { ! // assertEquals("params should equal", param, method.getParameters()[0]); ! // fail("This should fail since m.verify() is not called"); ! // } catch(IllegalStateException e) { ! // assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage()); ! // } ! // } } --- 81,144 ---- } ! public void testTwoMethodsOnThread() throws Exception { ! MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! final ListenerOne l = (ListenerOne) m; ! ! String methodName1 = "callMeFirst"; ! String methodName2 = "callMeSecond"; ! CalledMethod callMeFirst = m.expect(methodName1); ! CalledMethod callMeSecond = m.expect(methodName2); ! ! final int var1 = 4; ! final String param = "some params"; ! Thread t = new Thread() { ! public void run() { ! try { ! Thread.sleep(1000); ! l.callMeFirst(var1); ! l.callMeSecond(param); ! } catch (Exception e) { ! log.log(Level.WARNING, "exception", e); ! throw new RuntimeException(e); ! } ! } ! }; ! t.start(); ! ! m.verify(); ! ! assertEquals("the methodName should be the same", methodName1, ! callMeFirst.getMethodName()); ! assertEquals("params should equal", var1, ! callMeFirst.getParameters()[0]); ! assertEquals("param count should be 1", 1, ! callMeFirst.getParameters().length); ! ! assertEquals("the methodName should be the same", methodName2, ! callMeSecond.getMethodName()); ! assertEquals("params should equal", param, ! callMeSecond.getParameters()[0]); ! assertEquals("param count should be 1", 1, ! callMeSecond.getParameters().length); ! } ! public void testFailure() throws Exception { ! MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! ListenerOne l=(ListenerOne)m; ! ! String param="some params"; ! l.callMeSecond(param); ! ! String methodName="callMeSecond"; ! ! CalledMethod method=m.expect(methodName); ! ! try { ! assertEquals("params should equal", param, method.getParameters()[0]); ! fail("This should fail since m.verify() is not called"); ! } catch(IllegalStateException e) { ! //assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage()); ! } ! } } |
From: Jay <ja...@us...> - 2006-02-06 16:03:14
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9249/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice CalledMethodImpl.java MockObjectSuperImpl.java Log Message: pass Index: CalledMethodImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/CalledMethodImpl.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** CalledMethodImpl.java 5 Feb 2006 10:29:22 -0000 1.1.2.3 --- CalledMethodImpl.java 6 Feb 2006 16:02:54 -0000 1.1.2.4 *************** *** 31,34 **** --- 31,38 ---- public Object[] getParameters() { // TODO Auto-generated method stub + if(parameters==null) + { + throw new IllegalStateException(); + } return parameters; } *************** *** 38,41 **** --- 42,57 ---- return stackTrace; } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public void setParameters(Object[] parameters) { + this.parameters = parameters; + } + + public void setStackTrace(String stackTrace) { + this.stackTrace = stackTrace; + } Index: MockObjectSuperImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v retrieving revision 1.3.2.5 retrieving revision 1.3.2.6 diff -C2 -d -r1.3.2.5 -r1.3.2.6 *** MockObjectSuperImpl.java 5 Feb 2006 10:30:03 -0000 1.3.2.5 --- MockObjectSuperImpl.java 6 Feb 2006 16:02:54 -0000 1.3.2.6 *************** *** 14,164 **** public abstract class MockObjectSuperImpl implements MockObject { ! private static final Logger logger = Logger.getLogger(MockObjectSuperImpl.class.getName()); ! private static final long DEFAULT_TIME_OUT = 10000; ! private static int Index=0; ! /** * List of the current methods that have been called. */ private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>(); /** * List of the methods been called ,and store them */ ! // private List<CalledMethod> calledMethodsStore=new LinkedList<CalledMethod>(); /** * List of the methods that have been expected */ ! private List<CalledMethod> methodsExpected=new LinkedList<CalledMethod>(); /** * A map of queues, containing objects to return when methods are called */ private Map<String, List<Object>> methodToReturnVal = new HashMap<String, List<Object>>(); /** ! * A map of default return values, which are used to return if the ! * queue for the method is empty. */ private Map<String, Object> methodToDefaultRetVal = new HashMap<String, Object>(); ! public CalledMethod expect(String methodName, Class... vargs) { ! return expect(methodName, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(Object returnValue, String methodName, ! Class... vargs) { ! return expect(returnValue, methodName, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(String methodName, Throwable throwable, ! Class... vargs) { ! return expect(methodName, throwable, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(String methodName, Behavior behavior, ! Class... params) { ! return expect(methodName, behavior, DEFAULT_TIME_OUT, params); ! } ! public CalledMethod expect(String methodName, long timeout, Class... vargs){ ! if (methodName == null) ! throw new IllegalArgumentException("methd name can not be null"); ! CalledMethod calledMethod=new CalledMethodImpl(methodName); ! methodsExpected.add(calledMethod); ! return methodsExpected.get(Index++); ! } ! public CalledMethod expect(Object returnValue, String methodName, ! long timeout, Class... vargs) { ! // TODO Auto-generated method stub ! return null; ! } ! public CalledMethod expect(String methodName, Throwable throwable, ! long timeout, Class... vargs) { ! // TODO Auto-generated method stub ! return null; ! } ! public CalledMethod expect(String methodName, Behavior behavior, ! long timeout, Class... params) { ! // TODO Auto-generated method stub ! return null; ! } ! ! ! public void verify(){ ! for(int i=0;i<methodsExpected.size();i++){ ! if(methodsExpected.get(i).getMethodName()==methodsCalled.get(i).getMethodName()){ ! ! methodsExpected.add(i,methodsCalled.get(i)); ! methodsExpected.remove(i+1); ! //continue; ! } ! } ! } ! public void addIgnoreMethod(String methodName, Class... vargs) { ! // TODO Auto-generated method stub ! } ! public void removeIgnoreMethod(String methodName, Class... vargs) { ! // TODO Auto-generated method stub ! } ! public void setDefaultReturnValue(Object returnValue, String methodName, ! Class... vargs) { ! // TODO Auto-generated method stub ! } ! public Object instance() { ! // TODO Auto-generated method stub ! return null; ! } ! synchronized protected Object methodCalledImpl(String methodName, ! Object[] parameters) { ! methodName = methodName.intern(); ! String params = ""; ! if (parameters == null) { ! params = "no params"; ! } else { ! Object[] array = (Object[]) parameters; ! for (int i = 0; i < array.length - 1; i++) { ! params += array[i] + ", "; ! } ! params += array[array.length - 1]; ! } ! ! String stackTrace="method Called="+methodName+"("+params+"on object"+this+")"; ! CalledMethod calledMethod=new CalledMethodImpl(methodName,parameters,stackTrace); ! methodsCalled.add(calledMethod); ! //calledMethodsStore.add(calledMethod); ! ! //this.notifyAll(); ! return getReturnValue(methodName); ! } ! ! private Object getReturnValue(String methodName){ ! ! List l=(List)methodToReturnVal.get(methodName); ! if(l != null) { ! Object retVal = l.remove(0); ! if(l.size()<= 0) ! methodToReturnVal.remove(methodName); ! return retVal; ! } ! //next line returns null if setDefaultReturnValue not called by test case... ! return methodToDefaultRetVal.get(methodName); ! ! ! } } --- 14,182 ---- public abstract class MockObjectSuperImpl implements MockObject { ! private static final Logger logger = Logger ! .getLogger(MockObjectSuperImpl.class.getName()); ! private static final long DEFAULT_TIME_OUT = 10000; ! // private static int Index=0; ! ! /** * List of the current methods that have been called. */ private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>(); + /** * List of the methods been called ,and store them */ ! // private List<CalledMethod> calledMethodsStore=new ! // LinkedList<CalledMethod>(); /** * List of the methods that have been expected */ ! private List<CalledMethod> methodsExpected = new LinkedList<CalledMethod>(); ! /** * A map of queues, containing objects to return when methods are called */ private Map<String, List<Object>> methodToReturnVal = new HashMap<String, List<Object>>(); + /** ! * A map of default return values, which are used to return if the queue for ! * the method is empty. */ private Map<String, Object> methodToDefaultRetVal = new HashMap<String, Object>(); ! public CalledMethod expect(String methodName, Class... vargs) { ! return expect(methodName, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(Object returnValue, String methodName, ! Class... vargs) { ! return expect(returnValue, methodName, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(String methodName, Throwable throwable, ! Class... vargs) { ! return expect(methodName, throwable, DEFAULT_TIME_OUT, vargs); ! } ! public CalledMethod expect(String methodName, Behavior behavior, ! Class... params) { ! return expect(methodName, behavior, DEFAULT_TIME_OUT, params); ! } ! public CalledMethod expect(String methodName, long timeout, Class... vargs) { ! if (methodName == null) ! throw new IllegalArgumentException("methd name can not be null"); ! CalledMethod calledMethod = new CalledMethodImpl(methodName); ! methodsExpected.add(calledMethod); ! return calledMethod; ! } ! public CalledMethod expect(Object returnValue, String methodName, ! long timeout, Class... vargs) { ! // TODO Auto-generated method stub ! return null; ! } ! public CalledMethod expect(String methodName, Throwable throwable, ! long timeout, Class... vargs) { ! // TODO Auto-generated method stub ! return null; ! } ! public CalledMethod expect(String methodName, Behavior behavior, ! long timeout, Class... params) { ! // TODO Auto-generated method stub ! return null; ! } ! ! ! public void verify() { ! if (methodsCalled.size() == 0) { ! synchronized(this){ ! try { ! this.wait(DEFAULT_TIME_OUT); ! } catch (InterruptedException e) { ! // TODO Auto-generated catch block ! e.printStackTrace(); ! } ! } ! } ! ! while (methodsCalled.size() != 0) { ! CalledMethod calledMethod = methodsCalled.remove(0); ! CalledMethodImpl m = (CalledMethodImpl) methodsExpected.remove(0); ! m.setParameters(calledMethod.getParameters()); ! m.setStackTrace(calledMethod.getStackTrace()); ! } ! } ! public void addIgnoreMethod(String methodName, Class... vargs) { ! // TODO Auto-generated method stub ! } ! public void removeIgnoreMethod(String methodName, Class... vargs) { ! // TODO Auto-generated method stub ! } ! public void setDefaultReturnValue(Object returnValue, String methodName, ! Class... vargs) { ! // TODO Auto-generated method stub ! } ! public Object instance() { ! // TODO Auto-generated method stub ! return null; ! } ! synchronized protected Object methodCalledImpl(String methodName, ! Object[] parameters) { ! methodName = methodName.intern(); ! String params = ""; ! if (parameters == null) { ! params = "no params"; ! } else { ! Object[] array = (Object[]) parameters; ! for (int i = 0; i < array.length - 1; i++) { ! params += array[i] + ", "; ! } ! params += array[array.length - 1]; ! } ! ! String stackTrace = "method Called=" + methodName + "(" + params ! + "on object" + this + ")"; ! // if(methodsExpected.size()!=0){ ! CalledMethod calledMethod = new CalledMethodImpl(methodName, ! parameters, stackTrace); ! methodsCalled.add(calledMethod); ! ! // } ! ! return getReturnValue(methodName); ! } ! ! private Object getReturnValue(String methodName) { ! ! List l = (List) methodToReturnVal.get(methodName); ! if (l != null) { ! Object retVal = l.remove(0); ! if (l.size() <= 0) ! methodToReturnVal.remove(methodName); ! return retVal; ! } ! // next line returns null if setDefaultReturnValue not called by test ! // case... ! return methodToDefaultRetVal.get(methodName); ! ! } } |
From: Nobody <fas...@us...> - 2006-02-05 12:36:07
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20889/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: this may clear things up for Jay. Commit the code so we can talk over it. Also added a test case for him that we talked about. Go over that also. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** TestMockCreator.java 18 Jan 2006 09:45:09 -0000 1.1.2.7 --- TestMockCreator.java 5 Feb 2006 12:35:43 -0000 1.1.2.8 *************** *** 28,34 **** CalledMethod method=m.expect(methodName); ! assertEquals("the methodName should be the same",methodName,method.getMethodName()); ! assertEquals("params should equal", param, method.getParameters()[0]); ! assertEquals("param count should be 1", 1, method.getParameters().length); } --- 28,55 ---- CalledMethod method=m.expect(methodName); ! try { ! method.getParameters(); ! fail("Since verify was not called, CalledMethod methods should not work"); ! } catch(IllegalStateException e) { ! } ! //assertEquals("the methodName should be the same",methodName,method.getMethodName()); ! //assertEquals("params should equal", param, method.getParameters()[0]); ! //assertEquals("param count should be 1", 1, method.getParameters().length); ! } ! ! public void testNoVerifyCalled() throws Exception { ! MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! ListenerOne l=(ListenerOne)m; ! ! String methodName1 = "callMeFirst"; ! String methodName2="callMeSecond"; ! CalledMethod callMeFirst =m.expect(methodName1); ! CalledMethod callMeSecond=m.expect(methodName2); ! ! try { ! callMeFirst.getParameters(); ! fail("The method was not called yet and verify() was not called, so above should throw exceptoin"); ! } catch(IllegalStateException e) { ! } } *************** *** 50,54 **** assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); ! assertEquals("params should equal", param, callMeFirst.getParameters()[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); --- 71,76 ---- assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); ! Object[] array = callMeFirst.getParameters(); ! assertEquals("params should equal", param, array[0]); assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); |
From: Jay <ja...@us...> - 2006-02-05 10:30:19
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15513/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice MockObjectSuperImpl.java Log Message: for home Index: MockObjectSuperImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v retrieving revision 1.3.2.4 retrieving revision 1.3.2.5 diff -C2 -d -r1.3.2.4 -r1.3.2.5 *** MockObjectSuperImpl.java 18 Jan 2006 09:45:16 -0000 1.3.2.4 --- MockObjectSuperImpl.java 5 Feb 2006 10:30:03 -0000 1.3.2.5 *************** *** 17,20 **** --- 17,21 ---- private static final long DEFAULT_TIME_OUT = 10000; + private static int Index=0; /** *************** *** 22,26 **** */ private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>(); ! /** * A map of queues, containing objects to return when methods are called --- 23,34 ---- */ private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>(); ! /** ! * List of the methods been called ,and store them ! */ ! // private List<CalledMethod> calledMethodsStore=new LinkedList<CalledMethod>(); ! /** ! * List of the methods that have been expected ! */ ! private List<CalledMethod> methodsExpected=new LinkedList<CalledMethod>(); /** * A map of queues, containing objects to return when methods are called *************** *** 57,73 **** if (methodName == null) throw new IllegalArgumentException("methd name can not be null"); ! verify(); ! //waitForCalledMethod(methodName,DEFAULT_TIME_OUT); ! CalledMethod calledMethod=methodsCalled.remove(0); ! return calledMethod; } - //This class shows eclipse warnings....commented out to keep eclipse warnings at zero - // private void waitForCalledMethod(String methodName,long timeout) { - // // TODO Auto-generated method stub - // - // CalledMethod calledMethod=methodsCalled.remove(0); - // - // - // } public CalledMethod expect(Object returnValue, String methodName, --- 65,72 ---- if (methodName == null) throw new IllegalArgumentException("methd name can not be null"); ! CalledMethod calledMethod=new CalledMethodImpl(methodName); ! methodsExpected.add(calledMethod); ! return methodsExpected.get(Index++); } public CalledMethod expect(Object returnValue, String methodName, *************** *** 92,107 **** public void verify(){ ! // TODO Auto-generated method stub ! if(methodsCalled.size()<=0){ ! try { ! this.wait(DEFAULT_TIME_OUT); ! } catch (InterruptedException e) { ! e.getMessage(); } } - for(int i=0;i<methodsCalled.size();i++){ - CalledMethod calledMethod=methodsCalled.remove(0); - - } } --- 91,102 ---- public void verify(){ ! for(int i=0;i<methodsExpected.size();i++){ ! if(methodsExpected.get(i).getMethodName()==methodsCalled.get(i).getMethodName()){ ! ! methodsExpected.add(i,methodsCalled.get(i)); ! methodsExpected.remove(i+1); ! //continue; } } } *************** *** 141,151 **** params += array[array.length - 1]; } ! ! if (logger.isLoggable(Level.FINE)) ! logger.log(Level.FINE, "method called=" + methodName + "(" + params ! + ") on obj=" + this); String stackTrace="method Called="+methodName+"("+params+"on object"+this+")"; ! methodsCalled.add(new CalledMethodImpl(methodName,parameters,stackTrace)); ! this.notifyAll(); return getReturnValue(methodName); --- 136,146 ---- params += array[array.length - 1]; } ! String stackTrace="method Called="+methodName+"("+params+"on object"+this+")"; ! CalledMethod calledMethod=new CalledMethodImpl(methodName,parameters,stackTrace); ! methodsCalled.add(calledMethod); ! //calledMethodsStore.add(calledMethod); ! ! //this.notifyAll(); return getReturnValue(methodName); |
From: Jay <ja...@us...> - 2006-02-05 10:29:36
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15377/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice CalledMethodImpl.java Log Message: for home Index: CalledMethodImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/CalledMethodImpl.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** CalledMethodImpl.java 17 Jan 2006 07:58:27 -0000 1.1.2.2 --- CalledMethodImpl.java 5 Feb 2006 10:29:22 -0000 1.1.2.3 *************** *** 18,21 **** --- 18,26 ---- this.stackTrace=stackTrace; } + + public CalledMethodImpl(String methodName){ + this.methodName=methodName; + + } public String getMethodName() { |
From: Nobody <fas...@us...> - 2006-01-20 18:14:24
|
Update of /cvsroot/mocklib/mocklib2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14988 Modified Files: build Log Message: test autobuild tag. Index: build =================================================================== RCS file: /cvsroot/mocklib/mocklib2/build,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** build 20 Jan 2006 16:41:28 -0000 1.31 --- build 20 Jan 2006 18:14:13 -0000 1.32 *************** *** 1,5 **** - - - #************************************ # Generated file. Do not modify --- 1,2 ---- |
From: Nobody <fas...@us...> - 2006-01-20 16:41:35
|
Update of /cvsroot/mocklib/mocklib2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9968 Modified Files: build Log Message: test autobuild Index: build =================================================================== RCS file: /cvsroot/mocklib/mocklib2/build,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** build 18 Jan 2006 14:07:51 -0000 1.30 --- build 20 Jan 2006 16:41:28 -0000 1.31 *************** *** 1,2 **** --- 1,5 ---- + + + #************************************ # Generated file. Do not modify |
From: Nobody <fas...@us...> - 2006-01-18 14:08:00
|
Update of /cvsroot/mocklib/mocklib2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20958 Modified Files: build Log Message: trigger build Index: build =================================================================== RCS file: /cvsroot/mocklib/mocklib2/build,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** build 16 Jan 2006 15:23:17 -0000 1.29 --- build 18 Jan 2006 14:07:51 -0000 1.30 *************** *** 1,3 **** - #************************************ # Generated file. Do not modify --- 1,2 ---- |
From: Jay <ja...@us...> - 2006-01-18 09:45:40
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25727/input/javasrc/biz/xsoftware/mock2 Modified Files: Tag: branchForOffice MockObject.java Log Message: for home Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/MockObject.java,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -C2 -d -r1.2.2.3 -r1.2.2.4 *** MockObject.java 18 Jan 2006 01:46:29 -0000 1.2.2.3 --- MockObject.java 18 Jan 2006 09:45:32 -0000 1.2.2.4 *************** *** 143,148 **** * @param timeout * the time set for waitting the call */ ! public void verify(); /** --- 143,149 ---- * @param timeout * the time set for waitting the call + * @throws InterruptedException */ ! public void verify() throws InterruptedException; /** |
From: Jay <ja...@us...> - 2006-01-18 09:45:25
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25665/input/javasrc/biz/xsoftware/mock2/impl Modified Files: Tag: branchForOffice MockObjectSuperImpl.java Log Message: for home Index: MockObjectSuperImpl.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -C2 -d -r1.3.2.3 -r1.3.2.4 *** MockObjectSuperImpl.java 18 Jan 2006 01:46:29 -0000 1.3.2.3 --- MockObjectSuperImpl.java 18 Jan 2006 09:45:16 -0000 1.3.2.4 *************** *** 54,61 **** } ! public CalledMethod expect(String methodName, long timeout, Class... vargs) { if (methodName == null) throw new IllegalArgumentException("methd name can not be null"); ! verify(methodName,timeout); //waitForCalledMethod(methodName,DEFAULT_TIME_OUT); CalledMethod calledMethod=methodsCalled.remove(0); --- 54,61 ---- } ! public CalledMethod expect(String methodName, long timeout, Class... vargs){ if (methodName == null) throw new IllegalArgumentException("methd name can not be null"); ! verify(); //waitForCalledMethod(methodName,DEFAULT_TIME_OUT); CalledMethod calledMethod=methodsCalled.remove(0); *************** *** 89,99 **** } - private void verify(String method, long timeout) { - - } ! public void verify() { // TODO Auto-generated method stub ! } --- 89,107 ---- } ! ! public void verify(){ // TODO Auto-generated method stub ! if(methodsCalled.size()<=0){ ! try { ! this.wait(DEFAULT_TIME_OUT); ! } catch (InterruptedException e) { ! e.getMessage(); ! } ! } ! for(int i=0;i<methodsCalled.size();i++){ ! CalledMethod calledMethod=methodsCalled.remove(0); ! ! } } |
From: Jay <ja...@us...> - 2006-01-18 09:45:20
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25564/input/javasrc/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: for home Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** TestMockCreator.java 18 Jan 2006 03:42:56 -0000 1.1.2.6 --- TestMockCreator.java 18 Jan 2006 09:45:09 -0000 1.1.2.7 *************** *** 33,60 **** } ! // public void testTwoMethods() throws Exception { ! // MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! // ListenerOne l=(ListenerOne)m; ! // ! // String methodName1 = "callMeFirst"; ! // String methodName2="callMeSecond"; ! // CalledMethod callMeFirst =m.expect(methodName1); ! // CalledMethod callMeSecond=m.expect(methodName2); ! // ! // int var1 = 4; ! // l.callMeFirst(var1); ! // String param="some params"; ! // l.callMeSecond(param); ! // ! // m.verify(); ! // ! // assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); ! // assertEquals("params should equal", param, callMeFirst.getParameters()[0]); ! // assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); ! // ! // assertEquals("the methodName should be the same",methodName2,callMeSecond.getMethodName()); ! // assertEquals("params should equal", param, callMeSecond.getParameters()[0]); ! // assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); ! // } // public void testTwoMethodsOnThread() throws Exception { --- 33,60 ---- } ! public void testTwoMethods() throws Exception { ! MockObject m = MockObjectFactory.createMock(ListenerOne.class); ! ListenerOne l=(ListenerOne)m; ! ! String methodName1 = "callMeFirst"; ! String methodName2="callMeSecond"; ! CalledMethod callMeFirst =m.expect(methodName1); ! CalledMethod callMeSecond=m.expect(methodName2); ! ! int var1 = 4; ! l.callMeFirst(var1); ! String param="some params"; ! l.callMeSecond(param); ! ! m.verify(); ! ! assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); ! assertEquals("params should equal", param, callMeFirst.getParameters()[0]); ! assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); ! ! assertEquals("the methodName should be the same",methodName2,callMeSecond.getMethodName()); ! assertEquals("params should equal", param, callMeSecond.getParameters()[0]); ! assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); ! } // public void testTwoMethodsOnThread() throws Exception { |
From: Nobody <fas...@us...> - 2006-01-18 03:43:04
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6623/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: add another test case. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** TestMockCreator.java 18 Jan 2006 03:38:10 -0000 1.1.2.5 --- TestMockCreator.java 18 Jan 2006 03:42:56 -0000 1.1.2.6 *************** *** 1,4 **** --- 1,7 ---- package biz.xsoftware.test.mock2; + import java.util.logging.Level; + import java.util.logging.Logger; + import junit.framework.TestCase; import biz.xsoftware.mock2.CalledMethod; *************** *** 8,11 **** --- 11,16 ---- public class TestMockCreator extends TestCase { + private static final Logger log = Logger.getLogger(TestMockCreator.class.getName()); + public TestMockCreator(String name){ super(name); *************** *** 52,55 **** --- 57,102 ---- // assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); // } + + // public void testTwoMethodsOnThread() throws Exception { + // MockObject m = MockObjectFactory.createMock(ListenerOne.class); + // final ListenerOne l = (ListenerOne) m; + // + // String methodName1 = "callMeFirst"; + // String methodName2 = "callMeSecond"; + // CalledMethod callMeFirst = m.expect(methodName1); + // CalledMethod callMeSecond = m.expect(methodName2); + // + // final int var1 = 4; + // final String param = "some params"; + // Thread t = new Thread() { + // public void run() { + // try { + // Thread.sleep(1000); + // l.callMeFirst(var1); + // l.callMeSecond(param); + // } catch (Exception e) { + // log.log(Level.WARNING, "exception", e); + // throw new RuntimeException(e); + // } + // } + // }; + // t.start(); + // + // m.verify(); + // + // assertEquals("the methodName should be the same", methodName1, + // callMeFirst.getMethodName()); + // assertEquals("params should equal", param, + // callMeFirst.getParameters()[0]); + // assertEquals("param count should be 1", 1, + // callMeFirst.getParameters().length); + // + // assertEquals("the methodName should be the same", methodName2, + // callMeSecond.getMethodName()); + // assertEquals("params should equal", param, + // callMeSecond.getParameters()[0]); + // assertEquals("param count should be 1", 1, + // callMeSecond.getParameters().length); + // } // public void testFailure() throws Exception { |
From: Nobody <fas...@us...> - 2006-01-18 03:38:20
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4805/biz/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: add another test case. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** TestMockCreator.java 18 Jan 2006 01:46:29 -0000 1.1.2.4 --- TestMockCreator.java 18 Jan 2006 03:38:10 -0000 1.1.2.5 *************** *** 28,31 **** --- 28,56 ---- } + // public void testTwoMethods() throws Exception { + // MockObject m = MockObjectFactory.createMock(ListenerOne.class); + // ListenerOne l=(ListenerOne)m; + // + // String methodName1 = "callMeFirst"; + // String methodName2="callMeSecond"; + // CalledMethod callMeFirst =m.expect(methodName1); + // CalledMethod callMeSecond=m.expect(methodName2); + // + // int var1 = 4; + // l.callMeFirst(var1); + // String param="some params"; + // l.callMeSecond(param); + // + // m.verify(); + // + // assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName()); + // assertEquals("params should equal", param, callMeFirst.getParameters()[0]); + // assertEquals("param count should be 1", 1, callMeFirst.getParameters().length); + // + // assertEquals("the methodName should be the same",methodName2,callMeSecond.getMethodName()); + // assertEquals("params should equal", param, callMeSecond.getParameters()[0]); + // assertEquals("param count should be 1", 1, callMeSecond.getParameters().length); + // } + // public void testFailure() throws Exception { // MockObject m = MockObjectFactory.createMock(ListenerOne.class); |
From: Nobody <fas...@us...> - 2006-01-18 01:53:50
|
Update of /cvsroot/mocklib/mocklib2/bldfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6337/bldfiles Modified Files: Tag: branchForOffice design.xml Log Message: rename impl for version 1 in design to apiAndImpl as that is what it was. Index: design.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib2/bldfiles/design.xml,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** design.xml 18 Jan 2006 01:51:26 -0000 1.2.2.2 --- design.xml 18 Jan 2006 01:53:41 -0000 1.2.2.3 *************** *** 15,27 **** <!-- should use something like this instead on a per project basis --> ! <package name="impl" package="biz.xsoftware.mock"> <depends>junit</depends> </package> <package name="testapi" package="biz.xsoftware.test.mock" subpackages="include"> ! <depends>impl</depends> <depends>junit</depends> </package> <package name="examples" package="biz.xsoftware.examples" subpackages="include"> ! <depends>impl</depends> <depends>junit</depends> </package> --- 15,27 ---- <!-- should use something like this instead on a per project basis --> ! <package name="apiAndImpl" package="biz.xsoftware.mock"> <depends>junit</depends> </package> <package name="testapi" package="biz.xsoftware.test.mock" subpackages="include"> ! <depends>apiAndImpl</depends> <depends>junit</depends> </package> <package name="examples" package="biz.xsoftware.examples" subpackages="include"> ! <depends>apiAndImpl</depends> <depends>junit</depends> </package> |
From: Nobody <fas...@us...> - 2006-01-18 01:51:34
|
Update of /cvsroot/mocklib/mocklib2/bldfiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5728/bldfiles Modified Files: Tag: branchForOffice design.xml Log Message: fix design so impl2 only depends on api2 instead of allowing impl2 to depend on anything. Index: design.xml =================================================================== RCS file: /cvsroot/mocklib/mocklib2/bldfiles/design.xml,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** design.xml 17 Jan 2006 07:59:32 -0000 1.2.2.1 --- design.xml 18 Jan 2006 01:51:26 -0000 1.2.2.2 *************** *** 27,36 **** </package> ! <package name="impl2" package="biz.xsoftware.mock2.impl" needdepends="false"/> ! <package name="api2" package="biz.xsoftware.mock2"> ! <!-- is depending on junit a good idea???? it makes it easier to prevent ! people from forgetting to call verify but also locks us to use junit more ! but junit is pretty standard now --> ! <depends>junit</depends> </package> <package name="testapi2" package="biz.xsoftware.test.mock2" subpackages="include"> --- 27,33 ---- </package> ! <package name="api2" package="biz.xsoftware.mock2"/> ! <package name="impl2" package="biz.xsoftware.mock2.impl"> ! <depends>api2</depends> </package> <package name="testapi2" package="biz.xsoftware.test.mock2" subpackages="include"> |
From: Nobody <fas...@us...> - 2006-01-18 01:46:43
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4274/xsoftware/test/mock2 Modified Files: Tag: branchForOffice TestMockCreator.java Log Message: change back api to original api. api is agreed upon by C# and Java impl, and we should discuss if changes are needed. We are 90% sure no changes to the api are needed. Index: TestMockCreator.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** TestMockCreator.java 18 Jan 2006 01:37:20 -0000 1.1.2.3 --- TestMockCreator.java 18 Jan 2006 01:46:29 -0000 1.1.2.4 *************** *** 1,9 **** package biz.xsoftware.test.mock2; import biz.xsoftware.mock2.CalledMethod; - import biz.xsoftware.mock2.Messages; import biz.xsoftware.mock2.MockObject; import biz.xsoftware.mock2.MockObjectFactory; - import junit.framework.TestCase; public class TestMockCreator extends TestCase { --- 1,8 ---- package biz.xsoftware.test.mock2; + import junit.framework.TestCase; import biz.xsoftware.mock2.CalledMethod; import biz.xsoftware.mock2.MockObject; import biz.xsoftware.mock2.MockObjectFactory; public class TestMockCreator extends TestCase { |
From: Nobody <fas...@us...> - 2006-01-18 01:46:43
|
Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4274/xsoftware/mock2 Modified Files: Tag: branchForOffice MockObject.java Log Message: change back api to original api. api is agreed upon by C# and Java impl, and we should discuss if changes are needed. We are 90% sure no changes to the api are needed. Index: MockObject.java =================================================================== RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/MockObject.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** MockObject.java 17 Jan 2006 07:58:27 -0000 1.2.2.2 --- MockObject.java 18 Jan 2006 01:46:29 -0000 1.2.2.3 *************** *** 144,148 **** * the time set for waitting the call */ ! public void verify(String methodName,long timeout); /** --- 144,148 ---- * the time set for waitting the call */ ! public void verify(); /** |