From 6165b71eca31f18e61dbd8c6aa7e5218ccf54f28 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Thu, 2 Oct 2014 15:47:16 +1000 Subject: [PATCH] Fix the gradle plugun to work with scala 2.11 --- .../dius/pact/provider/gradle/PactVerificationTask.groovy | 4 ++-- .../au/com/dius/pact/provider/gradle/ProviderClient.groovy | 2 +- .../dius/pact/provider/gradle/ResponseComparison.groovy | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/PactVerificationTask.groovy b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/PactVerificationTask.groovy index 72bce11fba..52922bff4a 100644 --- a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/PactVerificationTask.groovy +++ b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/PactVerificationTask.groovy @@ -38,7 +38,7 @@ class PactVerificationTask extends DefaultTask { throw new RuntimeException('You must specify the pactfile to execute (use pactFile = ...)') } - def interactions = JavaConverters$.MODULE$.asJavaIteratorConverter(pact.interactions().iterator()) + def interactions = JavaConverters$.MODULE$.seqAsJavaListConverter(pact.interactions()) interactions.asJava().each { Interaction interaction -> def interactionMessage = "Verifying a pact between ${consumer.name} and ${providerToVerify.name} - ${interaction.description()}" @@ -143,7 +143,7 @@ class PactVerificationTask extends DefaultTask { void displayHeadersResult(Map failures, def expected, Map comparison, String comparisonDescription) { if (!comparison.isEmpty()) { AnsiConsole.out().println(' includes headers') - Map expectedHeaders = JavaConverters$.MODULE$.asJavaMapConverter(expected.get()).asJava() + Map expectedHeaders = JavaConverters$.MODULE$.mapAsJavaMapConverter(expected.get()).asJava() comparison.each { key, headerComparison -> def expectedHeaderValue = expectedHeaders[key] def ansi = Ansi.ansi().a(' "').bold().a(key).boldOff().a('" with value "').bold() diff --git a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ProviderClient.groovy b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ProviderClient.groovy index a714f4ac76..96606b0bd5 100644 --- a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ProviderClient.groovy +++ b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ProviderClient.groovy @@ -17,7 +17,7 @@ class ProviderClient { def requestMap = [path: request.path()] requestMap.headers = [:] if (request.headers().defined) { - requestMap.headers = JavaConverters$.MODULE$.asJavaMapConverter(request.headers().get()).asJava() + requestMap.headers = JavaConverters$.MODULE$.mapAsJavaMapConverter(request.headers().get()).asJava() } if (requestMap.headers['Content-Type']) { diff --git a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ResponseComparison.groovy b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ResponseComparison.groovy index fd929e9ea7..30d41b464d 100644 --- a/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ResponseComparison.groovy +++ b/pact-jvm-provider-gradle/src/main/groovy/au/com/dius/pact/provider/gradle/ResponseComparison.groovy @@ -43,12 +43,7 @@ class ResponseComparison { Map headerResult = [:] if (expected.headers().defined) { - def headers - if (JavaConverters$.MODULE$.metaClass.respondsTo('asJavaMapConverter')) { - headers = JavaConverters$.MODULE$.asJavaMapConverter(expected.headers().get()).asJava() - } else { - headers = JavaConverters$.MODULE$.mapAsJavaMapConverter(expected.headers().get()).asJava() - } + def headers = JavaConverters$.MODULE$.mapAsJavaMapConverter(expected.headers().get()).asJava() headers.each { headerKey, value -> try { assert actualHeaders[headerKey.toUpperCase()] == value