Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2016-07-11 17:13:32 -0400
committerGerrit Code Review @ Eclipse.org2016-07-14 16:08:39 -0400
commit4351b5505b4614adcdb1a093ef8f61fba69efc44 (patch)
tree821f4eb7170aa007ee00935253f8b1406faab268
parent4a0f348b7e484452c227585206a2cda6dd94d64d (diff)
downloadorg.eclipse.mylyn.tasks-4351b5505b4614adcdb1a093ef8f61fba69efc44.tar.gz
org.eclipse.mylyn.tasks-4351b5505b4614adcdb1a093ef8f61fba69efc44.tar.xz
org.eclipse.mylyn.tasks-4351b5505b4614adcdb1a093ef8f61fba69efc44.zip
497625: fix the two failing proxy junit tests
Change-Id: I14f61dd16ce1423f296d74e2bf15c0772aaef90f Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=497625
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryLocationTest.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryLocationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryLocationTest.java
index 89a69b422..5151be66b 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryLocationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryLocationTest.java
@@ -14,16 +14,17 @@ package org.eclipse.mylyn.tasks.tests.core;
import java.net.InetSocketAddress;
import java.net.Proxy;
-import junit.framework.TestCase;
-
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.UnsupportedRequestException;
+import org.eclipse.mylyn.commons.net.WebUtil;
import org.eclipse.mylyn.internal.commons.net.AuthenticatedProxy;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import junit.framework.TestCase;
+
/**
* @author Steffen Pingel
*/
@@ -51,15 +52,17 @@ public class TaskRepositoryLocationTest extends TestCase {
}
public void testGetProxyForHost() {
+ Proxy defaultProxy = WebUtil.getProxy("localhost", IProxyData.HTTP_PROXY_TYPE);
+
TaskRepository taskRepository = new TaskRepository("kind", "http://url");
TaskRepositoryLocation location = new TaskRepositoryLocation(taskRepository);
assertTrue(taskRepository.isDefaultProxyEnabled());
- assertEquals(null, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
+ assertEquals(defaultProxy, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
- taskRepository.setProperty(TaskRepository.PROXY_USEDEFAULT, "false");
+ taskRepository.setDefaultProxyEnabled(false);
assertFalse(taskRepository.isDefaultProxyEnabled());
- assertEquals(null, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
+ assertEquals(defaultProxy, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
taskRepository.setProperty(TaskRepository.PROXY_HOSTNAME, "host");
taskRepository.setProperty(TaskRepository.PROXY_PORT, "1234");
@@ -78,19 +81,19 @@ public class TaskRepositoryLocationTest extends TestCase {
}
public void testGetProxyForHostEmptyProxy() {
+ Proxy defaultProxy = WebUtil.getProxy("localhost", IProxyData.HTTP_PROXY_TYPE);
+
TaskRepository taskRepository = new TaskRepository("kind", "http://url");
TaskRepositoryLocation location = new TaskRepositoryLocation(taskRepository);
taskRepository.setDefaultProxyEnabled(false);
- assertEquals(null, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
-
taskRepository.setProperty(TaskRepository.PROXY_HOSTNAME, "");
taskRepository.setProperty(TaskRepository.PROXY_PORT, "");
- assertEquals(null, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
+ assertEquals(defaultProxy, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
taskRepository.setProperty(TaskRepository.PROXY_HOSTNAME, "");
taskRepository.setProperty(TaskRepository.PROXY_PORT, "abc");
- assertEquals(null, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
+ assertEquals(defaultProxy, location.getProxyForHost("localhost", IProxyData.HTTP_PROXY_TYPE));
}
public void testRequestCredentials() {

Back to the top