use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsMaterialTest method setUp.
@Before
public void setUp() {
GoCipher goCipher = mock(GoCipher.class);
tempFiles = new TempFiles();
tfsMaterialFirstCollectionFirstProject = new TfsMaterial(goCipher, new UrlArgument(TFS_FIRST_COLLECTION_URL), USERNAME, DOMAIN, PASSWORD, TFS_FIRST_PROJECT);
tfsMaterialFirstCollectionSecondProject = new TfsMaterial(goCipher, new UrlArgument(TFS_FIRST_COLLECTION_URL), USERNAME, DOMAIN, PASSWORD, TFS_SECOND_PROJECT);
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsMaterialTest method shouldNotDecryptPasswordIfPasswordIsNotNull.
@Test
public void shouldNotDecryptPasswordIfPasswordIsNotNull() throws Exception {
GoCipher mockGoCipher = mock(GoCipher.class);
when(mockGoCipher.encrypt("password")).thenReturn("encrypted");
when(mockGoCipher.decrypt("encrypted")).thenReturn("password");
TfsMaterial material = new TfsMaterial(mockGoCipher, new UrlArgument("/foo"), "username", DOMAIN, "password", "");
material.ensureEncrypted();
when(mockGoCipher.encrypt("new_password")).thenReturn("new_encrypted");
material.setPassword("new_password");
when(mockGoCipher.decrypt("new_encrypted")).thenReturn("new_password");
assertThat(material.getPassword(), is("new_password"));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsMaterialTest method shouldReturnUrlForCommandLine_asLocation_IfSet.
@Test
public void shouldReturnUrlForCommandLine_asLocation_IfSet() {
TfsMaterial tfsMaterial = new TfsMaterial(new GoCipher(), new UrlArgument("http://foo:bar@my-url.com"), "loser", DOMAIN, "foo_bar_baz", "/dev/null");
assertThat(tfsMaterial.getLocation(), is("http://foo:******@my-url.com"));
tfsMaterial = new TfsMaterial(new GoCipher(), null, "loser", DOMAIN, "foo_bar_baz", "/dev/null");
assertThat(tfsMaterial.getLocation(), is(nullValue()));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class MagicalGoConfigXmlWriterTest method shouldNotThrowUpWhenTfsWorkspaceIsNotSpecified.
@Test
public void shouldNotThrowUpWhenTfsWorkspaceIsNotSpecified() {
CruiseConfig cruiseConfig = GoConfigMother.configWithPipelines("tfs_pipeline");
PipelineConfig tfs_pipeline = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString("tfs_pipeline"));
tfs_pipeline.materialConfigs().clear();
tfs_pipeline.addMaterialConfig(new TfsMaterialConfig(new GoCipher(), new UrlArgument("http://tfs.com"), "username", "CORPORATE", "password", "$/project_path"));
try {
xmlWriter.write(cruiseConfig, output, false);
} catch (Exception e) {
fail("should not fail as workspace name is not mandatory anymore " + e);
}
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class SvnMaterialMockitoTest method shouldNotDeleteWorkingDirIfSvnRepositoryUsesFileProtocol.
@Test
public void shouldNotDeleteWorkingDirIfSvnRepositoryUsesFileProtocol() throws IOException {
Subversion subversion = mock(Subversion.class);
when(subversion.getUserName()).thenReturn("");
when(subversion.getPassword()).thenReturn("");
when(subversion.isCheckExternals()).thenReturn(false);
File workingCopy = createSvnWorkingCopy(true);
when(subversion.workingRepositoryUrl(workingCopy)).thenReturn(workingCopy.getPath());
String url = "file://" + workingCopy.getPath();
when(subversion.getUrl()).thenReturn(new UrlArgument(url));
SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(subversion);
svnMaterial.setUrl(url);
svnMaterial.updateTo(outputStreamConsumer, workingCopy, new RevisionContext(revision), new TestSubprocessExecutionContext());
assertThat(workingCopy.exists(), is(true));
verify(subversion).updateTo(outputStreamConsumer, workingCopy, revision);
}
Aggregations