Search in sources :

Example 1 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class MaterialExpansionServiceTest method shouldNotExpandGitSubmodulesIntoMultipleMaterialsWhenExpandingGitMaterialForScheduling.

@Test
public void shouldNotExpandGitSubmodulesIntoMultipleMaterialsWhenExpandingGitMaterialForScheduling() throws Exception {
    GitSubmoduleRepos submoduleRepos = new GitSubmoduleRepos(temporaryFolder);
    submoduleRepos.addSubmodule("submodule-1", "sub1");
    GitMaterial gitMaterial = new GitMaterial(submoduleRepos.mainRepo().getUrl());
    when(materialConfigConverter.toMaterials(new MaterialConfigs(gitMaterial.config()))).thenReturn(new Materials(gitMaterial));
    Materials materials = new Materials();
    materialExpansionService.expandForScheduling(gitMaterial, materials);
    assertThat(materials.size(), is(1));
    assertThat(materials.get(0), is(gitMaterial));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) Materials(com.thoughtworks.go.config.materials.Materials)

Example 2 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineDependencyGraphOldTest method shouldProvideMaterialRevisionForAGivenDownStreamPipeline.

@Test
public void shouldProvideMaterialRevisionForAGivenDownStreamPipeline() throws Exception {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    stages.add(new StageInstanceModel("stage-1", "2", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-1", "2")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
    PipelineInstanceModel down2 = pim("blahDown2");
    down2.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1, down2));
    assertThat(graph.dependencyRevisionFor(down1), is("blahUpStream/23/stage-0/21"));
    assertThat(graph.dependencyRevisionFor(down2), is("blahUpStream/23/stage-1/2"));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld) Test(org.junit.Test)

Example 3 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineDependencyGraphOldTest method shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger.

@Test
public void shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger() throws Exception {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
    assertThat(graph.hasUpStreamRevisionFor(down1), is(false));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld) Test(org.junit.Test)

Example 4 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class PipelineDependencyGraphOldTest method assertThatTriggerIsPossibleOnlyIfUpStreamPassed.

private void assertThatTriggerIsPossibleOnlyIfUpStreamPassed(StageResult upstreamResult) {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", upstreamResult, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
    assertThat(graph.hasUpStreamRevisionFor(graph.dependencies().find("blahDown1")), is(upstreamResult == StageResult.Passed));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld)

Example 5 with MaterialConfigs

use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method setup.

@Before
public void setup() throws Exception {
    diskSpaceSimulator = new DiskSpaceSimulator();
    new HgTestRepo("testHgRepo", temporaryFolder);
    svnRepository = new SvnTestRepo(temporaryFolder);
    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
    PipelineConfig 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.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();
    result = new HttpOperationResult();
    scheduleOptions = new ScheduleOptions();
    u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
    materialForManualTriggerPipeline = u.wf(new SvnMaterial("svn", "username", "password", false), "folder1");
    u.checkinInOrder(materialForManualTriggerPipeline, u.d(1), "s1");
    manualTriggerPipeline = configHelper.addPipeline(UUID.randomUUID().toString(), STAGE_NAME, materialForManualTriggerPipeline.config(), "build");
    username = Username.ANONYMOUS;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) TransactionStatus(org.springframework.transaction.TransactionStatus) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) 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)

Aggregations

MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)281 Test (org.junit.jupiter.api.Test)185 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)52 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)46 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)43 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)39 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)36 Test (org.junit.Test)32 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)29 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)27 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)27 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)26 TimeProvider (com.thoughtworks.go.util.TimeProvider)26 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)23 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)21 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)21 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)21 Modification (com.thoughtworks.go.domain.materials.Modification)21 Material (com.thoughtworks.go.domain.materials.Material)19 ValueStreamMapPresentationModel (com.thoughtworks.go.server.presentation.models.ValueStreamMapPresentationModel)19