use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class ModificationsMother method createPipelineMaterialRevision.
public static MaterialRevision createPipelineMaterialRevision(String stageIdentifier) {
Material material = MaterialsMother.dependencyMaterial();
List<Modification> modifications = new ArrayList<>();
modifications.add(new Modification(new Date(), stageIdentifier, "123", 1L));
return new MaterialRevision(material, modifications);
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldUnderstandIfMaterialHasNoNewModifications.
@Test
public void shouldUnderstandIfMaterialHasNoNewModifications() throws Exception {
Pipeline pipeline = pipelineOne.createPipelineWithFirstStageScheduled();
Material material = pipeline.getMaterialRevisions().getMaterialRevision(0).getMaterial();
configHelper.setViewPermissionForGroup("group1", "username");
PipelineInstanceModels latest = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.ONE_ITEM, "username");
PipelineInstanceModel model = latest.get(0);
assertThat(model.hasNewRevisions(material.config()), is(false));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldUnderstandIfMaterialHasNewModifications.
@Test
public void shouldUnderstandIfMaterialHasNewModifications() throws Exception {
Pipeline pipeline = pipelineOne.createPipelineWithFirstStageScheduled();
Material material = pipeline.getMaterialRevisions().getMaterialRevision(0).getMaterial();
saveRev(new MaterialRevision(material, new Modification(new Date(), "2", "MOCK_LABEL-12", null)));
configHelper.setViewPermissionForGroup("group1", "username");
PipelineInstanceModels latest = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.ONE_ITEM, "username");
PipelineInstanceModel model = latest.get(0);
assertThat(model.hasNewRevisions(material.config()), is(true));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PipelineScheduleServiceTest method shouldScheduleJobForAllAgentsWhenToBeRunOnAllAgents.
@Test
public void shouldScheduleJobForAllAgentsWhenToBeRunOnAllAgents() throws Exception {
configHelper.addAgent("localhost", "uuid1");
configHelper.addAgent("localhost", "uuid2");
configHelper.addAgent("localhost", "uuid3");
configHelper.addAgentToEnvironment("dev", "uuid1");
configHelper.setRunOnAllAgents(CaseInsensitiveString.str(evolveConfig.name()), STAGE_NAME, "unit", true);
Material stubMaterial = new TestingMaterial();
evolveConfig.setMaterialConfigs(new MaterialConfigs(stubMaterial.config()));
MaterialRevisions revisions = new MaterialRevisions();
revisions.addRevision(stubMaterial, ((TestingMaterial) stubMaterial).modificationsSince(null, null, subprocessExecutionContext));
BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
dbHelper.saveMaterials(buildCause.getMaterialRevisions());
Pipeline pipeline = instanceFactory.createPipelineInstance(evolveConfig, buildCause, new DefaultSchedulingContext(DEFAULT_APPROVED_BY, environmentConfigService.agentsForPipeline(evolveConfig.name())), md5, new TimeProvider());
pipelineService.save(pipeline);
Stage instance = scheduleService.scheduleStage(pipeline, STAGE_NAME, "anyone", new ScheduleService.NewStageInstanceCreator(goConfigService), new ScheduleService.ExceptioningErrorHandler());
JobInstances scheduledJobs = instance.getJobInstances();
assertThat(scheduledJobs.toArray(), hasItemInArray(hasProperty("name", is(RunOnAllAgents.CounterBasedJobNameGenerator.appendMarker("unit", 1)))));
assertThat(scheduledJobs.toArray(), hasItemInArray(hasProperty("agentUuid", is("uuid2"))));
assertThat(scheduledJobs.toArray(), hasItemInArray(hasProperty("name", is(RunOnAllAgents.CounterBasedJobNameGenerator.appendMarker("unit", 2)))));
assertThat(scheduledJobs.toArray(), hasItemInArray(hasProperty("agentUuid", is("uuid3"))));
assertThat(scheduledJobs.size(), is(2));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PipelineScheduleServiceTest method shouldLockPipelineWhenSchedulingIt.
@Test
public void shouldLockPipelineWhenSchedulingIt() throws Exception {
scheduleAndCompleteInitialPipelines();
configHelper.lockPipeline("mingle");
Material stubMaterial = new TestingMaterial();
mingleConfig.setMaterialConfigs(new MaterialConfigs(stubMaterial.config()));
assertThat(pipelineLockService.isLocked("mingle"), is(false));
MaterialRevisions revisions = new MaterialRevisions();
revisions.addRevision(stubMaterial, ((TestingMaterial) stubMaterial).modificationsSince(null, null, subprocessExecutionContext));
BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
dbHelper.saveMaterials(buildCause.getMaterialRevisions());
Pipeline pipeline = instanceFactory.createPipelineInstance(mingleConfig, buildCause, new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
pipelineService.save(pipeline);
assertThat(pipelineLockService.isLocked("mingle"), is(true));
}
Aggregations