Skip to content

Commit 99f6e3f

Browse files
committed
added example with spring cloud contract
1 parent 7bce17b commit 99f6e3f

15 files changed

Lines changed: 536 additions & 1 deletion

File tree

settings.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ include 'spring-data-rest-springfox'
55
// pact-feign-consumer must run before pact-spring-data-rest-provider because it creates a shared pact file
66
include 'pact-feign-consumer'
77
include 'pact-spring-data-rest-provider'
8+
include 'pact-spring-provider'
9+
include 'spring-cloud-contract-provider'
10+
811
include 'sleuth-downstream-service'
912
include 'sleuth-upstream-service'
13+
1014
include 'rabbitmq-event-brokering'
15+
1116
include 'junit5'
12-
include 'pact-spring-provider'
17+
1318
include 'spring-boot-tests'
1419

20+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
maven { url "http://repo.spring.io/snapshot" }
5+
maven { url "http://repo.spring.io/milestone" }
6+
maven { url "http://repo.spring.io/release" }
7+
}
8+
dependencies {
9+
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
10+
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
11+
classpath "org.springframework.cloud:spring-cloud-contract-spec-pact:${verifier_version}"
12+
classpath 'au.com.dius:pact-jvm-model:2.4.18'
13+
}
14+
}
15+
16+
apply plugin: 'groovy'
17+
apply plugin: 'spring-cloud-contract'
18+
19+
repositories {
20+
mavenCentral()
21+
jcenter()
22+
maven { url "http://repo.spring.io/snapshot" }
23+
maven { url "http://repo.spring.io/milestone" }
24+
maven { url "http://repo.spring.io/release" }
25+
}
26+
27+
dependencies {
28+
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springboot_version}")
29+
compile("org.springframework.boot:spring-boot-starter-web:${springboot_version}")
30+
compile('com.h2database:h2:1.4.196')
31+
testCompile('org.codehaus.groovy:groovy-all:2.4.6')
32+
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier:${verifier_version}")
33+
testCompile("org.springframework.cloud:spring-cloud-contract-spec:${verifier_version}")
34+
testCompile("org.springframework.boot:spring-boot-starter-test:${springboot_version}")
35+
}
36+
37+
contracts {
38+
baseClassMappings {
39+
baseClassMapping(".*userservice.*", "io.reflectoring.UserServiceBase")
40+
}
41+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
springboot_version=1.5.9.RELEASE
2+
verifier_version=1.2.2.BUILD-SNAPSHOT
53.4 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip

spring-cloud-contract-provider/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spring-cloud-contract-provider/gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.reflectoring;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.data.web.config.EnableSpringDataWebSupport;
6+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7+
8+
@SpringBootApplication
9+
@EnableWebMvc
10+
@EnableSpringDataWebSupport
11+
public class DemoApplication {
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(DemoApplication.class, args);
15+
}
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.reflectoring;
2+
3+
public class IdObject {
4+
5+
private final long id;
6+
7+
public IdObject(long id) {
8+
this.id = id;
9+
}
10+
11+
public long getId() {
12+
return id;
13+
}
14+
15+
}

0 commit comments

Comments
 (0)