Skip to content

Commit

Permalink
Fix JENKINS-21067 by jumping hoops
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed Dec 18, 2013
1 parent c4f0aeb commit c3d922b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Expand Up @@ -32,6 +32,7 @@

import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.Functions;
import hudson.model.AdministrativeMonitor;
import hudson.model.AutoCompletionCandidates;
import hudson.model.Describable;
Expand Down Expand Up @@ -110,7 +111,8 @@ public DescriptorImpl getDescriptor() {
@Override
public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
ContextMenu menu = new ContextMenu();
menu.add("newServer", "/images/24x24/new-package.png", Messages.AddNewServer());
menu.add("newServer", Functions.joinPath(Jenkins.getInstance().getRootUrl(), Functions.getResourcePath(),
"images", "24x24", "new-package.png"), Messages.AddNewServer());
for (GerritServer server : getServers()) {
menu.add(server);
}
Expand Down
Expand Up @@ -202,7 +202,12 @@ public String getDisplayName() {
@Override
public String getUrlName() {
//Lets make an absolute url to circumvent some buggy things in core
return Functions.joinPath("/", getParentUrl(), "server", getUrlEncodedName());
if (Jenkins.getInstance().getRootUrl() != null) {
return Functions.joinPath(Jenkins.getInstance().getRootUrl(),
getParentUrl(), "server", getUrlEncodedName());
} else {
return Functions.joinPath("/", getParentUrl(), "server", getUrlEncodedName());
}
}

/**
Expand Down
Expand Up @@ -15,9 +15,9 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.sonyericsson.hudson.plugins.gerrit.trigger;

import static com.sonyericsson.hudson.plugins.gerrit.trigger.test.SshdServerMock.GERRIT_STREAM_EVENTS;

import hudson.Functions;
import org.apache.sshd.SshServer;
import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;
Expand Down Expand Up @@ -227,8 +227,7 @@ public void testRemoveOneServerWithoutConfiguredJob() throws IOException {
*/
private void removeServer(String serverName, HtmlPage serverPage) throws IOException {
HtmlPage currentPage = serverPage;
String serverLink = Functions.joinPath("/", GerritManagement.URL_NAME, "server", serverName);
HtmlPage configPage = currentPage.getAnchorByHref(serverLink).click();
HtmlPage configPage = currentPage.getAnchorByText(serverName).click();
HtmlPage removalPage = configPage.getAnchorByHref("remove").click();

int serverSize = PluginImpl.getInstance().getServers().size();
Expand Down

0 comments on commit c3d922b

Please sign in to comment.