use of com.thoughtworks.go.server.service.ScheduleTestUtil in project gocd by gocd.
the class PipelineRepositoryIntegrationTest method shouldConsider_firstRevision_forAFlyweight_asInDb_whilePickingFromMultipleDeclarations.
@Test
public void shouldConsider_firstRevision_forAFlyweight_asInDb_whilePickingFromMultipleDeclarations() {
ScheduleTestUtil u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
int i = 1;
GitMaterial git1 = u.wf(new GitMaterial("git"), "folder1");
u.checkinInOrder(git1, "g1");
GitMaterial git2 = u.wf(new GitMaterial("git"), "folder2");
ScheduleTestUtil.AddedPipeline p = u.saveConfigWith("P", u.m(git1), u.m(git2));
CruiseConfig cruiseConfig = goConfigDao.load();
u.checkinInOrder(git1, u.d(i++), "g2");
u.runAndPass(p, "g1", "g2");
u.runAndPass(p, "g2", "g1");
PipelineTimeline timeline = new PipelineTimeline(pipelineRepository, transactionTemplate, transactionSynchronizationManager);
timeline.updateTimelineOnInit();
List<PipelineTimelineEntry> timelineEntries = new ArrayList<>(timeline.getEntriesFor("P"));
assertThat(timelineEntries.get(0).getPipelineLocator().getCounter(), is(1));
assertThat(timelineEntries.get(0).naturalOrder(), is(1.0));
List<PipelineTimelineEntry.Revision> flyweightsRevs = new ArrayList<>(timelineEntries.get(0).revisions().values()).get(0);
assertThat(flyweightsRevs.get(0).revision, is("g1"));
assertThat(flyweightsRevs.get(1).revision, is("g2"));
assertThat(timelineEntries.get(1).getPipelineLocator().getCounter(), is(2));
assertThat(timelineEntries.get(1).naturalOrder(), is(2.0));
flyweightsRevs = new ArrayList<>(timelineEntries.get(1).revisions().values()).get(0);
assertThat(flyweightsRevs.get(0).revision, is("g2"));
assertThat(flyweightsRevs.get(1).revision, is("g1"));
MaterialConfigs materials = configHelper.deepClone(p.config.materialConfigs());
Collections.reverse(materials);
configHelper.setMaterialConfigForPipeline("P", materials.toArray(new MaterialConfig[0]));
goConfigDao.load();
timeline = new PipelineTimeline(pipelineRepository, transactionTemplate, transactionSynchronizationManager);
timeline.updateTimelineOnInit();
timelineEntries = new ArrayList<>(timeline.getEntriesFor("P"));
assertThat(timelineEntries.get(0).getPipelineLocator().getCounter(), is(1));
assertThat(timelineEntries.get(0).naturalOrder(), is(1.0));
flyweightsRevs = new ArrayList<>(timelineEntries.get(0).revisions().values()).get(0);
assertThat(flyweightsRevs.get(0).revision, is("g1"));
assertThat(flyweightsRevs.get(1).revision, is("g2"));
assertThat(timelineEntries.get(1).getPipelineLocator().getCounter(), is(2));
assertThat(timelineEntries.get(1).naturalOrder(), is(2.0));
flyweightsRevs = new ArrayList<>(timelineEntries.get(1).revisions().values()).get(0);
assertThat(flyweightsRevs.get(0).revision, is("g2"));
assertThat(flyweightsRevs.get(1).revision, is("g1"));
}
use of com.thoughtworks.go.server.service.ScheduleTestUtil in project gocd by gocd.
the class StageSqlMapDaoIntegrationTest method setup.
@BeforeEach
public void setup() throws Exception {
goCache.clear();
dbHelper.onSetUp();
mingleConfig = twoBuildPlansWithResourcesAndMaterials(PIPELINE_NAME, STAGE_DEV);
origTemplate = stageDao.getSqlMapClientTemplate();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
scheduleUtil = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
}
use of com.thoughtworks.go.server.service.ScheduleTestUtil in project gocd by gocd.
the class DownstreamInstancePopulatorIntegrationTest method setup.
@BeforeEach
public void setup() throws Exception {
configHelper = new GoConfigFileHelper();
goCache.clear();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
dbHelper.onSetUp();
u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
downstreamInstancePopulator = new DownstreamInstancePopulator(pipelineDao);
notifier.disableUpdates();
}
use of com.thoughtworks.go.server.service.ScheduleTestUtil in project gocd by gocd.
the class MaterialRepositoryIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
originalTemplate = repo.getHibernateTemplate();
dbHelper.onSetUp();
goCache.clear();
u = new ScheduleTestUtil(transactionTemplate, repo, dbHelper, new GoConfigFileHelper());
}
use of com.thoughtworks.go.server.service.ScheduleTestUtil in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method setup.
@BeforeEach
public void setup() throws Exception {
dbHelper.onSetUp();
goCache.clear();
configHelper = new GoConfigFileHelper();
configHelper.usingCruiseConfigDao(goConfigDao);
u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
notifier.disableUpdates();
}
Aggregations