From d7a9b93f68046a8b3f1385528a987dc60cfbf870 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Thu, 18 Jun 2020 09:05:07 +1000 Subject: [PATCH] refactor: more some more Groovy code to Kotlin --- ...aseBuilder.groovy => GroovyBuilder.groovy} | 5 +- .../consumer/groovy/PactBodyBuilder.groovy | 8 +-- .../pact/consumer/groovy/PactBuilder.groovy | 31 +---------- .../messaging/PactMessageBuilder.groovy | 4 +- .../dius/pact/consumer/groovy/BaseBuilder.kt | 51 ++++++++++++++++++ .../consumer/groovy/BinaryFileSpec.groovy | 40 ++++++++++++++ consumer/groovy/src/test/resources/sample.pdf | Bin 0 -> 7498 bytes .../junit5/BinaryFileProviderTest.groovy | 6 +++ 8 files changed, 103 insertions(+), 42 deletions(-) rename consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/{BaseBuilder.groovy => GroovyBuilder.groovy} (69%) create mode 100644 consumer/groovy/src/main/kotlin/au/com/dius/pact/consumer/groovy/BaseBuilder.kt create mode 100644 consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/BinaryFileSpec.groovy create mode 100644 consumer/groovy/src/test/resources/sample.pdf diff --git a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/BaseBuilder.groovy b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/GroovyBuilder.groovy similarity index 69% rename from consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/BaseBuilder.groovy rename to consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/GroovyBuilder.groovy index db6c6adc60..4009785092 100644 --- a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/BaseBuilder.groovy +++ b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/GroovyBuilder.groovy @@ -3,9 +3,7 @@ package au.com.dius.pact.consumer.groovy /** * Base class for builders */ -class BaseBuilder extends Matchers { - public static final List COMPACT_MIME_TYPES = ['application/x-thrift+json'] - +class GroovyBuilder extends BaseBuilder { def call(Closure closure) { build(closure) } @@ -15,5 +13,4 @@ class BaseBuilder extends Matchers { closure.resolveStrategy = Closure.DELEGATE_FIRST closure.call() } - } diff --git a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilder.groovy b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilder.groovy index c7334420db..d1024dd4fc 100755 --- a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilder.groovy +++ b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBodyBuilder.groovy @@ -18,7 +18,7 @@ import static au.com.dius.pact.core.model.PathExpressionsKt.PATH_SPECIAL_CHARS /** * DSL Builder for constructing JSON bodies */ -class PactBodyBuilder extends BaseBuilder { +class PactBodyBuilder extends GroovyBuilder { public static final String PATH_SEP = '.' public static final String START_LIST = '[' @@ -45,11 +45,7 @@ class PactBodyBuilder extends BaseBuilder { } private boolean shouldPrettyPrint() { - prettyPrintBody == null && !compactMimeType() || prettyPrintBody - } - - private boolean compactMimeType() { - mimetype in COMPACT_MIME_TYPES + prettyPrintBody == null && (mimetype != null && !isCompactMimeType(mimetype) || mimetype == null) || prettyPrintBody } def methodMissing(String name, args) { diff --git a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBuilder.groovy b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBuilder.groovy index 6dfdaad46b..d3ab9c7cef 100644 --- a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBuilder.groovy +++ b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/PactBuilder.groovy @@ -23,7 +23,6 @@ import au.com.dius.pact.core.model.matchingrules.MatchingRules import au.com.dius.pact.core.model.matchingrules.MatchingRulesImpl import au.com.dius.pact.core.model.matchingrules.RegexMatcher import au.com.dius.pact.core.support.expressions.DataType -import groovy.json.JsonBuilder import groovy.transform.CompileStatic import org.apache.http.entity.ContentType import org.apache.http.entity.mime.HttpMultipartMode @@ -37,13 +36,7 @@ import static au.com.dius.pact.consumer.ConsumerPactRunnerKt.runConsumerTest * Builder DSL for Pact tests */ @SuppressWarnings('PropertyName') -class PactBuilder extends BaseBuilder { - - private static final String CONTENT_TYPE = 'Content-Type' - private static final String JSON = 'application/json' - private static final String BODY = 'body' - private static final String LOCALHOST = 'localhost' - public static final String HEADER = 'header' +class PactBuilder extends GroovyBuilder { Consumer consumer Provider provider @@ -232,24 +225,6 @@ class PactBuilder extends BaseBuilder { this } - private setupBody(Map requestData, Map request) { - if (requestData.containsKey(BODY)) { - def body = requestData.body - if (body instanceof PactBodyBuilder) { - request.body = body.body - request.matchers.addCategory(body.matchers) - request.generators.addGenerators(body.generators) - } else if (body != null && !(body instanceof String)) { - - if (requestData.prettyPrint == null && !compactMimeTypes(requestData) || requestData.prettyPrint) { - request.body = new JsonBuilder(body).toPrettyString() - } else { - request.body = new JsonBuilder(body).toString() - } - } - } - } - /** * Defines the response attributes (body, headers, etc.) that are returned for the request * @param responseData Map of attributes @@ -264,10 +239,6 @@ class PactBuilder extends BaseBuilder { this } - private static boolean compactMimeTypes(Map reqResData) { - reqResData.headers && reqResData.headers[CONTENT_TYPE] in COMPACT_MIME_TYPES - } - /** * Allows the body to be defined using a Groovy builder pattern * @param options The following options are available: diff --git a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilder.groovy b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilder.groovy index 3754c35182..20513b57e9 100644 --- a/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilder.groovy +++ b/consumer/groovy/src/main/groovy/au/com/dius/pact/consumer/groovy/messaging/PactMessageBuilder.groovy @@ -1,7 +1,7 @@ package au.com.dius.pact.consumer.groovy.messaging import au.com.dius.pact.consumer.PactConsumerConfig -import au.com.dius.pact.consumer.groovy.BaseBuilder +import au.com.dius.pact.consumer.groovy.GroovyBuilder import au.com.dius.pact.consumer.groovy.Matcher import au.com.dius.pact.consumer.groovy.PactBodyBuilder import au.com.dius.pact.core.model.Consumer @@ -17,7 +17,7 @@ import au.com.dius.pact.core.model.messaging.MessagePact /** * Pact builder for consumer tests for messaging */ -class PactMessageBuilder extends BaseBuilder { +class PactMessageBuilder extends GroovyBuilder { Consumer consumer Provider provider List providerStates = [] diff --git a/consumer/groovy/src/main/kotlin/au/com/dius/pact/consumer/groovy/BaseBuilder.kt b/consumer/groovy/src/main/kotlin/au/com/dius/pact/consumer/groovy/BaseBuilder.kt new file mode 100644 index 0000000000..d8f39a3c73 --- /dev/null +++ b/consumer/groovy/src/main/kotlin/au/com/dius/pact/consumer/groovy/BaseBuilder.kt @@ -0,0 +1,51 @@ +package au.com.dius.pact.consumer.groovy + +import au.com.dius.pact.core.model.generators.Generators +import au.com.dius.pact.core.model.matchingrules.Category +import au.com.dius.pact.core.model.matchingrules.MatchingRules +import au.com.dius.pact.core.support.property +import groovy.json.JsonBuilder +import mu.KLogging + +open class BaseBuilder : Matchers() { + protected fun setupBody(requestData: Map, request: MutableMap) { + if (requestData.containsKey(BODY)) { + val body = requestData[BODY] + if (body != null && body::class.qualifiedName == "au.com.dius.pact.consumer.groovy.PactBodyBuilder") { + request[BODY] = body::class.property(BODY)?.get(body) as Any + val matchers = request["matchers"] as MatchingRules + matchers.addCategory(body::class.property("matchers")?.get(body) as Category) + val generators = request["generators"] as Generators + generators.addGenerators(body::class.property("generators")?.get(body) as Generators) + } else if (body != null && body !is String) { + val prettyPrint = requestData["prettyPrint"] as Boolean? + if (prettyPrint == null && !compactMimeTypes(requestData) || prettyPrint == true) { + request[BODY] = JsonBuilder(body).toPrettyString() + } else { + request[BODY] = JsonBuilder(body).toString() + } + } + } + } + + companion object : KLogging() { + const val CONTENT_TYPE = "Content-Type" + const val JSON = "application/json" + const val BODY = "body" + const val LOCALHOST = "localhost" + const val HEADER = "header" + + val COMPACT_MIME_TYPES = listOf("application/x-thrift+json") + + @JvmStatic + fun compactMimeTypes(reqResData: Map): Boolean { + return if (reqResData.containsKey("headers")) { + val headers = reqResData["headers"] as Map + headers.entries.find { it.key == CONTENT_TYPE }?.value in COMPACT_MIME_TYPES + } else false + } + + @JvmStatic + fun isCompactMimeType(mimetype: String) = mimetype in COMPACT_MIME_TYPES + } +} diff --git a/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/BinaryFileSpec.groovy b/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/BinaryFileSpec.groovy new file mode 100644 index 0000000000..bf76007afd --- /dev/null +++ b/consumer/groovy/src/test/groovy/au/com/dius/pact/consumer/groovy/BinaryFileSpec.groovy @@ -0,0 +1,40 @@ +package au.com.dius.pact.consumer.groovy + +import au.com.dius.pact.consumer.MockServer +import au.com.dius.pact.consumer.PactVerificationResult +import org.apache.http.client.methods.RequestBuilder +import org.apache.http.impl.client.CloseableHttpClient +import org.apache.http.impl.client.HttpClients +import spock.lang.Ignore +import spock.lang.Specification + +@Ignore +class BinaryFileSpec extends Specification { + + def 'handles bodies from form posts'() { + given: + def pdf = BinaryFileSpec.getResourceAsStream('/sample.pdf').bytes + def service = new PactBuilder() + service { + serviceConsumer 'Consumer' + hasPactWith 'File Service' + uponReceiving('a multipart file POST') + withAttributes(path: '/get-doco') + willRespondWith(status: 200, body: pdf, headers: ['Content-Type': 'application/pdf']) + } + + when: + def result = service.runTest { MockServer mockServer, context -> + CloseableHttpClient httpclient = HttpClients.createDefault() + def response = httpclient.withCloseable { + def request = RequestBuilder.get(mockServer.url + '/get-doco').build() + httpclient.execute(request) + } + assert response.statusLine.statusCode == 200 + assert response.entity.contentLength == pdf.size() + } + + then: + result instanceof PactVerificationResult.Ok + } +} diff --git a/consumer/groovy/src/test/resources/sample.pdf b/consumer/groovy/src/test/resources/sample.pdf new file mode 100644 index 0000000000000000000000000000000000000000..aac7901f4e16ba286a0e60a7d1fbe0297194c41e GIT binary patch literal 7498 zcm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_FB z;YfrK8X<)gg2T`dw3HMYB}GEgJ(Qr7te_Mbgf4iDGyZo-(GV!9bqbPElLh<_lUz`Y literal 0 HcmV?d00001 diff --git a/provider/junit5/src/test/groovy/au/com/dius/pact/provider/junit5/BinaryFileProviderTest.groovy b/provider/junit5/src/test/groovy/au/com/dius/pact/provider/junit5/BinaryFileProviderTest.groovy index d56131e004..078bea87ae 100644 --- a/provider/junit5/src/test/groovy/au/com/dius/pact/provider/junit5/BinaryFileProviderTest.groovy +++ b/provider/junit5/src/test/groovy/au/com/dius/pact/provider/junit5/BinaryFileProviderTest.groovy @@ -4,6 +4,7 @@ import au.com.dius.pact.provider.junitsupport.Provider import au.com.dius.pact.provider.junitsupport.loader.PactFolder import com.github.tomakehurst.wiremock.WireMockServer import groovy.util.logging.Slf4j +import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.TestTemplate @@ -35,6 +36,11 @@ class BinaryFileProviderTest { System.setProperty('pact.content_type.override.application.pdf', 'text') } + @AfterAll + static void afterAll() { + System.clearProperty('pact.content_type.override.application.pdf') + } + @BeforeEach void before(PactVerificationContext context, @WiremockResolver.Wiremock WireMockServer server, @WiremockUriResolver.WiremockUri String uri) throws MalformedURLException {