Skip to content

Commit

Permalink
chore(deps): update to java 17 / pact 4.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Dec 5, 2023
1 parent bd434dd commit e6ebc12
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
distribution: 'temurin'
java-version: '17'
- name: Test
run: GIT_BRANCH=${GITHUB_REF:11} make test

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify_changed_pact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
distribution: 'temurin'
java-version: '17'
- name: Build
run: GIT_BRANCH=${GITHUB_REF:11} make ci_webhook
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11
17.0
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
"java.configuration.updateBuildConfiguration": "automatic",
"FSharp.suggestGitignore": false
}
23 changes: 13 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.springframework.boot' version '2.7.18'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
id "au.com.dius.pact" version "4.1.0"
id "au.com.dius.pact" version "4.6.3"
// id "au.com.dius.pact.provider:gradle" version "4.6.3"
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
sourceCompatibility = '17'

repositories {
mavenCentral()
Expand All @@ -22,19 +23,21 @@ configurations {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.kafka:spring-kafka'
testImplementation 'au.com.dius.pact.provider:junit5:4.1.7'
testImplementation 'au.com.dius.pact.provider:spring:4.1.7'
testImplementation 'au.com.dius.pact.provider:junit5:4.6.3'
testImplementation 'au.com.dius.pact.provider:spring:4.6.3'
testImplementation 'au.com.dius.pact.provider:gradle:4.6.3'
runtimeOnly 'com.h2database:h2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation 'com.github.javafaker:javafaker:1.0.2'
implementation 'net.datafaker:datafaker:2.0.2'
}

test {
useJUnitPlatform()
testLogging.showStandardStreams = true // output pact verification logs to stdout
}

pact {
Expand All @@ -46,16 +49,16 @@ pact {

serviceProviders {
"pactflow-example-provider" {
fromPactBroker {
withSelectors {
fromPactBroker {
withSelectors {
mainBranch() // (recommended) - Returns the pacts for consumers configured mainBranch property
deployedOrReleased() // (recommended) - Returns the pacts for all versions of the consumer that are currently deployed or released and currently supported in any environment.
// deployedTo('test') // Normally, this would not be needed, Any versions currently deployed to the specified environment.
// deployedTo('test') // Normally, this would not be needed, Any versions currently deployed to the specified environment.
// environment('test') // Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
// environment('production') // Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
}
}
}
}
}
}
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.github.javafaker.Faker;
import net.datafaker.Faker;

@Component
public class DummyEventGenerator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import au.com.dius.pact.core.model.Pact;
import au.com.dius.pact.provider.MessageAndMetadata;
import au.com.dius.pact.provider.PactVerifyProvider;
import au.com.dius.pact.provider.junit5.AmpqTestTarget;
import au.com.dius.pact.provider.junit5.MessageTestTarget;
import au.com.dius.pact.provider.junit5.PactVerificationContext;
import au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider;
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactBroker;
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerAuth;
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder;
import au.com.dius.pact.provider.junitsupport.loader.VersionSelector;

import java.util.HashMap;
Expand All @@ -25,11 +26,18 @@

@Provider("pactflow-example-provider-java-kafka")
@PactBroker(scheme = "https", host = "${PACT_BROKER_HOST}",
consumerVersionSelectors = {@VersionSelector(tag = "master"), @VersionSelector(tag = "prod")},
authentication = @PactBrokerAuth(token = "${PACT_BROKER_TOKEN}"))
public class ProductsKafkaProducerTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProductsKafkaProducerTest.class);

@au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors
public static SelectorBuilder consumerVersionSelectors() {
// Select Pacts for consumers deployed or released, or on the main branch
return new SelectorBuilder()
.deployedOrReleased()
.mainBranch();
}

@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void testTemplate(Pact pact, Interaction interaction, PactVerificationContext context) {
Expand All @@ -38,7 +46,7 @@ void testTemplate(Pact pact, Interaction interaction, PactVerificationContext co

@BeforeEach
void before(PactVerificationContext context) {
context.setTarget(new AmpqTestTarget());
context.setTarget(new MessageTestTarget());

System.out.println("GIT_COMMIT" + System.getenv("GIT_COMMIT"));
System.setProperty("pact.provider.version",
Expand Down

0 comments on commit e6ebc12

Please sign in to comment.