Search in sources :

Example 31 with PipelineTimelineEntry

use of com.thoughtworks.go.domain.PipelineTimelineEntry in project gocd by gocd.

the class PipelineTimelineTest method shouldPopuplateTheBeforeAndAfterNodesForAGivenPipelineDuringAddition.

@Test
public void shouldPopuplateTheBeforeAndAfterNodesForAGivenPipelineDuringAddition() throws Exception {
    PipelineTimelineEntry anotherPipeline1 = PipelineMaterialModificationMother.modification("another", 4, materials, Arrays.asList(now, now.plusMinutes(1), now.plusMinutes(2), now.plusMinutes(3)), 1, "123");
    PipelineTimelineEntry anotherPipeline2 = PipelineMaterialModificationMother.modification("another", 5, materials, Arrays.asList(now, now.plusMinutes(2), now.plusMinutes(1), now.plusMinutes(3)), 2, "123");
    PipelineTimelineEntry anotherPipeline3 = PipelineMaterialModificationMother.modification("another", 6, materials, Arrays.asList(now, now.plusMinutes(2), now.plusMinutes(3), now.plusMinutes(2)), 3, "123");
    PipelineTimeline mods = new PipelineTimeline(pipelineRepository, transactionTemplate, transactionSynchronizationManager);
    mods.add(first);
    mods.add(fourth);
    mods.add(anotherPipeline1);
    mods.add(third);
    mods.add(anotherPipeline3);
    mods.add(second);
    mods.add(anotherPipeline2);
    assertThat(third.insertedBefore(), is(fourth));
    assertThat(third.insertedAfter(), is(first));
    assertThat(second.insertedBefore(), is(third));
    assertThat(second.insertedAfter(), is(first));
    assertThat(anotherPipeline2.insertedBefore(), is(anotherPipeline3));
    assertThat(anotherPipeline2.insertedAfter(), is(anotherPipeline1));
    assertThat(mods.runAfter(anotherPipeline2.getId(), new CaseInsensitiveString("another")), is(anotherPipeline3));
    assertThat(mods.runBefore(anotherPipeline2.getId(), new CaseInsensitiveString("another")), is(anotherPipeline1));
    assertThat(mods.runAfter(first.getId(), new CaseInsensitiveString(first.getPipelineName())), is(nullValue()));
    assertThat(mods.runAfter(second.getId(), new CaseInsensitiveString(second.getPipelineName())), is(third));
}
Also used : PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

PipelineTimelineEntry (com.thoughtworks.go.domain.PipelineTimelineEntry)31 Test (org.junit.Test)18 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 ArrayList (java.util.ArrayList)11 DateTime (org.joda.time.DateTime)11 PipelineTimeline (com.thoughtworks.go.server.domain.PipelineTimeline)9 List (java.util.List)6 Date (java.util.Date)5 BigInteger (java.math.BigInteger)4 Map (java.util.Map)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)3 TimelineUpdateListener (com.thoughtworks.go.listener.TimelineUpdateListener)3 HashMap (java.util.HashMap)3 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)2 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)2 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)2 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)2 PipelineConfigMother.createPipelineConfig (com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig)2