Search in sources :

Example 86 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class PipelineInstanceModelTest method shouldGetCurrentRevisionForMaterialName.

@Test
public void shouldGetCurrentRevisionForMaterialName() {
    HgMaterial material = MaterialsMother.hgMaterial();
    material.setName(new CaseInsensitiveString("foo"));
    assertThat(setUpModificationFor(material).getCurrentRevision(CaseInsensitiveString.str(material.getName())).getRevision(), is("a087402bd2a7828a130c1bdf43f2d9ef8f48fd46"));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 87 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class PipelineInstanceModelTest method shouldGetCurrentRevisionForMaterialByName.

@Test
public void shouldGetCurrentRevisionForMaterialByName() {
    MaterialRevisions revisions = new MaterialRevisions();
    HgMaterial material = MaterialsMother.hgMaterial();
    SvnMaterial svnMaterial = MaterialsMother.svnMaterial();
    material.setName(new CaseInsensitiveString("hg_material"));
    revisions.addRevision(svnMaterial, new Modification(new Date(), "1024", "MOCK_LABEL-12", null));
    revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
    BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", buildCause, new StageInstanceModels());
    assertThat(model.getCurrentRevision("hg_material").getRevision(), is("a087402bd2a7828a130c1bdf43f2d9ef8f48fd46"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 88 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class BuildAssignmentTest method setUp.

@Before
public void setUp() throws IOException {
    initMocks(this);
    dir = temporaryFolder.newFolder("someFolder");
    svnRepoFixture = new SvnRepoFixture("../common/src/test/resources/data/svnrepo", temporaryFolder);
    svnRepoFixture.createRepository();
    command = new SvnCommand(null, svnRepoFixture.getEnd2EndRepoUrl());
    svnMaterial = createSvnMaterialWithMock(command);
    dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("upstream1"), new CaseInsensitiveString(STAGE_NAME));
    dependencyMaterialWithName = new DependencyMaterial(new CaseInsensitiveString("upstream2"), new CaseInsensitiveString(STAGE_NAME));
    dependencyMaterialWithName.setName(new CaseInsensitiveString("dependency_material_name"));
    setupHgRepo();
}
Also used : SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) SvnRepoFixture(com.thoughtworks.go.utils.SvnRepoFixture) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Before(org.junit.Before)

Example 89 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class BuildWorkEnvironmentVariablesTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    dir = temporaryFolder.newFolder("someFolder");
    environmentVariableContext = new EnvironmentVariableContext();
    svnRepoFixture = new SvnRepoFixture("../common/src/test/resources/data/svnrepo", temporaryFolder);
    svnRepoFixture.createRepository();
    command = new SvnCommand(null, svnRepoFixture.getEnd2EndRepoUrl());
    pipelineConfig = PipelineConfigMother.createPipelineConfig(PIPELINE_NAME, STAGE_NAME, JOB_NAME);
    svnMaterial = SvnMaterial.createSvnMaterialWithMock(command);
    dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("upstream1"), new CaseInsensitiveString(STAGE_NAME));
    dependencyMaterialWithName = new DependencyMaterial(new CaseInsensitiveString("upstream2"), new CaseInsensitiveString(STAGE_NAME));
    dependencyMaterialWithName.setName(new CaseInsensitiveString("dependency_material_name"));
    setupHgRepo();
    p4Fixture = new P4Fixture();
    p4Material = getP4Material();
}
Also used : P4Fixture(com.thoughtworks.go.domain.materials.perforce.P4Fixture) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) EnvironmentVariableContext(com.thoughtworks.go.util.command.EnvironmentVariableContext) SvnRepoFixture(com.thoughtworks.go.utils.SvnRepoFixture) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Before(org.junit.Before)

Example 90 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class DFSCycleDetectorTest method shouldNotThrowExceptionWhenCycleDependencyNotFound.

@Test
public void shouldNotThrowExceptionWhenCycleDependencyNotFound() throws Exception {
    when(state.getDependencyMaterials(new CaseInsensitiveString("a"))).thenReturn(new Node(new Node.DependencyNode(new CaseInsensitiveString("b"), new CaseInsensitiveString("stage"))));
    when(state.getDependencyMaterials(new CaseInsensitiveString("b"))).thenReturn(new Node(new Node.DependencyNode(new CaseInsensitiveString("c"), new CaseInsensitiveString("stage"))));
    when(state.getDependencyMaterials(new CaseInsensitiveString("c"))).thenReturn(new Node(new ArrayList<>()));
    when(state.hasPipeline(new CaseInsensitiveString("a"))).thenReturn(true);
    when(state.hasPipeline(new CaseInsensitiveString("b"))).thenReturn(true);
    when(state.hasPipeline(new CaseInsensitiveString("c"))).thenReturn(true);
    project.topoSort(new CaseInsensitiveString("a"), state);
}
Also used : ArrayList(java.util.ArrayList) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)392 Test (org.junit.Test)277 Username (com.thoughtworks.go.server.domain.Username)80 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)65 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)65 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)57 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)56 Date (java.util.Date)50 Modification (com.thoughtworks.go.domain.materials.Modification)44 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)30 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)28 Before (org.junit.Before)28 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)27 HashMap (java.util.HashMap)26 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)24 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)24 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)19 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)19 ArrayList (java.util.ArrayList)19 Pipeline (com.thoughtworks.go.domain.Pipeline)18