use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class HgCommandTest method shouldThrowExceptionForBadConnection.
@Test(expected = RuntimeException.class)
public void shouldThrowExceptionForBadConnection() throws Exception {
String url = "http://not-exists";
HgCommand hgCommand = new HgCommand(null, null, null, null, null);
hgCommand.checkConnection(new UrlArgument(url));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class HgCommandTest method shouldCloneOnlyTheSpecifiedBranchAndPointToIt.
@Test
public void shouldCloneOnlyTheSpecifiedBranchAndPointToIt() {
String branchName = "second";
HgCommand hg = new HgCommand(null, secondBranchWorkingCopy, branchName, serverRepo.getAbsolutePath(), null);
hg.clone(outputStreamConsumer, new UrlArgument(serverRepo.getAbsolutePath() + "#" + branchName));
String currentBranch = hg(secondBranchWorkingCopy, "branch").runOrBomb(null).outputAsString();
assertThat(currentBranch, is(branchName));
List<String> branches = hg(secondBranchWorkingCopy, "branches").runOrBomb(null).output();
ArrayList<String> branchNames = new ArrayList<>();
for (String branchDetails : branches) {
branchNames.add(StringUtils.split(branchDetails, " ")[0]);
}
assertThat(branchNames.size(), is(2));
assertThat(branchNames.contains(branchName), is(true));
assertThat(branchNames.contains("default"), is(true));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class SvnMaterialTest method setUp.
@Before
public void setUp() throws IOException {
temporaryFolder.create();
subversion = context.mock(Subversion.class);
context.checking(new Expectations() {
{
allowing(subversion).getUrl();
will(returnValue(new UrlArgument(URL)));
allowing(subversion).getPassword();
will(returnValue(""));
allowing(subversion).getUserName();
will(returnValue(""));
allowing(subversion).isCheckExternals();
will(returnValue(false));
}
});
svnMaterial = SvnMaterial.createSvnMaterialWithMock(subversion);
svnMaterial.setUrl(URL);
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsSDKCommandBuilderTest method shouldLoadTheCorrectImplementationOfSDKCommandViaTheNestedClassLoader.
@Test
public void shouldLoadTheCorrectImplementationOfSDKCommandViaTheNestedClassLoader() throws Exception {
when(mockSdkLoader.loadClass("com.thoughtworks.go.tfssdk.TfsSDKCommandTCLAdapter")).thenThrow(new RuntimeException());
try {
builder.buildTFSSDKCommand(null, new UrlArgument("url"), DOMAIN, USERNAME, PASSWORD, computedWorkspaceName, "$/project");
fail("should have failed to load class as we are not wiring any dependencies");
} catch (Exception e) {
// Do not worry about load class failing. We're only asserting that load class is invoked with the right FQN for TFSSDKCommand
}
verify(mockSdkLoader, times(1)).loadClass("com.thoughtworks.go.tfssdk.TfsSDKCommandTCLAdapter");
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsMaterialConfigUpdateTest method validate_shouldEnsureMaterialNameIsValid.
@Test
public void validate_shouldEnsureMaterialNameIsValid() {
TfsMaterialConfig tfsMaterialConfig = new TfsMaterialConfig(new GoCipher(), new UrlArgument("http://10.4.4.101:8080/tfs/Sample"), "loser", "CORPORATE", "passwd", "walk_this_path");
tfsMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(tfsMaterialConfig.errors().on(TfsMaterialConfig.MATERIAL_NAME), is(nullValue()));
tfsMaterialConfig.setName(new CaseInsensitiveString(".bad-name-with-dot"));
tfsMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(tfsMaterialConfig.errors().on(TfsMaterialConfig.MATERIAL_NAME), is("Invalid material name '.bad-name-with-dot'. This must be alphanumeric and can contain underscores and periods (however, it cannot start with a period). The maximum allowed length is 255 characters."));
}
Aggregations