diff --git a/OOP-Project.iml b/OOP-Project.iml index b1907ae..391e562 100644 --- a/OOP-Project.iml +++ b/OOP-Project.iml @@ -2,7 +2,12 @@ - + + + file://$MODULE_DIR$/src/Server/src/main/java/hello/Application.java + file://$MODULE_DIR$/src/Client/src/main/java/hello/Application.java + + @@ -13,20 +18,34 @@ + + - - + + - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 547dea2..74ac535 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,74 @@ spring-boot-autoconfigure 2.0.5.RELEASE + + org.slf4j + slf4j-api + 1.7.25 + + + org.slf4j + slf4j-api + 1.7.25 + + + org.springframework + spring-web + 5.0.9.RELEASE + + + ch.qos.logback + logback-classic + 1.2.3 + + + org.slf4j + slf4j-api + 1.7.25 + + + org.springframework + spring-web + 5.0.9.RELEASE + + + org.springframework + spring-web + 5.0.9.RELEASE + + + org.apache.logging.log4j + log4j-api + 2.10.0 + + + org.testng + testng + RELEASE + compile + + + org.testng + testng + 7.0.0-beta3 + compile + + + junit + junit + 4.13-beta-2 + + + org.junit.jupiter + junit-jupiter-api + RELEASE + compile + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.0 + diff --git a/src/Client/.idea/compiler.xml b/src/Client/.idea/compiler.xml new file mode 100644 index 0000000..3d94435 --- /dev/null +++ b/src/Client/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/Client/.idea/modules.xml b/src/Client/.idea/modules.xml new file mode 100644 index 0000000..46edb73 --- /dev/null +++ b/src/Client/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/Client/.idea/modules/Client.iml b/src/Client/.idea/modules/Client.iml new file mode 100644 index 0000000..642f2c3 --- /dev/null +++ b/src/Client/.idea/modules/Client.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Client/.idea/modules/Client.main.iml b/src/Client/.idea/modules/Client.main.iml new file mode 100644 index 0000000..046df4e --- /dev/null +++ b/src/Client/.idea/modules/Client.main.iml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Client/.idea/modules/Client.test.iml b/src/Client/.idea/modules/Client.test.iml new file mode 100644 index 0000000..ae12b55 --- /dev/null +++ b/src/Client/.idea/modules/Client.test.iml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Client/.idea/vcs.xml b/src/Client/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/src/Client/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Client/src/main/java/hello/Application.java b/src/Client/src/main/java/hello/Application.java index 0f4d931..c194ad3 100644 --- a/src/Client/src/main/java/hello/Application.java +++ b/src/Client/src/main/java/hello/Application.java @@ -1,4 +1,4 @@ -package hello; +package main.java.hello; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -9,12 +9,14 @@ import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; +/* +Application that connects to the server + */ @SpringBootApplication public class Application { - private static final Logger log = LoggerFactory.getLogger(Application.class); - public static void main(String args[]) { + public static void main(String[] args) { SpringApplication.run(Application.class); } @@ -22,14 +24,11 @@ public class Application { public RestTemplate restTemplate(RestTemplateBuilder builder) { return builder.build(); } - @Bean public CommandLineRunner run(RestTemplate restTemplate) throws Exception { return args -> { - Message message = restTemplate.getForObject( - "http://localhost:8080/greeting?name=Ceren", Message.class); + Message message = restTemplate.getForObject("http://localhost:8080/greeting?name=Ceren", Message.class); log.info(message.toString()); - }; } } \ No newline at end of file diff --git a/src/Client/src/main/java/hello/Message.java b/src/Client/src/main/java/hello/Message.java index b02965e..b32368e 100644 --- a/src/Client/src/main/java/hello/Message.java +++ b/src/Client/src/main/java/hello/Message.java @@ -1,4 +1,4 @@ -package hello; +package main.java.hello; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -29,9 +29,9 @@ public class Message { @Override public String toString() { - return "Message{" + - "id='" + id + '\'' + - ", content=" + content + - '}'; + return "Message{" + + "id='" + id + '\'' + + ", content=" + content + + '}'; } } \ No newline at end of file diff --git a/src/Client/src/test/java/ApplicationTest.java b/src/Client/src/test/java/ApplicationTest.java index 25d7734..162aa0f 100644 --- a/src/Client/src/test/java/ApplicationTest.java +++ b/src/Client/src/test/java/ApplicationTest.java @@ -1,3 +1,5 @@ +package test.java; + import org.junit.Test; public class ApplicationTest { diff --git a/src/Client/src/test/java/MessageTest.java b/src/Client/src/test/java/MessageTest.java index b0ad736..c5fb96f 100644 --- a/src/Client/src/test/java/MessageTest.java +++ b/src/Client/src/test/java/MessageTest.java @@ -1,4 +1,8 @@ -import hello.Message; +package test.java; + + + +import main.java.hello.Message; import org.junit.Assert; import org.junit.jupiter.api.Test; diff --git a/src/GUI/GUIController.java b/src/GUI/GUIController.java new file mode 100644 index 0000000..f829230 --- /dev/null +++ b/src/GUI/GUIController.java @@ -0,0 +1,22 @@ +package GUI; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Label; + +public class GUIController { + int pressed; + + //put @FXML to let the fxml file know that it can use this label, + // ind of the same as with @Test in jUnit tests + @FXML + private Label txtLabel; + + public void incrementLabel(ActionEvent event) throws Exception { +// System.out.println("pressed button"); + pressed++; + String labeltext = "Button pressed " + pressed + " times!"; + //set the text of the label to the string above + txtLabel.setText(labeltext); + } +} diff --git a/src/GUI/GUIMain.fxml b/src/GUI/GUIMain.fxml new file mode 100644 index 0000000..94ef759 --- /dev/null +++ b/src/GUI/GUIMain.fxml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/src/GUI/GUIMain.java b/src/GUI/GUIMain.java new file mode 100644 index 0000000..7b85a2b --- /dev/null +++ b/src/GUI/GUIMain.java @@ -0,0 +1,29 @@ +package GUI; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +public class GUIMain extends Application { + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + //link fxml file + Parent root = FXMLLoader.load(getClass().getResource("Login.fxml")); + //set the scene + Scene scene = new Scene(root, 400, 400); + //link the stylesheet with the scene + scene.getStylesheets().add(getClass().getResource("LoginStyle.css").toExternalForm()); + + //show the stagw + primaryStage.setScene(scene); + primaryStage.setTitle("login"); + primaryStage.show(); + } +} diff --git a/src/GUI/GUIStyle.css b/src/GUI/GUIStyle.css new file mode 100644 index 0000000..642022f --- /dev/null +++ b/src/GUI/GUIStyle.css @@ -0,0 +1,3 @@ +.root { + -fx-background-color: #eef9ee; +} \ No newline at end of file diff --git a/src/GUI/Login.fxml b/src/GUI/Login.fxml new file mode 100644 index 0000000..b943647 --- /dev/null +++ b/src/GUI/Login.fxml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + +