use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class MaterialDatabaseUpdaterIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
dbHelper.onSetUp();
testRepo = new GitTestRepo();
MaterialService slowMaterialService = new MaterialServiceWhichSlowsDownFirstTimeModificationCheck(materialRepository, goConfigService, securityService, packageRepositoryExtension, scmExtension);
LegacyMaterialChecker materialChecker = new LegacyMaterialChecker(slowMaterialService, subprocessExecutionContext);
ScmMaterialUpdater scmMaterialUpdater = new ScmMaterialUpdater(materialRepository, materialChecker, subprocessExecutionContext, slowMaterialService);
transactionTemplateWithInvocationCount = new TransactionTemplateWithInvocationCount(transactionTemplate);
updater = new MaterialDatabaseUpdater(materialRepository, serverHealthService, transactionTemplateWithInvocationCount, dependencyMaterialUpdater, scmMaterialUpdater, packageMaterialUpdater, pluggableSCMMaterialUpdater, materialExpansionService);
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitCommandTest method shouldRetrieveFilenameForInitialRevision.
@Test
public void shouldRetrieveFilenameForInitialRevision() throws IOException {
GitTestRepo testRepo = new GitTestRepo(GitTestRepo.GIT_SUBMODULE_REF_BUNDLE);
GitCommand gitCommand = new GitCommand(null, testRepo.gitRepository(), GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>(), null);
Modification modification = gitCommand.latestModification().get(0);
assertThat(modification.getModifiedFiles().size(), is(1));
assertThat(modification.getModifiedFiles().get(0).getFileName(), is("remote.txt"));
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitCommandTest method shouldBombIfCheckedForModificationsSinceWithASHAThatNoLongerExists.
@Test(expected = CommandLineException.class)
public void shouldBombIfCheckedForModificationsSinceWithASHAThatNoLongerExists() throws IOException {
GitTestRepo remoteRepo = new GitTestRepo();
executeOnGitRepo("git", "remote", "rm", "origin");
executeOnGitRepo("git", "remote", "add", "origin", remoteRepo.projectRepositoryUrl());
GitCommand command = new GitCommand(remoteRepo.createMaterial().getFingerprint(), gitLocalRepoDir, "master", false, new HashMap<>(), null);
Modification modification = remoteRepo.checkInOneFile("foo", "Adding a commit").get(0);
remoteRepo.addFileAndAmend("bar", "amendedCommit");
command.modificationsSince(new StringRevision(modification.getRevision()));
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitCommandTest method setup.
@Before
public void setup() throws Exception {
gitRepo = new GitTestRepo();
gitLocalRepoDir = createTempWorkingDirectory();
git = new GitCommand(null, gitLocalRepoDir, GitMaterialConfig.DEFAULT_BRANCH, false, new HashMap<>(), null);
repoLocation = gitRepo.gitRepository();
repoUrl = gitRepo.projectRepositoryUrl();
InMemoryStreamConsumer outputStreamConsumer = inMemoryConsumer();
int returnCode = git.cloneWithNoCheckout(outputStreamConsumer, repoUrl);
if (returnCode > 0) {
fail(outputStreamConsumer.getAllOutput());
}
gitFooBranchBundle = GitTestRepo.testRepoAtBranch(GIT_FOO_BRANCH_BUNDLE, BRANCH);
initMocks(this);
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitCommandTest method shouldReturnTheRebasedCommitForModificationsSinceTheRevisionBeforeRebase.
@Test
public void shouldReturnTheRebasedCommitForModificationsSinceTheRevisionBeforeRebase() throws IOException {
GitTestRepo remoteRepo = new GitTestRepo();
executeOnGitRepo("git", "remote", "rm", "origin");
executeOnGitRepo("git", "remote", "add", "origin", remoteRepo.projectRepositoryUrl());
GitCommand command = new GitCommand(remoteRepo.createMaterial().getFingerprint(), gitLocalRepoDir, "master", false, new HashMap<>(), null);
Modification modification = remoteRepo.addFileAndAmend("foo", "amendedCommit").get(0);
assertThat(command.modificationsSince(REVISION_4).get(0), is(modification));
}
Aggregations