Add Eureka client sample.
This commit is contained in:
committed by
GitHub
parent
42b71722f7
commit
1e3f713047
@@ -31,6 +31,7 @@ groups:
|
||||
smoke_tests:
|
||||
- cloud-config-client
|
||||
- cloud-discovery-consul
|
||||
- cloud-discovery-eureka
|
||||
- cloud-discovery-zookeeper
|
||||
- cloud-function-web
|
||||
- cloud-function-webflux
|
||||
|
||||
35
cloud/cloud-discovery-eureka/build.gradle
Normal file
35
cloud/cloud-discovery-eureka/build.gradle
Normal file
@@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot'
|
||||
id 'org.springframework.aot.smoke-test'
|
||||
id 'org.graalvm.buildtools.native'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates" }
|
||||
}
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "2022.0.0-SNAPSHOT")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(
|
||||
org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation(
|
||||
platform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
implementation("org.springframework.boot:spring-boot-starter-actuator")
|
||||
implementation("org.springframework.boot:spring-boot-starter-webflux")
|
||||
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
|
||||
appTestImplementation(project(":aot-smoke-test-support"))
|
||||
appTestImplementation("org.awaitility:awaitility:4.2.0")
|
||||
}
|
||||
|
||||
aotSmokeTest {
|
||||
webApplication = true
|
||||
}
|
||||
|
||||
6
cloud/cloud-discovery-eureka/docker-compose.yml
Normal file
6
cloud/cloud-discovery-eureka/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: '3'
|
||||
services:
|
||||
eureka:
|
||||
image: springcloud/demo-eureka-server:latest
|
||||
ports:
|
||||
- "8761"
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.example.cloud.discovery.eureka;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.smoketest.support.assertj.AssertableOutput;
|
||||
import org.springframework.aot.smoketest.support.junit.ApplicationTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ApplicationTest
|
||||
public class EurekaDiscoveryClientApplicationAotTests {
|
||||
|
||||
@Test
|
||||
void shouldRegisterWithEurekaServer(AssertableOutput output) {
|
||||
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
|
||||
assertThat(output).hasLineContaining("registration status: 204");
|
||||
assertThat(output).hasNoLinesContaining("Exception");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.example.cloud.discovery.eureka;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CloudDiscoveryEurekaApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudDiscoveryEurekaApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
spring:
|
||||
cloud:
|
||||
refresh:
|
||||
enabled: false
|
||||
application:
|
||||
name: eureka-discovery-client
|
||||
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://${EUREKA_HOST:localhost}:${EUREKA_PORT_8761:8761}/eureka/
|
||||
Reference in New Issue
Block a user