Commit 506018dd authored by Greg Messner's avatar Greg Messner
Browse files

Mods related to GitLab 12.0 changes (#420).

parent 6fa607bd
...@@ -101,7 +101,7 @@ public class ApplicationSettingsApi extends AbstractApi { ...@@ -101,7 +101,7 @@ public class ApplicationSettingsApi extends AbstractApi {
} }
/** /**
* Pareses 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
......
...@@ -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.
......
...@@ -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.getName())) if (TEST_NAMESPACE.equals(namespace.getPath()))
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).getName()); assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
} }
@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).getName()); assertEquals(TEST_SUB_GROUP, namespaces.get(0).getPath());
} }
@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).getName()); assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
} }
@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).getName()); assertEquals(TEST_NAMESPACE, pager.next().get(0).getPath());
} }
} }
...@@ -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, "NONE", true, "DEV"); gitLabApi.getProjectApi().updateVariable(testProject, key, "NO_VALUE", 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("NONE", variable.getValue()); assertEquals("NO_VALUE", 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");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment