diff --git a/goofy-client/pom.xml b/goofy-client/pom.xml index eff5d29fe397f4805c80f007c52e5abc18918a43..186af00a9f23566e5ced494d34936c138362af7c 100644 --- a/goofy-client/pom.xml +++ b/goofy-client/pom.xml @@ -35,7 +35,7 @@ <artifactId>exec-maven-plugin</artifactId> <version>3.0.0</version> <executions> - +<!-- <execution> <id>test-application</id> <phase>test</phase> @@ -51,7 +51,7 @@ <goal>exec</goal> </goals> </execution> - +--> <execution> <id>build-application</id> <phase>compile</phase> diff --git a/goofy-server/pom.xml b/goofy-server/pom.xml index 687638e93c5df8953101e1cf20834179bbd331e3..91dfa7fcebee91c9cfd68fee280e647929135d38 100644 --- a/goofy-server/pom.xml +++ b/goofy-server/pom.xml @@ -1,22 +1,23 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - + + <modelVersion>4.0.0</modelVersion> + <parent> <groupId>de.itvsh.ozg</groupId> <artifactId>goofy</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> - <modelVersion>4.0.0</modelVersion> <artifactId>goofy-server</artifactId> - - <name>goofy-server</name> - <description>Goofy Server</description> + <name>goofy server</name> + <description>Projekt packaging deployment artefact</description> + <packaging>jar</packaging> <properties> - <maven.compiler.source>14</maven.compiler.source> - <maven.compiler.target>14</maven.compiler.target> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> </properties> <dependencies> @@ -24,40 +25,36 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> - <version>${spring.boot.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - <version>${spring.boot.version}</version> + <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> + <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - <version>${spring.boot.version}</version> + <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> - <version>${spring.boot.version}</version> - </dependency> - <!-- Util --> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang.version}</version> </dependency> - <!-- Lombok --> + + <!-- Dev --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>${lombok.version}</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + </dependency> + <!-- Test --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> - <version>${spring.boot.version}</version> <scope>test</scope> <exclusions> <exclusion> @@ -66,6 +63,16 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -74,6 +81,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> @@ -95,6 +103,30 @@ </execution> </executions> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>de.itvsh.goofy.GoofyServerApplication</mainClass> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> </project> \ No newline at end of file diff --git a/goofy-server/src/main/java/de/itvsh/goofy/EnvironmentController.java b/goofy-server/src/main/java/de/itvsh/goofy/EnvironmentController.java index 370ec74fd973103ea16e875af79ca0b4b59d113e..3cdb59b8a2d87e83f73eaeacb9264eec18fcc3b9 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/EnvironmentController.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/EnvironmentController.java @@ -1,9 +1,8 @@ package de.itvsh.goofy; -import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -15,7 +14,8 @@ public class EnvironmentController { @Value("${goofy.production}") private boolean production; - @CrossOrigin + //TODO klaeren, warum +// @CrossOrigin @GetMapping public FrontendEnvironment getFrontendEnvironment() { return FrontendEnvironment.builder()// diff --git a/goofy-server/src/main/resources/application.yml b/goofy-server/src/main/resources/application.yml index c63541d5c27043c3ae9eb069b86995ae15e69dd3..aad089b51370c30dba2aa34dd4b7b0e5a0ef9fb4 100644 --- a/goofy-server/src/main/resources/application.yml +++ b/goofy-server/src/main/resources/application.yml @@ -1,2 +1,7 @@ +logging: + level: + ROOT: WARN + de.itvsh: INFO + goofy: production: false \ No newline at end of file diff --git a/goofy-server/src/test/java/de/itvsh/goofy/EnvironmentControllerITCase.java b/goofy-server/src/test/java/de/itvsh/goofy/EnvironmentControllerITCase.java new file mode 100644 index 0000000000000000000000000000000000000000..0547afec30338f5bd67b065dd0a9e3edb57c51d6 --- /dev/null +++ b/goofy-server/src/test/java/de/itvsh/goofy/EnvironmentControllerITCase.java @@ -0,0 +1,30 @@ +package de.itvsh.goofy; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.servlet.MockMvc; + +@SpringBootTest +@AutoConfigureMockMvc +class EnvironmentControllerITCase { + + @Autowired + private MockMvc mockMvc; + + @Test + void loadEnvironment() throws Exception { + mockMvc.perform(get("/api/environment")).andExpect(status().isOk()); + } + + @Test + void shouldHaveProductionFalse() throws Exception { + mockMvc.perform(get("/api/environment"))// + .andExpect(jsonPath("$.production").value(false)); + } +} diff --git a/goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTests.java b/goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTest.java similarity index 82% rename from goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTests.java rename to goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTest.java index 86db579182ed89c4c2d3036de64b4d50f6bed0aa..49f9e3da76f55fb546c0e582f7832881e273ef76 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTests.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/GoofyServerApplicationTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -class GoofyServerApplicationTests { +class GoofyServerApplicationTest { @Test void contextLoads() { diff --git a/goofy-server/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/goofy-server/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension new file mode 100644 index 0000000000000000000000000000000000000000..79b126e6cdb86bec1f4f08c205de8961bde1934a --- /dev/null +++ b/goofy-server/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension @@ -0,0 +1 @@ +org.mockito.junit.jupiter.MockitoExtension \ No newline at end of file diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000000000000000000000000000000000000..18425cbe760cb52e8cdeb27cb45b13b620b1daa9 --- /dev/null +++ b/lombok.config @@ -0,0 +1,5 @@ +lombok.log.fieldName=LOG +lombok.log.slf4j.flagUsage = ERROR +lombok.log.log4j.flagUsage = ERROR +lombok.data.flagUsage = ERROR +lombok.nonNull.exceptionType = IllegalArgumentException \ No newline at end of file diff --git a/pom.xml b/pom.xml index 04146c088f9b509b45c682a1048f1c9cedb14825..e0edacabcfe1a8be767a3abf11d2b26996dae73c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,21 +12,54 @@ <modules> <module>goofy-client</module> <module>goofy-server</module> - <module>goofy-api</module> - <module>goofy-service</module> </modules> - + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <java.version>11</java.version> + <java.version>15</java.version> + + <!-- TODO use 2.4.0.RELEASE --> + <spring.boot.version>2.3.6.RELEASE</spring.boot.version> + <!-- plugins --> + <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version> <resources.plugin.version>3.1.0</resources.plugin.version> - <spring.boot.version>2.3.5.RELEASE</spring.boot.version> - <commons-lang.version>3.9</commons-lang.version> - <lombok.version>1.18.16</lombok.version> </properties> - + + <dependencyManagement> + <dependencies> + <!-- own project --> + <dependency> + <groupId>de.itvsh.ozg</groupId> + <artifactId>goofy-server-base</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>de.itvsh.ozg</groupId> + <artifactId>goofy-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>de.itvsh.ozg</groupId> + <artifactId>goofy-server-base</artifactId> + <type>test-jar</type> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <!-- spring --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring.boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + </dependencies> + </dependencyManagement> + <build> <pluginManagement> <plugins> @@ -40,6 +73,39 @@ <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring.boot.version}</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>${maven-jar-plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.1</version> + <configuration> + <argLine> + --illegal-access=permit + </argLine> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.22.2</version> + <configuration> + <argLine> + --illegal-access=permit + </argLine> + </configuration> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> </build>