From 9d14afb724a06e210eb64d8f6bea319048a70a28 Mon Sep 17 00:00:00 2001 From: bu_ausb <2036870220@qq.com> Date: Sat, 28 Oct 2023 21:43:32 +0800 Subject: [PATCH] i don't known if it is right --- client-side/.gitignore | 38 +++++++++++++++++++ client-side/pom.xml | 37 ++++++++++++++++++ .../src/main/java/org/example/App.java | 13 +++++++ .../org/example/RegistrationServiceProxy.java | 22 +++++++++++ .../src/test/java/org/example/AppTest.java | 38 +++++++++++++++++++ pom.xml | 1 + 6 files changed, 149 insertions(+) create mode 100644 client-side/.gitignore create mode 100644 client-side/pom.xml create mode 100644 client-side/src/main/java/org/example/App.java create mode 100644 client-side/src/main/java/org/example/RegistrationServiceProxy.java create mode 100644 client-side/src/test/java/org/example/AppTest.java diff --git a/client-side/.gitignore b/client-side/.gitignore new file mode 100644 index 000000000000..5ff6309b7199 --- /dev/null +++ b/client-side/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/client-side/pom.xml b/client-side/pom.xml new file mode 100644 index 000000000000..898d91dbee96 --- /dev/null +++ b/client-side/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.26.0-SNAPSHOT + + + org.example + client-side + jar + + client-side + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + org.springframework + spring-web + + + org.springframework.boot + spring-boot-starter + + + diff --git a/client-side/src/main/java/org/example/App.java b/client-side/src/main/java/org/example/App.java new file mode 100644 index 000000000000..5f21d2e226b4 --- /dev/null +++ b/client-side/src/main/java/org/example/App.java @@ -0,0 +1,13 @@ +package org.example; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/client-side/src/main/java/org/example/RegistrationServiceProxy.java b/client-side/src/main/java/org/example/RegistrationServiceProxy.java new file mode 100644 index 000000000000..f1fe1b318666 --- /dev/null +++ b/client-side/src/main/java/org/example/RegistrationServiceProxy.java @@ -0,0 +1,22 @@ +package org.example; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +@Component +public class RegistrationServiceProxy { + @Value("${user_registration_url}") + String userRegistrationUrl; + @Autowired + RestTemplate restTemplate; + @Autowired + HttpRequest request; + public void registerUser(String emailAddress,String password){ + restTemplate.postForEntity(userRegistrationUrl,request,HttpResponse.class); + } +} diff --git a/client-side/src/test/java/org/example/AppTest.java b/client-side/src/test/java/org/example/AppTest.java new file mode 100644 index 000000000000..d5f435df0340 --- /dev/null +++ b/client-side/src/test/java/org/example/AppTest.java @@ -0,0 +1,38 @@ +package org.example; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/pom.xml b/pom.xml index a68345bcba94..58166a7130e4 100644 --- a/pom.xml +++ b/pom.xml @@ -208,6 +208,7 @@ thread-local-storage optimistic-offline-lock crtp + client-side