File tree

6 files changed

+180
-0
lines changed

6 files changed

+180
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@
6767
<artifactId>jaxb-api</artifactId>
6868
<version>2.3.0</version>
6969
</dependency>
70+
<dependency>
71+
<groupId>com.fasterxml.jackson.dataformat</groupId>
72+
<artifactId>jackson-dataformat-yaml</artifactId>
73+
<version>2.9.5</version>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.fasterxml.jackson.core</groupId>
77+
<artifactId>jackson-databind</artifactId>
78+
<version>2.9.5</version>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.apache.commons</groupId>
82+
<artifactId>commons-lang3</artifactId>
83+
<version>3.7</version>
84+
<scope>test</scope>
85+
</dependency>
7086
</dependencies>
7187

7288
<build>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.utplsql.cli.config;
2+
3+
import java.beans.ConstructorProperties;
4+
5+
public class ConnectionConfig {
6+
7+
private final String connectString;
8+
9+
@ConstructorProperties({"connectString"})
10+
public ConnectionConfig(String connectString) {
11+
this.connectString = connectString;
12+
}
13+
14+
public String getConnectString() {
15+
return connectString;
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.utplsql.cli.config;
2+
3+
import java.beans.ConstructorProperties;
4+
5+
public class ReporterConfig {
6+
7+
private final String name;
8+
private final String output;
9+
private boolean screen = false;
10+
11+
@ConstructorProperties({"name", "output", "screen"})
12+
public ReporterConfig( String name, String output, boolean screen ) {
13+
this.name = name;
14+
this.output = output;
15+
this.screen = screen;
16+
}
17+
18+
public String getName() {
19+
return name;
20+
}
21+
22+
public String getOutput() {
23+
return output;
24+
}
25+
26+
public boolean isScreen() {
27+
return screen;
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package org.utplsql.cli.config;
2+
3+
4+
import java.beans.ConstructorProperties;
5+
6+
public class TestRunnerConfig extends ConnectionConfig {
7+
8+
private final String[] suitePaths;
9+
private final ReporterConfig[] reporters;
10+
private boolean outputAnsiColor = false;
11+
private final Integer failureExitCode;
12+
private boolean skipCompatibilityCheck = false;
13+
private final String[] includePackages;
14+
private final String[] excludePackages;
15+
private final String sourcePath;
16+
private final String testPath;
17+
18+
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourcePath", "testPath"})
19+
public TestRunnerConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, String sourcePath, String testPath) {
20+
super(connectString);
21+
this.suitePaths = suitePaths;
22+
this.reporters = reporters;
23+
this.outputAnsiColor = outputAnsiColor;
24+
this.failureExitCode = failureExitCode;
25+
this.skipCompatibilityCheck = skipCompatibilityCheck;
26+
this.includePackages = includePackages;
27+
this.excludePackages = excludePackages;
28+
this.sourcePath = sourcePath;
29+
this.testPath = testPath;
30+
}
31+
32+
public String[] getSuitePaths() {
33+
return suitePaths;
34+
}
35+
36+
public ReporterConfig[] getReporters() {
37+
return reporters;
38+
}
39+
40+
public boolean isOutputAnsiColor() {
41+
return outputAnsiColor;
42+
}
43+
44+
public Integer getFailureExitCode() {
45+
return failureExitCode;
46+
}
47+
48+
public boolean isSkipCompatibilityCheck() {
49+
return skipCompatibilityCheck;
50+
}
51+
52+
public String[] getIncludePackages() {
53+
return includePackages;
54+
}
55+
56+
public String[] getExcludePackages() {
57+
return excludePackages;
58+
}
59+
60+
public String getSourcePath() {
61+
return sourcePath;
62+
}
63+
64+
public String getTestPath() {
65+
return testPath;
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.utplsql.cli;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
5+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
6+
import org.apache.commons.lang3.builder.ToStringStyle;
7+
import org.junit.jupiter.api.Test;
8+
import org.utplsql.cli.config.TestRunnerConfig;
9+
10+
import java.io.File;
11+
import java.io.IOException;
12+
13+
public class YmlConfigTest {
14+
15+
@Test
16+
public void letsPlayAround() throws IOException {
17+
18+
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
19+
20+
String testConfigFile = "src/test/resources/test-config.yml";
21+
22+
TestRunnerConfig config = mapper.readValue(new File(testConfigFile), TestRunnerConfig.class);
23+
24+
System.out.println(ReflectionToStringBuilder.toString(config,ToStringStyle.MULTI_LINE_STYLE));
25+
}
26+
27+
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# utPLSQL cli Test-Config
2+
---
3+
connectString: app/app@localhost:1522/ORCLPDB1
4+
suitePaths:
5+
- app.betwnstr
6+
- app
7+
reporters:
8+
- name: ut_documentation_reporter
9+
- name: ut_coverage_html_reporter
10+
output: coverage.html
11+
- name: ut_sonar_test_reporter
12+
output: sonar.txt
13+
screen: true
14+
outputAnsiColor: true
15+
failureExitCode: 2
16+
skipCompatibilityCheck: true
17+
includePackages: [app.betwnstr, mypackage]
18+
excludePackages:
19+
- mypackage.blubb
20+
- stuff
21+
sourcePath: path/to/source
22+
testPath: path/to/test

0 commit comments

Comments
 (0)