Skip to content

Commit

Permalink
Merge branch 'master' into v4.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Dec 4, 2024
2 parents d6242dd + 8b09520 commit c8dc88e
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 18 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
To generate the log, run `git log --pretty='* %h - %s (%an, %ad)' TAGNAME..HEAD` replacing TAGNAME and HEAD as appropriate.

# 4.6.16 - Maintenance Release

* 2d2016317 - fix: Dependency conflict with org.slf4j:slf4j-api was causing Spring tests to fail (Ronald Holshausen, Wed Dec 4 14:21:15 2024 +1100)
* 38c0d27b8 - feat: Update LambdaDsl.newJsonArray to allow setting the number of examples (Ronald Holshausen, Wed Dec 4 10:59:23 2024 +1100)
* 19c663c8c - chore: The pact-jvm-server main spec was not configured correctly (Ronald Holshausen, Wed Dec 4 10:24:23 2024 +1100)
* 147a2a661 - fix: LambdaDslJsonArray has no datetime function #1839 (Ronald Holshausen, Wed Dec 4 10:23:10 2024 +1100)
* c7911705b - chore: Update readme (Ronald Holshausen, Wed Dec 4 09:59:01 2024 +1100)
* 7229244f6 - Merge pull request #1837 from cburgmer/patch-1 (Ronald Holshausen, Fri Nov 15 10:03:21 2024 +1100)
* e95461a6a - Fix path to Clojure example (Christoph Burgmer, Thu Nov 14 14:21:10 2024 +0100)
* 9f6b209e2 - chore: Add a test + update docs on JUnit 4 report dir default #1836 (Ronald Holshausen, Thu Nov 14 15:58:48 2024 +1100)
* 3e501f58e - chore: Add a test for pact-jvm-server (Ronald Holshausen, Tue Oct 29 17:40:28 2024 +1100)
* 85c92365e - Update README.md (Ronald Holshausen, Tue Oct 29 11:32:02 2024 +1100)
* 5c41e17fc - bump version to 4.6.16 (Ronald Holshausen, Tue Oct 29 10:38:07 2024 +1100)

# 4.7.0-beta.0 - First beta release

