1818import org .gitlab4j .api .models .Commit ;
1919import org .gitlab4j .api .models .CompareResults ;
2020import org .gitlab4j .api .models .Project ;
21- import org .gitlab4j .api .models .RepositoryFile ;
2221import org .junit .AfterClass ;
2322import org .junit .Before ;
2423import org .junit .BeforeClass ;
@@ -56,7 +55,6 @@ public class TestRepositoryApi {
5655
5756 private static final String TEST_BRANCH_NAME = "feature/test_branch" ;
5857 private static final String TEST_PROTECT_BRANCH_NAME = "feature/protect_branch" ;
59- private static final String TEST_FILEPATH = "test-file.txt" ;
6058 private static GitLabApi gitLabApi ;
6159
6260 public TestRepositoryApi () {
@@ -98,11 +96,6 @@ public static void teardown() {
9896 try {
9997 Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
10098
101- try {
102- gitLabApi .getRepositoryFileApi ().deleteFile (TEST_FILEPATH , project .getId (), TEST_BRANCH_NAME , "Cleanup test files." );
103- } catch (GitLabApiException ignore ) {
104- }
105-
10699 try {
107100 gitLabApi .getRepositoryApi ().deleteBranch (project .getId (), TEST_BRANCH_NAME );
108101 } catch (GitLabApiException ignore ) {
@@ -172,46 +165,6 @@ public void testRepositoryArchiveViaFile() throws GitLabApiException, IOExceptio
172165 file .delete ();
173166 }
174167
175- @ Test
176- public void testRawFileViaFile () throws GitLabApiException , IOException {
177-
178- Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
179- assertNotNull (project );
180-
181- File file = gitLabApi .getRepositoryFileApi ().getRawFile (project .getId (), "master" , "README" , null );
182- assertTrue (file .length () > 0 );
183- file .delete ();
184-
185- file = gitLabApi .getRepositoryFileApi ().getRawFile (project .getId (), "master" , "README" , new File ("." ));
186- assertTrue (file .length () > 0 );
187- file .delete ();
188- }
189-
190- @ Test
191- public void testRepositoryFileViaInputStream () throws GitLabApiException , IOException {
192-
193- Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
194- assertNotNull (project );
195-
196- InputStream in = gitLabApi .getRepositoryFileApi ().getRawFile (project .getId (), "master" , "README" );
197-
198- Path target = Files .createTempFile (TEST_PROJECT_NAME + "-README" , "" );
199- Files .copy (in , target , StandardCopyOption .REPLACE_EXISTING );
200-
201- assertTrue (target .toFile ().length () > 0 );
202- Files .delete (target );
203- }
204-
205- @ Test
206- public void testRepositoryFileGetFile () throws GitLabApiException , IOException {
207-
208- Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
209- assertNotNull (project );
210-
211- RepositoryFile fileInfo = gitLabApi .getRepositoryFileApi ().getFileInfo (project .getId (), "README" , "master" );
212- assertNotNull (fileInfo );
213- }
214-
215168 @ Test
216169 public void testCompare () throws GitLabApiException {
217170
@@ -230,36 +183,6 @@ public void testCompare() throws GitLabApiException {
230183 assertNotNull (compareResults );
231184 }
232185
233- @ Test
234- public void testCreateFileAndDeleteFile () throws GitLabApiException {
235-
236- Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
237- assertNotNull (project );
238-
239- RepositoryFile file = new RepositoryFile ();
240- file .setFilePath (TEST_FILEPATH );
241- file .setContent ("This is a test file." );
242- RepositoryFile createdFile = gitLabApi .getRepositoryFileApi ().createFile (file , project .getId (), TEST_BRANCH_NAME , "Testing createFile()." );
243- assertNotNull (createdFile );
244-
245- gitLabApi .getRepositoryFileApi ().deleteFile (TEST_FILEPATH , project .getId (), TEST_BRANCH_NAME , "Testing deleteFile()." );
246- }
247-
248- @ Test
249- public void testCreateFileWithEmptyContent () throws GitLabApiException {
250-
251- Project project = gitLabApi .getProjectApi ().getProject (TEST_NAMESPACE , TEST_PROJECT_NAME );
252- assertNotNull (project );
253-
254- RepositoryFile file = new RepositoryFile ();
255- file .setFilePath (TEST_FILEPATH );
256- file .setContent ("" );
257- RepositoryFile createdFile = gitLabApi .getRepositoryFileApi ().createFile (file , project .getId (), TEST_BRANCH_NAME , "Testing createFile()." );
258- assertNotNull (createdFile );
259-
260- gitLabApi .getRepositoryFileApi ().deleteFile (TEST_FILEPATH , project .getId (), TEST_BRANCH_NAME , "Testing deleteFile()." );
261- }
262-
263186 @ Test
264187 public void testProtectBranch () throws GitLabApiException {
265188
0 commit comments