Search in sources :

Example 1 with TfsCommand

use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.

the class TfsMaterialTest method shouldCheckConnection.

@Test
public void shouldCheckConnection() {
    TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
    TfsCommand tfsCommand = mock(TfsCommand.class);
    doNothing().when(tfsCommand).checkConnection();
    TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
    doReturn(tfsCommand).when(spy).tfs(execCtx);
    assertThat(spy.checkConnection(execCtx), Is.is(ValidationBean.valid()));
    verify(tfsCommand, times(1)).checkConnection();
}
Also used : TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) TfsCommand(com.thoughtworks.go.domain.materials.tfs.TfsCommand) Test(org.junit.Test)

Example 2 with TfsCommand

use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.

the class TfsMaterialTest method shouldShowLatestModification.

@Test
public void shouldShowLatestModification() {
    File dir = tempFiles.createUniqueFolder("tfs-dir");
    TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
    TfsMaterial spy = spy(tfsMaterialFirstCollectionSecondProject);
    TfsCommand tfsCommand = mock(TfsCommand.class);
    when(tfsCommand.latestModification(dir)).thenReturn(new ArrayList<>());
    doReturn(tfsCommand).when(spy).tfs(execCtx);
    List<Modification> actual = spy.latestModification(dir, execCtx);
    assertThat(actual, is(new ArrayList<Modification>()));
    verify(tfsCommand).latestModification(dir);
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) TfsCommand(com.thoughtworks.go.domain.materials.tfs.TfsCommand) ArrayList(java.util.ArrayList) File(java.io.File) Test(org.junit.Test)

Example 3 with TfsCommand

use of com.thoughtworks.go.domain.materials.tfs.TfsCommand in project gocd by gocd.

the class TfsMaterialTest method shouldLoadAllModificationsSinceAGivenRevision.

@Test
public void shouldLoadAllModificationsSinceAGivenRevision() {
    File dir = tempFiles.createUniqueFolder("tfs-dir");
    TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
    TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
    TfsCommand tfsCommand = mock(TfsCommand.class);
    when(tfsCommand.modificationsSince(dir, new StringRevision("5"))).thenReturn(new ArrayList<>());
    doReturn(tfsCommand).when(spy).tfs(execCtx);
    List<Modification> actual = spy.modificationsSince(dir, new StringRevision("5"), execCtx);
    assertThat(actual, is(new ArrayList<Modification>()));
    verify(tfsCommand).modificationsSince(dir, new StringRevision("5"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) TfsCommand(com.thoughtworks.go.domain.materials.tfs.TfsCommand) ArrayList(java.util.ArrayList) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) File(java.io.File) Test(org.junit.Test)

Aggregations

TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)3 TfsCommand (com.thoughtworks.go.domain.materials.tfs.TfsCommand)3 Test (org.junit.Test)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)1