Search in sources :

Example 6 with FeedEntry

use of com.thoughtworks.go.domain.feed.FeedEntry in project gocd by gocd.

the class StageSqlMapDaoIntegrationTest method findCompletedStagesFor_shouldInvalidateCacheOnCompletionOfAStageForTheGivenPipeline.

@Test
public void findCompletedStagesFor_shouldInvalidateCacheOnCompletionOfAStageForTheGivenPipeline() {
    SqlMapClientTemplate mockTemplate = mock(SqlMapClientTemplate.class);
    stageDao.setSqlMapClientTemplate(mockTemplate);
    List<StageFeedEntry> entries = asList(new StageFeedEntry(1L, 1L, null, 1L, null, null));
    when(mockTemplate.queryForList(eq("allCompletedStagesForPipeline"), any())).thenReturn((List) entries);
    stageDao.findCompletedStagesFor("cruise", FeedModifier.Latest, 10, 100);
    updateResultInTransaction(StageMother.completedFailedStageInstance("cruise", "stage", "job"), StageResult.Failed);
    List<FeedEntry> actual = new ArrayList<>(stageDao.findCompletedStagesFor("cruise", FeedModifier.Latest, 10, 100));
    assertThat(actual).isEqualTo(entries);
    verify(mockTemplate, times(2)).queryForList(eq("allCompletedStagesForPipeline"), any());
}
Also used : StageFeedEntry(com.thoughtworks.go.domain.feed.stage.StageFeedEntry) FeedEntry(com.thoughtworks.go.domain.feed.FeedEntry) SqlMapClientTemplate(com.thoughtworks.go.server.transaction.SqlMapClientTemplate) StageFeedEntry(com.thoughtworks.go.domain.feed.stage.StageFeedEntry) Test(org.junit.jupiter.api.Test)

Aggregations

FeedEntry (com.thoughtworks.go.domain.feed.FeedEntry)6 StageFeedEntry (com.thoughtworks.go.domain.feed.stage.StageFeedEntry)6 Author (com.thoughtworks.go.domain.feed.Author)4 FeedEntries (com.thoughtworks.go.domain.feed.FeedEntries)4 Arrays.asList (java.util.Arrays.asList)4 Test (org.junit.Test)3 Test (org.junit.jupiter.api.Test)3 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 SqlMapClientTemplate (com.thoughtworks.go.server.transaction.SqlMapClientTemplate)1 ModificationForPipeline (com.thoughtworks.go.server.ui.ModificationForPipeline)1 PipelineId (com.thoughtworks.go.server.ui.PipelineId)1 Collections.emptyList (java.util.Collections.emptyList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1