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);
}
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));
}
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));
}
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));
}
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));
}
Aggregations