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
d8a3085a
Unverified
Commit
d8a3085a
authored
Apr 01, 2020
by
Marco
Committed by
GitHub
Apr 01, 2020
Browse files
Add support for repository_size and wiki_size (#543)
parent
29452096
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/models/ProjectStatistics.java
View file @
d8a3085a
...
@@ -5,46 +5,64 @@ import org.gitlab4j.api.utils.JacksonJson;
...
@@ -5,46 +5,64 @@ import org.gitlab4j.api.utils.JacksonJson;
/**
/**
* This class contains the sizing information from the project. To get this information,
* This class contains the sizing information from the project. To get this information,
* ProjectApi.getProject() has to be called with parameter statistics=true
* ProjectApi.getProject() has to be called with parameter statistics=true
* which is only allowed for GitLab admins.
* which is only allowed for GitLab admins.
*/
*/
public
class
ProjectStatistics
{
public
class
ProjectStatistics
{
long
commitCount
;
long
commitCount
;
long
storageSize
;
long
storageSize
;
long
lfsObjectSize
;
long
repositorySize
;
long
wikiSize
;
long
lfsObjectsSize
;
long
jobArtifactsSize
;
long
jobArtifactsSize
;
public
long
getCommitCount
()
{
public
long
getCommitCount
()
{
return
commitCount
;
return
commitCount
;
}
}
public
long
getJobArtifactsSize
()
{
public
void
setCommitCount
(
long
commitCount
)
{
return
jobArtifactsSize
;
this
.
commitCount
=
commitCount
;
}
public
long
getLfsObjectSize
()
{
return
lfsObjectSize
;
}
}
public
long
getStorageSize
()
{
public
long
getStorageSize
()
{
return
storageSize
;
return
storageSize
;
}
}
public
void
set
CommitCount
(
long
commitCount
)
{
public
void
set
StorageSize
(
long
storageSize
)
{
this
.
commitCount
=
commitCount
;
this
.
storageSize
=
storageSize
;
}
}
public
void
setJobArtifactsSize
(
long
jobArtifacts
Size
)
{
public
long
getRepository
Size
(
)
{
this
.
jobArtifactsSize
=
jobArtifacts
Size
;
return
repository
Size
;
}
}
public
void
set
LfsObjectSize
(
long
lfsObject
Size
)
{
public
void
set
RepositorySize
(
long
repository
Size
)
{
this
.
lfsObjectSize
=
lfsObject
Size
;
this
.
repositorySize
=
repository
Size
;
}
}
public
void
setStorageSize
(
long
storageSize
)
{
public
long
getWikiSize
()
{
this
.
storageSize
=
storageSize
;
return
wikiSize
;
}
public
void
setWikiSize
(
long
wikiSize
)
{
this
.
wikiSize
=
wikiSize
;
}
public
long
getLfsObjectsSize
()
{
return
lfsObjectsSize
;
}
public
void
setLfsObjectsSize
(
long
lfsObjectsSize
)
{
this
.
lfsObjectsSize
=
lfsObjectsSize
;
}
public
long
getJobArtifactsSize
()
{
return
jobArtifactsSize
;
}
public
void
setJobArtifactsSize
(
long
jobArtifactsSize
)
{
this
.
jobArtifactsSize
=
jobArtifactsSize
;
}
}
@Override
@Override
...
...
src/test/java/org/gitlab4j/api/TestProjectApi.java
View file @
d8a3085a
...
@@ -328,11 +328,12 @@ public class TestProjectApi extends AbstractIntegrationTest {
...
@@ -328,11 +328,12 @@ public class TestProjectApi extends AbstractIntegrationTest {
assertTrue
(
projects
.
size
()
>=
2
);
assertTrue
(
projects
.
size
()
>=
2
);
assertNotNull
(
projects
.
get
(
0
).
getStatistics
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getLfsObjectSize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getLfsObject
s
Size
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getCommitCount
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getCommitCount
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getJobArtifactsSize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getJobArtifactsSize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getStorageSize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getStorageSize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getRepositorySize
());
assertNotNull
(
projects
.
get
(
0
).
getStatistics
().
getWikiSize
());
}
}
@Test
@Test
...
...
src/test/resources/org/gitlab4j/api/project.json
View file @
d8a3085a
...
@@ -68,5 +68,13 @@
...
@@ -68,5 +68,13 @@
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"request_access_enabled"
:
false
,
"request_access_enabled"
:
false
,
"merge_method"
:
"merge"
"merge_method"
:
"merge"
,
"statistics"
:
{
"commit_count"
:
9827
,
"storage_size"
:
169043997645
,
"repository_size"
:
388717608
,
"wiki_size"
:
52428
,
"lfs_objects_size"
:
2118052893
,
"job_artifacts_size"
:
166537174716
}
}
}
\ No newline at end of file
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