Skip to content

Commit 76c7e4a

Browse files
committed
#70 Updated to new API and added oraStuckTimeout parameter
1 parent 955f8bf commit 76c7e4a

File tree

16 files changed

+574
-9
lines changed

16 files changed

+574
-9
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ Please refer to the following usage example for the parameters descriptions:
152152
<!-- Enables DBMS_OUTPUT -->
153153
<!-- Defaults to: false -->
154154
<dbmsOutput>false</dbmsOutput>
155+
156+
<!-- Sets a timeout around Reporter creation and retries when not ready after a while. -->
157+
<!-- 0 = no timeout. -->
158+
<ora-stuck-timeout>0</ora-stuck-timeout>
155159

156160
<!-- A list of tags to run. -->
157161
<tags>

mvnw

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# ----------------------------------------------------------------------------
2020

2121
# ----------------------------------------------------------------------------
22-
# Maven2 Start Up Batch script
22+
# Maven Start Up Batch script
2323
#
2424
# Required ENV vars:
2525
# ------------------
@@ -114,7 +114,6 @@ if $mingw ; then
114114
M2_HOME="`(cd "$M2_HOME"; pwd)`"
115115
[ -n "$JAVA_HOME" ] &&
116116
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117-
# TODO classpath?
118117
fi
119118

120119
if [ -z "$JAVA_HOME" ]; then
@@ -200,6 +199,85 @@ if [ -z "$BASE_DIR" ]; then
200199
exit 1;
201200
fi
202201

202+
##########################################################################################
203+
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204+
# This allows using the maven wrapper in projects that prohibit checking in binary data.
205+
##########################################################################################
206+
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207+
if [ "$MVNW_VERBOSE" = true ]; then
208+
echo "Found .mvn/wrapper/maven-wrapper.jar"
209+
fi
210+
else
211+
if [ "$MVNW_VERBOSE" = true ]; then
212+
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213+
fi
214+
if [ -n "$MVNW_REPOURL" ]; then
215+
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216+
else
217+
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218+
fi
219+
while IFS="=" read key value; do
220+
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221+
esac
222+
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223+
if [ "$MVNW_VERBOSE" = true ]; then
224+
echo "Downloading from: $jarUrl"
225+
fi
226+
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227+
if $cygwin; then
228+
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229+
fi
230+
231+
if command -v wget > /dev/null; then
232+
if [ "$MVNW_VERBOSE" = true ]; then
233+
echo "Found wget ... using wget"
234+
fi
235+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236+
wget "$jarUrl" -O "$wrapperJarPath"
237+
else
238+
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239+
fi
240+
elif command -v curl > /dev/null; then
241+
if [ "$MVNW_VERBOSE" = true ]; then
242+
echo "Found curl ... using curl"
243+
fi
244+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245+
curl -o "$wrapperJarPath" "$jarUrl" -f
246+
else
247+
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248+
fi
249+
250+
else
251+
if [ "$MVNW_VERBOSE" = true ]; then
252+
echo "Falling back to using Java to download"
253+
fi
254+
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255+
# For Cygwin, switch paths to Windows format before running javac
256+
if $cygwin; then
257+
javaClass=`cygpath --path --windows "$javaClass"`
258+
fi
259+
if [ -e "$javaClass" ]; then
260+
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261+
if [ "$MVNW_VERBOSE" = true ]; then
262+
echo " - Compiling MavenWrapperDownloader.java ..."
263+
fi
264+
# Compiling the Java class
265+
("$JAVA_HOME/bin/javac" "$javaClass")
266+
fi
267+
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268+
# Running the downloader
269+
if [ "$MVNW_VERBOSE" = true ]; then
270+
echo " - Running MavenWrapperDownloader.java ..."
271+
fi
272+
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273+
fi
274+
fi
275+
fi
276+
fi
277+
##########################################################################################
278+
# End of extension
279+
##########################################################################################
280+
203281
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204282
if [ "$MVNW_VERBOSE" = true ]; then
205283
echo $MAVEN_PROJECTBASEDIR
@@ -218,6 +296,11 @@ if $cygwin; then
218296
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
219297
fi
220298

