Search in sources :

Example 16 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class HgMaterialTest method shouldGetModifications.

@Test
public void shouldGetModifications() throws Exception {
    List<Modification> mods = hgMaterial.modificationsSince(workingFolder, new StringRevision(REVISION_0), new TestSubprocessExecutionContext());
    assertThat(mods.size(), is(2));
    Modification modification = mods.get(0);
    assertThat(modification.getRevision(), is(REVISION_2));
    assertThat(modification.getModifiedFiles().size(), is(1));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.Test)

Example 17 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class HgMaterialTest method shouldLogRepoInfoToConsoleOutWithoutFolder.

@Test
public void shouldLogRepoInfoToConsoleOutWithoutFolder() throws Exception {
    updateMaterial(hgMaterial, new StringRevision("0"));
    assertThat(outputStreamConsumer.getStdOut(), containsString(format("Start updating %s at revision %s from %s", "files", "0", hgMaterial.getUrl())));
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.Test)

Example 18 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class P4MaterialTestBase method shouldExcludeSpecifiedDirectory.

@Test
void shouldExcludeSpecifiedDirectory() {
    P4Material p4Material = p4Fixture.material("//depot/... //cws/...   \n  -//depot/lib/... //cws/release1/...");
    updateMaterial(p4Material, new StringRevision("2"));
    assertThat(new File(clientFolder, "release1").exists()).isFalse();
    assertThat(new File(clientFolder, "release1/junit.jar").exists()).isFalse();
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 19 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class P4MaterialTestBase method shouldBeAbleToConvertToJson.

@Test
void shouldBeAbleToConvertToJson() {
    P4Material p4Material = p4Fixture.material(VIEW);
    Map<String, Object> json = new LinkedHashMap<>();
    p4Material.toJson(json, new StringRevision("123"));
    JsonValue jsonValue = from(json);
    assertThat(jsonValue.getString("scmType")).isEqualTo("Perforce");
    assertThat(jsonValue.getString("location")).isEqualTo(p4Material.getServerAndPort());
    assertThat(jsonValue.getString("action")).isEqualTo("Modified");
}
Also used : JsonValue(com.thoughtworks.go.util.JsonValue) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) Test(org.junit.jupiter.api.Test)

Example 20 with StringRevision

use of com.thoughtworks.go.domain.materials.mercurial.StringRevision in project gocd by gocd.

the class P4MaterialTestBase method laterDefinitionShouldOveridePreviousOne.

@Test
void laterDefinitionShouldOveridePreviousOne() {
    P4Material p4Material = p4Fixture.material("//depot/src/... //cws/build/... \n //depot/lib/... //cws/build/...");
    File file = new File(clientFolder, "build/junit.jar");
    File folderNet = new File(clientFolder, "build/net");
    updateMaterial(p4Material, new StringRevision("2"));
    assertThat(folderNet.exists()).isFalse();
    assertThat(file.exists()).isTrue();
}
Also used : StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)65 Test (org.junit.Test)35 File (java.io.File)31 Test (org.junit.jupiter.api.Test)23 Modification (com.thoughtworks.go.domain.materials.Modification)17 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)17 GitSubmoduleRepos (com.thoughtworks.go.helper.GitSubmoduleRepos)11 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)7 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)6 TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 StringContains.containsString (org.hamcrest.core.StringContains.containsString)5 RegexMatcher (com.thoughtworks.go.matchers.RegexMatcher)4 ModifiedFile (com.thoughtworks.go.domain.materials.ModifiedFile)3 JsonValue (com.thoughtworks.go.util.JsonValue)3 Changeset (com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Changeset)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)2 SysOutStreamConsumer (com.thoughtworks.go.mail.SysOutStreamConsumer)2