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
15e3818f
Commit
15e3818f
authored
May 04, 2019
by
Greg Messner
Browse files
Mods so tests can be run independent of the test suite.
parent
21689235
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/AbstractIntegrationTest.java
View file @
15e3818f
...
...
@@ -10,19 +10,23 @@ import org.gitlab4j.api.models.Project;
/**
* In order for the integration tests to run you must set the following properties in test-gitlab4j.properties
* and the resources pointed to must exist.
*
* TEST_NAMESPACE
* TEST_PROJECT_NAME
*
* TEST_HOST_URL
* TEST_PRIVATE_TOKEN
* TEST_NAMESPACE
* TEST_PROJECT_NAME
*/
public
class
AbstractIntegrationTest
implements
PropertyConstants
{
// Get the values of the minimum required test properties.
protected
static
final
String
TEST_PROJECT_NAME
=
HelperUtils
.
getProperty
(
PROJECT_NAME_KEY
);
protected
static
final
String
TEST_NAMESPACE
=
HelperUtils
.
getProperty
(
NAMESPACE_KEY
);
protected
static
final
String
TEST_HOST_URL
=
HelperUtils
.
getProperty
(
HOST_URL_KEY
);
protected
static
String
TEST_PRIVATE_TOKEN
;
protected
static
final
String
TEST_LOGIN_USERNAME
=
HelperUtils
.
getProperty
(
LOGIN_USERNAME_KEY
);
protected
static
final
String
TEST_LOGIN_PASSWORD
=
HelperUtils
.
getProperty
(
LOGIN_PASSWORD_KEY
);
protected
static
final
String
TEST_PROJECT_NAME
=
HelperUtils
.
getProperty
(
PROJECT_NAME_KEY
);
protected
static
final
String
TEST_GROUP
=
HelperUtils
.
getProperty
(
GROUP_KEY
);
protected
static
final
String
TEST_GROUP_PROJECT_NAME
=
HelperUtils
.
getProperty
(
GROUP_PROJECT_KEY
);
protected
static
final
String
TEST_NAMESPACE
=
HelperUtils
.
getProperty
(
NAMESPACE_KEY
,
TEST_LOGIN_USERNAME
);
protected
static
final
String
TEST_PRIVATE_TOKEN
=
HelperUtils
.
getProperty
(
PRIVATE_TOKEN_KEY
);
protected
static
class
BaseTestResources
{
protected
GitLabApi
gitLabApi
;
...
...
@@ -58,26 +62,22 @@ public class AbstractIntegrationTest implements PropertyConstants {
}
String
problems
=
""
;
if
(
TEST_NAMESPACE
==
null
||
TEST_NAMESPACE
.
trim
().
isEmpty
())
{
problems
+=
"TEST_NAMESPACE cannot be empty\n"
;
}
if
(
TEST_PROJECT_NAME
==
null
||
TEST_PROJECT_NAME
.
trim
().
isEmpty
())
{
problems
+=
"TEST_PROJECT_NAME cannot be empty\n"
;
}
if
(
TEST_HOST_URL
==
null
||
TEST_HOST_URL
.
trim
().
isEmpty
())
{
problems
+=
"TEST_HOST_URL cannot be empty\n"
;
}
if
(
TEST_PRIVATE_TOKEN
==
null
)
{
TEST_PRIVATE_TOKEN
=
HelperUtils
.
getProperty
(
PRIVATE_TOKEN_KEY
);
}
if
(
TEST_PRIVATE_TOKEN
==
null
||
TEST_PRIVATE_TOKEN
.
trim
().
isEmpty
())
{
problems
+=
"TEST_PRIVATE_TOKEN cannot be empty\n"
;
}
if
(
TEST_NAMESPACE
==
null
||
TEST_NAMESPACE
.
trim
().
isEmpty
())
{
problems
+=
"TEST_NAMESPACE cannot be empty\n"
;
}
if
(
TEST_PROJECT_NAME
==
null
||
TEST_PROJECT_NAME
.
trim
().
isEmpty
())
{
problems
+=
"TEST_PROJECT_NAME cannot be empty\n"
;
}
if
(
problems
.
isEmpty
())
{
try
{
GitLabApi
gitLabApi
=
new
GitLabApi
(
ApiVersion
.
V4
,
TEST_HOST_URL
,
TEST_PRIVATE_TOKEN
);
...
...
src/test/java/org/gitlab4j/api/IntegrationTestSuite.java
View file @
15e3818f
...
...
@@ -34,15 +34,13 @@ import com.googlecode.junittoolbox.WildcardPatternSuite;
@IncludeCategory
(
IntegrationTest
.
class
)
public
class
IntegrationTestSuite
implements
PropertyConstants
{
private
static
final
String
TEST_HOST_URL
=
HelperUtils
.
getProperty
(
HOST_URL_KEY
,
"http://localhost:8090"
);
private
static
final
String
TEST_LOGIN_USERNAME
=
HelperUtils
.
getProperty
(
LOGIN_USERNAME_KEY
,
"gitlab4j"
);
private
static
final
String
TEST_LOGIN_PASSWORD
=
HelperUtils
.
getProperty
(
LOGIN_PASSWORD_KEY
,
"ChangeMeNow"
);
private
static
final
String
TEST_PROJECT_NAME
=
HelperUtils
.
getProperty
(
PROJECT_NAME_KEY
,
"test-project"
);
private
static
final
String
TEST_GROUP
=
HelperUtils
.
getProperty
(
GROUP_KEY
,
"test-group"
);
private
static
final
String
TEST_GROUP_PROJECT_NAME
=
HelperUtils
.
getProperty
(
GROUP_PROJECT_KEY
,
"test-group-project"
);
protected
static
final
String
TEST_NAMESPACE
=
HelperUtils
.
getProperty
(
NAMESPACE_KEY
,
TEST_LOGIN_USERNAME
);
private
static
final
String
TEST_HOST_URL
=
HelperUtils
.
getProperty
(
HOST_URL_KEY
);
private
static
final
String
TEST_LOGIN_USERNAME
=
HelperUtils
.
getProperty
(
LOGIN_USERNAME_KEY
);
private
static
final
String
TEST_LOGIN_PASSWORD
=
HelperUtils
.
getProperty
(
LOGIN_PASSWORD_KEY
);
private
static
final
String
TEST_NAMESPACE
=
HelperUtils
.
getProperty
(
NAMESPACE_KEY
,
TEST_LOGIN_USERNAME
);
private
static
final
String
TEST_PROJECT_NAME
=
HelperUtils
.
getProperty
(
PROJECT_NAME_KEY
);
private
static
final
String
TEST_GROUP
=
HelperUtils
.
getProperty
(
GROUP_KEY
);
private
static
final
String
TEST_GROUP_PROJECT_NAME
=
HelperUtils
.
getProperty
(
GROUP_PROJECT_KEY
);
protected
static
final
String
TEST_PRIVATE_TOKEN_NAME
=
"GitLab4J Test Private Token - "
+
HelperUtils
.
getRandomInt
(
1000
);
protected
static
String
TEST_PRIVATE_TOKEN
=
HelperUtils
.
getProperty
(
PRIVATE_TOKEN_KEY
);
...
...
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