299+
# Provide a "standardized" way to retrieve the CLI args that will
300+
# work with both Windows and non-Windows executions.
301+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302+
export MAVEN_CMD_LINE_ARGS
303+
221304
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
222305

223306
exec "$JAVACMD" \

mvnw.cmd

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
@REM ----------------------------------------------------------------------------
1919

2020
@REM ----------------------------------------------------------------------------
21-
@REM Maven2 Start Up Batch script
21+
@REM Maven Start Up Batch script
2222
@REM
2323
@REM Required ENV vars:
2424
@REM JAVA_HOME - location of a JDK home dir
2525
@REM
2626
@REM Optional ENV vars
2727
@REM M2_HOME - location of maven2's installed home dir
2828
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29-
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
29+
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
3030
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
3131
@REM e.g. to debug Maven itself, use
3232
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -35,7 +35,9 @@
3535

3636
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
3737
@echo off
38-
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
38+
@REM set title of command window
39+
title %0
40+
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
3941
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
4042

4143
@REM set %HOME% to equivalent of $HOME
@@ -115,10 +117,47 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
115117
:endReadAdditionalConfig
116118

117119
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
118-
119120
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120121
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121122

123+
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124+
125+
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126+
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127+
)
128+
129+
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130+
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131+
if exist %WRAPPER_JAR% (
132+
if "%MVNW_VERBOSE%" == "true" (
133+
echo Found %WRAPPER_JAR%
134+
)
135+
) else (
136+
if not "%MVNW_REPOURL%" == "" (
137+
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138+
)
139+
if "%MVNW_VERBOSE%" == "true" (
140+
echo Couldn't find %WRAPPER_JAR%, downloading it ...
141+
echo Downloading from: %DOWNLOAD_URL%
142+
)
143+
144+
powershell -Command "&{"^
145+
"$webclient = new-object System.Net.WebClient;"^
146+
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147+
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148+
"}"^
149+
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150+
"}"
151+
if "%MVNW_VERBOSE%" == "true" (
152+
echo Finished downloading %WRAPPER_JAR%
153+
)
154+
)
155+
@REM End of extension
156+
157+
@REM Provide a "standardized" way to retrieve the CLI args that will
158+
@REM work with both Windows and non-Windows executions.
159+
set MAVEN_CMD_LINE_ARGS=%*
160+
122161
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
123162
if ERRORLEVEL 1 goto error
124163
goto end

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@
7878
<dependency>
7979
<groupId>org.apache.maven.shared</groupId>
8080
<artifactId>maven-shared-utils</artifactId>
81-
<version>3.1.0</version>
81+
<version>3.3.4</version>
8282
</dependency>
8383

8484
<dependency>
8585
<groupId>org.utplsql</groupId>
8686
<artifactId>java-api</artifactId>
87-
<version>3.1.8</version>
87+
<version>3.1.9</version>
8888
</dependency>
8989

9090
<dependency>

