Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
2b91ecd4
Commit
2b91ecd4
authored
Dec 12, 2018
by
Greg Messner
Browse files
Mods for deprecated methods.
parent
eee4ed12
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestRepositoryFileApi.java
View file @
2b91ecd4
...
@@ -98,7 +98,7 @@ public class TestRepositoryFileApi {
...
@@ -98,7 +98,7 @@ public class TestRepositoryFileApi {
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
try
{
try
{
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
TEST_FILEPATH
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Cleanup test files."
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
project
.
getId
()
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
,
"Cleanup test files."
);
}
catch
(
GitLabApiException
ignore
)
{
}
catch
(
GitLabApiException
ignore
)
{
}
}
...
@@ -186,10 +186,10 @@ public class TestRepositoryFileApi {
...
@@ -186,10 +186,10 @@ public class TestRepositoryFileApi {
RepositoryFile
file
=
new
RepositoryFile
();
RepositoryFile
file
=
new
RepositoryFile
();
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setContent
(
TEST_CONTENT
);
file
.
setContent
(
TEST_CONTENT
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
file
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing createFile()."
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
project
.
getId
(),
file
,
TEST_BRANCH_NAME
,
"Testing createFile()."
);
assertNotNull
(
createdFile
);
assertNotNull
(
createdFile
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
TEST_FILEPATH
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
project
.
getId
()
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
}
}
...
@@ -205,10 +205,10 @@ public class TestRepositoryFileApi {
...
@@ -205,10 +205,10 @@ public class TestRepositoryFileApi {
RepositoryFile
file
=
new
RepositoryFile
();
RepositoryFile
file
=
new
RepositoryFile
();
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setContent
(
""
);
file
.
setContent
(
""
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
file
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing createFile()."
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
project
.
getId
(),
file
,
TEST_BRANCH_NAME
,
"Testing createFile()."
);
assertNotNull
(
createdFile
);
assertNotNull
(
createdFile
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
TEST_FILEPATH
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
project
.
getId
()
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
}
}
...
@@ -224,7 +224,7 @@ public class TestRepositoryFileApi {
...
@@ -224,7 +224,7 @@ public class TestRepositoryFileApi {
RepositoryFile
file
=
new
RepositoryFile
();
RepositoryFile
file
=
new
RepositoryFile
();
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setContent
(
TEST_CONTENT
);
file
.
setContent
(
TEST_CONTENT
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
file
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing createFile()."
);
RepositoryFile
createdFile
=
gitLabApi
.
getRepositoryFileApi
().
createFile
(
project
.
getId
(),
file
,
TEST_BRANCH_NAME
,
"Testing createFile()."
);
assertNotNull
(
createdFile
);
assertNotNull
(
createdFile
);
Optional
<
RepositoryFile
>
optionalFile
=
gitLabApi
.
getRepositoryFileApi
().
getOptionalFile
(
project
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
);
Optional
<
RepositoryFile
>
optionalFile
=
gitLabApi
.
getRepositoryFileApi
().
getOptionalFile
(
project
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
);
...
@@ -236,14 +236,14 @@ public class TestRepositoryFileApi {
...
@@ -236,14 +236,14 @@ public class TestRepositoryFileApi {
file
=
new
RepositoryFile
();
file
=
new
RepositoryFile
();
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
setFilePath
(
TEST_FILEPATH
);
file
.
encodeAndSetContent
(
newContent
);
file
.
encodeAndSetContent
(
newContent
);
gitLabApi
.
getRepositoryFileApi
().
updateFile
(
file
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing updateFile()."
);
gitLabApi
.
getRepositoryFileApi
().
updateFile
(
project
.
getId
(),
file
,
TEST_BRANCH_NAME
,
"Testing updateFile()."
);
optionalFile
=
gitLabApi
.
getRepositoryFileApi
().
getOptionalFile
(
project
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
);
optionalFile
=
gitLabApi
.
getRepositoryFileApi
().
getOptionalFile
(
project
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
);
assertTrue
(
optionalFile
.
isPresent
());
assertTrue
(
optionalFile
.
isPresent
());
RepositoryFile
updatedFile
=
optionalFile
.
get
();
RepositoryFile
updatedFile
=
optionalFile
.
get
();
assertEquals
(
newContent
,
updatedFile
.
getDecodedContentAsString
());
assertEquals
(
newContent
,
updatedFile
.
getDecodedContentAsString
());
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
TEST_FILEPATH
,
project
.
getId
(),
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryFileApi
().
deleteFile
(
project
.
getId
()
,
TEST_FILEPATH
,
TEST_BRANCH_NAME
,
"Testing deleteFile()."
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
gitLabApi
.
getRepositoryApi
().
deleteBranch
(
project
.
getId
(),
TEST_BRANCH_NAME
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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