Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
1040100a
Commit
1040100a
authored
Sep 02, 2016
by
Tim Olshansky
Committed by
GitHub
Sep 02, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #155 from nicolasgnr/master
Add get group by path
parents
50bd5cc2
c4d660fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+12
-1
GitlabAPITest.java
src/test/java/org/gitlab/api/GitlabAPITest.java
+22
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
1040100a
...
...
@@ -343,7 +343,18 @@ public class GitlabAPI {
}
public
GitlabGroup
getGroup
(
Integer
groupId
)
throws
IOException
{
String
tailUrl
=
GitlabGroup
.
URL
+
"/"
+
groupId
;
return
getGroup
(
groupId
.
toString
());
}
/**
* Get a group by path
*
* @param path Path of the group
* @return
* @throws IOException
*/
public
GitlabGroup
getGroup
(
String
path
)
throws
IOException
{
String
tailUrl
=
GitlabGroup
.
URL
+
"/"
+
path
;
return
retrieve
().
to
(
tailUrl
,
GitlabGroup
.
class
);
}
...
...
src/test/java/org/gitlab/api/GitlabAPITest.java
View file @
1040100a
package
org
.
gitlab
.
api
;
import
org.gitlab.api.models.GitlabGroup
;
import
org.gitlab.api.models.GitlabUser
;
import
org.junit.Before
;
import
org.junit.Ignore
;
...
...
@@ -119,6 +120,27 @@ public class GitlabAPITest {
}
@Test
public
void
testGetGroupByPath
()
throws
IOException
{
// Given
String
name
=
"groupName"
;
String
path
=
"groupPath"
;
GitlabGroup
originalGroup
=
api
.
createGroup
(
name
,
path
);
// When
GitlabGroup
group
=
api
.
getGroup
(
path
);
// Then:
assertNotNull
(
group
);
assertEquals
(
originalGroup
.
getId
(),
group
.
getId
());
assertEquals
(
originalGroup
.
getName
(),
group
.
getName
());
assertEquals
(
originalGroup
.
getPath
(),
group
.
getPath
());
// Cleanup
api
.
deleteGroup
(
group
.
getId
());
}
private
String
randVal
(
String
postfix
)
{
return
rand
+
"-"
+
postfix
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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