Skip to content

Commit

Permalink
fix: publish verification results when Pact URL is overridden #1049
Browse files Browse the repository at this point in the history
  • Loading branch information
arhohuttunen committed Mar 16, 2020
1 parent 6fd8adb commit 7d6a507
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package au.com.dius.pact.provider.junit.loader

import au.com.dius.pact.core.model.BrokerUrlSource
import au.com.dius.pact.core.model.Pact
import au.com.dius.pact.core.model.PactBrokerSource
import au.com.dius.pact.core.model.UrlSource
import au.com.dius.pact.core.pactbroker.IHalClient
import au.com.dius.pact.core.pactbroker.InvalidHalResponse
import au.com.dius.pact.core.pactbroker.PactBrokerClient
Expand Down Expand Up @@ -383,7 +383,8 @@ class PactBrokerLoaderSpec extends Specification {
tags = ['demo']
PactBrokerLoader loader = Spy(pactBrokerLoader())
loader.overridePactUrl('http://overridden.com', 'overridden')
def consumer = new ConsumerInfo('overridden', null, true, [], null, new UrlSource('http://overridden.com'))
def brokerUrlSource = new BrokerUrlSource('http://overridden.com', 'http://pactbroker:1234')
def consumer = new ConsumerInfo('overridden', null, true, [], null, brokerUrlSource)

when:
def result = loader.load('test')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package au.com.dius.pact.provider.junit.loader

import au.com.dius.pact.core.model.BrokerUrlSource
import au.com.dius.pact.core.model.Consumer
import au.com.dius.pact.core.model.DefaultPactReader
import au.com.dius.pact.core.model.Interaction
import au.com.dius.pact.core.model.Pact
import au.com.dius.pact.core.model.PactBrokerSource
import au.com.dius.pact.core.model.PactReader
import au.com.dius.pact.core.model.UrlSource
import au.com.dius.pact.core.model.PactSource
import au.com.dius.pact.core.pactbroker.PactBrokerClient
import au.com.dius.pact.core.support.expressions.ExpressionParser.parseExpression
Expand Down Expand Up @@ -78,8 +78,9 @@ open class PactBrokerLoader(
val resolver = setupValueResolver()
val pacts = when {
overriddenPactUrl.isNotEmpty() -> {
val pactBrokerClient = newPactBrokerClient(brokerUrl(resolver).build(), resolver)
val pactSource = UrlSource<Interaction>(overriddenPactUrl!!)
val brokerUri = brokerUrl(resolver).build()
val pactBrokerClient = newPactBrokerClient(brokerUri, resolver)
val pactSource = BrokerUrlSource(overriddenPactUrl!!, brokerUri.toString())
pactSource.encodePath = false
listOf(loadPact(ConsumerInfo(name = overriddenConsumer!!, pactSource = pactSource),
pactBrokerClient.options))
Expand Down

0 comments on commit 7d6a507

Please sign in to comment.