| 1 |
|
package org.europa.together; |
| 2 |
|
|
| 3 |
|
import java.sql.SQLException; |
| 4 |
|
import org.europa.together.application.JdbcActions; |
| 5 |
|
import org.europa.together.application.LogbackLogger; |
| 6 |
|
import org.europa.together.business.DatabaseActions; |
| 7 |
|
import org.europa.together.business.Logger; |
| 8 |
|
import org.europa.together.domain.LogLevel; |
| 9 |
|
import org.junit.jupiter.api.extension.BeforeAllCallback; |
| 10 |
|
import org.junit.jupiter.api.extension.ExtensionContext; |
| 11 |
|
import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL; |
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| |
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 4 |
Complexity Density: 0.36 |
|
| 18 |
|
public class JUnit5Preperator |
| 19 |
|
implements BeforeAllCallback { |
| 20 |
|
|
| 21 |
|
private static final Logger LOGGER = new LogbackLogger(JUnit5Preperator.class); |
| 22 |
|
|
| 23 |
|
public static DatabaseActions JDBC_CONNECTION; |
| 24 |
|
private static boolean isConnected = false; |
| 25 |
|
|
| |
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 26 |
34 |
@Override... |
| 27 |
|
public void beforeAll(ExtensionContext context) { |
| 28 |
34 |
LOGGER.log("TEST ENVIRONMENT will be prepared.", LogLevel.DEBUG); |
| 29 |
|
|
| 30 |
|
|
| 31 |
34 |
JDBC_CONNECTION = new JdbcActions(); |
| 32 |
34 |
try { |
| 33 |
34 |
JDBC_CONNECTION.connect("test"); |
| 34 |
34 |
LOGGER.log("JDBC: " + JDBC_CONNECTION.getJdbcMetaData().toString(), LogLevel.DEBUG); |
| 35 |
|
|
| 36 |
34 |
JUnit5Preperator.isConnected = true; |
| 37 |
34 |
context.getRoot().getStore(GLOBAL).put("TogetherPlatform", this); |
| 38 |
|
|
| 39 |
|
} catch (SQLException ex) { |
| 40 |
0 |
LOGGER.catchException(ex); |
| 41 |
|
} |
| 42 |
34 |
LOGGER.log("TEST ENVIRONMENT prepared...", LogLevel.DEBUG); |
| 43 |
|
} |
| 44 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 45 |
0 |
public void close() {... |
| 46 |
0 |
LOGGER.log("TEST ENVIRONMENT will be shut down.", LogLevel.DEBUG); |
| 47 |
|
} |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 49 |
7 |
public static boolean isConnected() {... |
| 50 |
7 |
return JUnit5Preperator.isConnected; |
| 51 |
|
} |
| 52 |
|
} |