File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/test/java/org/gitlab4j/api Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
package org .gitlab4j .api ;
2
2
3
+ import java .io .File ;
3
4
import java .io .FileInputStream ;
4
5
import java .io .IOException ;
5
6
import java .io .InputStream ;
@@ -27,12 +28,26 @@ public static String getReaderContentAsString(Reader reader) throws IOException
27
28
return (out .toString ());
28
29
}
29
30
30
-
31
31
private static Properties testProperties ;
32
32
static {
33
33
34
+ // Get the maven basedir, we use it to locate the properties for the unit tests
35
+ String basedir = (String ) System .getProperties ().get ("basedir" );
36
+
37
+ // If we are performing a release in target/checkout, trim off the target/checkout directory from basedir
38
+ if (basedir != null && (basedir .endsWith ("target/checkout" ) || basedir .endsWith ("target\\ checkout" ))) {
39
+ basedir = basedir .substring (0 , basedir .length () - 15 );
40
+ }
41
+
42
+ File propertiesFile = new File (basedir , "test-gitlab4j.properties" );
43
+ if (!propertiesFile .exists ()) {
44
+ propertiesFile = new File ((String ) System .getProperties ().get ("user.home" ), "test-gitlab4j.properties" );
45
+ }
46
+
47
+ System .out .println ("test-gitlab4j.properties location: " + propertiesFile .getAbsolutePath ());
48
+
34
49
testProperties = new Properties ();
35
- try (InputStream input = new FileInputStream ("test-gitlab4j.properties" )) {
50
+ try (InputStream input = new FileInputStream (propertiesFile )) {
36
51
testProperties .load (input );
37
52
} catch (IOException ioe ) {
38
53
}
You can’t perform that action at this time.
0 commit comments