Search in sources :

Example 46 with JobIdentifier

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

the class ConsoleActivityMonitorTest method shouldClearServerHealthMessageForARescheduledJob.

@Test
public void shouldClearServerHealthMessageForARescheduledJob() {
    JobIdentifier rescheduledJobIdentifier = new JobIdentifier("foo", 10, "label-10", "stage", "3", "job", 10l);
    JobInstance jobInstance = new JobInstance();
    jobInstance.setIdentifier(rescheduledJobIdentifier);
    jobInstance.setState(JobState.Rescheduled);
    listener.jobStatusChanged(jobInstance);
    verify(serverHealthService).removeByScope(HealthStateScope.forJob("foo", "stage", "job"));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 47 with JobIdentifier

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

the class ConsoleServiceTest method shouldReturnTemporaryFileIfBothTemporaryAndFinalFilesDoNotExist.

@Test
public void shouldReturnTemporaryFileIfBothTemporaryAndFinalFilesDoNotExist() throws Exception {
    JobIdentifier jobIdentifier = JobIdentifierMother.anyBuildIdentifier();
    File consoleFile = mock(File.class);
    when(chooser.temporaryConsoleFile(jobIdentifier)).thenReturn(consoleFile);
    when(consoleFile.exists()).thenReturn(false);
    File finalConsoleFile = mock(File.class);
    when(chooser.findArtifact(jobIdentifier, getConsoleOutputFolderAndFileName())).thenReturn(finalConsoleFile);
    when(finalConsoleFile.exists()).thenReturn(false);
    File file = service.consoleLogFile(jobIdentifier);
    assertThat(file, is(consoleFile));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) File(java.io.File) Test(org.junit.Test)

Example 48 with JobIdentifier

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

the class ConsoleServiceTest method shouldReturnFinalArtifactFileIfItExists.

@Test
public void shouldReturnFinalArtifactFileIfItExists() throws Exception {
    JobIdentifier jobIdentifier = JobIdentifierMother.anyBuildIdentifier();
    File consoleFile = mock(File.class);
    when(chooser.temporaryConsoleFile(jobIdentifier)).thenReturn(consoleFile);
    when(consoleFile.exists()).thenReturn(false);
    File finalConsoleFile = mock(File.class);
    when(chooser.findArtifact(jobIdentifier, getConsoleOutputFolderAndFileName())).thenReturn(finalConsoleFile);
    when(finalConsoleFile.exists()).thenReturn(true);
    File file = service.consoleLogFile(jobIdentifier);
    assertThat(file, is(finalConsoleFile));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) File(java.io.File) Test(org.junit.Test)

Example 49 with JobIdentifier

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

the class FailureServiceTest method setUp.

@Before
public void setUp() {
    shineDao = mock(ShineDao.class);
    securityService = mock(SecurityService.class);
    stageFinder = mock(StageFinder.class);
    failureService = new FailureService(securityService, shineDao, stageFinder);
    username = new Username(new CaseInsensitiveString("foo"));
    jobIdentifier = new JobIdentifier(new StageIdentifier("pipeline", 10, "stage", "5"), "job");
    result = new HttpLocalizedOperationResult();
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) ShineDao(com.thoughtworks.go.server.dao.sparql.ShineDao) Username(com.thoughtworks.go.server.domain.Username) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) StageFinder(com.thoughtworks.go.domain.StageFinder) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Before(org.junit.Before)

Example 50 with JobIdentifier

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

the class URLServiceTest method setUp.

@Before
public void setUp() {
    urlService = new URLService();
    jobIdentifier = new JobIdentifier("pipelineName", -2, "LATEST", "stageName", "LATEST", "buildName", 123L);
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Before(org.junit.Before)

Aggregations

JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)113 Test (org.junit.Test)85 File (java.io.File)16 JobInstance (com.thoughtworks.go.domain.JobInstance)15 Pipeline (com.thoughtworks.go.domain.Pipeline)13 DateTime (org.joda.time.DateTime)12 Before (org.junit.Before)10 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 Stage (com.thoughtworks.go.domain.Stage)6 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)5 IllegalArtifactLocationException (com.thoughtworks.go.domain.exception.IllegalArtifactLocationException)5 AgentMetadata (com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata)5 IOException (java.io.IOException)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 Property (com.thoughtworks.go.domain.Property)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 RunIf (com.googlecode.junit.ext.RunIf)2 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)2 HeaderConstraint (com.thoughtworks.go.server.security.HeaderConstraint)2