summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-01-24 11:05:25 (EST)
committer Steffen Pingel2012-01-24 11:05:25 (EST)
commit78f839a9cce110f97ec1d31a98627729bda6061d (patch)
tree4d0f66b275fd75e4abd28cedda80d2f49eb5d394
parente9cd1b88717f539bdf80f5e2202cfe93ee800f03 (diff)
downloadorg.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.zip
org.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.tar.gz
org.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.tar.bz2
NEW - bug 368912: setup test environment for Hudson 2.2 and 3.0 M0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=368912 Change-Id: Iccb5cfdd8c61c37f8c2540019a7f09a3477e53ca
-rw-r--r--org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java
index 681ad98..13635b3 100644
--- a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java
+++ b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java
@@ -63,9 +63,14 @@ public abstract class RepositoryTestFixture {
private TestSuite suite;
+ private boolean useCertificateAuthentication;
+
+ private boolean useShortUsernames;
+
public RepositoryTestFixture(String connectorKind, String repositoryUrl) {
this.connectorKind = connectorKind;
this.repositoryUrl = repositoryUrl;
+ this.useCertificateAuthentication = repositoryUrl.contains("/secure/");
}
public void add(Class<? extends TestCase> clazz) {
@@ -112,6 +117,14 @@ public abstract class RepositoryTestFixture {
return new HashSet<String>(Arrays.asList(excludeFixtureArray)).contains(getRepositoryUrl());
}
+ public boolean isUseCertificateAuthentication() {
+ return useCertificateAuthentication;
+ }
+
+ public boolean isUseShortUsernames() {
+ return useShortUsernames;
+ }
+
public RepositoryLocation location() throws Exception {
return location(PrivilegeLevel.USER);
}
@@ -122,7 +135,11 @@ public abstract class RepositoryTestFixture {
public RepositoryLocation location(PrivilegeLevel level, Proxy proxy) throws Exception {
UserCredentials credentials = CommonTestUtil.getCredentials(level);
- return location(credentials.getUserName(), credentials.getPassword(), proxy);
+ String userName = credentials.getUserName();
+ if (isUseShortUsernames() && userName.contains("@")) {
+ userName = userName.substring(0, userName.indexOf("@"));
+ }
+ return location(userName, credentials.getPassword(), proxy);
}
public RepositoryLocation location(String username, String password) throws Exception {
@@ -136,12 +153,20 @@ public abstract class RepositoryTestFixture {
if (username != null && password != null) {
location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials(username, password));
}
- if (repositoryUrl.contains("/secure/")) {
+ if (isUseCertificateAuthentication()) {
location.setCredentials(AuthenticationType.CERTIFICATE, CommonTestUtil.getCertificateCredentials());
}
return location;
}
+ public void setUseCertificateAuthentication(boolean useCertificateAuthentication) {
+ this.useCertificateAuthentication = useCertificateAuthentication;
+ }
+
+ public void setUseShortUsernames(boolean useShortUsernames) {
+ this.useShortUsernames = useShortUsernames;
+ }
+
protected abstract RepositoryTestFixture activate();
protected abstract RepositoryTestFixture getDefault();