Skip to content

Commit

Permalink
refactor: moved consumer project and removed scala and groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Mar 30, 2019
1 parent 85aaf4c commit 843427f
Show file tree
Hide file tree
Showing 43 changed files with 175 additions and 769 deletions.
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ subprojects {
}

dependencies {
testCompile "org.junit.jupiter:junit-jupiter-api:${project.junit5Version}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${project.junit5Version}"
testCompile('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
Expand Down Expand Up @@ -141,6 +143,15 @@ subprojects {
from sourceSets.main.allSource
}

test {
useJUnitPlatform()

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}

publishing {
publications {
mavenPublication(MavenPublication) {
Expand Down
2 changes: 2 additions & 0 deletions consumer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Consumer Pact-JVM Modules
=========================
3 changes: 3 additions & 0 deletions consumer/pact-jvm-consumer-scalasupport/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pact consumer Scala Support
===========================

4 changes: 4 additions & 0 deletions consumer/pact-jvm-consumer-scalasupport/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

dependencies {

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package au.com.dius.pact.consumer

import au.com.dius.pact.consumer.model.{MockHttpsKeystoreProviderConfig, MockHttpsProviderConfig, MockProviderConfig}
import au.com.dius.pact.core.model.{Pact => PactModel, _}
import au.com.dius.pact.model.{MockHttpsKeystoreProviderConfig, MockHttpsProviderConfig, MockProviderConfig}
import au.com.dius.pact.model.{MockHttpsProviderConfig, MockProviderConfig}
import com.typesafe.scalalogging.StrictLogging

import scala.util.Try

trait MockProvider[I <: Interaction] {
def config: MockProviderConfig
def session: PactSession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.netty.channel.ChannelHandler.Sharable
import io.netty.handler.codec.{http => netty}
import _root_.unfiltered.netty.{SslEngineProvider, cycle => unettyc}
import _root_.unfiltered.{netty => unetty, request => ureq, response => uresp}
import au.com.dius.pact.consumer.model.MockHttpsKeystoreProviderConfig
import au.com.dius.pact.core.model.{Request, RequestResponseInteraction, Response}

class UnfilteredHttpsKeystoreMockProvider(val config: MockHttpsKeystoreProviderConfig) extends StatefulMockProvider[RequestResponseInteraction] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.netty.channel.ChannelHandler.Sharable
import io.netty.handler.codec.{http => netty}
import _root_.unfiltered.netty.{SslContextProvider, cycle => unettyc}
import _root_.unfiltered.{netty => unetty, request => ureq, response => uresp}
import au.com.dius.pact.consumer.model.MockHttpsProviderConfig
import au.com.dius.pact.core.model.{Request, RequestResponseInteraction, Response}

class UnfilteredHttpsMockProvider(val config: MockHttpsProviderConfig) extends StatefulMockProvider[RequestResponseInteraction] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import _root_.unfiltered.{netty => unetty}
import _root_.unfiltered.netty.{cycle => unettyc}
import _root_.unfiltered.{request => ureq}
import _root_.unfiltered.{response => uresp}
import au.com.dius.pact.consumer.model.MockProviderConfig
import au.com.dius.pact.core.model.{Request, RequestResponseInteraction, Response}
import io.netty.channel.ChannelHandler.Sharable

Expand Down
16 changes: 8 additions & 8 deletions consumer/pact-jvm-consumer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Provides a DSL for use with Java to build consumer pacts.
The library is available on maven central using:

* group-id = `au.com.dius`
* artifact-id = `pact-jvm-consumer_2.11`
* artifact-id = `pact-jvm-consumer`

## DSL Usage

Expand Down Expand Up @@ -176,7 +176,7 @@ For example:
This will ensure that the users list is never empty and that each user has an identifier that is a number and a name that is a string.


#### Matching JSON values at the root (Version 3.2.2/2.4.3+)
#### Matching JSON values at the root

For cases where you are expecting basic JSON values (strings, numbers, booleans and null) at the root level of the body
and need to use matchers, you can use the `PactDslJsonRootValue` class. It has all the DSL matching methods for basic
Expand All @@ -194,7 +194,7 @@ For example:
.body(PactDslJsonRootValue.integerType())
```

#### Root level arrays that match all items (version 2.2.11+)
#### Root level arrays that match all items

If the root of the body is an array, you can create PactDslJsonArray classes with the following methods:

Expand Down Expand Up @@ -233,7 +233,7 @@ This will then match a body like:
} ]
```

#### Matching arrays of arrays (version 3.2.12/2.4.14+)
#### Matching arrays of arrays

For the case where you have arrays of arrays (GeoJSON is an example), the following methods have been provided:

Expand Down Expand Up @@ -285,7 +285,7 @@ This generated the following JSON:

and will be able to match all coordinates regardless of the number of coordinates.

#### Matching any key in a map (3.3.1/2.5.0+)
#### Matching any key in a map

The DSL has been extended for cases where the keys in a map are IDs. For an example of this, see
[#313](https://github.com/DiUS/pact-jvm/issues/313). In this case you can use the `eachKeyLike` method, which takes an
Expand Down Expand Up @@ -321,7 +321,7 @@ For an example, have a look at [WildcardKeysTest](../pact-jvm-consumer-junit/src
**Further Note: From version 3.5.22 onwards pacts with wildcards applied to map keys will require the Java system property
"pact.matching.wildcard" set to value "true" when the pact file is verified.**

### Matching on paths (version 2.1.5+)
### Matching on paths

You can use regular expressions to match incoming requests. The DSL has a `matchPath` method for this. You can provide
a real path as a second value to use when generating requests, and if you leave it out it will generate a random one
Expand All @@ -340,7 +340,7 @@ For example:
.body("{\"hello\": \"harry\"}")
```

### Matching on headers (version 2.2.2+)
### Matching on headers

You can use regular expressions to match request and response headers. The DSL has a `matchHeader` method for this. You can provide
an example header value to use when generating requests and responses, and if you leave it out it will generate a random one
Expand All @@ -361,7 +361,7 @@ For example:
.matchHeader("Location", ".*/hello/[0-9]+", "/hello/1234")
```

### Matching on query parameters (version 3.3.7+)
### Matching on query parameters

You can use regular expressions to match request query parameters. The DSL has a `matchQuery` method for this. You can provide
an example value to use when generating requests, and if you leave it out it will generate a random one
Expand Down
37 changes: 2 additions & 35 deletions consumer/pact-jvm-consumer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,14 @@ dependencies {
compile "org.json:json:${project.jsonVersion}"
compile "io.netty:netty-handler:${project.nettyVersion}"
compile "org.apache.httpcomponents:httpmime:${project.httpClientVersion}"
compile "ws.unfiltered:unfiltered-netty-server_${project.scalaVersion}:0.9.1"
compile "org.apache.httpcomponents:fluent-hc:${project.httpClientVersion}"
compile 'org.scala-lang.modules:scala-java8-compat_2.12:0.8.0'
compile "org.codehaus.groovy:groovy-json:${project.groovyVersion}:indy"

compile "org.scala-lang:scala-library:${project.scalaFullVersion}"
compile("com.typesafe.scala-logging:scala-logging_${project.scalaVersion}:3.7.2") {
exclude group: 'org.scala-lang'
}

testCompile "org.specs2:specs2-core_${project.scalaVersion}:${project.specs2Version}",
"org.specs2:specs2-junit_${project.scalaVersion}:${project.specs2Version}"
implementation 'org.slf4j:slf4j-api:1.7.26'

testCompile "ch.qos.logback:logback-classic:${project.logbackVersion}"
testCompile "org.specs2:specs2-mock_${project.scalaVersion}:${project.specs2Version}"
testCompile 'org.cthul:cthul-matchers:1.1.0'
testCompile "org.junit.jupiter:junit-jupiter-api:${project.junit5Version}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${project.junit5Version}"
testRuntime "org.junit.vintage:junit-vintage-engine:${project.junit5Version}"
testCompile "org.codehaus.groovy:groovy-dateutil:${project.groovyVersion}:indy"
}

// The language compilers should execute in this order
// Java then Kotlin then Scala then Groovy
sourceSets.main.scala.srcDir "src/main/java"
sourceSets.main.java.srcDirs = []

compileKotlin {
dependsOn tasks.getByPath('compileGroovy'), tasks.getByPath('compileScala')
dependsOn.remove('compileJava')
classpath += files(compileGroovy.destinationDir) + files(compileScala.destinationDir)
}
compileGroovy.dependsOn.remove("compileJava")
compileScala.dependsOn = []
compileTestGroovy.dependsOn compileTestScala

test {
useJUnitPlatform()

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
testCompile 'org.hamcrest:hamcrest:2.1'
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 843427f

Please sign in to comment.