-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-68008] Remove unnecessary usage of AHCUtils
- Loading branch information
Showing
3 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/com/cloudbees/jenkins/support/impl/UpdateCenterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.cloudbees.jenkins.support.impl; | ||
|
||
import com.cloudbees.jenkins.support.SupportTestUtils; | ||
import com.cloudbees.jenkins.support.api.Component; | ||
import hudson.ExtensionList; | ||
import hudson.ProxyConfiguration; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import static org.hamcrest.CoreMatchers.containsString; | ||
import static org.hamcrest.CoreMatchers.not; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class UpdateCenterTest { | ||
|
||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
@Issue("JENKINS-68008") | ||
public void testUpdateCenterProxyContent() { | ||
|
||
List<String> noProxyHosts = Arrays.asList(".server.com", "*.example.com"); | ||
j.jenkins.get().setProxy(new ProxyConfiguration("proxy.server.com", 1234, "proxyUser", "proxyPass", | ||
String.join("\n", noProxyHosts), "http://localhost:8080")); | ||
|
||
String ucMdToString = SupportTestUtils.invokeComponentToString(Objects.requireNonNull(ExtensionList.lookup(Component.class).get(UpdateCenter.class))); | ||
assertThat(ucMdToString, containsString(" - Host: proxy.server.com")); | ||
assertThat(ucMdToString, containsString(" - Port: 1234")); | ||
assertThat(ucMdToString, not(containsString("proxyUser"))); | ||
assertThat(ucMdToString, not(containsString("proxyPass"))); | ||
for (String noProxyHost : noProxyHosts) { | ||
assertThat(ucMdToString, containsString(" * " + noProxyHost)); | ||
} | ||
} | ||
} |