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 {
}
/**
* Pareses the returned JSON and returns an ApplicationSettings instance.
* Parses the returned JSON and returns an ApplicationSettings instance.
*
* @param root the root JsonNode
* @return the populated ApplicationSettings instance
......
......@@ -300,6 +300,12 @@ public enum Setting {
*/
GITALY_TIMEOUT_MEDIUM(Integer.class),
/** Undocumented setting. */
GRAFANA_ENABLED(Boolean.class),
/** Undocumented setting. */
GRAFANA_URL(String.class),
/** Enable Gravatar. */
GRAVATAR_ENABLED(Boolean.class),
......@@ -685,6 +691,11 @@ public enum Setting {
*/
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
* users are allowed to skip forced configuration of two-factor authentication.
......
......@@ -2,10 +2,12 @@ package org.gitlab4j.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNotNull;
import java.util.List;
import java.util.Optional;
import org.gitlab4j.api.models.Namespace;
import org.junit.Before;
......@@ -47,12 +49,9 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
public void testGetNamespaces() throws GitLabApiException {
List<Namespace> namespaces = gitLabApi.getNamespaceApi().getNamespaces();
assertNotNull(namespaces);
for (Namespace namespace : namespaces) {
if (TEST_NAMESPACE.equals(namespace.getName()))
return;
}
fail(TEST_NAMESPACE + " not found!");
Optional<Namespace> matchingNamespace = namespaces.stream().
filter(n -> n.getPath().equals(TEST_NAMESPACE)).findFirst();
assertTrue(TEST_NAMESPACE + " not found!", matchingNamespace.isPresent());
}
@Test
......@@ -63,7 +62,7 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
while (pager.hasNext()) {
List<Namespace> namespaces = pager.next();
for (Namespace namespace : namespaces) {
if (TEST_NAMESPACE.equals(namespace.getName()))
if (TEST_NAMESPACE.equals(namespace.getPath()))
return;
}
}
......@@ -75,39 +74,36 @@ public class TestNamespaceApi extends AbstractIntegrationTest {
public void testGetNamespacesByPage() throws GitLabApiException {
List<Namespace> namespaces = gitLabApi.getNamespaceApi().getNamespaces(1, 10);
assertNotNull(namespaces);
for (Namespace namespace : namespaces) {
if (TEST_NAMESPACE.equals(namespace.getName()))
return;
}
fail(TEST_NAMESPACE + " not found!");
Optional<Namespace> matchingNamespace = namespaces.stream().
filter(n -> n.getPath().equals(TEST_NAMESPACE)).findFirst();
assertTrue(TEST_NAMESPACE + " not found!", matchingNamespace.isPresent());
}
@Test
public void testFindNamespaces() throws GitLabApiException {
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE);
assertNotNull(namespaces);
assertEquals(TEST_NAMESPACE, namespaces.get(0).getName());
assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
}
@Test
public void testFindSubgroupNamespaces() throws GitLabApiException {
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_SUB_GROUP);
assertNotNull(namespaces);
assertEquals(TEST_SUB_GROUP, namespaces.get(0).getName());
assertEquals(TEST_SUB_GROUP, namespaces.get(0).getPath());
}
@Test
public void testFindNamespacesByPage() throws GitLabApiException {
List<Namespace> namespaces = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE, 1, 10);
assertNotNull(namespaces);
assertEquals(TEST_NAMESPACE, namespaces.get(0).getName());
assertEquals(TEST_NAMESPACE, namespaces.get(0).getPath());
}
@Test
public void testFindNamespacesViaPager() throws GitLabApiException {
Pager<Namespace> pager = gitLabApi.getNamespaceApi().findNamespaces(TEST_NAMESPACE, 10);
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 {
assertFalse(matchingVariable.getProtected());
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);
assertNotNull(variable);
assertEquals(key, variable.getKey());
assertEquals("NONE", variable.getValue());
assertEquals("NO_VALUE", variable.getValue());
assertTrue(variable.getProtected());
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