Search in sources :

Example 16 with EnvironmentVariableContext

use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.

the class AgentStatusReportTest method before.

@Before
public void before() {
    agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
    environmentVariableContext = new EnvironmentVariableContext();
    artifactManipulator = new GoArtifactsManipulatorStub();
    buildRepository = new BuildRepositoryRemoteStub();
    this.agentRuntimeInfo = new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Before(org.junit.Before)

Example 17 with EnvironmentVariableContext

use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method shouldSetupEnvironmentVariableForDependencyMaterial.

@Test
public void shouldSetupEnvironmentVariableForDependencyMaterial() throws IOException {
    EnvironmentVariableContext environmentVariableContext = doWorkWithMaterials(new Materials());
    assertThat("Properties: \n" + environmentVariableContext.getProperties(), environmentVariableContext.getProperty("GO_DEPENDENCY_LOCATOR_UPSTREAM1"), is("upstream1/0/first/1"));
    assertThat("Properties: \n" + environmentVariableContext.getProperties(), environmentVariableContext.getProperty("GO_DEPENDENCY_LABEL_UPSTREAM1"), is("upstream1-label"));
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Test(org.junit.Test)

Example 18 with EnvironmentVariableContext

use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method shouldSetEnvironmentVariableForSvnExternal.

@Test
public void shouldSetEnvironmentVariableForSvnExternal() throws IOException {
    svnRepoFixture.createExternals(svnRepoFixture.getEnd2EndRepoUrl());
    command = new SvnCommand(null, svnRepoFixture.getEnd2EndRepoUrl(), null, null, true);
    svnMaterial = SvnMaterial.createSvnMaterialWithMock(command);
    svnMaterial.setFolder("svn-Dir");
    EnvironmentVariableContext environmentVariableContext = doWorkWithMaterials(new Materials(svnMaterial));
    assertThat(environmentVariableContext.getProperty("GO_REVISION_SVN_DIR"), is("4"));
    assertThat(environmentVariableContext.getProperty("GO_REVISION_SVN_DIR_EXTERNAL"), is("4"));
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Test(org.junit.Test)

Example 19 with EnvironmentVariableContext

use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method shouldSetupEnvironmentVariableUsingDependencyMaterialName.

@Test
public void shouldSetupEnvironmentVariableUsingDependencyMaterialName() throws IOException {
    EnvironmentVariableContext environmentVariableContext = doWorkWithMaterials(new Materials());
    assertThat("Properties: \n" + environmentVariableContext.getProperties(), environmentVariableContext.getProperty("GO_DEPENDENCY_LOCATOR_DEPENDENCY_MATERIAL_NAME"), is("upstream2/0/first/1"));
    assertThat("Properties: \n" + environmentVariableContext.getProperties(), environmentVariableContext.getProperty("GO_DEPENDENCY_LABEL_DEPENDENCY_MATERIAL_NAME"), is("upstream2-label"));
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Test(org.junit.Test)

Example 20 with EnvironmentVariableContext

use of com.thoughtworks.go.util.command.EnvironmentVariableContext in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method shouldSetUpRevisionIntoEnvironmentContextCorrectlyForMutipleMaterial.

@Test
public void shouldSetUpRevisionIntoEnvironmentContextCorrectlyForMutipleMaterial() throws IOException {
    svnMaterial.setFolder("svn-Dir");
    EnvironmentVariableContext environmentVariableContext = doWorkWithMaterials(new Materials(svnMaterial, hgMaterial));
    assertThat(environmentVariableContext.getProperty("GO_REVISION_SVN_DIR"), is("3"));
    assertThat(environmentVariableContext.getProperty("GO_REVISION_HG_DIR"), is("ca3ebb67f527c0ad7ed26b789056823d8b9af23f"));
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) Test(org.junit.Test)

Aggregations

EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)94 Test (org.junit.Test)74 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)19 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)16 File (java.io.File)14 Date (java.util.Date)13 Modification (com.thoughtworks.go.domain.materials.Modification)12 Modifications (com.thoughtworks.go.domain.materials.Modifications)10 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)9 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)9 Before (org.junit.Before)8 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)7 ArtifactStores (com.thoughtworks.go.config.ArtifactStores)6 Materials (com.thoughtworks.go.config.materials.Materials)6 Builder (com.thoughtworks.go.domain.builder.Builder)6 HashMap (java.util.HashMap)6 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)5 RunIfConfigs (com.thoughtworks.go.domain.RunIfConfigs)5 PackageMaterialRevision (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialRevision)5 PluggableSCMMaterialRevision (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialRevision)5