Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit611234d

Browse files
committed
First, careful step into YAML-config for cli
I have to say, Jackson is working like a charm.Even immutable configuration-objects are no problem at all and it just works out of the box with minimum effort. Great stuff!
1 parentd402718 commit611234d

File tree

6 files changed

+180
-0
lines changed

6 files changed

+180
-0
lines changed

‎pom.xml

Lines changed: 16 additions & 0 deletions
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>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
packageorg.utplsql.cli.config;
2+
3+
importjava.beans.ConstructorProperties;
4+
5+
publicclassConnectionConfig {
6+
7+
privatefinalStringconnectString;
8+
9+
@ConstructorProperties({"connectString"})
10+
publicConnectionConfig(StringconnectString) {
11+
this.connectString =connectString;
12+
}
13+
14+
publicStringgetConnectString() {
15+
returnconnectString;
16+
}
17+
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
packageorg.utplsql.cli.config;
2+
3+
importjava.beans.ConstructorProperties;
4+
5+
publicclassReporterConfig {
6+
7+
privatefinalStringname;
8+
privatefinalStringoutput;
9+
privatebooleanscreen =false;
10+
11+
@ConstructorProperties({"name","output","screen"})
12+
publicReporterConfig(Stringname,Stringoutput,booleanscreen ) {
13+
this.name =name;
14+
this.output =output;
15+
this.screen =screen;
16+
}
17+
18+
publicStringgetName() {
19+
returnname;
20+
}
21+
22+
publicStringgetOutput() {
23+
returnoutput;
24+
}
25+
26+
publicbooleanisScreen() {
27+
returnscreen;
28+
}
29+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
packageorg.utplsql.cli.config;
2+
3+
4+
importjava.beans.ConstructorProperties;
5+
6+
publicclassTestRunnerConfigextendsConnectionConfig {
7+
8+
privatefinalString[]suitePaths;
9+
privatefinalReporterConfig[]reporters;
10+
privatebooleanoutputAnsiColor =false;
11+
privatefinalIntegerfailureExitCode;
12+
privatebooleanskipCompatibilityCheck =false;
13+
privatefinalString[]includePackages;
14+
privatefinalString[]excludePackages;
15+
privatefinalStringsourcePath;
16+
privatefinalStringtestPath;
17+
18+
@ConstructorProperties({"connectString","suitePaths","reporters","outputAnsiColor","failureExitCode","skipCompatibilityCheck","includePackages","excludePackages","sourcePath","testPath"})
19+
publicTestRunnerConfig(StringconnectString,String[]suitePaths,ReporterConfig[]reporters,booleanoutputAnsiColor,IntegerfailureExitCode,booleanskipCompatibilityCheck,String[]includePackages,String[]excludePackages,StringsourcePath,StringtestPath) {
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+
publicString[]getSuitePaths() {
33+
returnsuitePaths;
34+
}
35+
36+
publicReporterConfig[]getReporters() {
37+
returnreporters;
38+
}
39+
40+
publicbooleanisOutputAnsiColor() {
41+
returnoutputAnsiColor;
42+
}
43+
44+
publicIntegergetFailureExitCode() {
45+
returnfailureExitCode;
46+
}
47+
48+
publicbooleanisSkipCompatibilityCheck() {
49+
returnskipCompatibilityCheck;
50+
}
51+
52+
publicString[]getIncludePackages() {
53+
returnincludePackages;
54+
}
55+
56+
publicString[]getExcludePackages() {
57+
returnexcludePackages;
58+
}
59+
60+
publicStringgetSourcePath() {
61+
returnsourcePath;
62+
}
63+
64+
publicStringgetTestPath() {
65+
returntestPath;
66+
}
67+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
packageorg.utplsql.cli;
2+
3+
importcom.fasterxml.jackson.databind.ObjectMapper;
4+
importcom.fasterxml.jackson.dataformat.yaml.YAMLFactory;
5+
importorg.apache.commons.lang3.builder.ReflectionToStringBuilder;
6+
importorg.apache.commons.lang3.builder.ToStringStyle;
7+
importorg.junit.jupiter.api.Test;
8+
importorg.utplsql.cli.config.TestRunnerConfig;
9+
10+
importjava.io.File;
11+
importjava.io.IOException;
12+
13+
publicclassYmlConfigTest {
14+
15+
@Test
16+
publicvoidletsPlayAround()throwsIOException {
17+
18+
ObjectMappermapper =newObjectMapper(newYAMLFactory());
19+
20+
StringtestConfigFile ="src/test/resources/test-config.yml";
21+
22+
TestRunnerConfigconfig =mapper.readValue(newFile(testConfigFile),TestRunnerConfig.class);
23+
24+
System.out.println(ReflectionToStringBuilder.toString(config,ToStringStyle.MULTI_LINE_STYLE));
25+
}
26+
27+
28+
}

‎src/test/resources/test-config.yml

Lines changed: 22 additions & 0 deletions
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)

[8]ページ先頭

©2009-2025 Movatter.jp