From 530d32f2afead2e65d19058a3619a69295932449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Sat, 5 Nov 2022 19:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Test=20Provider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/.idea/encodings.xml | 2 ++ .../.idea/runConfigurations/TestProvider.xml | 16 ++++++++++ backend/microservice-gateway/pom.xml | 1 - .../src/main/resources/application.yml | 2 ++ .../microservice-provider-test-8011/pom.xml | 31 +++++++++++++++++++ .../java/com/cxyxiaomo/epp/TestProvider.java | 13 ++++++++ .../epp/controller/TestController.java | 14 +++++++++ .../src/main/resources/application.yml | 7 +++++ .../test/java/com/cxyxiaomo/epp/AppTest.java | 20 ++++++++++++ backend/pom.xml | 1 + 10 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 backend/.idea/runConfigurations/TestProvider.xml create mode 100644 backend/microservice-provider-test-8011/pom.xml create mode 100644 backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/TestProvider.java create mode 100644 backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/controller/TestController.java create mode 100644 backend/microservice-provider-test-8011/src/main/resources/application.yml create mode 100644 backend/microservice-provider-test-8011/src/test/java/com/cxyxiaomo/epp/AppTest.java diff --git a/backend/.idea/encodings.xml b/backend/.idea/encodings.xml index f34c6c5..b38c268 100644 --- a/backend/.idea/encodings.xml +++ b/backend/.idea/encodings.xml @@ -7,6 +7,8 @@ + + diff --git a/backend/.idea/runConfigurations/TestProvider.xml b/backend/.idea/runConfigurations/TestProvider.xml new file mode 100644 index 0000000..9b8a6dc --- /dev/null +++ b/backend/.idea/runConfigurations/TestProvider.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/backend/microservice-gateway/pom.xml b/backend/microservice-gateway/pom.xml index 0d205ab..75c2848 100644 --- a/backend/microservice-gateway/pom.xml +++ b/backend/microservice-gateway/pom.xml @@ -21,7 +21,6 @@ junit junit - 4.11 test diff --git a/backend/microservice-provider-miniprogram-8080/src/main/resources/application.yml b/backend/microservice-provider-miniprogram-8080/src/main/resources/application.yml index d4ead2c..921eeb2 100644 --- a/backend/microservice-provider-miniprogram-8080/src/main/resources/application.yml +++ b/backend/microservice-provider-miniprogram-8080/src/main/resources/application.yml @@ -3,6 +3,8 @@ server: max-http-header-size: 102400 spring: + application: + name: microservice-provider-miniprogram datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC diff --git a/backend/microservice-provider-test-8011/pom.xml b/backend/microservice-provider-test-8011/pom.xml new file mode 100644 index 0000000..cf03d61 --- /dev/null +++ b/backend/microservice-provider-test-8011/pom.xml @@ -0,0 +1,31 @@ + + + + + epp + com.cxyxiaomo + 0.0.1-SNAPSHOT + + 4.0.0 + + microservice-provider-test + + + UTF-8 + 11 + 11 + + + + + + org.springframework.boot + spring-boot-test + + + org.springframework.boot + spring-boot-starter-web + + + diff --git a/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/TestProvider.java b/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/TestProvider.java new file mode 100644 index 0000000..8b1b4d9 --- /dev/null +++ b/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/TestProvider.java @@ -0,0 +1,13 @@ +package com.cxyxiaomo.epp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +// 启动类 + +@SpringBootApplication +public class TestProvider { + public static void main(String[] args) { + SpringApplication.run(TestProvider.class, args); + } +} diff --git a/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/controller/TestController.java b/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/controller/TestController.java new file mode 100644 index 0000000..69770d6 --- /dev/null +++ b/backend/microservice-provider-test-8011/src/main/java/com/cxyxiaomo/epp/controller/TestController.java @@ -0,0 +1,14 @@ +package com.cxyxiaomo.epp.controller; + +// 提供 restful 服务 + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class TestController { + @GetMapping("/") + public String helloWorld() { + return "Hello World!"; + } +} diff --git a/backend/microservice-provider-test-8011/src/main/resources/application.yml b/backend/microservice-provider-test-8011/src/main/resources/application.yml new file mode 100644 index 0000000..9f8141c --- /dev/null +++ b/backend/microservice-provider-test-8011/src/main/resources/application.yml @@ -0,0 +1,7 @@ +server: + port: 8011 + +# Spring 配置 +spring: + application: + name: microservice-provider-test diff --git a/backend/microservice-provider-test-8011/src/test/java/com/cxyxiaomo/epp/AppTest.java b/backend/microservice-provider-test-8011/src/test/java/com/cxyxiaomo/epp/AppTest.java new file mode 100644 index 0000000..b3dda20 --- /dev/null +++ b/backend/microservice-provider-test-8011/src/test/java/com/cxyxiaomo/epp/AppTest.java @@ -0,0 +1,20 @@ +package com.cxyxiaomo.epp; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/backend/pom.xml b/backend/pom.xml index 3c895af..97ce6ca 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -17,6 +17,7 @@ microservice-pojo microservice-provider-user-8001 microservice-provider-miniprogram-8080 + microservice-provider-test-8011