diff options
5 files changed, 124 insertions, 81 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java index ab9125c7a..4797eddb3 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java @@ -239,7 +239,7 @@ public class BugzillaClient { // requestPath = requestPath.substring(0, // requestPath.indexOf(QUERY_DELIMITER)); // } - GetMethod getMethod = new GetMethod(requestURL); + GetMethod getMethod = new GetMethod(WebClientUtil.getRequestPath(requestURL)); if (requestURL.contains(QUERY_DELIMITER)) { getMethod.setQueryString(requestURL.substring(requestURL.indexOf(QUERY_DELIMITER))); } @@ -336,11 +336,11 @@ public class BugzillaClient { formData[0] = new NameValuePair(IBugzillaConstants.POST_INPUT_BUGZILLA_LOGIN, username); formData[1] = new NameValuePair(IBugzillaConstants.POST_INPUT_BUGZILLA_PASSWORD, password); - PostMethod method = new PostMethod(repositoryUrl.toString() + IBugzillaConstants.URL_POST_LOGIN); + PostMethod method = new PostMethod(WebClientUtil.getRequestPath(repositoryUrl.toString() + IBugzillaConstants.URL_POST_LOGIN)); method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" + characterEncoding); method.setRequestBody(formData); - method.setDoAuthentication(true); + method.setDoAuthentication(true); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler); httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECT_TIMEOUT); method.setFollowRedirects(false); @@ -588,7 +588,7 @@ public class BugzillaClient { PostMethod postMethod = null; try { - postMethod = new PostMethod(repositoryUrl.toString() + IBugzillaConstants.URL_POST_ATTACHMENT_UPLOAD); + postMethod = new PostMethod(WebClientUtil.getRequestPath(repositoryUrl + IBugzillaConstants.URL_POST_ATTACHMENT_UPLOAD)); // This option causes the client to first // check // with the server to see if it will in fact receive the post before @@ -650,7 +650,7 @@ public class BugzillaClient { if (!authenticated && hasAuthenticationCredentials()) { authenticate(); } - PostMethod postMethod = new PostMethod(repositoryUrl.toString() + formUrl); + PostMethod postMethod = new PostMethod(WebClientUtil.getRequestPath(repositoryUrl.toString()+formUrl)); postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" + characterEncoding); httpClient.getHttpConnectionManager().getParams().setSoTimeout(CONNECT_TIMEOUT); httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECT_TIMEOUT); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java index 64940d760..ca6850a4c 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java @@ -15,6 +15,7 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.net.InetAddress; +import java.net.Proxy; import java.net.Socket; import java.util.ArrayList; import java.util.Date; @@ -56,7 +57,8 @@ import org.eclipse.mylar.tasks.ui.TasksUiPlugin; */ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { -// private BugzillaAttachmentHandler attachmentHandler = new BugzillaAttachmentHandler(); + // private BugzillaAttachmentHandler attachmentHandler = new + // BugzillaAttachmentHandler(); public void testCreateTaskFromExistingId() throws Exception { init222(); @@ -67,7 +69,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); assertNotNull(task); assertEquals(RepositoryTaskSyncState.INCOMING, task.getSyncState()); - TasksUiPlugin.getSynchronizationManager().setTaskRead(task, true); + TasksUiPlugin.getSynchronizationManager().setTaskRead(task, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); BugzillaTask retrievedTask = (BugzillaTask) taskList.getTask(task.getHandleIdentifier()); @@ -152,7 +154,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { assertEquals(RepositoryTaskSyncState.INCOMING, task.getSyncState()); TasksUiPlugin.getSynchronizationManager().setTaskRead(task, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); - + // Modify it String newCommentText = "BugzillaRepositoryClientTest.testSynchronize(): " + (new Date()).toString(); task.getTaskData().setNewComment(newCommentText); @@ -160,32 +162,33 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { // BugEditor) task.getTaskData().setHasLocalChanges(true); task.setSyncState(RepositoryTaskSyncState.OUTGOING); - TasksUiPlugin.getDefault().getTaskDataManager().put(task.getTaskData()); + TasksUiPlugin.getDefault().getTaskDataManager().put(task.getTaskData()); assertEquals(RepositoryTaskSyncState.OUTGOING, task.getSyncState()); // Submit changes - - submit(task); -// task.setTaskData(null); + + submit(task); + // task.setTaskData(null); TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); - // After submit SYNCHRONIZED is set, after synchronize it should remain SYNCHRONIZED + // After submit SYNCHRONIZED is set, after synchronize it should remain + // SYNCHRONIZED assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); TasksUiPlugin.getSynchronizationManager().setTaskRead(task, true); // Has no outgoing changes or conflicts yet needs synch // because task doesn't have bug report (new query hit) // Result: retrieved with no incoming status - //task.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED); - + // task.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED); + RepositoryTaskData bugReport = task.getTaskData(); - //repository.setSyncTimeStamp(bugReport.getLastModified()); + // repository.setSyncTimeStamp(bugReport.getLastModified()); // task.setTaskData(null); TasksUiPlugin.getDefault().getTaskDataManager().remove(bugReport); TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, false, null); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertNotNull(task.getTaskData()); assertEquals(task.getTaskData().getId(), bugReport.getId()); - + // TODO: Test that comment was appended // ArrayList<Comment> comments = task.getTaskData().getComments(); // assertNotNull(comments); @@ -243,38 +246,42 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { taskList.addQuery(query2); assertEquals(2, taskList.getQueries().size()); assertEquals(1, taskList.getQueryHits().size()); - for (AbstractQueryHit hit: query1.getHits()) { - for (AbstractQueryHit hit2: query2.getHits()) { + for (AbstractQueryHit hit : query1.getHits()) { + for (AbstractQueryHit hit2 : query2.getHits()) { assertTrue(hit.getClass().equals(hit2.getClass())); } } - + taskList.deleteQuery(query1); taskList.deleteQuery(query2); assertEquals(1, taskList.getQueryHits().size()); taskList.removeOrphanedHits(); assertEquals(0, taskList.getQueryHits().size()); -// List<AbstractQueryHit> hitsForHandle = new ArrayList<AbstractQueryHit>(); -// for (AbstractRepositoryQuery query : taskList.getQueries()) { -// AbstractQueryHit foundHit = query.findQueryHit(AbstractRepositoryTask.getHandle( -// IBugzillaConstants.TEST_BUGZILLA_222_URL, "1")); -// if (foundHit != null) { -// hitsForHandle.add(foundHit); -// } -// } -// -// // IF two queries have the same hit there should only be one instance of -// // a hit with a given handle. -// assertEquals(1, hitsForHandle.size()); + // List<AbstractQueryHit> hitsForHandle = new + // ArrayList<AbstractQueryHit>(); + // for (AbstractRepositoryQuery query : taskList.getQueries()) { + // AbstractQueryHit foundHit = + // query.findQueryHit(AbstractRepositoryTask.getHandle( + // IBugzillaConstants.TEST_BUGZILLA_222_URL, "1")); + // if (foundHit != null) { + // hitsForHandle.add(foundHit); + // } + // } + // + // // IF two queries have the same hit there should only be one instance + // of + // // a hit with a given handle. + // assertEquals(1, hitsForHandle.size()); // IF two queries have the same hit there should only be one instance of // a hit for a given handle. // Note that getQueryHitsForHandle will always return a set of unique // elements (even if there are duplicates among queries because // it returns a set. -// assertEquals(1, taskList.getQueryHits( -// AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1")).size()); + // assertEquals(1, taskList.getQueryHits( + // AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL, + // "1")).size()); } @@ -304,20 +311,22 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { attachment.setReport(task.getTaskData()); attachment.setComment("Automated JUnit attachment test"); // optional - - /* Test attempt to upload a non-existent file */ attachment.setFilePath("/this/is/not/a/real-file"); - //IAttachmentHandler attachmentHandler = connector.getAttachmentHandler(); + // IAttachmentHandler attachmentHandler = + // connector.getAttachmentHandler(); BugzillaClient client = connector.getClientManager().getClient(repository); try { - client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); + client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), + new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); fail(); - } catch (Exception e) { + } catch (Exception e) { } -// attachmentHandler.uploadAttachment(repository, task, comment, description, file, contentType, isPatch, proxySettings) -// assertFalse(attachmentHandler.uploadAttachment(attachment, repository.getUserName(), repository.getPassword(), -// Proxy.NO_PROXY)); + // attachmentHandler.uploadAttachment(repository, task, comment, + // description, file, contentType, isPatch, proxySettings) + // assertFalse(attachmentHandler.uploadAttachment(attachment, + // repository.getUserName(), repository.getPassword(), + // Proxy.NO_PROXY)); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); task = (BugzillaTask) connector.createTaskFromExistingKey(repository, taskNumber); TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); @@ -328,12 +337,14 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { File attachFile = new File(fileName); attachment.setFilePath(attachFile.getAbsolutePath()); BufferedWriter write = new BufferedWriter(new FileWriter(attachFile)); -// assertFalse(attachmentHandler.uploadAttachment(attachment, repository.getUserName(), repository.getPassword(), -// Proxy.NO_PROXY)); + // assertFalse(attachmentHandler.uploadAttachment(attachment, + // repository.getUserName(), repository.getPassword(), + // Proxy.NO_PROXY)); try { - client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); + client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), + new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); fail(); - } catch (Exception e) { + } catch (Exception e) { } task = (BugzillaTask) connector.createTaskFromExistingKey(repository, taskNumber); TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); @@ -344,13 +355,13 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { write.write("test file"); write.close(); attachment.setFilePath(attachFile.getAbsolutePath()); -// assertTrue(attachmentHandler.uploadAttachment(attachment, repository.getUserName(), repository.getPassword(), -// Proxy.NO_PROXY)); - try { - client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); - } catch (Exception e) { - fail(); - } + // assertTrue(attachmentHandler.uploadAttachment(attachment, + // repository.getUserName(), repository.getPassword(), + // Proxy.NO_PROXY)); + + client.postAttachment(attachment.getReport().getId(), attachment.getComment(), attachment.getDescription(), + new File(attachment.getFilePath()), attachment.getContentType(), attachment.isPatch()); + task = (BugzillaTask) connector.createTaskFromExistingKey(repository, taskNumber); TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); assertEquals(numAttached + 1, task.getTaskData().getAttachments().size()); @@ -380,8 +391,8 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { TasksUiPlugin.getRepositoryManager().setSyncTime(repository, task5.getLastSyncDateStamp(), TasksUiPlugin.getDefault().getRepositoriesFilePath()); - Set<AbstractRepositoryTask> changedTasks = connector.getTaskDataHandler().getChangedSinceLastSync( - repository, tasks); + Set<AbstractRepositoryTask> changedTasks = connector.getTaskDataHandler().getChangedSinceLastSync(repository, + tasks); assertEquals(0, changedTasks.size()); String priority4 = null; @@ -407,12 +418,12 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { submit(task4); submit(task5); -// BugzillaReportSubmitForm bugzillaReportSubmitForm; -// -// bugzillaReportSubmitForm = makeExistingBugPost(task4.getTaskData()); -// bugzillaReportSubmitForm.submitReportToRepository(connector.getClientManager().getClient(repository)); -// bugzillaReportSubmitForm = makeExistingBugPost(task5.getTaskData()); -// bugzillaReportSubmitForm.submitReportToRepository(connector.getClientManager().getClient(repository)); + // BugzillaReportSubmitForm bugzillaReportSubmitForm; + // + // bugzillaReportSubmitForm = makeExistingBugPost(task4.getTaskData()); + // bugzillaReportSubmitForm.submitReportToRepository(connector.getClientManager().getClient(repository)); + // bugzillaReportSubmitForm = makeExistingBugPost(task5.getTaskData()); + // bugzillaReportSubmitForm.submitReportToRepository(connector.getClientManager().getClient(repository)); changedTasks = connector.getTaskDataHandler().getChangedSinceLastSync(repository, tasks); assertEquals("Changed reports expected ", 2, changedTasks.size()); @@ -446,13 +457,13 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { TasksUiPlugin.getRepositoryManager().setSyncTime(repository, task7.getLastSyncDateStamp(), TasksUiPlugin.getDefault().getRepositoriesFilePath()); - assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getTaskData(IBugzillaConstants.TEST_BUGZILLA_222_URL, - "7")); + assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getTaskData( + IBugzillaConstants.TEST_BUGZILLA_222_URL, "7")); ArrayList<RepositoryTaskData> taskDataList = new ArrayList<RepositoryTaskData>(); taskDataList.add(task7.getTaskData()); TasksUiPlugin.getDefault().getTaskDataManager().remove(taskDataList); - assertNull(TasksUiPlugin.getDefault().getTaskDataManager().getTaskData(IBugzillaConstants.TEST_BUGZILLA_222_URL, - "7")); + assertNull(TasksUiPlugin.getDefault().getTaskDataManager().getTaskData( + IBugzillaConstants.TEST_BUGZILLA_222_URL, "7")); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task7.getSyncState()); assertNotNull(task7.getLastSyncDateStamp()); @@ -575,7 +586,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { } public void testTrustAllSslProtocolSocketFactory() throws Exception { - SslProtocolSocketFactory factory = new SslProtocolSocketFactory(); + SslProtocolSocketFactory factory = new SslProtocolSocketFactory(Proxy.NO_PROXY); Socket s; s = factory.createSocket("mylar.eclipse.org", 80); diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SslProtocolSocketFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SslProtocolSocketFactory.java index 0e95a6970..b9bfb8536 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SslProtocolSocketFactory.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SslProtocolSocketFactory.java @@ -14,6 +14,7 @@ package org.eclipse.mylar.internal.tasks.core; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.Proxy; import java.net.Socket; import java.net.UnknownHostException; @@ -21,17 +22,28 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import org.apache.commons.httpclient.ConnectTimeoutException; +import org.apache.commons.httpclient.Credentials; +import org.apache.commons.httpclient.ProxyClient; +import org.apache.commons.httpclient.UsernamePasswordCredentials; +import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.params.HttpConnectionParams; import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; import org.eclipse.mylar.context.core.MylarStatusHandler; -/** +/** * @author Nathan Hapke + * @author Rob Elves */ public class SslProtocolSocketFactory implements ProtocolSocketFactory { private SSLContext sslContext; + private Proxy proxy; + + public SslProtocolSocketFactory(Proxy proxy) { + this.proxy = proxy; + } + private SSLContext getSslContext() { if (sslContext == null) { try { @@ -39,7 +51,7 @@ public class SslProtocolSocketFactory implements ProtocolSocketFactory { sslContext.init(null, new TrustManager[] { new RepositoryTrustManager() }, null); } catch (Exception e) { MylarStatusHandler.log(e, "could not get SSL context"); - } + } } return sslContext; } @@ -58,6 +70,33 @@ public class SslProtocolSocketFactory implements ProtocolSocketFactory { if (params == null || params.getConnectionTimeout() == 0) return getSslContext().getSocketFactory().createSocket(remoteHost, remotePort, clientHost, clientPort); + if (proxy != null && !Proxy.NO_PROXY.equals(proxy) && proxy.address() instanceof InetSocketAddress) { + ProxyClient proxyClient = new ProxyClient(); + + InetSocketAddress address = (InetSocketAddress) proxy.address(); + proxyClient.getHostConfiguration().setProxy(WebClientUtil.getDomain(address.getHostName()), + address.getPort()); + proxyClient.getHostConfiguration().setHost(remoteHost, remotePort); + if (proxy instanceof AuthenticatedProxy) { + AuthenticatedProxy authProxy = (AuthenticatedProxy) proxy; + Credentials credentials = new UsernamePasswordCredentials(authProxy.getUserName(), authProxy + .getPassword()); + AuthScope proxyAuthScope = new AuthScope(address.getHostName(), address.getPort(), AuthScope.ANY_REALM); + proxyClient.getState().setProxyCredentials(proxyAuthScope, credentials); + } + + ProxyClient.ConnectResponse response = proxyClient.connect(); + if (response.getSocket() != null) { + // tunnel SSL via the resultant socket + Socket sslsocket = getSslContext().getSocketFactory().createSocket(response.getSocket(), remoteHost, + remotePort, true); + return sslsocket; + } else { + MylarStatusHandler.log("Could not make proxy connection. Trying direct...", this); + } + + } + Socket socket = getSslContext().getSocketFactory().createSocket(); socket.bind(new InetSocketAddress(clientHost, clientPort)); socket.connect(new InetSocketAddress(remoteHost, remotePort), params.getConnectionTimeout()); diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java index 44a4c671e..8b869d3a0 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java @@ -15,7 +15,6 @@ import java.net.InetSocketAddress; import java.net.Proxy; import java.net.Proxy.Type; -import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; @@ -115,17 +114,6 @@ public class WebClientUtil { //System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire.header", "debug"); //System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug"); - if (proxySettings != null && proxySettings.address() instanceof InetSocketAddress) { - InetSocketAddress address = (InetSocketAddress) proxySettings.address(); - client.getHostConfiguration().setProxy(WebClientUtil.getDomain(address.getHostName()), address.getPort()); - if (proxySettings instanceof AuthenticatedProxy) { - AuthenticatedProxy authProxy = (AuthenticatedProxy) proxySettings; - Credentials credentials = new UsernamePasswordCredentials(authProxy.getUserName(), authProxy - .getPassword()); - AuthScope proxyAuthScope = new AuthScope(address.getHostName(), address.getPort(), AuthScope.ANY_REALM); - client.getState().setProxyCredentials(proxyAuthScope, credentials); - } - } if (user != null && password != null) { AuthScope authScope = new AuthScope(WebClientUtil.getDomain(repositoryUrl), WebClientUtil @@ -134,7 +122,7 @@ public class WebClientUtil { } if (WebClientUtil.repositoryUsesHttps(repositoryUrl)) { - Protocol acceptAllSsl = new Protocol("https", new SslProtocolSocketFactory(), WebClientUtil + Protocol acceptAllSsl = new Protocol("https", new SslProtocolSocketFactory(proxySettings), WebClientUtil .getPort(repositoryUrl)); client.getHostConfiguration().setHost(WebClientUtil.getDomain(repositoryUrl), WebClientUtil.getPort(repositoryUrl), acceptAllSsl); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/UrlConnectionUtilTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/UrlConnectionUtilTest.java index df86e73ad..a84e5d6fe 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/UrlConnectionUtilTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/UrlConnectionUtilTest.java @@ -29,6 +29,11 @@ public class UrlConnectionUtilTest extends TestCase { assertEquals(321, WebClientUtil.getPort(url)); assertEquals("example.com", WebClientUtil.getDomain(url)); assertEquals("", WebClientUtil.getRequestPath(url)); + + url = "example.com:321"; + assertEquals(321, WebClientUtil.getPort(url)); + assertEquals("example.com", WebClientUtil.getDomain(url)); + assertEquals("", WebClientUtil.getRequestPath(url)); } } |