-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
117 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,65 @@ | ||
plugins { | ||
id 'org.springframework.boot' version '2.7.1' apply false | ||
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false | ||
id 'java' | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
allprojects { | ||
group = 'com.currenjin' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
buildscript { | ||
ext { | ||
javaVersion = "17" | ||
springBootVersion = "2.7.5" | ||
springCloudVersion = "2021.0.5" | ||
} | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" | ||
classpath "io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE" | ||
classpath group: "org.sonarsource.scanner.gradle", name: "sonarqube-gradle-plugin", version: "3.3" | ||
} | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'java' | ||
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'io.spring.dependency-management' | ||
def demoProjects = subprojects - project(":clients") | ||
configure(demoProjects) { | ||
apply plugin: "java" | ||
apply plugin: "java-library" | ||
apply plugin: "org.springframework.boot" | ||
apply plugin: "io.spring.dependency-management" | ||
|
||
buildscript { | ||
ext { | ||
springBootVersion = '2.7.5' | ||
springCloudVersion = '2021.0.5' | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
sourceCompatibility = '17' | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" | ||
} | ||
} | ||
|
||
tasks.named("test") { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.projectlombok:lombok:1.18.22' | ||
implementation 'org.springframework.boot:spring-boot-starter' | ||
implementation "org.projectlombok:lombok:1.18.22" | ||
implementation "com.fasterxml.jackson.core:jackson-databind" | ||
implementation "com.fasterxml.jackson.core:jackson-core" | ||
implementation "com.fasterxml.jackson.core:jackson-annotations" | ||
|
||
annotationProcessor 'org.projectlombok:lombok:1.18.22' | ||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' | ||
annotationProcessor "org.projectlombok:lombok:1.18.22" | ||
testAnnotationProcessor "org.projectlombok:lombok:1.18.22" | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
} | ||
implementation "org.springframework.boot:spring-boot-starter" | ||
testImplementation "org.springframework.boot:spring-boot-starter-test" | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
testImplementation(testFixtures(project(":clients:client-core"))) | ||
} | ||
|
||
tasks.register('prepareKotlinBuildScriptModel'){} | ||
} | ||
|
||
def clientProjects = project(":clients").subprojects - project(":clients:client-core") | ||
configure(clientProjects) { | ||
dependencies { | ||
implementation(project(":clients:client-core")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...lients/client-httpbin/src/main/java/com/currenjin/httpbin/adapter/HttpBinFeignClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.currenjin.httpbin.adapter; | ||
|
||
import com.currenjin.httpbin.response.AnythingResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
||
@FeignClient(name = "httpBinClient", url = "${client.httpbin-api.access-url}", decode404 = true) | ||
public interface HttpBinFeignClient { | ||
@GetMapping("/anything/{id}") | ||
AnythingResponse getAnythingById(@PathVariable("id") Long id); | ||
} |
11 changes: 11 additions & 0 deletions
11
...lients/client-httpbin/src/main/java/com/currenjin/httpbin/config/HttpBinClientConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.currenjin.httpbin.config; | ||
|
||
import com.currenjin.httpbin.adapter.HttpBinFeignClient; | ||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@EnableFeignClients(basePackageClasses = {HttpBinFeignClient.class}) | ||
public class HttpBinClientConfig { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...clients/client-httpbin/src/main/java/com/currenjin/httpbin/response/AnythingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.currenjin.httpbin.response; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class AnythingResponse { | ||
private String data; | ||
|
||
public AnythingResponse(String data) { | ||
this.data = data; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
wire-mock/clients/client-httpbin/src/main/resources/application-httpbin-client.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
spring: | ||
config: | ||
import: | ||
- classpath:application-client-core.yml | ||
|
||
feign: | ||
client: | ||
config: | ||
httpBinClient: | ||
connectTimeout: 1000 | ||
readTimeout: 3000 | ||
|
||
client: | ||
httpbin-api: | ||
access-url: http://httpbin.org |
11 changes: 11 additions & 0 deletions
11
...nts/client-httpbin/src/test/java/com/currenjin/httpbin/HttpbinClientApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.currenjin.httpbin; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class HttpbinClientApplicationTests { | ||
@Test | ||
void contextLoads() { | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
wire-mock/clients/client-httpbin/src/test/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
spring: | ||
profiles: | ||
active: test | ||
include: httpbin-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
rootProject.name = 'wire-mock' | ||
include( | ||
'clients:client-core', | ||
'applications:internal-api' | ||
) | ||
include 'clients:client-core' | ||
include 'clients:client-httpbin' | ||
include 'applications:internal-api' |