Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
80cd6055
Commit
80cd6055
authored
Apr 15, 2018
by
Greg Messner
Browse files
Mods so unit tests work correctly when using the release plugin.
parent
eb929650
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestUtils.java
View file @
80cd6055
package
org.gitlab4j.api
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -27,12 +28,26 @@ public class TestUtils {
return
(
out
.
toString
());
}
private
static
Properties
testProperties
;
static
{
// Get the maven basedir, we use it to locate the properties for the unit tests
String
basedir
=
(
String
)
System
.
getProperties
().
get
(
"basedir"
);
// If we are performing a release in target/checkout, trim off the target/checkout directory from basedir
if
(
basedir
!=
null
&&
(
basedir
.
endsWith
(
"target/checkout"
)
||
basedir
.
endsWith
(
"target\\checkout"
)))
{
basedir
=
basedir
.
substring
(
0
,
basedir
.
length
()
-
15
);
}
File
propertiesFile
=
new
File
(
basedir
,
"test-gitlab4j.properties"
);
if
(!
propertiesFile
.
exists
())
{
propertiesFile
=
new
File
((
String
)
System
.
getProperties
().
get
(
"user.home"
),
"test-gitlab4j.properties"
);
}
System
.
out
.
println
(
"test-gitlab4j.properties location: "
+
propertiesFile
.
getAbsolutePath
());
testProperties
=
new
Properties
();
try
(
InputStream
input
=
new
FileInputStream
(
"test-gitlab4j.
properties
"
))
{
try
(
InputStream
input
=
new
FileInputStream
(
properties
File
))
{
testProperties
.
load
(
input
);
}
catch
(
IOException
ioe
)
{
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment