Commit 2344624f authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

Merge branch 'master' into 27-spring-boot-restserver-with-module-info

parents b7d38622 458cc98b
image: maven:3.8.3-openjdk-17
variables:
MAVEN_OPTS: "-Djava.awt.headless=true -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_CLI_OPTS: "--batch-mode -P headless -DskipUiTests=true"
stages:
- test
- build
cache:
paths:
- .m2/repository
key: "$CI_BUILD_REF_NAME"
test:
stage: test
script:
- "cd todolist; mvn clean test $MAVEN_CLI_OPTS"
build:
stage: build
when: manual
script:
- "cd todolist; mvn clean install $MAVEN_CLI_OPTS"
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Launch TodoApp",
"request": "launch",
"mainClass": "todolist.ui/todolist.ui.TodoApp",
"vmArgs": "--add-opens todolist.ui/todolist.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
"projectName": "fxui"
},
{
"type": "java",
"name": "Launch TodoDocumentApp",
"request": "launch",
"mainClass": "todolist.ui/todolist.ui.TodoDocumentApp",
"vmArgs": "--add-opens todolist.ui/todolist.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
"projectName": "fxui"
},
{
"type": "java",
"name": "Launch TodoRemoteApp",
"request": "launch",
"mainClass": "todolist.ui/todolist.ui.TodoRemoteApp",
"vmArgs": "--add-opens todolist.ui/todolist.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED",
"projectName": "fxui"
}
]
}
\ No newline at end of file
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.format.settings.url": "todolist/config/checkstyle/eclipse-java-google-style.xml",
"[java]": {
"editor.tabSize": 2
},
"java.test.config": [
{
"name": "coreTesting",
"vmArgs": []
},
{
"name": "fxuiTesting",
"vmArgs": ["--add-opens", "todolist.ui/todolist.ui=ALL-UNNAMED", "--add-exports", "javafx.graphics/com.sun.javafx.application=ALL-UNNAMED"]
}
],
"java.test.defaultConfig": "fxuiTesting"
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ component core {
package todolist.json
}
todolist.core ..> todolist.json
component jackson {
}
......@@ -15,9 +16,10 @@ component fxutil {
component fxui {
package todolist.ui
package todolist.ui.util
}
todolist.ui ..> todolist.ui.util
todolist.ui ..> todolist.core
todolist.ui ..> todolist.json
......@@ -55,16 +57,4 @@ component grizzly2 {
rest ..> jersey
rest ..> grizzly2
component "springboot/restserver" as springboot.restserver {
package todolist.springboot.restserver
}
todolist.springboot.restserver ..> todolist.core
todolist.springboot.restserver ..> todolist.json
component "spring boot" as springboot {
}
springboot.restserver ..> springboot
@enduml
\ No newline at end of file
......@@ -11,10 +11,6 @@
<artifactId>fxui</artifactId>
<properties>
<skipUiTests>false</skipUiTests>
</properties>
<dependencies>
<dependency>
<groupId>it1901.todolist</groupId>
......@@ -167,6 +163,22 @@
</plugins>
</build>
</profile>
<profile>
<id>headless</id>
<properties>
<headlessTests>true</headlessTests>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testfx/openjfx-monocle -->
<dependency>
<groupId>org.testfx</groupId>
<artifactId>openjfx-monocle</artifactId>
<version>jdk-12.0.1+2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
......@@ -179,17 +191,50 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipUiTests}</skipTests>
<systemPropertyVariables>
<headless>${headlessTests}</headless>
</systemPropertyVariables>
<argLine>
@{jaCoCoArgLine} --add-opens todolist.ui/todolist.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
@{jaCoCoArgLine}
--add-opens todolist.ui/todolist.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
--add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
--add-exports javafx.graphics/com.sun.glass.ui.delegate=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<version>0.0.8</version>
<configuration>
<mainClass>todolist.ui/todolist.ui.TodoApp</mainClass>
<!-- rest of options are for jlink -->
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<stripDebug>true</stripDebug>
<noManPages>true</noManPages>
<launcher>todolistfx</launcher>
<jlinkImageName>todolistfx</jlinkImageName>
<jlinkZipName>todolistfx</jlinkZipName>
</configuration>
</plugin>
<!-- config above and below taken from https://dev.to/cherrychain/javafx-jlink-and-jpackage-h9 -->
<plugin>
<groupId>org.panteleyev</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<name>TodoListFX</name>
<appVersion>1.0.0</appVersion>
<vendor>it1901</vendor>
<destination>target/dist</destination>
<module>todolist.ui/todolist.ui.TodoApp</module>
<runtimeImage>target/todolistfx</runtimeImage>
<javaOptions>
<option>-Dfile.encoding=UTF-8</option>
</javaOptions>
</configuration>
</plugin>
......
......@@ -7,6 +7,9 @@ module todolist.ui {
requires javafx.controls;
requires javafx.fxml;
requires de.jensd.fx.glyphs.commons;
requires de.jensd.fx.glyphs.fontawesome;
requires todolist.core;
requires fxutil;
......
......@@ -11,6 +11,19 @@ import javafx.stage.Stage;
*/
public class TodoApp extends Application {
/**
* Helper method used by tests needing to run headless.
*/
public static void supportHeadless() {
if (Boolean.getBoolean("headless")) {
System.setProperty("testfx.robot", "glass");
System.setProperty("testfx.headless", "true");
System.setProperty("prism.order", "sw");
System.setProperty("prism.text", "t2k");
System.setProperty("java.awt.headless", "true");
}
}
@Override
public void start(Stage stage) throws Exception {
Parent parent = FXMLLoader.load(getClass().getResource("TodoApp.fxml"));
......
......@@ -10,12 +10,19 @@ import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.testfx.framework.junit5.ApplicationTest;
public class TodoAppTest extends ApplicationTest {
@BeforeAll
public static void setupHeadless() {
TodoApp.supportHeadless();
}
private TodoModelController controller;
@Override
......@@ -26,7 +33,7 @@ public class TodoAppTest extends ApplicationTest {
stage.setScene(new Scene(root));
stage.show();
}
private TodoPersistence todoPersistence = new TodoPersistence();
@BeforeEach
......
......@@ -16,10 +16,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.testfx.framework.junit5.ApplicationTest;
import org.testfx.util.WaitForAsyncUtils;
import todolist.core.AbstractTodoList;
......@@ -31,6 +32,11 @@ import todolist.json.TodoPersistence;
public class TodoListControllerTest extends ApplicationTest {
@BeforeAll
public static void setupHeadless() {
TodoApp.supportHeadless();
}
private TodoListController controller;
@Override
......@@ -123,7 +129,6 @@ public class TodoListControllerTest extends ApplicationTest {
/** Test - virker ikke i gitpod */
@Test
@DisplayName("Test dragging a ToDo list item")
@DisabledIfEnvironmentVariable(named = "GITPOD_WORKSPACE_ID", matches = ".*")
public void testDragTodoItem() {
Predicate<TodoItemListCell> draggableCell = cell -> cell.lookup(".label") != null;
// drag the first item in the list view, which is the second item in the model
......
......@@ -75,6 +75,24 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>headless</id>
<properties>
<headlessTests>true</headlessTests>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testfx/openjfx-monocle -->
<dependency>
<groupId>org.testfx</groupId>
<artifactId>openjfx-monocle</artifactId>
<version>jdk-12.0.1+2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>
......@@ -147,8 +165,10 @@
<goal>verify</goal>
</goals>
<configuration>
<skipTests>${skipUiTests}</skipTests>
<!-- System.getProperty("todo.port") gir riktig port -->
<systemPropertyVariables>
<headless>${headlessTests}</headless>
<todo.port>${jetty.port}</todo.port>
</systemPropertyVariables>
</configuration>
......
......@@ -11,12 +11,18 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.testfx.framework.junit5.ApplicationTest;
public class TodoAppIT extends ApplicationTest {
@BeforeAll
public static void setupHeadless() {
TodoApp.supportHeadless();
}
private TodoModelController controller;
@Override
......
......@@ -12,6 +12,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jupiter.version>5.8.1</jupiter.version>
<jackson.version>2.12.5</jackson.version>
<skipUiTests>false</skipUiTests>
<headlessTests>false</headlessTests>
</properties>
<dependencyManagement>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment