use of com.thoughtworks.go.server.service.MaterialConfigConverter in project gocd by gocd.
the class ModificationsMother method modifyNoFiles.
public static BuildCause modifyNoFiles(PipelineConfig config) {
MaterialRevisions materialRevisions = new MaterialRevisions();
for (Material material : new MaterialConfigConverter().toMaterials(config.materialConfigs())) {
ArrayList<Modification> list = new ArrayList<>();
list.add(new Modification("no-user", "comment", "dummy-email", new Date(), "Dummy Modification" + UUID.randomUUID().toString()));
materialRevisions.addRevision(material, list);
}
return BuildCause.createWithModifications(materialRevisions, "");
}
use of com.thoughtworks.go.server.service.MaterialConfigConverter in project gocd by gocd.
the class SCMMaterialSourceTest method setUp.
@BeforeEach
public void setUp() throws Exception {
goConfigService = mock(GoConfigService.class);
systemEnvironment = new SystemEnvironment();
serverHealthService = mock(ServerHealthService.class);
materialConfigConverter = mock(MaterialConfigConverter.class);
materialUpdateService = mock(MaterialUpdateService.class);
source = new SCMMaterialSource(goConfigService, systemEnvironment, materialConfigConverter, materialUpdateService);
}
use of com.thoughtworks.go.server.service.MaterialConfigConverter in project gocd by gocd.
the class SCMMaterialSourceTest method shouldRefreshMaterialCacheOnPackageRepositoryChange.
@Test
public void shouldRefreshMaterialCacheOnPackageRepositoryChange() {
GitMaterialConfig gitMaterial = new GitMaterialConfig();
gitMaterial.setUrl("http://github.com/gocd/gocd");
ArgumentCaptor<EntityConfigChangedListener> captor = ArgumentCaptor.forClass(EntityConfigChangedListener.class);
doNothing().when(goConfigService).register(captor.capture());
when(goConfigService.getSchedulableSCMMaterials()).thenReturn(emptySet()).thenReturn(singleton(gitMaterial));
source = new SCMMaterialSource(goConfigService, systemEnvironment, new MaterialConfigConverter(), materialUpdateService);
source.initialize();
EntityConfigChangedListener entityConfigChangedListener = captor.getAllValues().get(1);
assertTrue(entityConfigChangedListener.shouldCareAbout(new PackageRepository()));
assertThat(source.materialsForUpdate().size(), is(0));
entityConfigChangedListener.onEntityConfigChange(new PackageRepository());
Set<Material> materials = source.materialsForUpdate();
assertThat(materials.size(), is(1));
assertThat(materials.iterator().next().getFingerprint(), is(gitMaterial.getFingerprint()));
}
use of com.thoughtworks.go.server.service.MaterialConfigConverter in project gocd by gocd.
the class DatabaseAccessHelper method newPipelineWithFirstStagePassed.
public Pipeline newPipelineWithFirstStagePassed(PipelineConfig config) throws SQLException {
Pipeline pipeline = instanceFactory.createPipelineInstance(config, BuildCause.createManualForced(modifyOneFile(new MaterialConfigConverter().toMaterials(config.materialConfigs()), ModificationsMother.nextRevision()), Username.ANONYMOUS), new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY), md5, new TimeProvider());
saveMaterialsWIthPassedStages(pipeline);
return pipeline;
}
use of com.thoughtworks.go.server.service.MaterialConfigConverter in project gocd by gocd.
the class DatabaseAccessHelper method newPipelineWithFirstStageScheduled.
public Pipeline newPipelineWithFirstStageScheduled(PipelineConfig config) throws SQLException {
Pipeline pipeline = instanceFactory.createPipelineInstance(config, BuildCause.createManualForced(modifyOneFile(new MaterialConfigConverter().toMaterials(config.materialConfigs()), ModificationsMother.nextRevision()), Username.ANONYMOUS), new DefaultSchedulingContext(GoConstants.DEFAULT_APPROVED_BY), md5, new TimeProvider());
savePipelineWithStagesAndMaterials(pipeline);
return pipeline;
}
Aggregations