Commit 37444213 authored by Grogdunn's avatar Grogdunn

enh: formatted code

parent 42bf4d2b
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.gitlab</groupId> <groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId> <artifactId>java-gitlab-api</artifactId>
<version>1.1.10-SNAPSHOT</version> <version>1.1.10-SNAPSHOT</version>
<name>Gitlab Java API Wrapper</name> <name>Gitlab Java API Wrapper</name>
<description>A Java wrapper for the Gitlab Git Hosting Server API</description> <description>A Java wrapper for the Gitlab Git Hosting Server API</description>
<parent> <parent>
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId> <artifactId>oss-parent</artifactId>
<version>9</version> <version>9</version>
</parent> </parent>
<developers> <developers>
<developer> <developer>
<id>timols</id> <id>timols</id>
<name>Tim Olshansky</name> <name>Tim Olshansky</name>
<email>tim.olshansky@gmail.com</email> <email>tim.olshansky@gmail.com</email>
</developer> </developer>
</developers> </developers>
<contributors> <contributors>
<contributor> <contributor>
<name>Adam Retter</name> <name>Adam Retter</name>
<email>adam.retter@googlemail.com</email> <email>adam.retter@googlemail.com</email>
<organization>Evolved Binary Ltd</organization> <organization>Evolved Binary Ltd</organization>
</contributor> </contributor>
<contributor> <contributor>
<name>Cesar Aguilar</name> <name>Cesar Aguilar</name>
<email>cesar@fuzzproductions.com</email> <email>cesar@fuzzproductions.com</email>
<organization>Fuzz Productions</organization> <organization>Fuzz Productions</organization>
</contributor> </contributor>
<contributor> <contributor>
<name>Chris Luu</name> <name>Chris Luu</name>
<email>luu@fuzzproductions.com</email> <email>luu@fuzzproductions.com</email>
<organization>Fuzz Productions</organization> <organization>Fuzz Productions</organization>
</contributor> </contributor>
</contributors> </contributors>
<licenses> <licenses>
<license> <license>
<name>The Apache Software License, Version 2.0</name> <name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
</licenses> </licenses>
<scm> <scm>
<connection>scm:git:ssh://github.com/timols/java-gitlab-api.git</connection> <connection>scm:git:ssh://github.com/timols/java-gitlab-api.git</connection>
<developerConnection>scm:git:ssh://git@github.com/timols/java-gitlab-api.git</developerConnection> <developerConnection>scm:git:ssh://git@github.com/timols/java-gitlab-api.git</developerConnection>
<url>https://github.com/timols/java-gitlab-api</url> <url>https://github.com/timols/java-gitlab-api</url>
</scm> </scm>
<issueManagement> <issueManagement>
<system>Github</system> <system>Github</system>
<url>https://github.com/timols/java-gitlab-api/issues</url> <url>https://github.com/timols/java-gitlab-api/issues</url>
</issueManagement> </issueManagement>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.5.3</version> <version>2.5.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.5.3</version> <version>2.5.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.4</version> <version>2.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId> <artifactId>hamcrest-all</artifactId>
<version>1.3</version> <version>1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version> <version>2.5.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version> <version>2.17</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version> <version>2.17</version>
<executions> <executions>
<execution> <execution>
<id>default-integration-test</id> <id>default-integration-test</id>
<goals> <goals>
<goal>integration-test</goal> <goal>integration-test</goal>
</goals> </goals>
</execution> </execution>
<execution> <execution>
<id>default-verify</id> <id>default-verify</id>
<goals> <goals>
<goal>verify</goal> <goal>verify</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>2.4</version> <version>2.4</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
<phase>verify</phase> <phase>verify</phase>
<goals> <goals>
<goal>jar-no-fork</goal> <goal>jar-no-fork</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
This diff is collapsed.
package org.gitlab.api; package org.gitlab.api;
public enum TokenType { public enum TokenType {
PRIVATE_TOKEN("private_token") PRIVATE_TOKEN("private_token"), ACCESS_TOKEN("access_token"),;
, ACCESS_TOKEN("access_token"),
;
private final String tokenParamName; private final String tokenParamName;
TokenType(String tokenParamName) { TokenType(String tokenParamName) {
this.tokenParamName = tokenParamName; this.tokenParamName = tokenParamName;
} }
public String getTokenParamName() { public String getTokenParamName() {
return tokenParamName; return tokenParamName;
} }
} }
...@@ -20,8 +20,8 @@ import java.util.regex.Pattern; ...@@ -20,8 +20,8 @@ import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
/** /**
* Gitlab HTTP Requestor * Gitlab HTTP Requestor Responsible for handling HTTP requests to the Gitlab
* Responsible for handling HTTP requests to the Gitlab API * API
* *
* @author &#064;timols (Tim O) * @author &#064;timols (Tim O)
*/ */
...@@ -57,8 +57,8 @@ public class GitlabHTTPRequestor { ...@@ -57,8 +57,8 @@ public class GitlabHTTPRequestor {
} }
/** /**
* Sets the HTTP Request method for the request. * Sets the HTTP Request method for the request. Has a fluent api for method
* Has a fluent api for method chaining. * chaining.
* *
* @param method The HTTP method * @param method The HTTP method
* @return this * @return this
...@@ -74,11 +74,11 @@ public class GitlabHTTPRequestor { ...@@ -74,11 +74,11 @@ public class GitlabHTTPRequestor {
} }
/** /**
* Sets the HTTP Form Post parameters for the request * Sets the HTTP Form Post parameters for the request Has a fluent api for
* Has a fluent api for method chaining * method chaining
* *
* @param key Form parameter Key * @param key Form parameter Key
* @param value Form parameter Value * @param value Form parameter Value
* @return this * @return this
*/ */
public GitlabHTTPRequestor with(String key, Object value) { public GitlabHTTPRequestor with(String key, Object value) {
...@@ -100,10 +100,11 @@ public class GitlabHTTPRequestor { ...@@ -100,10 +100,11 @@ public class GitlabHTTPRequestor {
* Opens the HTTP(S) connection, submits any data and parses the response. * Opens the HTTP(S) connection, submits any data and parses the response.
* Will throw an error * Will throw an error
* *
* @param <T> The return type of the method * @param <T> The return type of the method
* @param tailAPIUrl The url to open a connection to (after the host and namespace) * @param tailAPIUrl The url to open a connection to (after the host and
* @param type The type of the response to be deserialized from * namespace)
* @param instance The instance to update from the response * @param type The type of the response to be deserialized from
* @param instance The instance to update from the response
* @return An object of type T * @return An object of type T
* @throws java.io.IOException on gitlab api error * @throws java.io.IOException on gitlab api error
*/ */
...@@ -113,7 +114,7 @@ public class GitlabHTTPRequestor { ...@@ -113,7 +114,7 @@ public class GitlabHTTPRequestor {
connection = setupConnection(root.getAPIUrl(tailAPIUrl)); connection = setupConnection(root.getAPIUrl(tailAPIUrl));
if (hasOutput()) { if (hasOutput()) {
submitData(connection); submitData(connection);
} else if ("PUT".equals(method)) { } else if ("PUT".equals(method)) {
// PUT requires Content-Length: 0 even when there is no body (eg: API for protecting a branch) // PUT requires Content-Length: 0 even when there is no body (eg: API for protecting a branch)
connection.setDoOutput(true); connection.setDoOutput(true);
...@@ -231,17 +232,15 @@ public class GitlabHTTPRequestor { ...@@ -231,17 +232,15 @@ public class GitlabHTTPRequestor {
if (matcher.find()) { if (matcher.find()) {
Integer page = Integer.parseInt(matcher.group(2)) + 1; Integer page = Integer.parseInt(matcher.group(2)) + 1;
this.url = new URL(matcher.replaceAll(matcher.group(1) + "page=" + page)); this.url = new URL(matcher.replaceAll(matcher.group(1) + "page=" + page));
} else if (GitlabCommit[].class == type) {
// there is a bug in the Gitlab CE API
// (https://gitlab.com/gitlab-org/gitlab-ce/issues/759)
// that starts pagination with page=0 for commits
this.url = new URL(url + "&page=1");
} else { } else {
if (GitlabCommit[].class == type) { // Since the page query was not present, its safe to assume that we just
// there is a bug in the Gitlab CE API // currently used the first page, so we can default to page 2
// (https://gitlab.com/gitlab-org/gitlab-ce/issues/759) this.url = new URL(url + "&page=2");
// that starts pagination with page=0 for commits
this.url = new URL(url + "&page=1");
} else {
// Since the page query was not present, its safe to assume that we just
// currently used the first page, so we can default to page 2
this.url = new URL(url + "&page=2");
}
} }
} }
}; };
...@@ -286,7 +285,7 @@ public class GitlabHTTPRequestor { ...@@ -286,7 +285,7 @@ public class GitlabHTTPRequestor {
try { try {
reader = new InputStreamReader(wrapStream(connection, connection.getInputStream()), "UTF-8"); reader = new InputStreamReader(wrapStream(connection, connection.getInputStream()), "UTF-8");
if (byte[].class == type) { if (byte[].class == type) {
return type.cast(IOUtils.toByteArray(reader)); return type.cast(IOUtils.toByteArray(reader));
} }
String data = IOUtils.toString(reader); String data = IOUtils.toString(reader);
if (type != null) { if (type != null) {
...@@ -334,19 +333,19 @@ public class GitlabHTTPRequestor { ...@@ -334,19 +333,19 @@ public class GitlabHTTPRequestor {
private void ignoreCertificateErrors() { private void ignoreCertificateErrors() {
TrustManager[] trustAllCerts = new TrustManager[]{ TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() { public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null; return null;
} }
public void checkClientTrusted( public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) { java.security.cert.X509Certificate[] certs, String authType) {
} }
public void checkServerTrusted( public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) { java.security.cert.X509Certificate[] certs, String authType) {
}
} }
}
}; };
// Added per https://github.com/timols/java-gitlab-api/issues/44 // Added per https://github.com/timols/java-gitlab-api/issues/44
HostnameVerifier nullVerifier = new HostnameVerifier() { HostnameVerifier nullVerifier = new HostnameVerifier() {
......
...@@ -8,12 +8,12 @@ import java.util.ArrayList; ...@@ -8,12 +8,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Models the Query * Models the Query aspect of a URL
* aspect of a URL
*/ */
public class Query { public class Query {
private class Tuple<T1, T2> { private class Tuple<T1, T2> {
T1 _1; T1 _1;
T2 _2; T2 _2;
...@@ -24,18 +24,19 @@ public class Query { ...@@ -24,18 +24,19 @@ public class Query {
} }
/** /**
* The type of params is: * The type of params is: Tuple<name,
* Tuple<name, Tuple<value, URLEncoder.encode(value, "UTF-8")>> * Tuple<value, URLEncoder.encode(value, "UTF-8")>>
*/ */
private final List<Tuple<String, Tuple<String, String>>> params = new ArrayList<Tuple<String, Tuple<String, String>>>(); private final List<Tuple<String, Tuple<String, String>>> params = new ArrayList<Tuple<String, Tuple<String, String>>>();
/** /**
* Appends a parameter to the query * Appends a parameter to the query
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot
* be URL Encoded
*/ */
public Query append(final String name, final String value) throws UnsupportedEncodingException { public Query append(final String name, final String value) throws UnsupportedEncodingException {
params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8")))); params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8"))));
...@@ -43,13 +44,14 @@ public class Query { ...@@ -43,13 +44,14 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query * Conditionally append a parameter to the query if the value of the
* if the value of the parameter is not null * parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot
* be URL Encoded
*/ */
public Query appendIf(final String name, final String value) throws UnsupportedEncodingException { public Query appendIf(final String name, final String value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -59,13 +61,14 @@ public class Query { ...@@ -59,13 +61,14 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query * Conditionally append a parameter to the query if the value of the
* if the value of the parameter is not null * parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot
* be URL Encoded
*/ */
public Query appendIf(final String name, final Integer value) throws UnsupportedEncodingException { public Query appendIf(final String name, final Integer value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -75,13 +78,14 @@ public class Query { ...@@ -75,13 +78,14 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query * Conditionally append a parameter to the query if the value of the
* if the value of the parameter is not null * parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot
* be URL Encoded
*/ */
public Query appendIf(final String name, final Boolean value) throws UnsupportedEncodingException { public Query appendIf(final String name, final Boolean value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -91,13 +95,14 @@ public class Query { ...@@ -91,13 +95,14 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query * Conditionally append a parameter to the query if the value of the
* if the value of the parameter is not null * parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot
* be URL Encoded
*/ */
public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException { public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -107,8 +112,7 @@ public class Query { ...@@ -107,8 +112,7 @@ public class Query {
} }
/** /**
* Returns a Query suitable for appending * Returns a Query suitable for appending to a URI
* to a URI
*/ */
@Override @Override
public String toString() { public String toString() {
......
...@@ -3,6 +3,7 @@ package org.gitlab.api.models; ...@@ -3,6 +3,7 @@ package org.gitlab.api.models;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabBranch { public class GitlabBranch {
public final static String URL = "/repository/branches/"; public final static String URL = "/repository/branches/";
@JsonProperty("name") @JsonProperty("name")
......
...@@ -5,6 +5,7 @@ import java.util.Date; ...@@ -5,6 +5,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabBranchCommit { public class GitlabBranchCommit {
public static String URL = "/users"; public static String URL = "/users";
private String id; private String id;
......
...@@ -5,6 +5,7 @@ import java.util.Date; ...@@ -5,6 +5,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabMergeRequest { public class GitlabMergeRequest {
public static final String URL = "/merge_requests"; public static final String URL = "/merge_requests";
private Integer id; private Integer id;
......
...@@ -5,6 +5,7 @@ import java.util.Date; ...@@ -5,6 +5,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabNamespace { public class GitlabNamespace {
public static final String URL = "/groups"; public static final String URL = "/groups";
private Integer id; private Integer id;
......
...@@ -10,7 +10,6 @@ public class GitlabProjectAccessLevel { ...@@ -10,7 +10,6 @@ public class GitlabProjectAccessLevel {
@JsonProperty("notification_level") @JsonProperty("notification_level")
private int notificationLevel; private int notificationLevel;
public GitlabAccessLevel getAccessLevel() { public GitlabAccessLevel getAccessLevel() {
return GitlabAccessLevel.fromAccessValue(accessLevel); return GitlabAccessLevel.fromAccessValue(accessLevel);
} }
...@@ -19,7 +18,6 @@ public class GitlabProjectAccessLevel { ...@@ -19,7 +18,6 @@ public class GitlabProjectAccessLevel {
this.accessLevel = accessLevel.accessValue; this.accessLevel = accessLevel.accessValue;
} }
public int getNoficationLevel() { public int getNoficationLevel() {
return notificationLevel; return notificationLevel;
} }
...@@ -28,5 +26,4 @@ public class GitlabProjectAccessLevel { ...@@ -28,5 +26,4 @@ public class GitlabProjectAccessLevel {
this.accessLevel = notificationLevel; this.accessLevel = notificationLevel;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
public class GitlabRepositoryTree { public class GitlabRepositoryTree {
public static String URL = "/tree";
private String name; public static String URL = "/tree";
private String type;
private String mode;
private String id;
public String getName() { private String name;
return name; private String type;
} private String mode;
private String id;
public void setName(String name) { public String getName() {
this.name = name; return name;
} }
public String getType() { public void setName(String name) {
return type; this.name = name;
} }
public void setType(String type) { public String getType() {
this.type = type; return type;
} }
public String getMode() { public void setType(String type) {
return mode; this.type = type;
} }
public void setMode(String mode) { public String getMode() {
this.mode = mode; return mode;
} }
public String getId() { public void setMode(String mode) {
return id; this.mode = mode;
} }
public void setId(String id) { public String getId() {
this.id = id; return id;
} }
public void setId(String id) {
this.id = id;
}
} }
package org.gitlab.api.models; package org.gitlab.api.models;
public class GitlabSSHKey { public class GitlabSSHKey {
public static String KEYS_URL = "/keys"; public static String KEYS_URL = "/keys";
private Integer _id; private Integer _id;
......
...@@ -5,6 +5,7 @@ import java.util.Date; ...@@ -5,6 +5,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabUser { public class GitlabUser {
public static String URL = "/users"; public static String URL = "/users";
public static String USERS_URL = "/users"; public static String USERS_URL = "/users";
public static String USER_URL = "/user"; // for sudo based ops public static String USER_URL = "/user"; // for sudo based ops
......
...@@ -24,7 +24,6 @@ public class GitlabAPIT { ...@@ -24,7 +24,6 @@ public class GitlabAPIT {
String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8); String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
@Before @Before
public void setup() throws IOException { public void setup() throws IOException {
api = GitlabAPI.connect(TEST_URL, TEST_TOKEN); api = GitlabAPI.connect(TEST_URL, TEST_TOKEN);
...@@ -62,7 +61,6 @@ public class GitlabAPIT { ...@@ -62,7 +61,6 @@ public class GitlabAPIT {
String password = randVal("$%password"); String password = randVal("$%password");
GitlabUser gitUser = api.createUser(randVal("testEmail@gitlabapitest.com"), GitlabUser gitUser = api.createUser(randVal("testEmail@gitlabapitest.com"),
password, password,
randVal("userName"), randVal("userName"),
...@@ -91,14 +89,11 @@ public class GitlabAPIT { ...@@ -91,14 +89,11 @@ public class GitlabAPIT {
10 /* project limit does not come back on GET */, gitUser.getExternUid(), gitUser.getExternProviderName(), 10 /* project limit does not come back on GET */, gitUser.getExternUid(), gitUser.getExternProviderName(),
gitUser.getBio(), gitUser.isAdmin(), gitUser.isCanCreateGroup()); gitUser.getBio(), gitUser.isAdmin(), gitUser.isCanCreateGroup());
GitlabUser postUpdate = api.getUserViaSudo(gitUser.getUsername()); GitlabUser postUpdate = api.getUserViaSudo(gitUser.getUsername());
assertNotNull(postUpdate); assertNotNull(postUpdate);
assertEquals(postUpdate.getSkype(), "newSkypeId"); assertEquals(postUpdate.getSkype(), "newSkypeId");
api.deleteUser(postUpdate.getId()); api.deleteUser(postUpdate.getId());
// expect a 404, but we have no access to it // expect a 404, but we have no access to it
...@@ -109,7 +104,6 @@ public class GitlabAPIT { ...@@ -109,7 +104,6 @@ public class GitlabAPIT {
assertTrue(true); // expected assertTrue(true); // expected
} }
} }
private String randVal(String postfix) { private String randVal(String postfix) {
......
...@@ -32,7 +32,6 @@ public class QueryTest { ...@@ -32,7 +32,6 @@ public class QueryTest {
Query query = new Query() Query query = new Query()
.append("p1", "v1"); .append("p1", "v1");
query.append("p2", "v2"); query.append("p2", "v2");
query = query.append("p3", "v3"); query = query.append("p3", "v3");
......
Markdown is supported
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