Integration tests in groovy, another problem (which is probably operator error)

37 views
Skip to first unread message

Jez P

unread,
Mar 27, 2013, 2:29:58 PM3/27/13
to ve...@googlegroups.com
I seem to have run into a very weird-looking problem.

Pulled down the vertx gradle template to create a new project, ran 
./gradlew test to make sure it all worked, all well and good

I then went and modified the canned "mytest.groovy" integration test script in a completely trivial manner, I replaced test_1 with the following method

def test_trivialRequestResponse() {
    def test = vertx.createHttpServer()
    vertx.createHttpServer().requestHandler({req ->
        println("HELLO")
        req.response.end "DUMMY RESPONSE"
    }).listen(8080)

  assertEquals("foo", "foo")
  testComplete()
}

I know this won't do anything because the http server will be stopped as soon as it's started, but I just wanted to check it got through that test ok, ran ./gradlew test again and I get the following error:-

com.mycompany.myproject.test.integration.groovy.GroovyIntegrationTests > src/test/resources/integration_tests/groovy/mytest.groovy#test_trivialRequestResponse STANDARD_ERROR
    Mar 27, 2013 6:11:03 PM org.vertx.java.core.logging.impl.JULLogDelegate info
    INFO: Downloading io.vertx~lang-groovy~1.0.0-SNAPSHOT. Please wait...
    Mar 27, 2013 6:11:24 PM org.vertx.java.core.logging.impl.JULLogDelegate info
    INFO: Module io.vertx~lang-groovy~1.0.0-SNAPSHOT successfully installed
    Mar 27, 2013 6:11:25 PM org.vertx.java.core.logging.impl.JULLogDelegate error
    SEVERE: Exception in Groovy verticle
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at org.vertx.groovy.platform.impl.GroovyVerticleFactory$1.start(GroovyVerticleFactory.groovy:93)
    at org.vertx.java.platform.Verticle.start(Verticle.java:82)
    at org.vertx.java.platform.impl.DefaultPlatformManager$11.run(DefaultPlatformManager.java:1177)
    at org.vertx.java.core.impl.Context$1.run(Context.java:126)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:328)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:331)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:109)
    at java.lang.Thread.run(Thread.java:722)
    Caused by: groovy.lang.MissingMethodException: No signature of method: org.vertx.java.core.http.impl.DefaultHttpServer.requestHandler() is applicable for argument types: (mytest$_test_trivialRequestResponse_closure1) values: [mytest$_test_trivialRequestResponse_closure1@7d89a87b]

This looks as the the call to createHttpServer is not returning an instance of org.vertx.groovy.core.http.HttpServer, however, by sticking a breakpoint in and debugging GroovyIntegrationTests as a JUnit test  it seems that the vertx reference is correctly pointing at an instance of org.vertx.groovy.core.Vertx, and its createHttpServer method should return org.vertx.groovy.core.http.HttpServer (presumably the groovy equivalent of the java DefaultHttpServer, which is what it appears to be returning). 

Is there something blindingly obvious that I'm missing? I'm assuming it should be ok to make calls against the vertx property of the test script. I'm happy to zip up the sample for review.

Cheers for all insights

Jez
Reply all
Reply to author
Forward
0 new messages