Merge branch 'Development'

This commit is contained in:
Sem van der Hoeven
2019-03-04 11:57:15 +01:00
27 changed files with 487 additions and 36 deletions

View File

@@ -2,7 +2,12 @@
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
<configuration>
<fileset id="fileset" name="Spring Application Context" removed="false">
<file>file://$MODULE_DIR$/src/Server/src/main/java/hello/Application.java</file>
<file>file://$MODULE_DIR$/src/Client/src/main/java/hello/Application.java</file>
</fileset>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
@@ -13,20 +18,34 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/Client/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Server/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/Client/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/Server/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13-beta-2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.13-beta-2" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
<orderEntry type="library" name="Maven: org.testng:testng:7.0.0-beta3" level="project" />
<orderEntry type="library" name="Maven: com.beust:jcommander:1.72" level="project" />
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.4.0" level="project" />
<orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
</component>
</module>

68
pom.xml
View File

@@ -32,6 +32,74 @@
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0-beta3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13-beta-2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<build>

9
src/Client/.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="com.bettercoding.jfx.Client.main" target="1.8" />
<module name="com.bettercoding.jfx.Client.test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

10
src/Client/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Client.main.iml" filepath="$PROJECT_DIR$/.idea/modules/Client.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Client.test.iml" filepath="$PROJECT_DIR$/.idea/modules/Client.test.iml" />
<module fileurl="file://$PROJECT_DIR$/src/main/resources.iml" filepath="$PROJECT_DIR$/src/main/resources.iml" />
</modules>
</component>
</project>

2
src/Client/.idea/modules/Client.iml generated Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Client" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4" />

48
src/Client/.idea/modules/Client.main.iml generated Normal file
View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Client:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../out/production/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/main">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.hibernate.validator:hibernate-validator:6.0.12.Final" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-webmvc:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.yaml:snakeyaml:1.19" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
<orderEntry type="library" name="Gradle: javax.validation:validation-api:2.0.1.Final" level="project" />
<orderEntry type="library" name="Gradle: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Gradle: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
<orderEntry type="library" name="Gradle: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-core:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
</component>
</module>

75
src/Client/.idea/modules/Client.test.iml generated Normal file
View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Client:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test">
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Client.main" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-test:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Gradle: org.junit.jupiter:junit-jupiter-api:5.4.0" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.vintage:junit-vintage-engine:5.4.0" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.jupiter:junit-jupiter-engine:5.4.0" level="project" />
<orderEntry type="library" name="Gradle: org.hibernate.validator:hibernate-validator:6.0.12.Final" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-webmvc:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-test-autoconfigure:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-test:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" name="Gradle: org.assertj:assertj-core:3.9.1" level="project" />
<orderEntry type="library" name="Gradle: org.mockito:mockito-core:2.15.0" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Gradle: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-test:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: org.xmlunit:xmlunit-core:2.5.1" level="project" />
<orderEntry type="library" name="Gradle: org.junit.platform:junit-platform-commons:1.4.0" level="project" />
<orderEntry type="library" name="Gradle: org.apiguardian:apiguardian-api:1.0.0" level="project" />
<orderEntry type="library" name="Gradle: org.opentest4j:opentest4j:1.1.1" level="project" />
<orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.platform:junit-platform-engine:1.4.0" level="project" />
<orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Gradle: org.yaml:snakeyaml:1.19" level="project" />
<orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
<orderEntry type="library" name="Gradle: javax.validation:validation-api:2.0.1.Final" level="project" />
<orderEntry type="library" name="Gradle: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Gradle: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" name="Gradle: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
<orderEntry type="library" name="Gradle: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Gradle: net.bytebuddy:byte-buddy:1.7.11" level="project" />
<orderEntry type="library" name="Gradle: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
<orderEntry type="library" name="Gradle: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" name="Gradle: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Gradle: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-core:2.9.6" level="project" />
<orderEntry type="library" name="Gradle: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" name="Gradle: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
<orderEntry type="library" name="Gradle: org.ow2.asm:asm:5.0.4" level="project" />
</component>
</module>

6
src/Client/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@@ -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());
};
}
}

View File

@@ -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
+ '}';
}
}

View File

@@ -1,3 +1,5 @@
package test.java;
import org.junit.Test;
public class ApplicationTest {

View File

@@ -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;

View File

@@ -0,0 +1,31 @@
package GUI;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class GUIController {
private int pressed;
//put @FXML to let the fxml file know that it can use this label,
//kind of the same as with @Test in jUnit tests
/**
*the label to be edited by pressing the button
*/
@FXML
private Label txtLabel;
/**
* increments the counter when the button is presssed
* @param event an event that happens (button is clicked)
* @throws Exception
*/
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);
}
}

