Skip to content
Snippets Groups Projects
Commit e9361c14 authored by Lukas Johannes Horn's avatar Lukas Johannes Horn Committed by Ellen Seifert
Browse files

Resolve "Create Logger Property File"

parent 8cb0da57
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
......
......@@ -31,7 +31,7 @@
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
......@@ -60,6 +60,15 @@
</options>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>
......@@ -6,6 +6,10 @@ import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.LogManager;
/**
* JavaFX application which is executed.
*
......@@ -14,6 +18,16 @@ import javafx.stage.Stage;
*/
public class DragDropSSHApplication extends Application {
static{
InputStream properties = DragDropSSHApplication.class.getClassLoader().getResourceAsStream("logging.properties");
try{
LogManager.getLogManager().readConfiguration(properties);
}catch(IOException io){
io.printStackTrace();
}
}
private static final double WINDOW_WITH = 800, WINDOW_HEIGHT = 500;
@Override
......
handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.pattern=%h/logs/%u.log
java.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter
\ No newline at end of file
......@@ -28,7 +28,7 @@
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
......
......@@ -55,7 +55,7 @@
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
......@@ -83,4 +83,14 @@
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>
......@@ -24,7 +24,7 @@
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter -->
......
......@@ -43,6 +43,7 @@ public class SSHSessionLoginTest {
public void testCorrectLogin(){
when(user.getUsername()).thenReturn("root");
when(user.getPassword()).thenReturn("root");
lenient().when(user.promptYesNo(anyString())).thenReturn(true);
when(server.getHostName()).thenReturn("localhost");
when(server.getPort()).thenReturn(2222);
......@@ -73,6 +74,7 @@ public class SSHSessionLoginTest {
@Test
public void testIncorrectUsername(){
when(user.getUsername()).thenReturn("admin");
lenient().when(user.promptYesNo(anyString())).thenReturn(true);
when(server.getHostName()).thenReturn("localhost");
when(server.getPort()).thenReturn(2222);
......@@ -84,6 +86,7 @@ public class SSHSessionLoginTest {
public void testIncorrectPassword(){
when(user.getUsername()).thenReturn("root");
when(user.getPassword()).thenReturn("example");
lenient().when(user.promptYesNo(anyString())).thenReturn(true);
when(server.getHostName()).thenReturn("localhost");
when(server.getPort()).thenReturn(2222);
......@@ -95,6 +98,7 @@ public class SSHSessionLoginTest {
public void doubleConnection(){
when(user.getUsername()).thenReturn("root");
when(user.getPassword()).thenReturn("root");
lenient().when(user.promptYesNo(anyString())).thenReturn(true);
when(server.getHostName()).thenReturn("localhost");
when(server.getPort()).thenReturn(2222);
......
......@@ -37,6 +37,7 @@ public class SSHSessionLogoutTest {
public void testCloseExistingConnection() throws Exception{
when(user.getUsername()).thenReturn("root");
when(user.getPassword()).thenReturn("root");
lenient().when(user.promptYesNo(anyString())).thenReturn(true);
when(server.getHostName()).thenReturn("localhost");
when(server.getPort()).thenReturn(2222);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment