Skip to content

Commit 15e3818

Browse files
committed
Mods so tests can be run independent of the test suite.
1 parent 2168923 commit 15e3818

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

src/test/java/org/gitlab4j/api/AbstractIntegrationTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,23 @@
1010
/**
1111
* In order for the integration tests to run you must set the following properties in test-gitlab4j.properties
1212
* and the resources pointed to must exist.
13-
*
14-
* TEST_NAMESPACE
15-
* TEST_PROJECT_NAME
13+
*
1614
* TEST_HOST_URL
1715
* TEST_PRIVATE_TOKEN
16+
* TEST_NAMESPACE
17+
* TEST_PROJECT_NAME
1818
*/
1919
public class AbstractIntegrationTest implements PropertyConstants {
2020

2121
// Get the values of the minimum required test properties.
22-
protected static final String TEST_PROJECT_NAME = HelperUtils.getProperty(PROJECT_NAME_KEY);
23-
protected static final String TEST_NAMESPACE = HelperUtils.getProperty(NAMESPACE_KEY);
2422
protected static final String TEST_HOST_URL = HelperUtils.getProperty(HOST_URL_KEY);
25-
protected static String TEST_PRIVATE_TOKEN;
23+
protected static final String TEST_LOGIN_USERNAME = HelperUtils.getProperty(LOGIN_USERNAME_KEY);
24+
protected static final String TEST_LOGIN_PASSWORD = HelperUtils.getProperty(LOGIN_PASSWORD_KEY);
25+
protected static final String TEST_PROJECT_NAME = HelperUtils.getProperty(PROJECT_NAME_KEY);
26+
protected static final String TEST_GROUP = HelperUtils.getProperty(GROUP_KEY);
27+
protected static final String TEST_GROUP_PROJECT_NAME = HelperUtils.getProperty(GROUP_PROJECT_KEY);
28+
protected static final String TEST_NAMESPACE = HelperUtils.getProperty(NAMESPACE_KEY, TEST_LOGIN_USERNAME);
29+
protected static final String TEST_PRIVATE_TOKEN = HelperUtils.getProperty(PRIVATE_TOKEN_KEY);
2630

2731
protected static class BaseTestResources {
2832
protected GitLabApi gitLabApi;
@@ -58,26 +62,22 @@ protected static GitLabApi baseTestSetup() {
5862
}
5963

6064
String problems = "";
61-
if (TEST_NAMESPACE == null || TEST_NAMESPACE.trim().isEmpty()) {
62-
problems += "TEST_NAMESPACE cannot be empty\n";
63-
}
64-
65-
if (TEST_PROJECT_NAME == null || TEST_PROJECT_NAME.trim().isEmpty()) {
66-
problems += "TEST_PROJECT_NAME cannot be empty\n";
67-
}
68-
6965
if (TEST_HOST_URL == null || TEST_HOST_URL.trim().isEmpty()) {
7066
problems += "TEST_HOST_URL cannot be empty\n";
7167
}
7268

73-
if (TEST_PRIVATE_TOKEN == null) {
74-
TEST_PRIVATE_TOKEN = HelperUtils.getProperty(PRIVATE_TOKEN_KEY);
75-
}
76-
7769
if (TEST_PRIVATE_TOKEN == null || TEST_PRIVATE_TOKEN.trim().isEmpty()) {
7870
problems += "TEST_PRIVATE_TOKEN cannot be empty\n";
7971
}
8072

73+
if (TEST_NAMESPACE == null || TEST_NAMESPACE.trim().isEmpty()) {
74+
problems += "TEST_NAMESPACE cannot be empty\n";
75+
}
76+
77+
if (TEST_PROJECT_NAME == null || TEST_PROJECT_NAME.trim().isEmpty()) {
78+
problems += "TEST_PROJECT_NAME cannot be empty\n";
79+
}
80+
8181
if (problems.isEmpty()) {
8282
try {
8383
GitLabApi gitLabApi = new GitLabApi(ApiVersion.V4, TEST_HOST_URL, TEST_PRIVATE_TOKEN);

src/test/java/org/gitlab4j/api/IntegrationTestSuite.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@
3434
@IncludeCategory(IntegrationTest.class)
3535
public class IntegrationTestSuite implements PropertyConstants {
3636

37-
private static final String TEST_HOST_URL = HelperUtils.getProperty(HOST_URL_KEY, "http://localhost:8090");
38-
private static final String TEST_LOGIN_USERNAME = HelperUtils.getProperty(LOGIN_USERNAME_KEY, "gitlab4j");
39-
private static final String TEST_LOGIN_PASSWORD = HelperUtils.getProperty(LOGIN_PASSWORD_KEY, "ChangeMeNow");
40-
41-
private static final String TEST_PROJECT_NAME = HelperUtils.getProperty(PROJECT_NAME_KEY, "test-project");
42-
private static final String TEST_GROUP = HelperUtils.getProperty(GROUP_KEY, "test-group");
43-
private static final String TEST_GROUP_PROJECT_NAME = HelperUtils.getProperty(GROUP_PROJECT_KEY, "test-group-project");
44-
45-
protected static final String TEST_NAMESPACE = HelperUtils.getProperty(NAMESPACE_KEY, TEST_LOGIN_USERNAME);
37+
private static final String TEST_HOST_URL = HelperUtils.getProperty(HOST_URL_KEY);
38+
private static final String TEST_LOGIN_USERNAME = HelperUtils.getProperty(LOGIN_USERNAME_KEY);
39+
private static final String TEST_LOGIN_PASSWORD = HelperUtils.getProperty(LOGIN_PASSWORD_KEY);
40+
private static final String TEST_NAMESPACE = HelperUtils.getProperty(NAMESPACE_KEY, TEST_LOGIN_USERNAME);
41+
private static final String TEST_PROJECT_NAME = HelperUtils.getProperty(PROJECT_NAME_KEY);
42+
private static final String TEST_GROUP = HelperUtils.getProperty(GROUP_KEY);
43+
private static final String TEST_GROUP_PROJECT_NAME = HelperUtils.getProperty(GROUP_PROJECT_KEY);
4644

4745
protected static final String TEST_PRIVATE_TOKEN_NAME = "GitLab4J Test Private Token - " + HelperUtils.getRandomInt(1000);
4846
protected static String TEST_PRIVATE_TOKEN = HelperUtils.getProperty(PRIVATE_TOKEN_KEY);

0 commit comments

Comments
 (0)