23
src/GUI/GUIMain.fxml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.GUIController">
<children>
<Label fx:id="txtLabel" layoutX="306.0" layoutY="248.0" text="Button pressed 0 times!">
<font>
<Font size="18.0" />
</font>
</Label>
<Button layoutX="362.0" layoutY="323.0" mnemonicParsing="false" onAction="#incrementLabel" text="Click me!">
<font>
<Font size="14.0" />
</font>
</Button>
</children>
</AnchorPane>

38
src/GUI/GUIMain.java Normal file
View File

@@ -0,0 +1,38 @@
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 {
/**
* launches the stage
* @param args
*/
public static void main(String[] args) {
launch(args);
}
/**
*
* @param primaryStage the stage to be started
* @throws Exception when the fxml file can't be found
*/
@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();
}
}

3
src/GUI/GUIStyle.css Normal file
View File

@@ -0,0 +1,3 @@
.root {
-fx-background-color: #eef9ee;
}

21
src/GUI/Login.fxml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.LoginController">
<children>
<TextField fx:id="usertext" layoutX="126.0" layoutY="182.0" promptText="Username" />
<PasswordField fx:id="passwordField" layoutX="126.0" layoutY="244.0" promptText="Password" />
<Button fx:id="loginbutton" layoutX="177.0" layoutY="317.0" mnemonicParsing="false" onAction="#Login" text="Login" />
<Label fx:id="statustext" alignment="CENTER" layoutX="126.0" layoutY="91.0" textAlignment="CENTER" wrapText="true">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</AnchorPane>

View File

@@ -0,0 +1,69 @@
package GUI;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class LoginController {
//set labels and textfields, with the @FXML line to let the fxml file know it can use these
@FXML
private Label statustext;
@FXML
private TextField usertext;
@FXML
private PasswordField passwordField;
@FXML
private Button loginbutton;
/**
* redirects to the main stage when the login credentials are correct
* @param event the entered username and password, and clicking the button
* @throws Exception
* @author Sem van der Hoeven
*/
public void Login(ActionEvent event) throws Exception {
//if the entered username and password are correct
if (usertext.getText().equals("user") && passwordField.getText().equals("pass")) {
//display green login succes message
statustext.setText("Login success!");
statustext.setTextFill(Color.GREEN);
//and open next window
openMainWindow();
} else {
//else display red login failed message
statustext.setText("Login failed! try again!");
statustext.setTextFill(Color.RED);
}
}
public void openMainWindow() throws Exception {
//basically the same thing as in the main class: open a new stage
Stage primaryStage = new Stage();
//link fxml file
Parent root = FXMLLoader.load(getClass().getResource("GUIMain.fxml"));
//set the scene
Scene scene = new Scene(root, 800, 600);
//link the stylesheet with the scene
scene.getStylesheets().add(getClass().getResource("GUIStyle.css").toExternalForm());
//show the stage
primaryStage.setScene(scene);
primaryStage.setTitle("oop project group 43");
primaryStage.show();
}
}

6
src/GUI/LoginStyle.css Normal file
View File

@@ -0,0 +1,6 @@
.root {
-fx-background-color: #91daff;
}
#usertext {
-fx-text-fill: #670eed;
}

4
src/Server/.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

7
src/Server/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -1,4 +1,4 @@
package hello;
package main.java.hello;
public class Greeting {

View File

@@ -1,10 +1,11 @@
package hello;
package main.java.hello;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.atomic.AtomicLong;
@RestController
public class GreetingController {

View File

@@ -1,12 +1,12 @@
package hello;
package main.java.hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public class ServerApplication {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(ServerApplication.class, args);
}
}

View File

@@ -1,14 +1,15 @@
import hello.Greeting;
import hello.GreetingController;
import org.junit.jupiter.api.Test;
package test.java;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import main.java.hello.GreetingController;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class GreetingControllerTest {
@Test
void nullTest() {
GreetingController controller = new GreetingController();
assertThat(controller).isNotNull();
// Assert.assertThat(controller).isNotNull();
Assert.assertNotNull(controller);
}
}

View File

@@ -1,7 +1,8 @@
import hello.Greeting;
import org.junit.jupiter.api.Test;
package test.java;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import main.java.hello.Greeting;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
public class GreetingTest {
@Test
@@ -9,7 +10,9 @@ public class GreetingTest {
Greeting greeting = new Greeting(1, "hello");
long id = greeting.getId();
String content = greeting.getContent();
assertThat(id).isEqualTo(1);
assertThat(content).isEqualTo(content);
// assertThat(id).isEqualTo(1);
Assert.assertEquals(id, 1);
// assertThat(content).isEqualTo(content);
Assert.assertEquals(content,content);
}
}

View File

@@ -1,5 +1,7 @@
package test.java;
import org.junit.Test;
public class ApplicationTest {
public class ServerApplicationTest {
@Test
public void main() {
}