Thanks Jain all working now. I'm using this feature in 2 ways, to mock our middle tier by adding JSON responses to a mocked page, and to get ahead of the developers by creating component tests against an "unwritten" page. Very useful!
On Aug 12, 6:45 pm, Jian Fang <[email protected]> wrote: > There is a typo in the MockHttpServer class. I just fixed. Please update the > new jars from our Maven > repo. > > The UserModuleTestCase in core is created based on your sample code and it > works. > > Thanks, > > Jian > > On Wed, Aug 12, 2009 at 5:59 AM, dominicm <[email protected]>wrote: > > > > > > > Hi, > > > I'm trying to use the MockHttp server function ad get the following > > errors: > > > 1. When attempting to use "registerHtml" an exception is thrown - > > Caused by: java.lang.ClassCastException: > > org.tellurium.test.mock.MockHttpHandler cannot be cast to > > java.lang.Comparable > > at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createRange > > (ScriptBytecodeAdapter.java:653) > > at org.tellurium.test.mock.MockHttpHandler.registerHtml > > (MockHttpHandler.groovy:53) > > at org.tellurium.test.mock.MockHttpHandler$registerHtml.call(Unknown > > Source) > > at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall > > (CallSiteArray.java:43) > > at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call > > (AbstractCallSite.java:117) > > at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call > > (AbstractCallSite.java:129) > > at org.tellurium.test.mock.MockHttpServer.registerHtml > > (MockHttpServer.groovy:50) > > at com.betfair.www.website.methods.web.MockMethod.getMockData > > (MockMethod.java:41) > > > Code is as follows: > > > server = new MockHttpServer(8080); > > server.registerHtml("/mockFunction.do", MockObject.RESP_HEADER); > > > public static String RESP_HEADER = """ > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > > "http://www.w3.org/TR/html4/loose.dtd"> > > <html> > > <head> > > <title>Mock HTTP Server</title> > > </head> > > <body> > > BODY_HTML_SOURCE > > </body> > > </html> > > """ > > > This is identical to the default value but still fails. Everything > > works if I leave the header template as default. > > > 2. When stopping the server I get - > > > Caused by: java.lang.IllegalArgumentException > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at sun.reflect.NativeMethodAccessorImpl.invoke > > (NativeMethodAccessorImpl.java:39) > > at sun.reflect.DelegatingMethodAccessorImpl.invoke > > (DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite > > $PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:188) > > at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call > > (PojoMetaMethodSite.java:52) > > at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall > > (CallSiteArray.java:43) > > at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call > > (AbstractCallSite.java:117) > > at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call > > (AbstractCallSite.java:121) > > at > > org.tellurium.test.mock.MockHttpServer.stop(MockHttpServer.groovy: > > 65) > > at com.betfair.www.website.methods.web.MockMethod.getMockData > > (MockMethod.java:62) > > > This happens every time the stop function is called even if execution > > was fine until then. > > > Any help much appreciated. > > > Thanks- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en -~----------~----~----~----~------~----~------~--~---
