use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitMaterialUpdaterTest method shouldCreateBuildCommandUpdateToSpecificRevision.
@Test
public void shouldCreateBuildCommandUpdateToSpecificRevision() throws Exception {
GitMaterial material = new GitMaterial(new GitTestRepo(temporaryFolder).projectRepositoryUrl(), true);
File newFile = new File(workingDir, "second.txt");
updateTo(material, new RevisionContext(REVISION_1, REVISION_0, 2), JobResult.Passed);
assertThat(console.output(), containsString("Start updating files at revision " + REVISION_1.getRevision()));
assertThat(newFile.exists(), is(false));
console.clear();
updateTo(material, new RevisionContext(REVISION_2, REVISION_1, 2), JobResult.Passed);
assertThat(console.output(), containsString("Start updating files at revision " + REVISION_2.getRevision()));
assertThat(newFile.exists(), is(true));
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitMaterialUpdaterTest method shouldDeleteAndRecheckoutDirectoryWhenUrlChanges.
@Test
public void shouldDeleteAndRecheckoutDirectoryWhenUrlChanges() throws Exception {
updateTo(new GitMaterial(new GitTestRepo(temporaryFolder).projectRepositoryUrl(), true), new RevisionContext(new StringRevision("origin/master")), JobResult.Passed);
File shouldBeRemoved = new File(workingDir, "shouldBeRemoved");
shouldBeRemoved.createNewFile();
assertThat(shouldBeRemoved.exists(), is(true));
String repositoryUrl = new GitTestRepo(temporaryFolder).projectRepositoryUrl();
GitMaterial material = new GitMaterial(repositoryUrl, true);
updateTo(material, new RevisionContext(REVISION_4), JobResult.Passed);
assertThat(localRepoFor(material).workingRepositoryUrl().forCommandline(), is(repositoryUrl));
assertThat(shouldBeRemoved.exists(), is(false));
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitMaterialShallowCloneTest method setup.
@Before
public void setup() throws Exception {
repo = new GitTestRepo(temporaryFolder);
workingDir = temporaryFolder.newFolder("working-dir");
}
use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.
the class GitMaterialTest method shouldDeleteAndRecheckoutDirectoryWhenUrlChanges.
@Test
public void shouldDeleteAndRecheckoutDirectoryWhenUrlChanges() throws Exception {
git.latestModification(workingDir, new TestSubprocessExecutionContext());
File shouldBeRemoved = new File(workingDir, "shouldBeRemoved");
shouldBeRemoved.createNewFile();
assertThat(shouldBeRemoved.exists(), is(true));
git = new GitMaterial(new GitTestRepo(temporaryFolder).projectRepositoryUrl());
git.latestModification(workingDir, new TestSubprocessExecutionContext());
assertThat("Should have deleted whole folder", shouldBeRemoved.exists(), is(false));
}
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(temporaryFolder);
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);
}
Aggregations