use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class ConfigMaterialUpdaterTest method SetUp.
@Before
public void SetUp() {
repoConfigDataSource = mock(GoRepoConfigDataSource.class);
materialChecker = mock(MaterialChecker.class);
materialRepository = mock(MaterialRepository.class);
configCompleted = mock(ConfigMaterialUpdateCompletedTopic.class);
topic = mock(MaterialUpdateCompletedTopic.class);
materialService = mock(MaterialService.class);
material = new SvnMaterial("url", "tom", "pass", false);
when(materialRepository.folderFor(material)).thenReturn(folder);
poller = mock(MaterialPoller.class);
when(materialService.getPollerImplementation(any(Material.class))).thenReturn(poller);
Modification svnModification = new Modification("user", "commend", "em@il", new Date(), "1");
mods = revisions(material, svnModification);
when(materialRepository.findLatestModification(material)).thenReturn(mods);
configUpdater = new ConfigMaterialUpdater(repoConfigDataSource, materialRepository, materialChecker, configCompleted, topic, materialService, new TestSubprocessExecutionContext());
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class TfsMaterialTest method shouldCheckConnection.
@Test
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)).isEqualTo(valid());
verify(tfsCommand, times(1)).checkConnection();
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4MultipleMaterialsTest method shouldUpdateToItsDestFolder.
@Test
public void shouldUpdateToItsDestFolder() {
P4Material p4Material = p4Fixture.material(VIEW_SRC, "dest1");
MaterialRevision revision = new MaterialRevision(p4Material, p4Material.latestModification(clientFolder, new TestSubprocessExecutionContext()));
revision.updateTo(clientFolder, inMemoryConsumer(), new TestSubprocessExecutionContext());
assertThat(new File(clientFolder, "dest1/net").exists(), is(true));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4MultipleMaterialsTest method shouldFoundModificationsForEachMaterial.
@Test
public void shouldFoundModificationsForEachMaterial() throws Exception {
P4Material p4Material1 = p4Fixture.material(VIEW_SRC, "src");
P4Material p4Material2 = p4Fixture.material(VIEW_LIB, "lib");
Materials materials = new Materials(p4Material1, p4Material2);
p4TestRepo.checkInOneFile(p4Material1, "filename.txt");
p4TestRepo.checkInOneFile(p4Material2, "filename2.txt");
MaterialRevisions materialRevisions = materials.latestModification(clientFolder, new TestSubprocessExecutionContext());
assertThat(materialRevisions.getRevisions().size(), is(2));
assertThat(materialRevisions, containsModifiedFile("src/filename.txt"));
assertThat(materialRevisions, containsModifiedFile("lib/filename2.txt"));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4MaterialTestBase method shouldCheckConnection.
@Test
void shouldCheckConnection() {
P4Material p4Material = new P4Material("localhost:9876", "p4view");
p4Material.setPassword("secret");
p4Material.setUseTickets(false);
ValidationBean validation = p4Material.checkConnection(new TestSubprocessExecutionContext());
assertThat(validation.isValid()).isFalse();
assertThat(validation.getError()).contains("Unable to connect to server localhost:9876");
assertThat(validation.getError()).doesNotContain("secret");
}
Aggregations