Search in sources :

Example 1 with PropertyDao

use of com.thoughtworks.go.server.dao.PropertyDao in project gocd by gocd.

the class PropertiesServiceTest method shouldLoadOriginalJobPropertiesForGivenJobIdentifier.

@Test
public void shouldLoadOriginalJobPropertiesForGivenJobIdentifier() {
    Properties props = new Properties(new Property("a", "1"), new Property("b", "2"));
    PropertyDao propertyDao = mock(PropertyDao.class);
    JobResolverService resolver = mock(JobResolverService.class);
    PropertiesService service = new PropertiesService(propertyDao, null, null, resolver);
    JobIdentifier oldId = new JobIdentifier("pipeline-name", 10, "label-10", "stage-name", "3", "job-name", 9l);
    when(propertyDao.list(6l)).thenReturn(props);
    when(resolver.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("pipeline-name", 7, "label-7", "stage-name", "1", "job-name", 6l));
    assertThat(service.getPropertiesForOriginalJob(oldId), is(props));
}
Also used : PropertyDao(com.thoughtworks.go.server.dao.PropertyDao) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Properties(com.thoughtworks.go.domain.Properties) Property(com.thoughtworks.go.domain.Property) Test(org.junit.Test)

Aggregations

JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)1 Properties (com.thoughtworks.go.domain.Properties)1 Property (com.thoughtworks.go.domain.Property)1 PropertyDao (com.thoughtworks.go.server.dao.PropertyDao)1 Test (org.junit.Test)1