src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ public class UtPlsqlMojo extends AbstractMojo {
125125
@Parameter
126126
boolean dbmsOutput;
127127

128+
@Parameter(defaultValue = "0")
129+
Integer oraStuckTimeout;
130+
128131
private final SqlFileScanner sqlFileScanner = new SqlFileScanner();
129132

130133
@Override
@@ -160,7 +163,8 @@ public void execute() throws MojoExecutionException {
160163
.addTags(tags)
161164
.randomTestOrder(randomTestOrder)
162165
.randomTestOrderSeed(randomTestOrderSeed)
163-
.failOnErrors(!ignoreFailure);
166+
.failOnErrors(!ignoreFailure)
167+
.oraStuckTimeout(oraStuckTimeout);
164168

165169
if (isNotBlank(excludeObject)) {
166170
if (excludeObject.contains(",")) {

src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,11 @@ void include_object(MavenExecutionResult result) {
7575

7676
assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml");
7777
}
78+
79+
@MavenTest
80+
void ora_stuck_timeout(MavenExecutionResult result) {
81+
assertThat(result).isSuccessful();
82+
83+
assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml");
84+
}
7885
}

src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,22 @@ public void skip_utplsql_tests() throws Exception {
272272
* <p>
273273
* Given : a pom.xml with dbmsOutput=true
274274
* When : pom is read
275+
* Then : Property is set
276+
*/
277+
@Test
278+
public void ora_stuck_timeout() throws Exception {
279+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("ora_stuck_timeout");
280+
assertNotNull(utPlsqlMojo);
281+
282+
utPlsqlMojo.execute();
283+
}
284+
285+
286+
/**
287+
* Ora Stuck Timeout
288+
* <p>
289+
* Given : a pom.xml with ora-stuck-timeout set
290+
* When : pom is read
275291
* Then : DBMS_OUTPUT is enabled
276292
*/
277293
@Test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<coverage version="1">
2+
<file path="scripts/sources/APP.PKG_TEST_ME.pkb">
3+
<lineToCover lineNumber="7" covered="true"/>
4+
<lineToCover lineNumber="8" covered="true"/>
5+
<lineToCover lineNumber="9" covered="true"/>
6+
<lineToCover lineNumber="10" covered="true"/>
7+
<lineToCover lineNumber="12" covered="true"/>
8+
<lineToCover lineNumber="18" covered="true"/>
9+
<lineToCover lineNumber="21" covered="true"/>
10+
<lineToCover lineNumber="22" covered="true"/>
11+
</file>
12+
</coverage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<testExecutions version="1">
2+
<file path="scripts/tests/APP.TEST_PKG_TEST_ME.pkb">
3+
<testCase name="test_fc_input_1" duration="1" >
4+
</testCase>
5+
<testCase name="test_fc_input_0" duration="1" >
6+
</testCase>
7+
<testCase name="test_fc_input_null" duration="1" >
8+
</testCase>
9+
<testCase name="test_pr_test_me_null" duration="1" >
10+
</testCase>
11+
<testCase name="test_pr_test_me_not_null" duration="1" >
12+
</testCase>
13+
<testCase name="test_pr_test_me_exists" duration="1" >
14+
</testCase>
15+
<testCase name="test_pr_test_me_cursor" duration="1" >
16+
</testCase>
17+
</file>
18+
</testExecutions>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>ora-stuck-timeout</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@localhost:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.utplsql</groupId>
21+
<artifactId>utplsql-maven-plugin</artifactId>
22+
<version>@project.version@</version>
23+
<executions>
24+
<execution>
25+
<goals>
26+
<goal>test</goal>
27+
</goals>
28+
<configuration>
29+
<oraStuckTimeout>1</oraStuckTimeout>
30+
<ignoreFailure>false</ignoreFailure>
31+
<paths>
32+
<path>app</path>
33+
</paths>
34+
<reporters>
35+
<reporter>
36+
<name>UT_COVERAGE_SONAR_REPORTER</name>
37+
<fileOutput>utplsql/coverage-sonar-report.xml</fileOutput>
38+
<consoleOutput>true</consoleOutput>
39+
</reporter>
40+
<reporter>
41+
<name>UT_SONAR_TEST_REPORTER</name>
42+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
43+
<consoleOutput>true</consoleOutput>
44+
</reporter>
45+
</reporters>
46+
<sources>
47+
<source>
48+
<directory>scripts/sources</directory>
49+
<includes>
50+
<include>**/**.pks</include>
51+
<include>**/**.pkb</include>
52+
</includes>
53+
</source>
54+
</sources>
55+
<tests>
56+
<test>
57+
<directory>scripts/tests</directory>
58+
<includes>
59+
<include>**/**.pks</include>
60+
<include>**/**.pkb</include>
61+
</includes>
62+
</test>
63+
</tests>
64+
</configuration>
65+
</execution>
66+
</executions>
67+
</plugin>
68+
</plugins>
69+
</build>
70+
</project>

0 commit comments

Comments
 (0)