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 11package org .gitlab4j .api ;
22
3+ import java .io .File ;
34import java .io .FileInputStream ;
45import java .io .IOException ;
56import java .io .InputStream ;
@@ -27,12 +28,26 @@ public static String getReaderContentAsString(Reader reader) throws IOException
2728 return (out .toString ());
2829 }
2930
30-
3131 private static Properties testProperties ;
3232 static {
3333
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+
3449 testProperties = new Properties ();
35- try (InputStream input = new FileInputStream ("test-gitlab4j.properties" )) {
50+ try (InputStream input = new FileInputStream (propertiesFile )) {
3651 testProperties .load (input );
3752 } catch (IOException ioe ) {
3853 }
You can’t perform that action at this time.
0 commit comments