Skip to content

Commit

Permalink
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
@@ -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')
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
@@ -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))

0 comments on commit 85c3bdb

Please sign in to comment.