Letractively / aost

Automatically exported from code.google.com/p/aost
Other
1 stars 0 forks source link

Errors using the MockHttpServer #243

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

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.

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 12 Aug 2009 at 5:40

GoogleCodeExporter commented 8 years ago
There is a typo in the MockHttpServer class. Fixed it.

Original comment by John.Jian.Fang@gmail.com on 12 Aug 2009 at 5:46