Search in sources :

Example 6 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method setup.

@Before
public void setup() throws Exception {
    diskSpaceSimulator = new DiskSpaceSimulator();
    new HgTestRepo("testHgRepo");
    svnRepository = new SvnTestRepo("testSvnRepo");
    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
    goParentPipelineConfig = configHelper.addPipeline(GO_PIPELINE_UPSTREAM, STAGE_NAME, new MaterialConfigs(new GitMaterialConfig("foo-bar")), "unit");
    goPipelineConfig = configHelper.addPipeline(GO_PIPELINE_NAME, STAGE_NAME, repository, "unit");
    svnMaterialRevs = new MaterialRevisions();
    SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    svnMaterialRevs.addRevision(svnMaterial, svnMaterial.latestModification(null, new ServerSubprocessExecutionContext(goConfigService, new SystemEnvironment())));
    final MaterialRevisions materialRevisions = new MaterialRevisions();
    SvnMaterial anotherSvnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    materialRevisions.addRevision(anotherSvnMaterial, anotherSvnMaterial.latestModification(null, subprocessExecutionContext));
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        @Override
        protected void doInTransactionWithoutResult(TransactionStatus status) {
            materialRepository.save(svnMaterialRevs);
        }
    });
    BuildCause buildCause = BuildCause.createWithModifications(svnMaterialRevs, "");
    mingleConfig = configHelper.addPipeline(MINGLE_PIPELINE_NAME, STAGE_NAME, repository, new Filter(new IgnoredFiles("**/*.doc")), "unit", "functional");
    latestPipeline = PipelineMother.schedule(this.mingleConfig, buildCause);
    latestPipeline = pipelineDao.saveWithStages(latestPipeline);
    dbHelper.passStage(latestPipeline.getStages().first());
    pipelineScheduleQueue.clear();
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) TransactionStatus(org.springframework.transaction.TransactionStatus) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) Before(org.junit.Before)

Example 7 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class BuildCauseProducerServiceWithFlipModificationTest method setup.

@Before
public void setup() throws Exception {
    configHelper = new GoConfigFileHelper();
    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    svnRepository = new SvnTestRepo("testSvnRepo");
    hgTestRepo = new HgTestRepo("testHgRepo");
    repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
    svnMaterialConfig = new SvnMaterialConfig(repository.getUrl().forCommandline(), repository.getUserName(), repository.getPassword(), repository.isCheckExternals());
}
Also used : SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Before(org.junit.Before)

Example 8 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class SvnPostCommitHookImplementerTest method shouldReturnEmptySvnCommand.

@Test
public void shouldReturnEmptySvnCommand() {
    final SvnCommand svnCommand = implementer.getEmptySvnCommand();
    assertThat(svnCommand instanceof SvnCommand, is(true));
    assertThat(svnCommand.getUrl().toString(), is("."));
}
Also used : SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) Test(org.junit.Test)

Example 9 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class MaterialExpansionServiceCachingTest method shouldCacheSvnMaterialCheckExternalCommand.

@Test
public void shouldCacheSvnMaterialCheckExternalCommand() {
    SvnMaterialConfig svnMaterialConfig = svnMaterialConfig(svnRepo.projectRepositoryUrl(), "mainRepo");
    MaterialConfigs materialConfigs = new MaterialConfigs();
    String cacheKey = (MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svnMaterialConfig.getFingerprint()).intern();
    Subversion svn = (SvnCommand) goCache.get(cacheKey);
    assertNull(svn);
    materialExpansionService.expandForScheduling(svnMaterialConfig, materialConfigs);
    svn = (SvnCommand) goCache.get(cacheKey);
    assertNotNull(svn);
    assertThat(svn.getUrl().forCommandline(), is(svnMaterialConfig.getUrl()));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) Subversion(com.thoughtworks.go.domain.materials.svn.Subversion) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 10 with SvnCommand

use of com.thoughtworks.go.domain.materials.svn.SvnCommand in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method materialRevisions.

private MaterialRevisions materialRevisions() {
    MaterialRevision svnRevision = new MaterialRevision(this.svnMaterial, ModificationsMother.oneModifiedFile(svnRepoFixture.getHeadRevision(svnRepoFixture.getEnd2EndRepoUrl())));
    SvnMaterial svnMaterialForExternal = SvnMaterial.createSvnMaterialWithMock(new SvnCommand(null, svnRepoFixture.getExternalRepoUrl()));
    String folder = this.svnMaterial.getFolder() == null ? "external" : this.svnMaterial.getFolder() + "/" + "external";
    svnMaterialForExternal.setFolder(folder);
    MaterialRevision svnExternalRevision = new MaterialRevision(svnMaterialForExternal, ModificationsMother.oneModifiedFile(svnRepoFixture.getHeadRevision(svnRepoFixture.getExternalRepoUrl())));
    MaterialRevision hgRevision = new MaterialRevision(hgMaterial, ModificationsMother.oneModifiedFile(hgTestRepo.latestModifications().get(0).getRevision()));
    MaterialRevision dependencyRevision1 = ModificationsMother.dependencyMaterialRevision(0, dependencyMaterial.getPipelineName() + "-label", 1, dependencyMaterial, new Date());
    MaterialRevision dependencyRevisionWithName = ModificationsMother.dependencyMaterialRevision(0, dependencyMaterialWithName.getPipelineName() + "-label", 1, dependencyMaterialWithName, new Date());
    return new MaterialRevisions(svnRevision, svnExternalRevision, hgRevision, dependencyRevision1, dependencyRevisionWithName);
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) Date(java.util.Date)

Aggregations

SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)25 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)9 Before (org.junit.Before)8 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)5 Test (org.junit.Test)5 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)4 Subversion (com.thoughtworks.go.domain.materials.svn.Subversion)4 PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)3 TestRepo (com.thoughtworks.go.helper.TestRepo)3 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)3 File (java.io.File)3 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)2 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)2 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 SvnRepoFixture (com.thoughtworks.go.utils.SvnRepoFixture)2 Date (java.util.Date)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1