Search in sources :

Example 31 with JobIdentifier

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

the class ElasticAgentPluginRegistryTest method shouldTalkToExtensionToCreateElasticAgent.

@Test
public void shouldTalkToExtensionToCreateElasticAgent() {
    final Map<String, String> configuration = Collections.singletonMap("GoServerURL", "foo");
    final JobIdentifier jobIdentifier = new JobIdentifier();
    final String autoRegisterKey = "auto-register-key";
    final String environment = "test-env";
    elasticAgentPluginRegistry.createAgent(PLUGIN_ID, autoRegisterKey, environment, configuration, jobIdentifier);
    verify(elasticAgentExtension, times(1)).createAgent(PLUGIN_ID, autoRegisterKey, environment, configuration, jobIdentifier);
    verifyNoMoreInteractions(elasticAgentExtension);
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 32 with JobIdentifier

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

the class ElasticAgentExtensionConverterV2Test method setUp.

@Before
public void setUp() throws Exception {
    jobIdentifier = new JobIdentifier("test-pipeline", 1, "Test Pipeline", "test-stage", "1", "test-job");
    jobIdentifier.setBuildId(100L);
    converterV2 = new ElasticAgentExtensionConverterV2();
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Before(org.junit.Before)

Example 33 with JobIdentifier

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

the class ArtifactsServiceTest method shouldConvertArtifactPathWithLocationToUrl.

@Test
public void shouldConvertArtifactPathWithLocationToUrl() throws Exception {
    File artifactsRoot = temporaryFolder.newFolder();
    assumeArtifactsRoot(artifactsRoot);
    ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
    JobIdentifier identifier = JobIdentifierMother.jobIdentifier("p", 1, "s", "2", "j");
    when(resolverService.actualJobIdentifier(identifier)).thenReturn(identifier);
    String url = artifactsService.findArtifactUrl(identifier, "console.log");
    assertThat(url, is("/files/p/1/s/2/j/console.log"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) Test(org.junit.Test)

Example 34 with JobIdentifier

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

the class ArtifactsServiceTest method shouldProvideArtifactRootForAJobOnLinux.

@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { DO_NOT_RUN_ON, WINDOWS })
public void shouldProvideArtifactRootForAJobOnLinux() throws Exception {
    assumeArtifactsRoot(fakeRoot);
    ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
    artifactsService.initialize();
    JobIdentifier oldId = new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox", null);
    when(resolverService.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("cruise", 2, "2.2", "functional", "3", "mac-safari"));
    String artifactRoot = artifactsService.findArtifactRoot(oldId);
    assertThat(artifactRoot, is("pipelines/cruise/2/functional/3/mac-safari"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RunIf(com.googlecode.junit.ext.RunIf) Test(org.junit.Test)

Example 35 with JobIdentifier

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

the class ArtifactsServiceTest method shouldConvertArtifactPathToUrl.

@Test
public void shouldConvertArtifactPathToUrl() throws Exception {
    File artifactsRoot = temporaryFolder.newFolder();
    assumeArtifactsRoot(artifactsRoot);
    ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
    JobIdentifier identifier = JobIdentifierMother.jobIdentifier("p", 1, "s", "2", "j");
    when(resolverService.actualJobIdentifier(identifier)).thenReturn(identifier);
    String url = artifactsService.findArtifactUrl(identifier);
    assertThat(url, is("/files/p/1/s/2/j"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) File(java.io.File) Test(org.junit.Test)

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