File tree Expand file tree Collapse file tree 18 files changed +218
-10
lines changed
test/java/io/dksifoua/eshop/gateway
java/io/dksifoua/eshop/catalog/handler
test/java/io/dksifoua/eshop/catalog
java/io/dksifoua/eshop/eureka
test/java/io/dksifoua/eshop/eureka Expand file tree Collapse file tree 18 files changed +218
-10
lines changed Original file line number Diff line number Diff line change
1
+ name : eureka-server
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - develop
8
+ - feature/**
9
+ pull_request :
10
+ branches :
11
+ - main
12
+ - develop
13
+ - feature/**
14
+
15
+ jobs :
16
+ test :
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - uses : actions/checkout@v3
20
+ - name : Setup Java
21
+ uses : actions/setup-java@v4
22
+ with :
23
+ distribution : oracle
24
+ java-version : 21
25
+ - name : Setup Task
26
+ uses : arduino/setup-task@v2
27
+ with :
28
+ version : 3.x
29
+ repo-token : ${{ secrets.GH_TOKEN }}
30
+ - name : Test eureka server
31
+ run : task eureka:test
Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ Event driven microservice-based c2c ecommerce platform
4
4
5
5
[ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/eshop.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/eshop.yaml )
6
6
7
- [ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml )
8
7
[ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/gateway.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/gateway.yaml )
8
+ [ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/catalog.yaml )
9
+ [ ![ ] ( https://github.com/dksifoua/eshop/actions/workflows/eureka.yaml/badge.svg )] ( https://github.com/dksifoua/eshop/actions/workflows/eureka.yaml )
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ version: 3
3
3
includes :
4
4
catalog :
5
5
taskfile : ./catalog-service/Taskfile.yaml
6
+ eureka :
7
+ taskfile : ./eureka-server/Taskfile.yaml
6
8
gateway :
7
9
taskfile : ./api-gateway/Taskfile.yaml
8
10
17
19
silent : true
18
20
test :
19
21
desc : Test all projects
20
- cmd : ./gradlew test --parallel
22
+ cmds :
23
+ - task : clean
24
+ - ./gradlew test --parallel
21
25
silent : true
22
26
23
27
gradle:stop :
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ dependencies {
27
27
}
28
28
29
29
implementation ' org.springframework.cloud:spring-cloud-starter-gateway'
30
+ implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
30
31
developmentOnly ' org.springframework.boot:spring-boot-devtools'
31
32
testImplementation ' org.springframework.boot:spring-boot-starter-test'
32
33
testImplementation ' io.projectreactor:reactor-test'
Original file line number Diff line number Diff line change 1
1
server :
2
2
port : 8080
3
3
4
+ eureka :
5
+ client :
6
+ service-url :
7
+ defaultZone : ${EUREKA_URI:http://localhost:8761/eureka}
8
+
4
9
spring :
5
10
application :
6
11
name : api-gateway
Original file line number Diff line number Diff line change 2
2
3
3
import org .junit .jupiter .api .Test ;
4
4
import org .springframework .boot .test .context .SpringBootTest ;
5
+ import org .springframework .test .context .TestPropertySource ;
5
6
6
7
@ SpringBootTest
8
+ @ TestPropertySource (properties = {
9
+ "eureka.client.enabled=false" ,
10
+ "eureka.client.register-with-eureka=false" ,
11
+ "eureka.client.fetch-registry=false"
12
+ })
7
13
class ApiGatewayApplicationTests {
8
14
9
- @ Test
10
- void contextLoads () {
11
- }
15
+ @ Test
16
+ void contextLoads () {
17
+ }
12
18
13
19
}
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ plugins {
4
4
id ' io.spring.dependency-management' version ' 1.1.6'
5
5
}
6
6
7
+ ext {
8
+ springCloudVersion = " 2023.0.3"
9
+ }
10
+
7
11
group = ' io.dksifoua.eshop'
8
12
version = ' 0.0.1-SNAPSHOT'
9
13
@@ -26,6 +30,7 @@ repositories {
26
30
dependencies {
27
31
implementation ' org.springframework.boot:spring-boot-starter-data-mongodb'
28
32
implementation ' org.springframework.boot:spring-boot-starter-webflux'
33
+ implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
29
34
compileOnly ' org.projectlombok:lombok'
30
35
developmentOnly ' org.springframework.boot:spring-boot-devtools'
31
36
developmentOnly ' org.springframework.boot:spring-boot-docker-compose'
@@ -38,6 +43,12 @@ dependencies {
38
43
testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
39
44
}
40
45
46
+ dependencyManagement {
47
+ imports {
48
+ mavenBom " org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion "
49
+ }
50
+ }
51
+
41
52
tasks. named(' test' ) {
42
53
useJUnitPlatform()
43
54
}
Original file line number Diff line number Diff line change 8
8
public class IndexHandler {
9
9
10
10
public Mono <ServerResponse > index () {
11
- return ServerResponse .ok ().body (Mono .just ("Welcome to eshop product category service!" ), String .class );
11
+ String responseData = "Welcome to eshop product category service!" ;
12
+ return ServerResponse .ok ().body (Mono .just (responseData ), String .class );
12
13
}
13
14
}
Original file line number Diff line number Diff line change 1
1
app :
2
2
base-path : /api/v1/catalog
3
3
4
+ eureka :
5
+ client :
6
+ service-url :
7
+ defaultZone : ${EUREKA_URI:http://localhost:8761/eureka}
8
+
4
9
server :
5
10
port : 8081
6
11
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .Test ;
4
4
import org .springframework .boot .test .context .SpringBootTest ;
5
5
import org .springframework .context .annotation .Import ;
6
+ import org .springframework .test .context .TestPropertySource ;
6
7
7
8
@ Import (TestcontainersConfiguration .class )
8
9
@ SpringBootTest
10
+ @ TestPropertySource (properties = {
11
+ "eureka.client.enabled=false" ,
12
+ "eureka.client.register-with-eureka=false" ,
13
+ "eureka.client.fetch-registry=false"
14
+ })
9
15
class CatalogServiceApplicationTests {
10
16
11
- @ Test
12
- void contextLoads () {
13
- }
17
+ @ Test
18
+ void contextLoads () {
19
+ assert true ;
20
+ }
14
21
15
22
}
Original file line number Diff line number Diff line change
1
+ HELP.md
2
+ .gradle
3
+ build /
4
+ ! gradle /wrapper /gradle-wrapper.jar
5
+ ! ** /src /main /** /build /
6
+ ! ** /src /test /** /build /
7
+
8
+ # ## STS ###
9
+ .apt_generated
10
+ .classpath
11
+ .factorypath
12
+ .project
13
+ .settings
14
+ .springBeans
15
+ .sts4-cache
16
+ bin /
17
+ ! ** /src /main /** /bin /
18
+ ! ** /src /test /** /bin /
19
+
20
+ # ## IntelliJ IDEA ###
21
+ .idea
22
+ * .iws
23
+ * .iml
24
+ * .ipr
25
+ out /
26
+ ! ** /src /main /** /out /
27
+ ! ** /src /test /** /out /
28
+
29
+ # ## NetBeans ###
30
+ /nbproject /private /
31
+ /nbbuild /
32
+ /dist /
33
+ /nbdist /
34
+ /.nb-gradle /
35
+
36
+ # ## VS Code ###
37
+ .vscode /
Original file line number Diff line number Diff line change
1
+ version : 3
2
+
3
+ tasks :
4
+ clean :
5
+ desc : Clean eureka server build
6
+ cmd : ./gradlew :eureka-server:clean
7
+ silent : true
8
+
9
+ run :
10
+ desc : Run netflix eureka server
11
+ cmd : ./gradlew :eureka-server:bootRun
12
+ silent : true
13
+
14
+ test :
15
+ desc : Test netflix eureka server
16
+ cmds :
17
+ - task : clean
18
+ - ./gradlew :eureka-server:test
19
+ silent : true
Original file line number Diff line number Diff line change
1
+ plugins {
2
+ id ' java'
3
+ id ' org.springframework.boot' version ' 3.3.3'
4
+ id ' io.spring.dependency-management' version ' 1.1.6'
5
+ }
6
+
7
+ group = ' io.dksifoua.eshop'
8
+ version = ' 0.0.1-SNAPSHOT'
9
+
10
+ java {
11
+ toolchain {
12
+ languageVersion = JavaLanguageVersion . of(21 )
13
+ }
14
+ }
15
+
16
+ repositories {
17
+ mavenCentral()
18
+ }
19
+
20
+ ext {
21
+ set(' springCloudVersion' , " 2023.0.3" )
22
+ }
23
+
24
+ dependencies {
25
+ implementation ' org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
26
+ testImplementation ' org.springframework.boot:spring-boot-starter-test'
27
+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
28
+ }
29
+
30
+ dependencyManagement {
31
+ imports {
32
+ mavenBom " org.springframework.cloud:spring-cloud-dependencies:${ springCloudVersion} "
33
+ }
34
+ }
35
+
36
+ tasks. named(' test' ) {
37
+ useJUnitPlatform()
38
+ }
Original file line number Diff line number Diff line change
1
+ rootProject. name = ' eureka'
Original file line number Diff line number Diff line change
1
+ package io .dksifoua .eshop .eureka ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .cloud .netflix .eureka .server .EnableEurekaServer ;
6
+
7
+ @ SpringBootApplication
8
+ @ EnableEurekaServer
9
+ public class EurekaServerApplication {
10
+
11
+ public static void main (String [] args ) {
12
+ SpringApplication .run (EurekaServerApplication .class , args );
13
+ }
14
+
15
+ }
Original file line number Diff line number Diff line change
1
+ eureka :
2
+ client :
3
+ fetch-registry : false
4
+ register-with-eureka : false
5
+
6
+ server :
7
+ port : 8761
8
+
9
+ spring :
10
+ application :
11
+ name : eureka-server
Original file line number Diff line number Diff line change
1
+ package io .dksifoua .eshop .eureka ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+ import org .springframework .boot .test .context .SpringBootTest ;
5
+
6
+ @ SpringBootTest
7
+ class EurekaServerApplicationTests {
8
+
9
+ @ Test
10
+ void contextLoads () {
11
+ assert true ;
12
+ }
13
+
14
+ }
Original file line number Diff line number Diff line change 1
1
rootProject. name = ' eshop'
2
2
3
3
include(' api-gateway' )
4
- include(' catalog-service' )
4
+ include(' catalog-service' )
5
+ include(' eureka-server' )
You can’t perform that action at this time.
0 commit comments