Revert "Went towards beta version of wiremock"

This reverts commit 0021a0dd70.
This commit is contained in:
Marcin Grzejszczak
2015-08-30 20:44:44 +02:00
parent 0021a0dd70
commit ca2c051ea2
4 changed files with 19 additions and 16 deletions

View File

@@ -25,29 +25,30 @@ class WireMockResponseStubStrategy extends BaseWireMockStubStrategy {
@PackageScope
ResponseDefinition buildClientResponseContent() {
int status = response.status.clientValue as Integer
HttpHeaders httpHeaders = getHttpHeaders()
String body = getBody()
return new ResponseDefinition(status, body as String, null, null, null, httpHeaders, null, null, null, null, null)
ResponseDefinition responseDefinition = new ResponseDefinition()
responseDefinition.setStatus(response.status.clientValue as Integer)
appendHeaders(responseDefinition)
appendBody(responseDefinition)
return responseDefinition
}
private HttpHeaders getHttpHeaders() {
private void appendHeaders(ResponseDefinition responseDefinition) {
if(!(response.headers)) {
return null
return
}
return new HttpHeaders(response.headers.entries?.collect { new HttpHeader(it.name, it.clientValue.toString()) })
responseDefinition.setHeaders(new HttpHeaders(response.headers.entries?.collect { new HttpHeader(it.name, it.clientValue.toString()) }))
}
private String getBody() {
private void appendBody(ResponseDefinition responseDefinition) {
if (!response.body) {
return null
return
}
Object body = response.body.clientValue
ContentType contentType = recognizeContentTypeFromHeader(response.headers)
if (contentType == ContentType.UNKNOWN) {
contentType = recognizeContentTypeFromContent(body)
}
return parseBody(body, contentType)
responseDefinition.setBody(parseBody(body, contentType))
}

View File

@@ -1,4 +1,5 @@
package io.codearte.accurest.plugin
import io.codearte.accurest.config.AccurestConfigProperties
import org.gradle.api.Plugin
import org.gradle.api.Project
@@ -29,9 +30,11 @@ class AccurestGradlePlugin implements Plugin<Project> {
createGenerateTestsTask(extension)
createAndConfigureGenerateWireMockClientStubsFromDslTask(extension)
deprecatedCreateAndConfigureGenerateWiremockClientStubsFromDslTask()
project.dependencies.add("testCompile", "io.codearte.accurest:accurest-core:+")
project.dependencies.add("testCompile", "com.blogspot.toomuchcoding:wiremock:0.0.1")
project.repositories { jcenter() }
project.configurations {
all {
exclude group: 'org.glassfish.jersey.jetty', module: 'jetty-server'
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.github.tomakehurst' && details.requested.name == "wiremock") {
@@ -42,6 +45,7 @@ class AccurestGradlePlugin implements Plugin<Project> {
}
}
project.afterEvaluate {
def hasIdea = project.plugins.findPlugin(IDEA_PLUGIN_CLASS)
if (hasIdea) {

View File

@@ -94,9 +94,7 @@ project(':accurest-core') {
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.5'
compile 'asm:asm:3.3.1'
compile('com.github.tomakehurst:wiremock:2.0.0-beta') {
exclude group: 'org.mortbay.jetty', module: 'servlet-api'
}
compile 'com.blogspot.toomuchcoding:wiremock:0.0.1'
testCompile 'cglib:cglib-nodep:2.2'
testCompile 'org.objenesis:objenesis:2.1'
testCompile 'org.skyscreamer:jsonassert:1.2.3'
@@ -110,7 +108,7 @@ project(':accurest-converters') {
compile 'org.apache.commons:commons-lang3:[3.0,)'
compile 'commons-io:commons-io:[2.0,)'
compile 'dk.brics.automaton:automaton:1.11-8' // needed for Xeger
testCompile 'com.github.tomakehurst:wiremock:2.0.0-beta'
testCompile 'com.blogspot.toomuchcoding:wiremock:0.0.1'
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
}

View File

@@ -12,7 +12,7 @@ task sourcesJar(type: Jar) {
}
artifacts {
archives javadocJar, sourcesJar
archives javadocJar, sourcesJar, repackagedJar
}
signing {