Skip to content

Commit 506018d

Browse files
committed
Mods related to GitLab 12.0 changes (#420).
1 parent 6fa607b commit 506018d

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

src/main/java/org/gitlab4j/api/ApplicationSettingsApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public ApplicationSettings updateApplicationSetting(String setting, Object value
101101
}
102102

103103
/**
104-
* Pareses the returned JSON and returns an ApplicationSettings instance.
104+
* Parses the returned JSON and returns an ApplicationSettings instance.
105105
*
106106
* @param root the root JsonNode
107107
* @return the populated ApplicationSettings instance

src/main/java/org/gitlab4j/api/models/Setting.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,12 @@ public enum Setting {
300300
*/
301301
GITALY_TIMEOUT_MEDIUM(Integer.class),
302302

303+
/** Undocumented setting. */
304+
GRAFANA_ENABLED(Boolean.class),
305+
306+
/** Undocumented setting. */
307+
GRAFANA_URL(String.class),
308+
303309
/** Enable Gravatar. */
304310
GRAVATAR_ENABLED(Boolean.class),
305311

@@ -685,6 +691,11 @@ public enum Setting {
685691
*/
686692
THROTTLE_UNAUTHENTICATED_REQUESTS_PER_PERIOD(Integer.class),
687693

694+
/**
695+
* Limit display of time tracking units to hours. Default is false.
696+
*/
697+
TIME_TRACKING_LIMIT_TO_HOURS(Boolean.class),
698+
688699
/**
689700
* required by: require_two_factor_authentication Amount of time (in hours) that
690701
* users are allowed to skip forced configuration of two-factor authentication.

src/test/java/org/gitlab4j/api/TestNamespaceApi.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
import static org.junit.Assert.assertEquals;
44
import static org.junit.Assert.assertNotNull;
5+
import static org.junit.Assert.assertTrue;
56
import static org.junit.Assert.fail;
67
import static org.junit.Assume.assumeNotNull;
78

89
import java.util.List;
10+
import java.util.Optional;
911

1012
import org.gitlab4j.api.models.Namespace;
1113
import org.junit.Before;
@@ -47,12 +49,9 @@ public void beforeMethod() {
4749
public void testGetNamespaces() throws GitLabApiException {
4850
List<Namespace> namespaces = gitLabApi.getNamespaceApi().getNamespaces();
4951
assertNotNull(namespaces);
50-
for (Namespace namespace : namespaces) {
51-
if (TEST_NAMESPACE.equals(namespace.getName()))
52-
return;
53-
}
54-
55-
fail(TEST_NAMESPACE + " not found!");
52+
Optional<Namespace> matchingNamespace = namespaces.stream().
53+
filter(n -> n.getPath().equals(TEST_NAMESPACE)).findFirst();
54+
assertTrue(TEST_NAMESPACE + " not found!", matchingNamespace.isPresent());
5655
}
5756

5857
@Test
@@ -63,7 +62,7 @@ public void testGetNamespacesViaPager() throws GitLabApiException {
6362
while (pager.hasNext()) {
6463
List<Namespace> namespaces = pager.next();
6564
for (Namespace namespace : namespaces) {
66-
if (TEST_NAMESPACE.equals(namespace.getName()))
65+
if (TEST_NAMESPACE.equals(namespace.getPath()))
6766
return;
6867
}
6968
}
@@ -75,39 +74,36 @@ public void testGetNamespacesViaPager() throws GitLabApiException {
7574
public void testGetNamespacesByPage() throws GitLabApiException {
7675
List<Namespace> namespaces = gitLabApi.getNamespaceApi().getNamespaces(1, 10);
7776
assertNotNull(namespaces);
78-
for (Namespace namespace : namespaces) {
79-
if (TEST_NAMESPACE.equals(namespace.getName()))
80-
return;
81-
}
82-
83-
fail(TEST_NAMESPACE + " not found!");
77+
Optional<Namespace> matchingNamespace = namespaces.stream().
78+
filter(n -> n.getPath().equals(TEST_NAMESPACE)).findFirst();
79+
assertTrue(TEST_NAMESPACE + " not found!", matchingNamespace.isPresent());
8480
}
8581

8682
@Test
8783
public void testFindNamespaces() throws GitLabApiException {
8884
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE);
8985
assertNotNull(namespaces);
90-
assertEquals(TEST_NAMESPACE, namespaces.get(0).getName());
86+
assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
9187
}
9288

9389
@Test
9490
public void testFindSubgroupNamespaces() throws GitLabApiException {
9591
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_SUB_GROUP);
9692
assertNotNull(namespaces);
97-
assertEquals(TEST_SUB_GROUP, namespaces.get(0).getName());
93+
assertEquals(TEST_SUB_GROUP, namespaces.get(0).getPath());
9894
}
9995

10096
@Test
10197
public void testFindNamespacesByPage() throws GitLabApiException {
10298
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE, 1, 10);
10399
assertNotNull(namespaces);
104-
assertEquals(TEST_NAMESPACE, namespaces.get(0).getName());
100+
assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
105101
}
106102

107103
@Test
108104
public void testFindNamespacesViaPager() throws GitLabApiException {
109105
Pager<Namespace> pager = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE, 10);
110106
assertNotNull(pager);
111-
assertEquals(TEST_NAMESPACE, pager.next().get(0).getName());
107+
assertEquals(TEST_NAMESPACE, pager.next().get(0).getPath());
112108
}
113109
}

src/test/java/org/gitlab4j/api/TestProjectApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,12 @@ public void testVariables() throws GitLabApiException {
691691
assertFalse(matchingVariable.getProtected());
692692
assertNull(matchingVariable.getEnvironmentScope());
693693

694-
gitLabApi.getProjectApi().updateVariable(testProject, key, "NONE", true, "DEV");
694+
gitLabApi.getProjectApi().updateVariable(testProject, key, "NO_VALUE", true, "DEV");
695695
variable = gitLabApi.getProjectApi().getVariable(testProject, key);
696696

697697
assertNotNull(variable);
698698
assertEquals(key, variable.getKey());
699-
assertEquals("NONE", variable.getValue());
699+
assertEquals("NO_VALUE", variable.getValue());
700700
assertTrue(variable.getProtected());
701701

702702
gitLabApi.getProjectApi().updateVariable(testProject, key, value, Variable.Type.ENV_VAR, false, true, "DEV");

0 commit comments

Comments
 (0)