Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
37444213
Commit
37444213
authored
Sep 25, 2015
by
Grogdunn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enh: formatted code
parent
42bf4d2b
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
393 additions
and
370 deletions
+393
-370
pom.xml
pom.xml
+135
-135
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+153
-127
TokenType.java
src/main/java/org/gitlab/api/TokenType.java
+8
-10
GitlabHTTPRequestor.java
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
+33
-34
Query.java
src/main/java/org/gitlab/api/http/Query.java
+28
-24
GitlabBranch.java
src/main/java/org/gitlab/api/models/GitlabBranch.java
+1
-0
GitlabBranchCommit.java
src/main/java/org/gitlab/api/models/GitlabBranchCommit.java
+1
-0
GitlabMergeRequest.java
src/main/java/org/gitlab/api/models/GitlabMergeRequest.java
+1
-0
GitlabNamespace.java
src/main/java/org/gitlab/api/models/GitlabNamespace.java
+1
-0
GitlabProjectAccessLevel.java
.../java/org/gitlab/api/models/GitlabProjectAccessLevel.java
+0
-3
GitlabRepositoryTree.java
...main/java/org/gitlab/api/models/GitlabRepositoryTree.java
+30
-29
GitlabSSHKey.java
src/main/java/org/gitlab/api/models/GitlabSSHKey.java
+1
-1
GitlabUser.java
src/main/java/org/gitlab/api/models/GitlabUser.java
+1
-0
GitlabAPIT.java
src/test/java/org/gitlab/api/GitlabAPIT.java
+0
-6
QueryTest.java
src/test/java/org/gitlab/api/http/QueryTest.java
+0
-1
No files found.
pom.xml
View file @
37444213
<?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"
>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.gitlab
</groupId>
<artifactId>
java-gitlab-api
</artifactId>
<version>
1.1.10-SNAPSHOT
</version>
<groupId>
org.gitlab
</groupId>
<artifactId>
java-gitlab-api
</artifactId>
<version>
1.1.10-SNAPSHOT
</version>
<name>
Gitlab Java API Wrapper
</name>
<description>
A Java wrapper for the Gitlab Git Hosting Server API
</description>
<name>
Gitlab Java API Wrapper
</name>
<description>
A Java wrapper for the Gitlab Git Hosting Server API
</description>
<parent>
<groupId>
org.sonatype.oss
</groupId>
<artifactId>
oss-parent
</artifactId>
<version>
9
</version>
</parent>
<parent>
<groupId>
org.sonatype.oss
</groupId>
<artifactId>
oss-parent
</artifactId>
<version>
9
</version>
</parent>
<developers>
<developer>
<id>
timols
</id>
<name>
Tim Olshansky
</name>
<email>
tim.olshansky@gmail.com
</email>
</developer>
</developers>
<contributors>
<contributor>
<name>
Adam Retter
</name>
<email>
adam.retter@googlemail.com
</email>
<organization>
Evolved Binary Ltd
</organization>
</contributor>
<contributor>
<name>
Cesar Aguilar
</name>
<email>
cesar@fuzzproductions.com
</email>
<organization>
Fuzz Productions
</organization>
</contributor>
<contributor>
<name>
Chris Luu
</name>
<email>
luu@fuzzproductions.com
</email>
<organization>
Fuzz Productions
</organization>
</contributor>
</contributors>
<developers>
<developer>
<id>
timols
</id>
<name>
Tim Olshansky
</name>
<email>
tim.olshansky@gmail.com
</email>
</developer>
</developers>
<contributors>
<contributor>
<name>
Adam Retter
</name>
<email>
adam.retter@googlemail.com
</email>
<organization>
Evolved Binary Ltd
</organization>
</contributor>
<contributor>
<name>
Cesar Aguilar
</name>
<email>
cesar@fuzzproductions.com
</email>
<organization>
Fuzz Productions
</organization>
</contributor>
<contributor>
<name>
Chris Luu
</name>
<email>
luu@fuzzproductions.com
</email>
<organization>
Fuzz Productions
</organization>
</contributor>
</contributors>
<licenses>
<license>
<name>
The Apache Software License, Version 2.0
</name>
<url>
http://www.apache.org/licenses/LICENSE-2.0.txt
</url>
<distribution>
repo
</distribution>
</license>
</licenses>
<licenses>
<license>
<name>
The Apache Software License, Version 2.0
</name>
<url>
http://www.apache.org/licenses/LICENSE-2.0.txt
</url>
<distribution>
repo
</distribution>
</license>
</licenses>
<scm>
<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>
<url>
https://github.com/timols/java-gitlab-api
</url>
</scm>
<scm>
<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>
<url>
https://github.com/timols/java-gitlab-api
</url>
</scm>
<issueManagement>
<system>
Github
</system>
<url>
https://github.com/timols/java-gitlab-api/issues
</url>
</issueManagement>
<issueManagement>
<system>
Github
</system>
<url>
https://github.com/timols/java-gitlab-api/issues
</url>
</issueManagement>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
</properties>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
<version>
2.5.3
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.5.3
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.4
</version>
</dependency>
<dependency>
<groupId>
org.hamcrest
</groupId>
<artifactId>
hamcrest-all
</artifactId>
<version>
1.3
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
<version>
2.5.3
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.5.3
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.4
</version>
</dependency>
<dependency>
<groupId>
org.hamcrest
</groupId>
<artifactId>
hamcrest-all
</artifactId>
<version>
1.3
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
2.5.1
</version>
<configuration>
<source>
1.6
</source>
<target>
1.6
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.17
</version>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<version>
2.17
</version>
<executions>
<execution>
<id>
default-integration-test
</id>
<goals>
<goal>
integration-test
</goal>
</goals>
</execution>
<execution>
<id>
default-verify
</id>
<goals>
<goal>
verify
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-source-plugin
</artifactId>
<version>
2.4
</version>
<executions>
<execution>
<id>
attach-sources
</id>
<phase>
verify
</phase>
<goals>
<goal>
jar-no-fork
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
2.5.1
</version>
<configuration>
<source>
1.6
</source>
<target>
1.6
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.17
</version>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<version>
2.17
</version>
<executions>
<execution>
<id>
default-integration-test
</id>
<goals>
<goal>
integration-test
</goal>
</goals>
</execution>
<execution>
<id>
default-verify
</id>
<goals>
<goal>
verify
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-source-plugin
</artifactId>
<version>
2.4
</version>
<executions>
<execution>
<id>
attach-sources
</id>
<phase>
verify
</phase>
<goals>
<goal>
jar-no-fork
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
37444213
This diff is collapsed.
Click to expand it.
src/main/java/org/gitlab/api/TokenType.java
View file @
37444213
package
org
.
gitlab
.
api
;
public
enum
TokenType
{
PRIVATE_TOKEN
(
"private_token"
)
,
ACCESS_TOKEN
(
"access_token"
),
;
PRIVATE_TOKEN
(
"private_token"
),
ACCESS_TOKEN
(
"access_token"
),;
private
final
String
tokenParamName
;
private
final
String
tokenParamName
;
TokenType
(
String
tokenParamName
)
{
this
.
tokenParamName
=
tokenParamName
;
}
TokenType
(
String
tokenParamName
)
{
this
.
tokenParamName
=
tokenParamName
;
}
public
String
getTokenParamName
()
{
return
tokenParamName
;
}
public
String
getTokenParamName
()
{
return
tokenParamName
;
}
}
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
View file @
37444213
...
...
@@ -20,8 +20,8 @@ import java.util.regex.Pattern;
import
java.util.zip.GZIPInputStream
;
/**
* Gitlab HTTP Requestor
*
Responsible for handling HTTP requests to the Gitlab
API
* Gitlab HTTP Requestor
Responsible for handling HTTP requests to the Gitlab
* API
*
* @author @timols (Tim O)
*/
...
...
@@ -57,8 +57,8 @@ public class GitlabHTTPRequestor {
}
/**
* Sets the HTTP Request method for the request.
*
Has a fluent api for method
chaining.
* Sets the HTTP Request method for the request.
Has a fluent api for method
* chaining.
*
* @param method The HTTP method
* @return this
...
...
@@ -74,11 +74,11 @@ public class GitlabHTTPRequestor {
}
/**
* Sets the HTTP Form Post parameters for the request
*
Has a fluent api for
method chaining
* Sets the HTTP Form Post parameters for the request
Has a fluent api for
* method chaining
*
* @param key
Form parameter Key
* @param value
Form parameter Value
* @param key Form parameter Key
* @param value Form parameter Value
* @return this
*/
public
GitlabHTTPRequestor
with
(
String
key
,
Object
value
)
{
...
...
@@ -100,10 +100,11 @@ public class GitlabHTTPRequestor {
* Opens the HTTP(S) connection, submits any data and parses the response.
* Will throw an error
*
* @param <T> The return type of the method
* @param tailAPIUrl The url to open a connection to (after the host and namespace)
* @param type The type of the response to be deserialized from
* @param instance The instance to update from the response
* @param <T> The return type of the method
* @param tailAPIUrl The url to open a connection to (after the host and
* namespace)
* @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
* @throws java.io.IOException on gitlab api error
*/
...
...
@@ -113,7 +114,7 @@ public class GitlabHTTPRequestor {
connection
=
setupConnection
(
root
.
getAPIUrl
(
tailAPIUrl
));
if
(
hasOutput
())
{
submitData
(
connection
);
submitData
(
connection
);
}
else
if
(
"PUT"
.
equals
(
method
))
{
// PUT requires Content-Length: 0 even when there is no body (eg: API for protecting a branch)
connection
.
setDoOutput
(
true
);
...
...
@@ -231,17 +232,15 @@ public class GitlabHTTPRequestor {
if
(
matcher
.
find
())
{
Integer
page
=
Integer
.
parseInt
(
matcher
.
group
(
2
))
+
1
;
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
{
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
{
// 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"
);
}
// 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 {
try
{
reader
=
new
InputStreamReader
(
wrapStream
(
connection
,
connection
.
getInputStream
()),
"UTF-8"
);
if
(
byte
[].
class
==
type
)
{
return
type
.
cast
(
IOUtils
.
toByteArray
(
reader
));
return
type
.
cast
(
IOUtils
.
toByteArray
(
reader
));
}
String
data
=
IOUtils
.
toString
(
reader
);
if
(
type
!=
null
)
{
...
...
@@ -334,19 +333,19 @@ public class GitlabHTTPRequestor {
private
void
ignoreCertificateErrors
()
{
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
new
X509TrustManager
()
{
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
public
void
checkClientTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
{
}
public
void
checkClientTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
{
}
public
void
checkServerTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
{
}
public
void
checkServerTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
{
}
}
};
// Added per https://github.com/timols/java-gitlab-api/issues/44
HostnameVerifier
nullVerifier
=
new
HostnameVerifier
()
{
...
...
src/main/java/org/gitlab/api/http/Query.java
View file @
37444213
...
...
@@ -8,12 +8,12 @@ import java.util.ArrayList;
import
java.util.List
;
/**
* Models the Query
* aspect of a URL
* Models the Query aspect of a URL
*/
public
class
Query
{
private
class
Tuple
<
T1
,
T2
>
{
T1
_1
;
T2
_2
;
...
...
@@ -24,18 +24,19 @@ public class Query {
}
/**
* The type of params is:
* Tuple<
name, Tuple<
value, URLEncoder.encode(value, "UTF-8")>>
* The type of params is:
Tuple<name,
* Tuple<value, URLEncoder.encode(value, "UTF-8")>>
*/
private
final
List
<
Tuple
<
String
,
Tuple
<
String
,
String
>>>
params
=
new
ArrayList
<
Tuple
<
String
,
Tuple
<
String
,
String
>>>();
/**
* Appends a parameter to the query
*
* @param name
Parameter name
* @param name Parameter name
* @param value Parameter value
* @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
{
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 {
}
/**
* Conditionally append a parameter to the query
*
if the value of the
parameter is not null
* Conditionally append a parameter to the query
if the value of the
* parameter is not null
*
* @param name
Parameter name
* @param name Parameter name
* @param value Parameter value
* @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
{
if
(
value
!=
null
)
{
...
...
@@ -59,13 +61,14 @@ public class Query {
}
/**
* Conditionally append a parameter to the query
*
if the value of the
parameter is not null
* Conditionally append a parameter to the query
if the value of the
* parameter is not null
*
* @param name
Parameter name
* @param name Parameter name
* @param value Parameter value
* @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
{
if
(
value
!=
null
)
{
...
...
@@ -75,13 +78,14 @@ public class Query {
}
/**
* Conditionally append a parameter to the query
*
if the value of the
parameter is not null
* Conditionally append a parameter to the query
if the value of the
* parameter is not null
*
* @param name
Parameter name
* @param name Parameter name
* @param value Parameter value
* @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
{
if
(
value
!=
null
)
{
...
...
@@ -91,13 +95,14 @@ public class Query {
}
/**
* Conditionally append a parameter to the query
*
if the value of the
parameter is not null
* Conditionally append a parameter to the query
if the value of the
* parameter is not null
*
* @param name
Parameter name
* @param name Parameter name
* @param value Parameter value
* @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
{
if
(
value
!=
null
)
{
...
...
@@ -107,8 +112,7 @@ public class Query {
}
/**
* Returns a Query suitable for appending
* to a URI
* Returns a Query suitable for appending to a URI
*/
@Override
public
String
toString
()
{
...
...
src/main/java/org/gitlab/api/models/GitlabBranch.java
View file @
37444213
...
...
@@ -3,6 +3,7 @@ package org.gitlab.api.models;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabBranch
{
public
final
static
String
URL
=
"/repository/branches/"
;
@JsonProperty
(
"name"
)
...
...
src/main/java/org/gitlab/api/models/GitlabBranchCommit.java
View file @
37444213
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabBranchCommit
{
public
static
String
URL
=
"/users"
;
private
String
id
;
...
...
src/main/java/org/gitlab/api/models/GitlabMergeRequest.java
View file @
37444213
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabMergeRequest
{
public
static
final
String
URL
=
"/merge_requests"
;
private
Integer
id
;
...
...
src/main/java/org/gitlab/api/models/GitlabNamespace.java
View file @
37444213
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabNamespace
{
public
static
final
String
URL
=
"/groups"
;
private
Integer
id
;
...
...
src/main/java/org/gitlab/api/models/GitlabProjectAccessLevel.java
View file @
37444213
...
...
@@ -10,7 +10,6 @@ public class GitlabProjectAccessLevel {
@JsonProperty
(
"notification_level"
)
private
int
notificationLevel
;
public
GitlabAccessLevel
getAccessLevel
()
{
return
GitlabAccessLevel
.
fromAccessValue
(
accessLevel
);
}
...
...
@@ -19,7 +18,6 @@ public class GitlabProjectAccessLevel {
this
.
accessLevel
=
accessLevel
.
accessValue
;
}
public
int
getNoficationLevel
()
{
return
notificationLevel
;
}
...
...
@@ -28,5 +26,4 @@ public class GitlabProjectAccessLevel {
this
.
accessLevel
=
notificationLevel
;
}
}
src/main/java/org/gitlab/api/models/GitlabRepositoryTree.java
View file @
37444213
package
org
.
gitlab
.
api
.
models
;
public
class
GitlabRepositoryTree
{
public
static
String
URL
=
"/tree"
;
private
String
name
;
private
String
type
;
private
String
mode
;
private
String
id
;
public
static
String
URL
=
"/tree"
;
public
String
getName
()
{
return
name
;
}
private
String
name
;
private
String
type
;
private
String
mode
;
private
String
id
;
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
(
)
{
return
name
;
}
public
String
getType
(
)
{
return
typ
e
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
nam
e
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
(
)
{
return
type
;
}
public
String
getMode
(
)
{
return
mod
e
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
typ
e
;
}
public
void
setMode
(
String
mode
)
{
this
.
mode
=
mode
;
}
public
String
getMode
(
)
{
return
mode
;
}
public
String
getId
(
)
{
return
id
;
}
public
void
setMode
(
String
mode
)
{
this
.
mode
=
mode
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
src/main/java/org/gitlab/api/models/GitlabSSHKey.java
View file @
37444213
package
org
.
gitlab
.
api
.
models
;
public
class
GitlabSSHKey
{
public
static
String
KEYS_URL
=
"/keys"
;
private
Integer
_id
;
...
...
src/main/java/org/gitlab/api/models/GitlabUser.java
View file @
37444213
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabUser
{
public
static
String
URL
=
"/users"
;
public
static
String
USERS_URL
=
"/users"
;
public
static
String
USER_URL
=
"/user"
;
// for sudo based ops
...
...
src/test/java/org/gitlab/api/GitlabAPIT.java
View file @
37444213
...
...
@@ -24,7 +24,6 @@ public class GitlabAPIT {
String
rand
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
substring
(
0
,
8
);
@Before
public
void
setup
()
throws
IOException
{
api
=
GitlabAPI
.
connect
(
TEST_URL
,
TEST_TOKEN
);
...
...
@@ -62,7 +61,6 @@ public class GitlabAPIT {
String
password
=
randVal
(
"$%password"
);
GitlabUser
gitUser
=
api
.
createUser
(
randVal
(
"testEmail@gitlabapitest.com"
),
password
,
randVal
(
"userName"
),
...
...
@@ -91,14 +89,11 @@ public class GitlabAPIT {
10
/* project limit does not come back on GET */
,
gitUser
.
getExternUid
(),
gitUser
.
getExternProviderName
(),
gitUser
.
getBio
(),
gitUser
.
isAdmin
(),
gitUser
.
isCanCreateGroup
());
GitlabUser
postUpdate
=
api
.
getUserViaSudo
(
gitUser
.
getUsername
());
assertNotNull
(
postUpdate
);
assertEquals
(
postUpdate
.
getSkype
(),
"newSkypeId"
);
api
.
deleteUser
(
postUpdate
.
getId
());
// expect a 404, but we have no access to it
...
...
@@ -109,7 +104,6 @@ public class GitlabAPIT {
assertTrue
(
true
);
// expected
}
}
private
String
randVal
(
String
postfix
)
{
...
...
src/test/java/org/gitlab/api/http/QueryTest.java
View file @
37444213
...
...
@@ -32,7 +32,6 @@ public class QueryTest {
Query
query
=
new
Query
()
.
append
(
"p1"
,
"v1"
);
query
.
append
(
"p2"
,
"v2"
);
query
=
query
.
append
(
"p3"
,
"v3"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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