Search in sources :

Example 6 with StageIdentity

use of com.thoughtworks.go.server.domain.StageIdentity in project gocd by gocd.

the class StageSqlMapDaoTest method findLatestStageInstancesShouldCacheResults.

@Test
public void findLatestStageInstancesShouldCacheResults() throws SQLException {
    List<StageIdentity> latestStages = Arrays.asList(new StageIdentity("p1", "s1", 10L), new StageIdentity("p2", "s2", 100L));
    when(sqlMapClientTemplate.queryForList("latestStageInstances")).thenReturn(latestStages);
    List<StageIdentity> firstStageInstances = stageSqlMapDao.findLatestStageInstances();
    List<StageIdentity> latestStageInstances = stageSqlMapDao.findLatestStageInstances();
    assertThat(firstStageInstances, is(latestStages));
    assertThat(latestStageInstances, is(latestStages));
    verify(sqlMapClientTemplate, times(1)).queryForList("latestStageInstances");
}
Also used : StageIdentity(com.thoughtworks.go.server.domain.StageIdentity) Test(org.junit.Test)

Aggregations

StageIdentity (com.thoughtworks.go.server.domain.StageIdentity)6 Test (org.junit.Test)4 Stage (com.thoughtworks.go.domain.Stage)2 ProjectStatus (com.thoughtworks.go.domain.activity.ProjectStatus)2 ArrayList (java.util.ArrayList)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 Date (java.util.Date)1 List (java.util.List)1