Skip to content

Commit 9d142e0

Browse files
committed
Quick and simple try to make cli compatible with 3.1.0
1 parent 7265993 commit 9d142e0

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

pom.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.utplsql</groupId>
66
<artifactId>cli</artifactId>
7-
<version>3.0.5-SNAPSHOT</version>
7+
<version>3.1.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>cli</name>
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>org.utplsql</groupId>
2424
<artifactId>java-api</artifactId>
25-
<version>3.0.5-SNAPSHOT</version>
25+
<version>3.1.0-SNAPSHOT</version>
2626
<scope>compile</scope>
2727
<exclusions>
2828
<exclusion>
@@ -31,6 +31,18 @@
3131
</exclusion>
3232
</exclusions>
3333
</dependency>
34+
<dependency>
35+
<groupId>com.oracle.jdbc</groupId>
36+
<artifactId>ojdbc8</artifactId>
37+
<version>12.2.0.1</version>
38+
<scope>compile</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.oracle.jdbc</groupId>
42+
<artifactId>orai18n</artifactId>
43+
<version>12.2.0.1</version>
44+
<scope>compile</scope>
45+
</dependency>
3446
<dependency>
3547
<groupId>com.beust</groupId>
3648
<artifactId>jcommander</artifactId>

src/main/java/org/utplsql/cli/Cli.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static void main(String[] args) {
1919
LocaleInitializer.initLocale();
2020

2121
JCommander jc = new JCommander();
22+
jc.setProgramName("utplsql");
2223
// jc.addCommand(HELP_CMD, new HelpCommand());
2324
RunCommand runCmd = new RunCommand();
2425
jc.addCommand(RUN_CMD, runCmd);

src/main/java/org/utplsql/cli/RunCommand.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
import com.beust.jcommander.Parameter;
44
import com.beust.jcommander.Parameters;
5-
import org.utplsql.api.*;
5+
import org.utplsql.api.FileMapperOptions;
6+
import org.utplsql.api.KeyValuePair;
7+
import org.utplsql.api.TestRunner;
8+
import org.utplsql.api.Version;
69
import org.utplsql.api.compatibility.CompatibilityProxy;
710
import org.utplsql.api.exception.SomeTestsFailedException;
11+
import org.utplsql.api.reporter.CoreReporters;
812
import org.utplsql.api.reporter.CoverageHTMLReporter;
913
import org.utplsql.api.reporter.Reporter;
1014
import org.utplsql.api.reporter.ReporterFactory;
@@ -100,6 +104,7 @@ public class RunCommand {
100104

101105

102106
private CompatibilityProxy compatibilityProxy;
107+
private ReporterFactory reporterFactory;
103108

104109
public ConnectionInfo getConnectionInfo() {
105110
return connectionInfoList.get(0);
@@ -154,6 +159,7 @@ public int run() throws Exception {
154159

155160
// First of all do a compatibility check and fail-fast
156161
compatibilityProxy = checkFrameworkCompatibility(conn);
162+
reporterFactory = ReporterFactory.createDefault(compatibilityProxy);
157163

158164
reporterList = initReporters(conn, reporterOptionsList);
159165

@@ -218,15 +224,15 @@ private List<Reporter> initReporters( Connection conn, List<ReporterOptions> rep
218224
final List<Reporter> reporterList = new ArrayList<>();
219225

220226
for (ReporterOptions ro : reporterOptionsList) {
221-
Reporter reporter = ReporterFactory.createReporter(ro.getReporterName());
227+
Reporter reporter = reporterFactory.createReporter(ro.getReporterName());
222228

223229
// Quick-hack for CoverageHTML Reporter
224230
if ( reporter instanceof CoverageHTMLReporter && ro.outputToFile() ) {
225231
((CoverageHTMLReporter)reporter).setAssetsPath(ro.getOutputFileName()+"_assets/");
226232
CoverageHTMLReporter.writeReportAssetsTo(Paths.get(ro.getOutputFileName()+"_assets/"));
227233
}
228234

229-
reporter.init(conn);
235+
reporter.init(conn, compatibilityProxy, reporterFactory);
230236
ro.setReporterObj(reporter);
231237
reporterList.add(reporter);
232238
}
@@ -259,7 +265,7 @@ private void startReporterGatherers(List<ReporterOptions> reporterOptionsList, E
259265
printStreams.add(fileOutStream);
260266
}
261267

262-
new OutputBuffer(ro.getReporterObj()).printAvailable(conn, printStreams);
268+
ro.getReporterObj().getOutputBuffer().printAvailable(conn, printStreams);
263269
} catch (SQLException | FileNotFoundException e) {
264270
System.out.println(e.getMessage());
265271
returnCode[0] = Cli.DEFAULT_ERROR_CODE;
@@ -310,7 +316,7 @@ public List<ReporterOptions> getReporterOptionsList() {
310316

311317
// If no reporter parameters were passed, use default reporter.
312318
if (reporterOptionsList.isEmpty()) {
313-
reporterOptionsList.add(new ReporterOptions(CustomTypes.UT_DOCUMENTATION_REPORTER));
319+
reporterOptionsList.add(new ReporterOptions(CoreReporters.UT_DOCUMENTATION_REPORTER.name()));
314320
}
315321

316322
return reporterOptionsList;

src/test/java/org/utplsql/cli/RunCommandTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.junit.jupiter.api.Test;
44
import org.utplsql.api.CustomTypes;
5+
import org.utplsql.api.reporter.CoreReporters;
56

67
import java.util.List;
78

@@ -19,7 +20,7 @@ public void reporterOptions_Default() {
1920
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
2021

2122
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
22-
assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
23+
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
2324
assertNull(reporterOptions1.getOutputFileName());
2425
assertFalse(reporterOptions1.outputToFile());
2526
assertTrue(reporterOptions1.outputToScreen());
@@ -32,7 +33,7 @@ public void reporterOptions_OneReporter() {
3233
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
3334

3435
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
35-
assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
36+
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
3637
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
3738
assertTrue(reporterOptions1.outputToFile());
3839
assertFalse(reporterOptions1.outputToScreen());
@@ -45,7 +46,7 @@ public void reporterOptions_OneReporterForceScreen() {
4546
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
4647

4748
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
48-
assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
49+
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
4950
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
5051
assertTrue(reporterOptions1.outputToFile());
5152
assertTrue(reporterOptions1.outputToScreen());
@@ -58,7 +59,7 @@ public void reporterOptions_OneReporterForceScreenInverse() {
5859
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
5960

6061
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
61-
assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
62+
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
6263
assertEquals(reporterOptions1.getOutputFileName(), "output.txt");
6364
assertTrue(reporterOptions1.outputToFile());
6465
assertTrue(reporterOptions1.outputToScreen());
@@ -73,13 +74,13 @@ public void reporterOptions_TwoReporters() {
7374
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
7475

7576
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
76-
assertEquals(CustomTypes.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
77+
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER, reporterOptions1.getReporterName());
7778
assertNull(reporterOptions1.getOutputFileName());
7879
assertFalse(reporterOptions1.outputToFile());
7980
assertTrue(reporterOptions1.outputToScreen());
8081

8182
ReporterOptions reporterOptions2 = reporterOptionsList.get(1);
82-
assertEquals(CustomTypes.UT_COVERAGE_HTML_REPORTER, reporterOptions2.getReporterName());
83+
assertEquals(CoreReporters.UT_COVERAGE_HTML_REPORTER, reporterOptions2.getReporterName());
8384
assertEquals(reporterOptions2.getOutputFileName(), "coverage.html");
8485
assertTrue(reporterOptions2.outputToFile());
8586
assertTrue(reporterOptions2.outputToScreen());

0 commit comments

Comments
 (0)