Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
70d987fb
Commit
70d987fb
authored
8 years ago
by
Greg Messner
Browse files
Options
Download
Email Patches
Plain Diff
Initial check-in.
parent
29375a26
main
5.0.x
5.0.x.jdk17
6.x
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/gitlab4j/api/TestGitLabSession.java
+72
-0
src/test/java/org/gitlab4j/api/TestGitLabSession.java
with
72 additions
and
0 deletions
+72
-0
src/test/java/org/gitlab4j/api/TestGitLabSession.java
0 → 100644
+
72
-
0
View file @
70d987fb
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
/**
* In order for these tests to run you must set the following systems properties:
*
* TEST_HOST_URL
* TEST_USERNAME
* TEST_PASSWORD
*
* If any of the above are NULL, all tests in this class will be skipped. If running from mvn simply
* use a command line similar to:
*
* mvn test -DTEST_HOST_URL=https://gitlab.com -DTTEST_USERNAME=your_username -DTEST_PASSWORD=your_strong_password
*/
public
class
TestGitLabSession
{
// The following needs to be set to your test repository
private
static
final
String
TEST_USERNAME
;
private
static
final
String
TEST_PASSWORD
;
private
static
final
String
TEST_HOST_URL
;
static
{
TEST_USERNAME
=
System
.
getProperty
(
"TEST_USERNAME"
);
TEST_PASSWORD
=
System
.
getProperty
(
"TEST_PASSWORD"
);
TEST_HOST_URL
=
System
.
getProperty
(
"TEST_HOST_URL"
);
}
private
static
String
problems
=
""
;
public
TestGitLabSession
()
{
super
();
}
@BeforeClass
public
static
void
setup
()
{
problems
=
""
;
if
(
TEST_USERNAME
==
null
||
TEST_USERNAME
.
trim
().
length
()
==
0
)
{
problems
+=
"TEST_USERNAME cannot be empty\n"
;
}
if
(
TEST_PASSWORD
==
null
||
TEST_PASSWORD
.
trim
().
length
()
==
0
)
{
problems
+=
"TEST_PASSWORD cannot be empty\n"
;
}
if
(
TEST_HOST_URL
==
null
||
TEST_HOST_URL
.
trim
().
length
()
==
0
)
{
problems
+=
"TEST_HOST_URL cannot be empty\n"
;
}
if
(!
problems
.
isEmpty
())
{
System
.
err
.
print
(
problems
);
}
}
@Before
public
void
beforeMethod
()
{
assumeTrue
(
problems
!=
null
&&
problems
.
isEmpty
());
}
@Test
public
void
testSession
()
throws
GitLabApiException
{
GitLabApi
gitlabApi
=
GitLabApi
.
create
(
TEST_HOST_URL
,
TEST_USERNAME
,
TEST_PASSWORD
);
assertNotNull
(
gitlabApi
);
}
}
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets