]> source.dussan.org Git - gitblit.git/commitdiff
Cleanup working folders for git servlet unit tests
authorJames Moger <james.moger@gitblit.com>
Sat, 22 Dec 2012 05:26:35 +0000 (00:26 -0500)
committerJames Moger <james.moger@gitblit.com>
Sat, 22 Dec 2012 05:26:35 +0000 (00:26 -0500)
tests/com/gitblit/tests/GitServletTest.java

index 07771a2016417941bce625373502ea51733b1502..7dce07d8f4abd8624597b41f09c6bef1796fea48 100644 (file)
@@ -88,6 +88,11 @@ public class GitServletTest {
 \r
        @Test\r
        public void testClone() throws Exception {\r
+               GitBlitSuite.close(ticgitFolder);\r
+               if (ticgitFolder.exists()) {\r
+                       FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);\r
+               }\r
+               \r
                CloneCommand clone = Git.cloneRepository();\r
                clone.setURI(MessageFormat.format("{0}/git/ticgit.git", url));\r
                clone.setDirectory(ticgitFolder);\r
@@ -187,6 +192,20 @@ public class GitServletTest {
 \r
        @Test\r
        public void testAnonymousPush() throws Exception {\r
+               GitBlitSuite.close(ticgitFolder);\r
+               if (ticgitFolder.exists()) {\r
+                       FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);\r
+               }\r
+\r
+               CloneCommand clone = Git.cloneRepository();\r
+               clone.setURI(MessageFormat.format("{0}/git/ticgit.git", url));\r
+               clone.setDirectory(ticgitFolder);\r
+               clone.setBare(false);\r
+               clone.setCloneAllBranches(true);\r
+               clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password));\r
+               GitBlitSuite.close(clone.call());               \r
+               assertTrue(true);\r
+               \r
                Git git = Git.open(ticgitFolder);\r
                File file = new File(ticgitFolder, "TODO");\r
                OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);\r
@@ -201,6 +220,11 @@ public class GitServletTest {
 \r
        @Test\r
        public void testSubfolderPush() throws Exception {\r
+               GitBlitSuite.close(jgitFolder);\r
+               if (jgitFolder.exists()) {\r
+                       FileUtils.delete(jgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);\r
+               }\r
+               \r
                CloneCommand clone = Git.cloneRepository();\r
                clone.setURI(MessageFormat.format("{0}/git/test/jgit.git", url));\r
                clone.setDirectory(jgitFolder);\r
@@ -224,6 +248,11 @@ public class GitServletTest {
        \r
        @Test\r
        public void testPushToFrozenRepo() throws Exception {\r
+               GitBlitSuite.close(jgitFolder);\r
+               if (jgitFolder.exists()) {\r
+                       FileUtils.delete(jgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);\r
+               }\r
+               \r
                CloneCommand clone = Git.cloneRepository();\r
                clone.setURI(MessageFormat.format("{0}/git/test/jgit.git", url));\r
                clone.setDirectory(jgitFolder);\r