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
506018dd
Commit
506018dd
authored
Jul 27, 2019
by
Greg Messner
Browse files
Mods related to GitLab 12.0 changes (#420).
parent
6fa607bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java
View file @
506018dd
...
@@ -101,7 +101,7 @@ public class ApplicationSettingsApi extends AbstractApi {
...
@@ -101,7 +101,7 @@ public class ApplicationSettingsApi extends AbstractApi {
}
}
/**
/**
* Par
e
ses the returned JSON and returns an ApplicationSettings instance.
* Parses the returned JSON and returns an ApplicationSettings instance.
*
*
* @param root the root JsonNode
* @param root the root JsonNode
* @return the populated ApplicationSettings instance
* @return the populated ApplicationSettings instance
...
...
src/main/java/org/gitlab4j/api/models/Setting.java
View file @
506018dd
...
@@ -300,6 +300,12 @@ public enum Setting {
...
@@ -300,6 +300,12 @@ public enum Setting {
*/
*/
GITALY_TIMEOUT_MEDIUM
(
Integer
.
class
),
GITALY_TIMEOUT_MEDIUM
(
Integer
.
class
),
/** Undocumented setting. */
GRAFANA_ENABLED
(
Boolean
.
class
),
/** Undocumented setting. */
GRAFANA_URL
(
String
.
class
),
/** Enable Gravatar. */
/** Enable Gravatar. */
GRAVATAR_ENABLED
(
Boolean
.
class
),
GRAVATAR_ENABLED
(
Boolean
.
class
),
...
@@ -685,6 +691,11 @@ public enum Setting {
...
@@ -685,6 +691,11 @@ public enum Setting {
*/
*/
THROTTLE_UNAUTHENTICATED_REQUESTS_PER_PERIOD
(
Integer
.
class
),
THROTTLE_UNAUTHENTICATED_REQUESTS_PER_PERIOD
(
Integer
.
class
),
/**
* Limit display of time tracking units to hours. Default is false.
*/
TIME_TRACKING_LIMIT_TO_HOURS
(
Boolean
.
class
),
/**
/**
* required by: require_two_factor_authentication Amount of time (in hours) that
* required by: require_two_factor_authentication Amount of time (in hours) that
* users are allowed to skip forced configuration of two-factor authentication.
* users are allowed to skip forced configuration of two-factor authentication.
...
...
src/test/java/org/gitlab4j/api/TestNamespaceApi.java
View file @
506018dd
...
@@ -2,10 +2,12 @@ package org.gitlab4j.api;
...
@@ -2,10 +2,12 @@ package org.gitlab4j.api;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
Assert
.
fail
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
org.gitlab4j.api.models.Namespace
;
import
org.gitlab4j.api.models.Namespace
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -47,12 +49,9 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -47,12 +49,9 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
public
void
testGetNamespaces
()
throws
GitLabApiException
{
public
void
testGetNamespaces
()
throws
GitLabApiException
{
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
getNamespaces
();
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
getNamespaces
();
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
for
(
Namespace
namespace
:
namespaces
)
{
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
if
(
TEST_NAMESPACE
.
equals
(
namespace
.
getName
()))
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
return
;
assertTrue
(
TEST_NAMESPACE
+
" not found!"
,
matchingNamespace
.
isPresent
());
}
fail
(
TEST_NAMESPACE
+
" not found!"
);
}
}
@Test
@Test
...
@@ -63,7 +62,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -63,7 +62,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
while
(
pager
.
hasNext
())
{
while
(
pager
.
hasNext
())
{
List
<
Namespace
>
namespaces
=
pager
.
next
();
List
<
Namespace
>
namespaces
=
pager
.
next
();
for
(
Namespace
namespace
:
namespaces
)
{
for
(
Namespace
namespace
:
namespaces
)
{
if
(
TEST_NAMESPACE
.
equals
(
namespace
.
get
Name
()))
if
(
TEST_NAMESPACE
.
equals
(
namespace
.
get
Path
()))
return
;
return
;
}
}
}
}
...
@@ -75,39 +74,36 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
...
@@ -75,39 +74,36 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
public
void
testGetNamespacesByPage
()
throws
GitLabApiException
{
public
void
testGetNamespacesByPage
()
throws
GitLabApiException
{
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
getNamespaces
(
1
,
10
);
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
getNamespaces
(
1
,
10
);
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
for
(
Namespace
namespace
:
namespaces
)
{
Optional
<
Namespace
>
matchingNamespace
=
namespaces
.
stream
().
if
(
TEST_NAMESPACE
.
equals
(
namespace
.
getName
()))
filter
(
n
->
n
.
getPath
().
equals
(
TEST_NAMESPACE
)).
findFirst
();
return
;
assertTrue
(
TEST_NAMESPACE
+
" not found!"
,
matchingNamespace
.
isPresent
());
}
fail
(
TEST_NAMESPACE
+
" not found!"
);
}
}
@Test
@Test
public
void
testFindNamespaces
()
throws
GitLabApiException
{
public
void
testFindNamespaces
()
throws
GitLabApiException
{
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
);
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
);
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
assertEquals
(
TEST_NAMESPACE
,
namespaces
.
get
(
0
).
get
Name
());
assertEquals
(
TEST_NAMESPACE
,
namespaces
.
get
(
0
).
get
Path
());
}
}
@Test
@Test
public
void
testFindSubgroupNamespaces
()
throws
GitLabApiException
{
public
void
testFindSubgroupNamespaces
()
throws
GitLabApiException
{
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_SUB_GROUP
);
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_SUB_GROUP
);
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
assertEquals
(
TEST_SUB_GROUP
,
namespaces
.
get
(
0
).
get
Name
());
assertEquals
(
TEST_SUB_GROUP
,
namespaces
.
get
(
0
).
get
Path
());
}
}
@Test
@Test
public
void
testFindNamespacesByPage
()
throws
GitLabApiException
{
public
void
testFindNamespacesByPage
()
throws
GitLabApiException
{
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
,
1
,
10
);
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
,
1
,
10
);
assertNotNull
(
namespaces
);
assertNotNull
(
namespaces
);
assertEquals
(
TEST_NAMESPACE
,
namespaces
.
get
(
0
).
get
Name
());
assertEquals
(
TEST_NAMESPACE
,
namespaces
.
get
(
0
).
get
Path
());
}
}
@Test
@Test
public
void
testFindNamespacesViaPager
()
throws
GitLabApiException
{
public
void
testFindNamespacesViaPager
()
throws
GitLabApiException
{
Pager
<
Namespace
>
pager
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
,
10
);
Pager
<
Namespace
>
pager
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
TEST_NAMESPACE
,
10
);
assertNotNull
(
pager
);
assertNotNull
(
pager
);
assertEquals
(
TEST_NAMESPACE
,
pager
.
next
().
get
(
0
).
get
Name
());
assertEquals
(
TEST_NAMESPACE
,
pager
.
next
().
get
(
0
).
get
Path
());
}
}
}
}
src/test/java/org/gitlab4j/api/TestProjectApi.java
View file @
506018dd
...
@@ -691,12 +691,12 @@ public class TestProjectApi extends AbstractIntegrationTest {
...
@@ -691,12 +691,12 @@ public class TestProjectApi extends AbstractIntegrationTest {
assertFalse
(
matchingVariable
.
getProtected
());
assertFalse
(
matchingVariable
.
getProtected
());
assertNull
(
matchingVariable
.
getEnvironmentScope
());
assertNull
(
matchingVariable
.
getEnvironmentScope
());
gitLabApi
.
getProjectApi
().
updateVariable
(
testProject
,
key
,
"NO
N
E"
,
true
,
"DEV"
);
gitLabApi
.
getProjectApi
().
updateVariable
(
testProject
,
key
,
"NO
_VALU
E"
,
true
,
"DEV"
);
variable
=
gitLabApi
.
getProjectApi
().
getVariable
(
testProject
,
key
);
variable
=
gitLabApi
.
getProjectApi
().
getVariable
(
testProject
,
key
);
assertNotNull
(
variable
);
assertNotNull
(
variable
);
assertEquals
(
key
,
variable
.
getKey
());
assertEquals
(
key
,
variable
.
getKey
());
assertEquals
(
"NO
N
E"
,
variable
.
getValue
());
assertEquals
(
"NO
_VALU
E"
,
variable
.
getValue
());
assertTrue
(
variable
.
getProtected
());
assertTrue
(
variable
.
getProtected
());
gitLabApi
.
getProjectApi
().
updateVariable
(
testProject
,
key
,
value
,
Variable
.
Type
.
ENV_VAR
,
false
,
true
,
"DEV"
);
gitLabApi
.
getProjectApi
().
updateVariable
(
testProject
,
key
,
value
,
Variable
.
Type
.
ENV_VAR
,
false
,
true
,
"DEV"
);
...
...
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