Permalink
Browse files

Implement 'Pull' operation for issue #37 - will update working dir

Not hooked up to anything yet...

#37
  • Loading branch information...
1 parent 1857c7a commit 6fdffd3af7f5856994c3e074c81d76514775521b @rtyley committed Aug 26, 2011
Showing with 492 additions and 641 deletions.
  1. +0 −2 agit-integration-tests/src/main/java/com/madgag/agit/AboutActivityStoryTest.java
  2. +4 −5 agit-integration-tests/src/main/java/com/madgag/agit/AgitTestApplication.java
  3. +42 −0 agit-integration-tests/src/main/java/com/madgag/agit/AndroidTestEnvironment.java
  4. +3 −6 agit-integration-tests/src/main/java/com/madgag/agit/CloneLauncherActivityStoryTest.java
  5. +0 −2 agit-integration-tests/src/main/java/com/madgag/agit/DashboardActivityTest.java
  6. +41 −22 agit-integration-tests/src/main/java/com/madgag/agit/GitAsyncTaskTest.java
  7. +16 −37 agit-integration-tests/src/main/java/com/madgag/agit/RDTypeListActivityStoryTest.java
  8. +8 −8 agit-integration-tests/src/main/java/com/madgag/agit/RepoNotificationsTest.java
  9. +2 −4 agit-integration-tests/src/main/java/com/madgag/agit/YesToEveryPromptService.java
  10. +0 −20 agit-integration-tests/src/main/java/com/madgag/agit/sync/PeriodicSyncTest.java
  11. +3 −5 agit-integration-tests/src/main/java/roboguice/test/RoboServiceTestCase.java
  12. +5 −29 agit-test-utils/src/main/java/com/madgag/agit/GitTestUtils.java
  13. +10 −0 agit-test-utils/src/main/java/com/madgag/agit/TestEnvironment.java
  14. +47 −0 agit-test-utils/src/main/java/com/madgag/agit/matchers/GitTestHelper.java
  15. +1 −4 agit-test-utils/src/main/java/com/madgag/agit/matchers/VisibilityMatcher.java
  16. +1 −1 agit/res/values/strings.xml
  17. +1 −1 agit/src/main/java/com/commonsware/cwac/sacklist/SackOfViewsAdapter.java
  18. +0 −1 agit/src/main/java/com/madgag/ZeroByteInflationCheck.java
  19. +0 −2 agit/src/main/java/com/madgag/agit/AboutUsingSshActivity.java
  20. +5 −7 agit/src/main/java/com/madgag/agit/AgitApplication.java
  21. +28 −34 agit/src/main/java/com/madgag/agit/AgitModule.java
  22. +0 −2 agit/src/main/java/com/madgag/agit/AgitProductionModule.java
  23. +0 −4 agit/src/main/java/com/madgag/agit/CloneLauncherActivity.java
  24. +9 −10 agit/src/main/java/com/madgag/agit/CommitNavigationView.java
  25. +17 −22 agit/src/main/java/com/madgag/agit/CommitView.java
  26. +1 −3 agit/src/main/java/com/madgag/agit/CommitViewHolder.java
  27. +22 −24 agit/src/main/java/com/madgag/agit/CommitViewerActivity.java
  28. +0 −1 agit/src/main/java/com/madgag/agit/DashboardActivity.java
  29. +3 −5 agit/src/main/java/com/madgag/agit/GitFetchService.java
  30. +1 −5 agit/src/main/java/com/madgag/agit/GitInfoProvider.java
  31. +2 −3 agit/src/main/java/com/madgag/agit/GitIntentBuilder.java
  32. +5 −6 agit/src/main/java/com/madgag/agit/GitIntents.java
  33. +1 −1 agit/src/main/java/com/madgag/agit/GitOperationsService.java
  34. +0 −2 agit/src/main/java/com/madgag/agit/MarkdownActivityBase.java
  35. +6 −8 agit/src/main/java/com/madgag/agit/RDTypeListActivity.java
  36. +4 −5 agit/src/main/java/com/madgag/agit/RemoteViewer.java
  37. +1 −3 agit/src/main/java/com/madgag/agit/RepoScopedActivityBase.java
  38. +4 −7 agit/src/main/java/com/madgag/agit/RepositoryContext.java
  39. +4 −5 agit/src/main/java/com/madgag/agit/RepositoryProvider.java
  40. +5 −4 agit/src/main/java/com/madgag/agit/RepositoryViewerActivity.java
  41. +8 −16 agit/src/main/java/com/madgag/agit/RevCommitListView.java
  42. +2 −2 agit/src/main/java/com/madgag/agit/TagViewer.java
  43. +0 −2 agit/src/main/java/com/madgag/agit/ViewHoldingIterableAdapter.java
  44. +0 −3 agit/src/main/java/com/madgag/agit/diff/CommitDiffer.java
  45. +3 −2 agit/src/main/java/com/madgag/agit/diff/DeltaSpan.java
  46. +7 −7 agit/src/main/java/com/madgag/agit/diff/DiffText.java
  47. +3 −4 agit/src/main/java/com/madgag/agit/diff/FileDiff.java
  48. +0 −1 agit/src/main/java/com/madgag/agit/diff/FileHeaderViewHolder.java
  49. +4 −5 agit/src/main/java/com/madgag/agit/diff/FilePathDiffer.java
  50. +13 −22 agit/src/main/java/com/madgag/agit/diff/LineContextDiffer.java
  51. +1 −5 agit/src/main/java/com/madgag/agit/git/GitObjectFunction.java
  52. +2 −9 agit/src/main/java/com/madgag/agit/git/GitObjects.java
  53. +11 −12 agit/src/main/java/com/madgag/agit/git/Repos.java
  54. +4 −6 agit/src/main/java/com/madgag/agit/git/TransportFactory.java
  55. +0 −1 agit/src/main/java/com/madgag/agit/git/TransportProtocols.java
  56. +4 −4 agit/src/main/java/com/madgag/agit/git/model/RDTRemote.java
  57. +1 −1 agit/src/main/java/com/madgag/agit/git/model/RDTTag.java
  58. +4 −4 agit/src/main/java/com/madgag/agit/git/model/Relation.java
  59. +4 −13 agit/src/main/java/com/madgag/agit/git/model/RepoDomainType.java
  60. +0 −1 agit/src/main/java/com/madgag/agit/guice/OperationScope.java
  61. +7 −9 agit/src/main/java/com/madgag/agit/guice/RepositoryScope.java
  62. +4 −4 agit/src/main/java/com/madgag/agit/guice/RepositoryScoped.java
  63. +0 −2 agit/src/main/java/com/madgag/agit/guice/ScopeBase.java
  64. +1 −1 agit/src/main/java/com/madgag/agit/operation/lifecycle/CasualShortTermLifetime.java
  65. +3 −3 agit/src/main/java/com/madgag/agit/operation/lifecycle/LongRunningServiceLifetime.java
  66. +1 −1 agit/src/main/java/com/madgag/agit/operation/lifecycle/OperationLifecycleSupport.java
  67. +6 −7 agit/src/main/java/com/madgag/agit/operation/lifecycle/RepoNotifications.java
  68. +1 −1 agit/src/main/java/com/madgag/agit/operation/lifecycle/StatusBarProgressView.java
  69. +4 −5 agit/src/main/java/com/madgag/agit/operations/Clone.java
  70. +7 −9 agit/src/main/java/com/madgag/agit/operations/Fetch.java
  71. +10 −11 agit/src/main/java/com/madgag/agit/operations/GitAsyncTask.java
  72. +0 −2 agit/src/main/java/com/madgag/agit/operations/GitAsyncTaskFactory.java
  73. +3 −5 agit/src/main/java/com/madgag/agit/operations/GitOperation.java
  74. +1 −2 agit/src/main/java/com/madgag/agit/operations/MessagingProgressMonitor.java
  75. +5 −11 agit/src/main/java/com/madgag/agit/operations/Pull.java
  76. +0 −3 agit/src/main/java/com/madgag/agit/operations/RepoDeleter.java
  77. +0 −2 agit/src/main/java/com/madgag/agit/operations/RepoOpRegistry.java
  78. +7 −9 agit/src/main/java/com/madgag/agit/ssh/AndroidAuthAgentProvider.java
  79. +0 −2 agit/src/main/java/com/madgag/agit/ssh/AndroidSshSessionFactory.java
  80. +5 −10 agit/src/main/java/com/madgag/agit/ssh/jsch/GUIUserInfo.java
  81. +0 −2 agit/src/main/java/com/madgag/agit/sync/AccountAuthenticatorService.java
  82. +0 −11 agit/src/main/java/com/madgag/agit/sync/SyncCampaign.java
  83. +0 −2 agit/src/main/java/com/madgag/agit/util/Time.java
  84. +1 −1 agit/src/main/java/com/madgag/agit/views/BranchesSummaryView.java
  85. +2 −5 agit/src/main/java/com/madgag/agit/views/LatestCommitView.java
  86. +1 −4 agit/src/main/java/com/madgag/agit/views/ObjectIdView.java
  87. +1 −1 agit/src/main/java/com/madgag/agit/views/ObjectSummaryView.java
  88. +1 −1 agit/src/main/java/com/madgag/agit/views/PrettyCommitSummaryView.java
  89. +1 −4 agit/src/main/java/com/madgag/agit/views/TagSummaryView.java
  90. +0 −9 agit/src/main/java/com/madgag/agit/views/ViewUtil.java
  91. +0 −2 agit/src/main/java/com/madgag/agit/weblaunchers/GitHubWebLaunchActivity.java
  92. +0 −2 agit/src/main/java/com/madgag/agit/weblaunchers/GitoriousWebLaunchActivity.java
  93. +0 −2 agit/src/main/java/com/madgag/agit/weblaunchers/WebLaunchActivity.java
  94. +0 −4 agit/src/main/java/com/madgag/android/ClickableText.java
  95. +0 −1 agit/src/main/java/com/madgag/ssh/authagent/client/jsch/SSHAgentIdentity.java
  96. +3 −10 agit/src/main/java/com/markupartist/android/widget/ActionBar.java
  97. +4 −10 agit/src/main/java/com/markupartist/android/widget/PullToRefreshListView.java
  98. +0 −2 agit/src/test/java/com/madgag/agit/ClickableTextTest.java
  99. +2 −1 agit/src/test/java/com/madgag/agit/CloneLauncherActivityRobolectricTest.java
  100. +2 −8 agit/src/test/java/com/madgag/agit/CommitViewerRobolectricTest.java
  101. +0 −6 agit/src/test/java/com/madgag/agit/DashboardActivityRobolectricTest.java
  102. +4 −5 agit/src/test/java/com/madgag/agit/GuiceTest.java
  103. +22 −0 agit/src/test/java/com/madgag/agit/OracleJVMTestEnvironment.java
  104. +6 −6 agit/src/test/java/com/madgag/agit/RDTTagTest.java
  105. +2 −11 agit/src/test/java/com/madgag/agit/TagViewerRobolectricTest.java
  106. +2 −2 agit/src/test/java/com/madgag/agit/views/TreeSummaryViewTest.java
