Search in sources :

Example 21 with PipelineTimelineEntry

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

the class FailedBuildHistoryCacheSweeperTest method setUp.

@Before
public void setUp() {
    HashMap<String, List<PipelineTimelineEntry.Revision>> modificationTimes = new HashMap<>();
    modificationTimes.put("hg", a(new PipelineTimelineEntry.Revision(new Date(), "123", "hg", 10)));
    newlyAddedEntry = new PipelineTimelineEntry("cruise", 100, 10, modificationTimes, 5.0);
    entryBeforeNew = new PipelineTimelineEntry("cruise", 98, 9, modificationTimes, 4.0);
    entryAfterNew = new PipelineTimelineEntry("cruise", 99, 11, modificationTimes, 6.0);
    timeline = new TreeSet<>();
    timeline.add(entryBeforeNew);
    timeline.add(entryAfterNew);
    timeline.add(newlyAddedEntry);
}
Also used : HashMap(java.util.HashMap) List(java.util.List) PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) Date(java.util.Date) Before(org.junit.Before)

Example 22 with PipelineTimelineEntry

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

the class PipelineMaterialModificationTest method shouldBreakTieOnMinimumUsingPipelineCounter.

@Test
public void shouldBreakTieOnMinimumUsingPipelineCounter() throws Exception {
    List<String> materials = Arrays.asList("first", "second", "third", "fourth");
    DateTime base = new DateTime();
    //Because there is a tie on the lowest value i.e. date 2, use the counter to order
    PipelineTimelineEntry modification = modification(1, materials, Arrays.asList(base, base.plusMinutes(3), base.plusMinutes(2), base.plusMinutes(4)), 1, "123", "pipeline");
    PipelineTimelineEntry that = modification(2, materials, Arrays.asList(base, base.plusMinutes(2), base.plusMinutes(3), base.plusMinutes(2)), 2, "123", "pipeline");
    assertThat(modification.compareTo(that), is(-1));
    assertThat(that.compareTo(modification), is(1));
}
Also used : PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 23 with PipelineTimelineEntry

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

the class PipelineMaterialModificationTest method shouldCompareModsUsingCounterToBreakTies.

@Test
public void shouldCompareModsUsingCounterToBreakTies() throws Exception {
    List<String> materials = Arrays.asList("first", "second", "third");
    DateTime base = new DateTime();
    PipelineTimelineEntry modification = modification(1, materials, Arrays.asList(base, base.plusMinutes(3), base.plusMinutes(2)), 1, "123", "pipeline");
    PipelineTimelineEntry that = modification(2, materials, Arrays.asList(base, base.plusMinutes(2), base.plusMinutes(3)), 2, "123", "pipeline");
    assertThat(modification.compareTo(that), is(-1));
    assertThat(that.compareTo(modification), is(1));
}
Also used : PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 24 with PipelineTimelineEntry

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

the class PipelineMaterialModificationTest method shouldCompareModsWithMultipleMaterials.

@Test
public void shouldCompareModsWithMultipleMaterials() throws Exception {
    List<String> materials = Arrays.asList("flyweight", "another");
    DateTime base = new DateTime();
    PipelineTimelineEntry modification = modification(1, materials, Arrays.asList(base.plusMinutes(1), base.plusMinutes(3)), 1, "123");
    PipelineTimelineEntry that = modification(2, materials, Arrays.asList(base.plusMinutes(4), base.plusMinutes(2)), 1, "123");
    assertThat(modification.compareTo(that), is(-1));
    assertThat(that.compareTo(modification), is(1));
}
Also used : PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 25 with PipelineTimelineEntry

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

the class PipelineMaterialModificationTest method shouldCompareModsWithMultipleMaterialsWithOneMaterialNotChanged.

@Test
public void shouldCompareModsWithMultipleMaterialsWithOneMaterialNotChanged() throws Exception {
    List<String> materials = Arrays.asList("flyweight", "another");
    DateTime base = new DateTime();
    PipelineTimelineEntry modification = modification(1, materials, Arrays.asList(base, base.plusMinutes(3)), 1, "123");
    PipelineTimelineEntry that = modification(2, materials, Arrays.asList(base, base.plusMinutes(2)), 1, "123");
    assertThat(modification.compareTo(that), is(1));
    assertThat(that.compareTo(modification), is(-1));
}
Also used : PipelineTimelineEntry(com.thoughtworks.go.domain.PipelineTimelineEntry) DateTime(org.joda.time.DateTime) 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