Skip to content

Commit

Permalink
WIP grails 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Cavestro committed Jun 12, 2014
1 parent a663681 commit 0de7e2e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions JaxrsGrailsPlugin.groovy
Expand Up @@ -11,8 +11,8 @@ import static org.grails.jaxrs.web.JaxrsUtils.JAXRS_CONTEXT_NAME

class JaxrsGrailsPlugin {
def groupId = "org.grails.plugins"
def version = "0.10"
def grailsVersion = "2.3 > *"
def version = "0.11-SNAPSHOT"
def grailsVersion = "2.4 > *"
def pluginExcludes = [
"grails-app/domain/*",
"grails-app/providers/*",
Expand Down
6 changes: 3 additions & 3 deletions application.properties
@@ -1,5 +1,5 @@
#Grails Metadata file
#Sun Sep 29 08:45:20 IDT 2013
app.grails.version=2.3.5
#Thu Jun 12 18:00:09 CEST 2014
app.grails.version=2.4.0
app.name=JaxrsGrailsPlugin
app.servlet.version=2.5
app.name=JaxrsGrailsPlugin
24 changes: 20 additions & 4 deletions src/groovy/org/grails/jaxrs/itest/IntegrationTestCase.groovy
Expand Up @@ -15,7 +15,7 @@
*/
package org.grails.jaxrs.itest

import org.codehaus.groovy.grails.commons.ApplicationHolder
import grails.util.Holders
import org.codehaus.groovy.grails.test.support.GrailsTestAutowirer
import org.grails.jaxrs.JaxrsController
import org.junit.Before
Expand All @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse
*/
abstract class IntegrationTestCase implements JaxRsIntegrationTest {

private applicationContext = ApplicationHolder.application.mainContext
private applicationContext = Holders.grailsApplication.mainContext
private autowirer = new GrailsTestAutowirer(applicationContext)

def grailsApplication
Expand Down Expand Up @@ -94,15 +94,31 @@ abstract class IntegrationTestCase implements JaxRsIntegrationTest {
}

@Override
HttpServletResponse sendRequest(String url, String method, byte[] content = ''.bytes) {
HttpServletResponse sendRequest(String url, String method, byte[] content) {
defaultMixin.sendRequest(url, method, content)
}

/*
* overloaded version of sendRequest: since default params are not always compatible with Override,
* the method must be redeclared explicitly, see https://jira.codehaus.org/browse/GROOVY-5413
*/
HttpServletResponse sendRequest(String url, String method) {
defaultMixin.sendRequest(url, method, ''.bytes)
}

@Override
HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers, byte[] content = ''.bytes) {
HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers, byte[] content) {
defaultMixin.sendRequest(url, method, headers, content)
}

/*
* overloaded version of sendRequest: since default params are not always compatible with Override,
* the method must be redeclared explicitly, see https://jira.codehaus.org/browse/GROOVY-5413
*/
HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers) {
defaultMixin.sendRequest(url, method, headers, ''.bytes)
}

@Override
String getContextLocations() {
defaultMixin.contextLocations
Expand Down
Expand Up @@ -20,7 +20,7 @@ import grails.spring.BeanBuilder
import javax.servlet.ServletContextEvent
import javax.servlet.ServletContextListener

import org.codehaus.groovy.grails.commons.ApplicationHolder
import grails.util.Holders
import org.codehaus.groovy.grails.commons.GrailsApplication
import org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext
import org.grails.jaxrs.ProviderArtefactHandler
Expand Down Expand Up @@ -56,7 +56,7 @@ class IntegrationTestEnvironment {

synchronized JaxrsContext getJaxrsContext() {
if (!jaxrsContext) {
GrailsApplication application = ApplicationHolder.application
GrailsApplication application = Holders.grailsApplication
GrailsWebApplicationContext applicationContext = application.mainContext

BeanBuilder beanBuilder = new BeanBuilder(applicationContext)
Expand Down
12 changes: 10 additions & 2 deletions src/groovy/org/grails/jaxrs/itest/IntegrationTestSpec.groovy
Expand Up @@ -72,15 +72,23 @@ abstract class IntegrationTestSpec extends IntegrationSpec implements JaxRsInteg
}

@Override
HttpServletResponse sendRequest(String url, String method, byte[] content = ''.bytes) {
HttpServletResponse sendRequest(String url, String method, byte[] content) {
defaultMixin.sendRequest(url, method, content)
}

HttpServletResponse sendRequest(String url, String method) {
defaultMixin.sendRequest(url, method, ''.bytes)
}

@Override
HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers, byte[] content = ''.bytes) {
HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers, byte[] content) {
defaultMixin.sendRequest(url, method, headers, content)
}

HttpServletResponse sendRequest(String url, String method, Map<String, Object> headers) {
defaultMixin.sendRequest(url, method, headers, ''.bytes)
}

@Override
String getContextLocations() {
defaultMixin.contextLocations
Expand Down

0 comments on commit 0de7e2e

Please sign in to comment.