@@ -21,8 +21,6 @@
import com.github.calculon.CalculonStoryTest;
-import java.io.File;
-
public class AboutActivityStoryTest extends CalculonStoryTest<AboutActivity> {
public AboutActivityStoryTest() {
@@ -19,16 +19,15 @@
package com.madgag.agit;
-import static java.util.Arrays.asList;
-
-import java.util.List;
-
import android.app.Instrumentation;
import android.content.Context;
import android.util.Log;
-
import com.google.inject.Module;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+
public class AgitTestApplication extends AgitApplication {
private static final String TAG = "AgitTestApplication";
@@ -0,0 +1,42 @@
+package com.madgag.agit;
+
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.os.Environment;
+import android.util.Log;
+import com.madgag.agit.matchers.GitTestHelper;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+import static java.util.Arrays.asList;
+
+public class AndroidTestEnvironment implements TestEnvironment {
+
+ private final Instrumentation instrumentation;
+
+ public AndroidTestEnvironment(Instrumentation instrumentation) {
+ this.instrumentation = instrumentation;
+ }
+
+ public InputStream streamFor(String fileName) {
+ try {
+ Context context = instrumentation.getContext();
+ Log.i("ATE", asList(context.getAssets().list("")).toString());
+ return context.getAssets().open(fileName);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public File tempFolder() {
+ return new File(Environment.getExternalStorageDirectory(), "agit-integration-tests-tmp");
+ }
+
+ public static GitTestHelper helper(Instrumentation instrumentation) {
+ return new GitTestHelper(new AndroidTestEnvironment(instrumentation));
+ }
+}
@@ -18,14 +18,11 @@
*/
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.*;
-import java.io.File;
-import java.io.IOException;
-
-import android.os.Environment;
import com.github.calculon.CalculonStoryTest;
+import java.io.File;
+
public class CloneLauncherActivityStoryTest extends CalculonStoryTest<CloneLauncherActivity> {
private String existingFolder = File.listRoots()[0].getAbsolutePath();
@@ -52,7 +49,7 @@ public void testDoesNotCrashDueToStackOverflow() {
// public void testCheckoutToCustomLocationWorks() {
-// File customLocation = newFolder();
+// File customLocation = tempFolder();
// setUp(R.id.CloneUrlEditText).setText("git://github.com/agittest/small-project.git").now();
// setUp(R.id.UseDefaultGitDirLocation).setChecked(false).now();
// setUp(R.id.GitDirEditText).setText(customLocation.getAbsolutePath()).now();
@@ -23,8 +23,6 @@
import java.io.File;
-import static com.madgag.agit.GitTestUtils.newFolder;
-
public class DashboardActivityTest extends CalculonStoryTest<DashboardActivity> {
private String existingFolder = File.listRoots()[0].getAbsolutePath();
@@ -21,12 +21,14 @@
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;
-import com.madgag.agit.git.Repos;
+import com.madgag.agit.matchers.GitTestHelper;
import com.madgag.agit.operation.lifecycle.OperationLifecycleSupport;
import com.madgag.agit.operations.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
import roboguice.test.RoboUnitTestCase;
@@ -37,7 +39,6 @@
import java.util.concurrent.CountDownLatch;
import static com.madgag.agit.GitTestUtils.*;
-import static com.madgag.agit.git.Repos.addRemoteTo;
import static com.madgag.agit.git.Repos.remoteConfigFor;
import static com.madgag.agit.matchers.HasGitObjectMatcher.hasGitObject;
import static com.madgag.hamcrest.FileExistenceMatcher.exists;
@@ -46,16 +47,23 @@
import static java.lang.Thread.currentThread;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
+import static org.eclipse.jgit.lib.Constants.R_HEADS;
+import static org.eclipse.jgit.lib.Constants.R_REMOTES;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
public class GitAsyncTaskTest extends RoboUnitTestCase<AgitTestApplication> {
private static final String TAG = "GitAsyncTaskTest";
+ private GitTestHelper helper() {
+ return AndroidTestEnvironment.helper(getInstrumentation());
+ }
+
@MediumTest
public void testCloneRepoWithEmptyBlobInPack() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("tiny-repo.with-empty-file.git"), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("tiny-repo.with-empty-file.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
assertThat(repo, hasGitObject("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")); // empty blob
@@ -64,7 +72,7 @@ public void testCloneRepoWithEmptyBlobInPack() throws Exception {
@MediumTest
public void testCloneNonBareRepoFromLocalTestServer() throws Exception {
- Clone cloneOp = new Clone(false, integrationGitServerURIFor("small-repo.early.git"), newFolder());
+ Clone cloneOp = new Clone(false, integrationGitServerURIFor("small-repo.early.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
@@ -77,42 +85,51 @@ public void testCloneNonBareRepoFromLocalTestServer() throws Exception {
@MediumTest
public void testPullUpdatesFromLocalTestServer() throws Exception {
- URIish oldUri = integrationGitServerURIFor("small-repo.early.git");
- Git git=Git.cloneRepository().setDirectory(newFolder()).setURI(oldUri.toPrivateString()).call();
-
- Repository repository = git.getRepository();
+ Repository repository = helper().unpackRepo("small-test-repo.early.zip");
RemoteConfig remoteConfig = remoteConfigFor(repository, DEFAULT_REMOTE_NAME);
- remoteConfig.removeURI(oldUri);
- remoteConfig.addURI(integrationGitServerURIFor("small-repo.later.git"));
-
+ for (URIish urIish : remoteConfig.getURIs()) {
+ remoteConfig.removeURI(urIish);
+ }
+ remoteConfig.addURI(integrationGitServerURIFor("small-test-repo.later.git"));
+ remoteConfig.update(repository.getConfig());
+ repository.getConfig().save();
+ // Git.wrap(repository).branchCreate().setName("master").setStartPoint("origin/master");
+
+ assertThat(repository, hasGitObject("3974996807a9f596cf25ac3a714995c24bb97e2c"));
+ String commit1 = "ce1e0703402e989bedf03d5df535401340f54b42";
+ assertThat(repository, not(hasGitObject(commit1)));
+ assertFileLength(2, repository.getWorkTree(), "EXAMPLE");
Pull pullOp = new Pull(repository);
- Repository repo = executeAndWaitFor(pullOp);
+ executeAndWaitFor(pullOp);
+ assertThat(repository, hasGitObject(commit1));
- assertThat(repo, hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
+ assertFileLength(4, repository.getWorkTree(), "EXAMPLE");
+ }
- File readmeFile= new File(repo.getWorkTree(), "README");
- assertThat(readmeFile, exists());
- assertThat(readmeFile, ofLength(12));
+ private void assertFileLength(int length, File workTree, String exampleFile) {
+ File readmeFile= new File(workTree, exampleFile);
+ assertThat(readmeFile, exists());
+ assertThat("len="+readmeFile.length(), readmeFile, ofLength(length));
}
@MediumTest
public void testCloneRepoUsingRSA() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(RSA_USER), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(RSA_USER), helper().newFolder());
assertThat(executeAndWaitFor(cloneOp), hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
}
@MediumTest
public void testCloneRepoUsingDSA() throws Exception {
- Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(DSA_USER), newFolder());
+ Clone cloneOp = new Clone(true, integrationGitServerURIFor("small-repo.early.git").setUser(DSA_USER), helper().newFolder());
assertThat(executeAndWaitFor(cloneOp), hasGitObject("ba1f63e4430bff267d112b1e8afc1d6294db0ccc"));
}
@MediumTest
public void testSimpleReadOnlyCloneFromGitHub() throws Exception {
- Clone cloneOp = new Clone(false, new URIish("git://github.com/agittest/small-project.git"), newFolder());
+ Clone cloneOp = new Clone(false, new URIish("git://github.com/agittest/small-project.git"), helper().newFolder());
Repository repo = executeAndWaitFor(cloneOp);
assertThat(repo, hasGitObject("9e0b5e42b3e1c59bc83b55142a8c50dfae36b144"));
@@ -125,7 +142,7 @@ public void testSimpleReadOnlyCloneFromGitHub() throws Exception {
// @LargeTest
// public void testCanCloneAllSuggestedRepos() throws Exception {
// for (SuggestedRepo suggestedRepo : SUGGESTIONS) {
-// Repository repo = executeAndWaitFor(new Clone(true, new URIish(suggestedRepo.getURI()), newFolder()));
+// Repository repo = executeAndWaitFor(new Clone(true, new URIish(suggestedRepo.getURI()), tempFolder()));
// Map<String,Ref> allRefs = repo.getAllRefs();
// assertThat("Refs for " + suggestedRepo + " @ " + repo, allRefs.size(), greaterThan(0));
// }
@@ -143,7 +160,9 @@ public void startedWith(OpNotification ongoingNotification) {
Log.i(TAG,"Started "+operation+" with "+ongoingNotification);
}
public void publish(Progress progress) {}
- public void error(OpNotification completionNotification) {}
+ public void error(OpNotification notification) {
+ Log.i(TAG,"Errored "+operation+" with "+notification);
+ }
public void success(OpNotification completionNotification) {}
public void completed(OpNotification completionNotification) {
Log.i(TAG,"Completed "+operation+" with "+completionNotification);
@@ -19,33 +19,25 @@
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.*;
-import static com.madgag.agit.RDTypeListActivity.listIntent;
-import static com.madgag.agit.matchers.CharSequenceMatcher.charSequence;
-import static com.madgag.compress.CompressUtil.unzip;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import com.madgag.agit.git.model.RDTTag;
-import org.apache.commons.compress.archivers.ArchiveException;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
-
-import android.content.res.AssetManager;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
-
+import com.madgag.agit.git.model.RDTTag;
import com.madgag.agit.git.model.RDTTag.TagSummary;
+import com.madgag.agit.matchers.GitTestHelper;
+import org.eclipse.jgit.lib.Repository;
+
+import java.util.List;
+
+import static com.madgag.agit.AndroidTestEnvironment.helper;
+import static com.madgag.agit.RDTypeListActivity.listIntent;
+import static com.madgag.agit.matchers.CharSequenceMatcher.charSequence;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
public class RDTypeListActivityStoryTest extends ActivityInstrumentationTestCase2<RDTypeListActivity> {
@@ -56,7 +48,9 @@ public RDTypeListActivityStoryTest() {
}
public void testShouldShowAllTags() throws Exception {
- Repository repoWithTags = unpackRepo("small-repo.with-tags.zip");
+
+ GitTestHelper helper = AndroidTestEnvironment.helper(getInstrumentation());
+ Repository repoWithTags = helper.unpackRepo("small-repo.with-tags.zip");
setActivityIntent(listIntent(repoWithTags, "tag"));
@@ -103,20 +97,5 @@ public void run() {
getInstrumentation().waitForIdleSync();
return listView.getSelectedView();
}
-
- private Repository unpackRepo(String fileName) throws IOException, ArchiveException {
- AssetManager am = getInstrumentation().getContext().getAssets();
- File repoParentFolder = newFolder();
- InputStream rawZipFileInputStream = am.open(fileName);
- return unzipRepoFromStreamToFolder(rawZipFileInputStream, repoParentFolder);
- }
-
- private Repository unzipRepoFromStreamToFolder(
- InputStream rawZipFileInputStream, File destinationFolder)
- throws IOException, ArchiveException {
- unzip(rawZipFileInputStream, destinationFolder);
- rawZipFileInputStream.close();
- return new FileRepository(new File(destinationFolder,".git"));
- }
}
@@ -19,24 +19,24 @@
package com.madgag.agit;
-import static com.madgag.agit.GitTestUtils.newFolder;
-import static org.eclipse.jgit.lib.Constants.DOT_GIT;
-
-import java.io.File;
-
import android.content.Context;
-import roboguice.test.RoboUnitTestCase;
import android.test.suitebuilder.annotation.SmallTest;
-
+import com.madgag.agit.matchers.GitTestHelper;
import com.madgag.agit.operation.lifecycle.RepoNotifications;
+import roboguice.test.RoboUnitTestCase;
+
+import java.io.File;
+
+import static org.eclipse.jgit.lib.Constants.DOT_GIT;
public class RepoNotificationsTest extends RoboUnitTestCase<AgitTestApplication> {
private static final String TAG="RNT";
+ private final GitTestHelper helper = AndroidTestEnvironment.helper(getInstrumentation());
@SmallTest
public void testShouldHaveDifferentOngoingNotificationIds() throws Exception {
- File gitdir1=new File(newFolder(), DOT_GIT),gitdir2=new File(newFolder(), DOT_GIT);
+ File gitdir1=new File(helper.newFolder(), DOT_GIT),gitdir2=new File(helper.newFolder(), DOT_GIT);
Context c = getInstrumentation().getContext();
RepoNotifications roc1a = new RepoNotifications(c, gitdir1, null);
@@ -19,13 +19,11 @@
package com.madgag.agit;
+import android.util.Log;
+import com.google.inject.Module;
import com.madgag.agit.operations.OpPrompt;
import com.madgag.android.blockingprompt.BlockingPromptService;
import roboguice.config.AbstractAndroidModule;
-import android.util.Log;
-
-import com.google.inject.Module;
-import com.jcraft.jsch.UserInfo;
import static java.lang.Boolean.TRUE;
Oops, something went wrong.

0 comments on commit 6fdffd3

Please sign in to comment.