diff options
author | Steffen Pingel | 2012-01-24 16:05:25 +0000 |
---|---|---|
committer | Steffen Pingel | 2012-01-24 16:05:25 +0000 |
commit | 78f839a9cce110f97ec1d31a98627729bda6061d (patch) | |
tree | 4d0f66b275fd75e4abd28cedda80d2f49eb5d394 /org.eclipse.mylyn.commons.sdk.util | |
parent | e9cd1b88717f539bdf80f5e2202cfe93ee800f03 (diff) | |
download | org.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.tar.gz org.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.tar.xz org.eclipse.mylyn.commons-78f839a9cce110f97ec1d31a98627729bda6061d.zip |
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
Diffstat (limited to 'org.eclipse.mylyn.commons.sdk.util')
-rw-r--r-- | org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/RepositoryTestFixture.java | 29 |
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 681ad987..13635b34 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(); |