* 2d69044ca - chore: Correct release script for Gradle 8.11 (Ronald Holshausen, Wed Dec 4 09:29:37 2024 +1100)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ and in the [Pact-JVM wiki](https://github.com/pact-foundation/pact-jvm/wiki). [S
| Branch | Specification | JDK | Kotlin Version | Latest Version | Notes |
|-----------------------------------------------------------------------------------|---------------|-----------------------|----------------|----------------|-------|
| [4.7.x](https://github.com/pact-foundation/pact-jvm/blob/v4.7.x/README.md) | V4 + plugins | 17+ (tested up to 23) | 2.0.21 | 4.7.0-beta.0 | |
| [4.6.x](https://github.com/pact-foundation/pact-jvm/blob/v4.6.x/README.md) master | V4 + plugins | 17-18 | 1.8.22 | 4.6.15 | |
| [4.5.x](https://github.com/pact-foundation/pact-jvm/blob/v4.5.x/README.md) | V4 + plugins | 11+/17(1) | 1.7.20 | 4.5.13 | |
| [4.6.x](https://github.com/pact-foundation/pact-jvm/blob/v4.6.x/README.md) master | V4 + plugins | 17+ (tested up to 18) | 1.8.22 | 4.6.15 | |
| [4.5.x](https://github.com/pact-foundation/pact-jvm/blob/v4.5.x/README.md) | V4 + plugins | 11+/17+(1) | 1.7.20 | 4.5.13 | |
| [4.1.x](https://github.com/pact-foundation/pact-jvm/blob/v4.1.x/README.md) | V3 | 8-12 | 1.3.72 | 4.1.43 | |

**Notes:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'org.apache.tika:tika-core:2.9.1'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-api:2.0.4'
implementation 'io.ktor:ktor-http-jvm:3.0.1'
implementation 'io.ktor:ktor-server-netty:3.0.1'
implementation 'io.ktor:ktor-network-tls-certificates:3.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ public static LambdaDslJsonArray newJsonArray(Consumer<LambdaDslJsonArray> array
return dslArray;
}

/**
* DSL function to simplify creating a {@link DslPart} generated from a {@link LambdaDslJsonArray}.
* @param examples Number of examples to populate the array with
*/
public static LambdaDslJsonArray newJsonArray(Integer examples, Consumer<LambdaDslJsonArray> array) {
final PactDslJsonArray pactDslJsonArray = new PactDslJsonArray();
pactDslJsonArray.setNumberExamples(examples);
final LambdaDslJsonArray dslArray = new LambdaDslJsonArray(pactDslJsonArray);
array.accept(dslArray);
return dslArray;
}

/**
* DSL function to simplify creating a {@link DslPart} generated from a {@link LambdaDslJsonArray} where a minimum base array size is specified
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ public LambdaDslJsonArray time(final String format, final Date example) {
*/
@Deprecated
public LambdaDslJsonArray timestamp() {
pactArray.datetime();
return this;
return datetime();
}

/**
Expand All @@ -316,8 +315,7 @@ public LambdaDslJsonArray timestamp() {
*/
@Deprecated
public LambdaDslJsonArray timestamp(final String format) {
pactArray.datetime(format);
return this;
return datetime(format);
}

/**
Expand All @@ -329,8 +327,7 @@ public LambdaDslJsonArray timestamp(final String format) {
*/
@Deprecated
public LambdaDslJsonArray timestamp(final String format, final Date example) {
pactArray.datetime(format, example);
return this;
return datetime(format, example);
}

/**
Expand All @@ -342,10 +339,49 @@ public LambdaDslJsonArray timestamp(final String format, final Date example) {
*/
@Deprecated
public LambdaDslJsonArray timestamp(final String format, final Instant example) {
pactArray.datetime(format, example);
return this;
return datetime(format, example);
}

/**
* Element that must be an ISO formatted date/time
*/
public LambdaDslJsonArray datetime() {
pactArray.datetime();
return this;
}

/**
* Element that must match the given date/time format
*
* @param format date/time format
*/
public LambdaDslJsonArray datetime(final String format) {
pactArray.datetime(format);
return this;
}

/**
* Element that must match the given date/time format
*
* @param format date/time format
* @param example example date and time to use for generated bodies
*/
public LambdaDslJsonArray datetime(final String format, final Date example) {
pactArray.datetime(format, example);
return this;
}

/**
* Element that must match the given date/time format
*
* @param format date/time format
* @param example example date and time to use for generated bodies
*/
public LambdaDslJsonArray datetime(final String format, final Instant example) {
pactArray.datetime(format, example);
return this;
}

/**
* Element that must be a numeric identifier
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,4 +764,21 @@ public void testUnorderedArrayMatcher() {
assertThat(lambdaPactDsl.getMatchers(), is(pactDslJson.getMatchers()));
}

@Test
public void arrayEachLike() {
// Old DSL
final DslPart pactDslJson = PactDslJsonArray
.arrayEachLike(2)
.stringType("name", "Berlin")
.close();

// Lambda DSL
final DslPart lambdaPactDsl = LambdaDsl.newJsonArray(2, array ->
array.object(obj ->
obj.stringType("name", "Berlin")
)
).build().close();

assertThat(lambdaPactDsl.getBody().toString(), is(pactDslJson.getBody().toString()));
}
}
6 changes: 4 additions & 2 deletions provider/junit5spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ dependencies {
implementation 'org.apache.commons:commons-lang3'
implementation 'javax.mail:mail:1.5.0-b01'

testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.14'
testImplementation 'org.springframework.boot:spring-boot-starter-web:2.5.14'
testImplementation 'org.springframework.boot:spring-boot-test:2.5.14'
testImplementation 'org.springframework.boot:spring-boot-test-autoconfigure:2.5.14'
testImplementation 'org.springframework:spring-webmvc:5.3.20'
testImplementation 'org.apache.groovy:groovy'
testImplementation 'org.yaml:snakeyaml:1.33'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -24,7 +23,6 @@
@WebMvcTest
@Provider("myAwesomeService")
@PactFolder("pacts")
@Disabled // TODO: this fails with NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
class MockMvcTestTargetWebMvcTestJava {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -18,7 +17,6 @@
@SpringBootTest
@Provider("myAwesomeService")
@PactFolder("pacts")
@Disabled // TODO: this fails with NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
class WebTestClientPactTest {

public static class Handler {
Expand Down
2 changes: 1 addition & 1 deletion provider/spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public class PactVerificationTest {
```

#### JUnit5
You actually don't need to dependend on `pact-jvm-provider-spring` for this. It's sufficient to depend on `pact-jvm-provider-junit5`.
You actually don't need to depend on `pact-jvm-provider-spring` for this. It's sufficient to depend on `pact-jvm-provider-junit5`.

You can set the port to the `HttpTestTarget` object in the before method.

Expand Down

0 comments on commit c8dc88e

Please sign in to comment.