提交 bcd94569 编写于 作者: V Vincent Latombe

Merge branch 'master' into views_include_jobs_folder

......@@ -60,12 +60,24 @@ Upcoming changes</a>
<li class=rfe>
Added confirmation dialog before reloading configuration from disk.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15340">issue 15340</a>)
<li class=rfe>
Switched confirmation before deleting jobs or wiping out workspace to a dialog.
<li class=rfe>
Different text than “Build Now” for parameterized jobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10738">issue 10738</a>)
<li class=bug>
“Build Now” context menu item broken for parameterized jobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17110">issue 17110</a>)
<li class=bug>
Incorrect redirection after delete of job in folder in view.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17575">issue 17575</a>)
<li class=bug>
”My Views" links leads to 404 Not Found.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17317">issue 17317</a>)
<li class=bug>
Quoting Issue with JDK Installer with Windows Installer.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-5408">issue 5408</a>)
</ul>
</ul>
</div><!--=TRUNK-END=-->
......@@ -190,6 +202,9 @@ Upcoming changes</a>
<li class=bug>
JNA-related error from Windows slave monitoring thrown repeatedly.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15796">issue 15796</a>)
<li class=bug>
New JSON library corrects problems such as form values starting with <code>[</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-14827">issue 14827</a>)
<li class=rfe>
Improved the request handling performance (where the file lookup is expensive, such as on NFS).
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16606">issue 16606</a>)
......
......@@ -494,6 +494,9 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
/**
* Deletes this item.
* Note on the funny name: for reasons of historical compatibility, this URL is {@code /doDelete}
* since it predates {@code <l:confirmationLink>}. {@code /delete} goes to a Jelly page
* which should now be unused by core but is left in case plugins are still using it.
*/
@CLIMethod(name="delete-job")
@RequirePOST
......
......@@ -95,6 +95,7 @@ import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.ForwardToView;
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.HttpResponse;
......@@ -117,6 +118,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
......@@ -1880,11 +1882,20 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
delete();
if (req == null || rsp == null)
return;
View view = req.findAncestorObject(View.class);
if (view == null)
rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl());
else
rsp.sendRedirect2(req.getContextPath() + '/' + view.getUrl());
List<Ancestor> ancestors = req.getAncestors();
ListIterator<Ancestor> it = ancestors.listIterator(ancestors.size());
String url = getParent().getUrl(); // fallback but we ought to get to Jenkins.instance at the root
while (it.hasPrevious()) {
Object a = it.previous().getObject();
if (a instanceof View) {
url = ((View) a).getUrl();
break;
} else if (a instanceof ViewGroup) {
url = ((ViewGroup) a).getUrl();
break;
}
}
rsp.sendRedirect2(req.getContextPath() + '/' + url);
}
@Override
......
......@@ -145,7 +145,7 @@ public class MyViewsProperty extends UserProperty implements ViewGroup, Action,
}
public HttpResponse doIndex() {
return new HttpRedirect("view/" + getPrimaryView().getViewName() + "/");
return new HttpRedirect("view/" + Util.encode(getPrimaryView().getViewName()) + "/");
}
public synchronized void doCreateView(StaplerRequest req, StaplerResponse rsp)
......@@ -262,5 +262,5 @@ public class MyViewsProperty extends UserProperty implements ViewGroup, Action,
}
}
}
......@@ -475,6 +475,10 @@ public abstract class View extends AbstractModelObject implements AccessControll
return (owner!=null ? owner.getUrl() : "") + "view/" + Util.rawEncode(getViewName()) + '/';
}
@Override public String toString() {
return super.toString() + "[" + getViewUrl() + "]";
}
public String getSearchUrl() {
return getUrl();
}
......
......@@ -227,10 +227,10 @@ public class JDKInstaller extends ToolInstaller {
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(jdkBundle);
if (isJava15() || isJava14()) {
args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\\\""+ expectedLocation +"\\\" /L \\\""+logFile+"\\\"");
args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\""+ expectedLocation +"\" /L \""+logFile+"\"");
} else {
// modern version supports arguments in more sane format.
args.add("/s","/v","/qn","/L","\\\""+logFile+"\\\"","REBOOT=ReallySuppress","INSTALLDIR=\\\""+ expectedLocation+"\\\"");
args.add("/s","/v","/qn","/L","\""+logFile+"\"","REBOOT=ReallySuppress","INSTALLDIR=\""+ expectedLocation+"\"");
}
// according to http://community.acresso.com/showthread.php?t=83301, \" is the trick to quote values with whitespaces.
// Oh Windows, oh windows, why do you have to be so difficult?
......
......@@ -23,10 +23,7 @@ THE SOFTWARE.
-->
<!--
Delete this job.
Some jobs cannot be deleted by the user, so this view is not necessarily
applicable to all jobs.
@deprecated Use a l:confirmationLink directly to /job/*/doDelete.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
......
......@@ -41,7 +41,7 @@ THE SOFTWARE.
<l:task icon="images/24x24/search.png" href="${url}/" title="${%Status}" contextMenu="false"/>
<l:task icon="images/24x24/notepad.png" href="${url}/changes" title="${%Changes}" />
<l:task icon="images/24x24/folder.png" href="${url}/ws/" title="${%Workspace}" permission="${it.WORKSPACE}">
<l:task icon="images/24x24/folder-delete.png" href="${url}/wipeOutWorkspace" title="${%Wipe Out Workspace}" permission="${h.isWipeOutPermissionEnabled() ? it.WIPEOUT : it.BUILD}" />
<l:task icon="images/24x24/folder-delete.png" href="${url}/doWipeOutWorkspace" title="${%Wipe Out Workspace}" permission="${h.isWipeOutPermissionEnabled() ? it.WIPEOUT : it.BUILD}" post="true" requiresConfirmation="true" confirmationMessage="${%wipe.out.confirm}"/>
</l:task>
<j:if test="${it.configurable}">
<j:if test="${it.buildable}">
......@@ -56,7 +56,7 @@ THE SOFTWARE.
}
</script>
</j:if>
<l:task icon="images/24x24/edit-delete.png" href="${url}/delete" title="${%delete(it.pronoun)}" permission="${it.DELETE}" />
<l:task icon="images/24x24/edit-delete.png" href="${url}/doDelete" title="${%delete(it.pronoun)}" permission="${it.DELETE}" post="true" requiresConfirmation="true" confirmationMessage="${%delete.confirm(it.pronoun, it.displayName)}"/>
<j:choose>
<j:when test="${h.hasPermission(it,it.CONFIGURE)}">
<l:task icon="images/24x24/setting.png" href="${url}/configure" title="${%Configure}" />
......
......@@ -21,3 +21,5 @@
# THE SOFTWARE.
delete=Delete {0}
delete.confirm=Are you sure about deleting the {0} \u2018{1}\u2019?
wipe.out.confirm=Are you sure about wiping out the workspace?
......@@ -29,3 +29,4 @@ Workspace=Arbejdsomr\u00e5de
Build\ scheduled=Byg skeduleret
View\ Configuration=Vis konfiguration
Wipe\ Out\ Workspace=Slet arbejdsomr\u00e5det
wipe.out.confirm=Er du sikker p\u00e5 at du vil slette arbejdsomr\u00e5det?
......@@ -20,13 +20,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Back\ to\ Dashboard= Zurück zur Übersicht
Back\ to\ Dashboard= Zur\u00fcck zur \u00dcbersicht
Status=Status
Changes=Änderungen
Changes=\u00c4nderungen
Workspace=Arbeitsbereich
delete={0} L\u00F6schen
delete={0} L\u00f6schen
Configure=Konfigurieren
View\ Configuration=Konfiguration anzeigen
Build\ scheduled=Build geplant
Wipe\ Out\ Workspace=Arbeitsbereich löschen
Wipe\ Out\ Workspace=Arbeitsbereich l\u00f6schen
View\ Configuration=Konfiguration anzeigen
wipe.out.confirm=Sind Sie sicher, dass sie den Arbeitsbereich l\u00f6schen m\u00f6chten?
......@@ -20,13 +20,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Build\ scheduled=Ejecuci\u00F3n agendada
Build\ scheduled=Ejecuci\u00f3n agendada
Changes=Cambios
Configure=Configurar
Status=Estado
Wipe\ Out\ Workspace=Limpiar el Espacio de trabajo
Workspace=Espacio de trabajo
delete=Borrar {0}
View\ Configuration=Ver la configuración
View\ Configuration=Ver la configuraci\u00f3n
Back\ to\ Dashboard=Volver al Panel de control
wipe.out.confirm=\u00bfEst\u00e1s seguro de que quieres limpiar el espacio de trabajo?
......@@ -21,10 +21,11 @@
# THE SOFTWARE.
Back\ to\ Dashboard=Retour au tableau de bord
Status=\u00C9tat
Status=\u00c9tat
Changes=Modifications
Workspace=Espace de travail
delete=Supprimer ce {0}
Configure=Configurer
Build\ scheduled=Construction programm\u00E9e
Wipe\ Out\ Workspace=Effacer le r\u00E9pertoire de travail
Build\ scheduled=Construction programm\u00e9e
Wipe\ Out\ Workspace=Effacer le r\u00e9pertoire de travail
wipe.out.confirm=Voulez-vous vraiment effacer le r\u00e9pertoire de travail?
......@@ -21,10 +21,11 @@
# THE SOFTWARE.
Back\ to\ Dashboard=
Build\ scheduled=Id\u0151z\u00EDtett \u00E9p\u00EDt\u00E9s
Changes=V\u00E1ltoz\u00E1sok
Configure=Be\u00E1ll\u00EDt\u00E1sok
Status=\u00C1llapot
Wipe\ Out\ Workspace=Munkater\u00FClet t\u00F6rl\u00E9se
Workspace=Munkater\u00FClet
delete=T\u00F6rl\u00E9s {0}
Build\ scheduled=Id\u0151z\u00edtett \u00e9p\u00edt\u00e9s
Changes=V\u00e1ltoz\u00e1sok
Configure=Be\u00e1ll\u00edt\u00e1sok
Status=\u00c1llapot
Wipe\ Out\ Workspace=Munkater\u00fclet t\u00f6rl\u00e9se
Workspace=Munkater\u00fclet
delete=T\u00f6rl\u00e9s {0}
wipe.out.confirm=Biztosan t\u00f6r\u00f6lni akarja a munkater\u00fcletet?
......@@ -28,3 +28,4 @@ Status=Stato
Wipe\ Out\ Workspace=Pulisci workspace
Workspace=Workspace
delete=Elimina {0}
wipe.out.confirm=Sei sicuro di voler pulire il workspace?
......@@ -29,3 +29,4 @@ delete={0}\u306e\u524a\u9664
Configure=\u8a2d\u5b9a
Build\ scheduled=\u30d3\u30eb\u30c9\u304c\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f
View\ Configuration=\u8a2d\u5b9a\u306e\u53c2\u7167
wipe.out.confirm=\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u30af\u30ea\u30a2\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b?
......@@ -22,10 +22,11 @@
Back\ to\ Dashboard=Voltar para Painel Principal
Status=Status
Build\ scheduled=Constru\u00E7\u00E3o agendada
Build\ scheduled=Constru\u00e7\u00e3o agendada
Changes=Mudan\u00e7as
Wipe\ Out\ Workspace=Limpar Workspace
Workspace=\u00c1rea de Trabalho
delete=Excluir {0}
Configure=Configurar
View\ Configuration= Configurar a View
wipe.out.confirm=Tem certeza que quer excluir esse workspace?
......@@ -20,11 +20,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Back\ to\ Dashboard=\u041D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E
Back\ to\ Dashboard=\u041d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e
Status=\u0421\u0442\u0430\u0442\u0443\u0441
Changes=\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f
Wipe\ Out\ Workspace=\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0447\u0435\u0435 \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u043E
Workspace=\u0421\u0431\u043E\u0440\u043E\u0447\u043D\u0430\u044F \u0434\u0438\u0440\u0435\u043A\u0442\u043E\u0440\u0438\u044F
delete=\u0423\u0434\u0430\u043B\u0438\u0442\u044C {0}
Configure=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438
Wipe\ Out\ Workspace=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e
Workspace=\u0421\u0431\u043e\u0440\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f
delete=\u0423\u0434\u0430\u043b\u0438\u0442\u044c {0}
Configure=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
Build\ scheduled=\u0421\u0431\u043e\u0440\u043a\u0430 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0430
wipe.out.confirm=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u0421\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0439 \u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438?
......@@ -22,9 +22,10 @@
Back\ to\ Dashboard=Tillbaka till instrumentpanelen
Build\ scheduled=Jobb schemalagt
Changes=F\u00F6r\u00E4ndringar
Changes=F\u00f6r\u00e4ndringar
Configure=Konfigurera
Status=Status
Wipe\ Out\ Workspace=Ta bort arbetsyta
Workspace=Arbetsyta
delete=Ta bort {0}
wipe.out.confirm=\u00c4r du s\u00e4ker p\u00e5 att du vill rensa arbetsytan?
......@@ -21,11 +21,12 @@
# THE SOFTWARE.
Back\ to\ Dashboard=\u8fd4\u56de
Build\ scheduled=\u6784\u5EFA\u5DF2\u5B89\u6392
Build\ scheduled=\u6784\u5efa\u5df2\u5b89\u6392
Changes=\u53d8\u66f4\u96c6
Configure=\u914D\u7F6E
Configure=\u914d\u7f6e
Status=\u72b6\u6001
View\ Configuration=\u67E5\u770B\u914D\u7F6E
View\ Configuration=\u67e5\u770b\u914d\u7f6e
Wipe\ Out\ Workspace=\u6e05\u7a7a\u5de5\u4f5c\u533a
Workspace=\u5de5\u4f5c\u533a
delete=\u5220\u9664 {0}
wipe.out.confirm=\u786e\u5b9a\u60f3\u8981\u6e05\u7a7a\u5de5\u4f5c\u533a\u5417\uff1f
......@@ -32,3 +32,4 @@ Build\ scheduled=\u5df2\u6392\u5165\u5efa\u7f6e
delete=\u522a\u9664{0}
Configure=\u8a2d\u5b9a
View\ Configuration=\u6aa2\u8996\u8a2d\u5b9a
wipe.out.confirm=\u78ba\u5b9a\u8981\u6e05\u9664\u5de5\u4f5c\u5340?
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!-- ask the user if he's ready to wipe out the workspace -->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout>
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1><img src="${imagesURL}/48x48/folder-delete.png" alt="" height="48" width="48"/> ${%title}</h1>
<form id="confirmation" method="post" action="doWipeOutWorkspace">
<f:submit value="${%Yes}" />
</form>
</l:main-panel>
</l:layout>
</j:jelly>
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=Are you sure about wiping out the workspace?
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=Ja
title=Er du sikker p\u00e5 at du vil slette arbejdsomr\u00e5det?
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=Sind Sie sicher, dass sie den Arbeitsbereich löschen möchten?
Yes=Ja
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=¿Estás seguro de que quieres limpiar el espacio de trabajo?
Yes=
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=Voulez-vous vraiment effacer le répertoire de travail?
Yes=Oui
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=Igen
title=Biztosan t\u00F6r\u00F6lni akarja a munkater\u00FCletet?
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=Si
title=Sei sicuro di voler pulire il workspace?
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u30af\u30ea\u30a2\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b?
Yes=\u5b9f\u884c
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc., Cleiber Silva
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=Sim
# Are you sure about wiping out the workspace?
title=Tem certeza que quer excluir esse workspace?
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=\u0414\u0430
title=\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043E \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0444\u0430\u0439\u043B\u044B \u0438\u0437 \u0421\u0431\u043E\u0440\u043E\u0447\u043D\u043E\u0439 \u0414\u0438\u0440\u0435\u043A\u0442\u043E\u0440\u0438\u0438?
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=Ja
title=\u00C4r du s\u00E4ker p\u00E5 att du vill rensa arbetsytan?
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Yes=\u662F
title=\u786E\u5B9A\u60F3\u8981\u6E05\u7A7A\u5DE5\u4F5C\u533A\u5417\uFF1F
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
title=\u78ba\u5b9a\u8981\u6e05\u9664\u5de5\u4f5c\u5340?
Yes=\u662f
......@@ -38,13 +38,15 @@ THE SOFTWARE.
A confirmation dialog message.
</st:attribute>
</st:documentation>
<j:set var="id" value="${h.generateId()}"/>
<form method="${post ? 'POST' : 'GET'}" action="${attrs.href}" name="${id}"/>
<a href="#" onclick="confirmPOST('${id}', '${message}')"><d:invokeBody/></a>
<a href="#" onclick="confirmPOST(${post ?: 'false'}, '${attrs.href}', '${h.jsStringEscape(message)}')"><d:invokeBody/></a>
<script>
function confirmPOST(id, message) {
function confirmPOST(post, href, message) {
if (confirm(message)) {
document[id].submit();
var form = document.createElement('form');
form.setAttribute('method', post ? 'POST' : 'GET');
form.setAttribute('action', href);
document.body.appendChild(form);
form.submit();
}
return false;
}
......
......@@ -67,6 +67,10 @@ THE SOFTWARE.
(onclick supersedes this except in the context menu.)
(since 1.512)
</st:attribute>
<st:attribute name="confirmationMessage">
Message to use for confirmation, if requested; defaults to title.
(since 1.512)
</st:attribute>
</st:documentation>
<!--
......@@ -123,7 +127,7 @@ THE SOFTWARE.
<j:choose>
<j:when test="${requiresConfirmation and not attrs.onClick}">
<l:confirmationLink href="${href}" post="${post}">
<l:confirmationLink href="${href}" post="${post}" message="${confirmationMessage ?: title}">
<img width="24" height="24" style="margin: 2px;" alt="" src="${icon}"/>
</l:confirmationLink>
</j:when>
......@@ -137,7 +141,7 @@ THE SOFTWARE.
<j:choose>
<j:when test="${requiresConfirmation and not attrs.onClick}">
<l:confirmationLink href="${href}" post="${post}">
<l:confirmationLink href="${href}" post="${post}" message="${confirmationMessage ?: title}">
<j:choose>
<j:when test="${match}">
<b>${title}</b>
......
......@@ -26,27 +26,40 @@ package org.jvnet.hudson.test;
import hudson.Extension;
import hudson.model.AbstractItem;
import hudson.model.Action;
import hudson.model.AllView;
import hudson.model.FreeStyleProject;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.ItemGroupMixIn;
import hudson.model.Job;
import hudson.model.TopLevelItem;
import hudson.model.TopLevelItemDescriptor;
import hudson.model.View;
import hudson.model.ViewGroup;
import hudson.model.ViewGroupMixIn;
import hudson.util.Function1;
import hudson.views.DefaultViewsTabBar;
import hudson.views.ViewsTabBar;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.model.ModifiableTopLevelItemGroup;
import org.kohsuke.stapler.StaplerFallback;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.WebMethod;
/**
* Minimal implementation of a modifiable item group akin to the CloudBees Folders plugin.
......@@ -54,9 +67,12 @@ import org.kohsuke.stapler.StaplerResponse;
* @since 1.494
*/
@SuppressWarnings({"unchecked", "rawtypes"}) // the usual API mistakes
public class MockFolder extends AbstractItem implements ModifiableTopLevelItemGroup, TopLevelItem { // could be a ViewGroup too
public class MockFolder extends AbstractItem implements ModifiableTopLevelItemGroup, TopLevelItem, ViewGroup, StaplerFallback {
private transient Map<String,TopLevelItem> items = new TreeMap<String,TopLevelItem>();
private final List<View> views = new ArrayList<View>(Collections.singleton(new AllView("All", this)));
private String primaryView;
private ViewsTabBar viewsTabBar;
private MockFolder(ItemGroup parent, String name) {
super(parent, name);
......@@ -102,6 +118,20 @@ public class MockFolder extends AbstractItem implements ModifiableTopLevelItemGr
};
}
private ViewGroupMixIn vgmixin() {
return new ViewGroupMixIn(this) {
@Override protected List<View> views() {
return views;
}
@Override protected String primaryView() {
return primaryView != null ? primaryView : views.get(0).getViewName();
}
@Override protected void primaryView(String newName) {
primaryView = newName;
}
};
}
@Override public <T extends TopLevelItem> T copy(T src, String name) throws IOException {
return mixin().copy(src, name);
}
......@@ -145,6 +175,63 @@ public class MockFolder extends AbstractItem implements ModifiableTopLevelItemGr
return Jenkins.getInstance().getDescriptorByType(DescriptorImpl.class);
}
public void addView(View view) throws IOException {
vgmixin().addView(view);
}
@Override public boolean canDelete(View view) {
return vgmixin().canDelete(view);
}
@Override public void deleteView(View view) throws IOException {
vgmixin().deleteView(view);
}
@Override public Collection<View> getViews() {
return vgmixin().getViews();
}
@Override public View getView(String name) {
return vgmixin().getView(name);
}
@Override public View getPrimaryView() {
return vgmixin().getPrimaryView();
}
@Override public void onViewRenamed(View view, String oldName, String newName) {
vgmixin().onViewRenamed(view, oldName, newName);
}
@Override public ViewsTabBar getViewsTabBar() {
if (viewsTabBar == null) {
viewsTabBar = new DefaultViewsTabBar();
}
return viewsTabBar;
}
@Override public ItemGroup<? extends TopLevelItem> getItemGroup() {
return this;
}
@Override public List<Action> getViewActions() {
// XXX what should the default be? View.getOwnerViewActions uses Jenkins.actions; Jenkins.viewActions would make more sense as a default;
// or should it be empty by default since non-top-level folders probably do not need the same actions as root?
return Collections.emptyList();
}
@Override public Object getStaplerFallback() {
return getPrimaryView();
}
/**
* Same as {@link #getItem} but named this way as a {@link WebMethod}.
* @see Hudson#getJob
*/
public TopLevelItem getJob(String name) {
return getItem(name);
}
@Extension public static class DescriptorImpl extends TopLevelItemDescriptor {
@Override public String getDisplayName() {
......
......@@ -66,7 +66,8 @@ public class ConsoleAnnotatorTest extends HudsonTestCase {
assertTrue(raw.getContent().contains(nl+"---"+nl+"ooo"+nl+"ooo"+nl));
// there should be two 'ooo's
assertEquals(3,rsp.asXml().split("ooo").length);
String xml = rsp.asXml();
assertEquals(xml, 3, xml.split("ooo").length);
}
/**
......
......@@ -24,6 +24,8 @@
package hudson.model;
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
......@@ -58,6 +60,7 @@ import java.util.concurrent.Future;
import org.apache.commons.io.FileUtils;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import org.jvnet.hudson.test.MockFolder;
/**
......@@ -85,13 +88,7 @@ public class AbstractProjectTest extends HudsonTestCase {
assertTrue("Workspace should exist by now",
b.getWorkspace().exists());
// emulate the user behavior
WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(project);
page = (HtmlPage)page.getFirstAnchorByText("Workspace").click();
page = (HtmlPage)page.getFirstAnchorByText("Wipe Out Workspace").click();
page = (HtmlPage)((HtmlForm)page.getElementById("confirmation")).submit(null);
project.doDoWipeOutWorkspace();
assertFalse("Workspace should be gone by now",
b.getWorkspace().exists());
......@@ -382,4 +379,28 @@ public class AbstractProjectTest extends HudsonTestCase {
assertFalse(b.getRootDir().isDirectory());
}
@Bug(17575)
public void testDeleteRedirect() throws Exception {
createFreeStyleProject("j1");
assertEquals("", deleteRedirectTarget("job/j1"));
createFreeStyleProject("j2");
Jenkins.getInstance().addView(new AllView("v1"));
assertEquals("view/v1/", deleteRedirectTarget("view/v1/job/j2"));
MockFolder d = Jenkins.getInstance().createProject(MockFolder.class, "d");
d.addView(new AllView("v2"));
d.createProject(FreeStyleProject.class, "j3");
d.createProject(FreeStyleProject.class, "j4");
d.createProject(FreeStyleProject.class, "j5");
assertEquals("job/d/", deleteRedirectTarget("job/d/job/j3"));
assertEquals("job/d/view/v2/", deleteRedirectTarget("job/d/view/v2/job/j4"));
assertEquals("view/v1/job/d/", deleteRedirectTarget("view/v1/job/d/job/j5"));
}
private String deleteRedirectTarget(String job) throws Exception {
WebClient wc = new WebClient();
String base = wc.getContextPath();
String loc = wc.getPage(wc.addCrumb(new WebRequestSettings(new URL(base + job + "/doDelete"), HttpMethod.POST))).getWebResponse().getUrl().toString();
assertTrue(loc, loc.startsWith(base));
return loc.substring(base.length());
}
}
......@@ -44,8 +44,8 @@ import org.jvnet.hudson.test.Email;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.LocalData;
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
......@@ -152,10 +152,10 @@ public class HudsonTest extends HudsonTestCase {
// try to delete it by hitting the final URL directly
WebRequestSettings req = new WebRequestSettings(new URL(wc.getContextPath()+"computer/(master)/doDelete"), HttpMethod.POST);
try {
wc.getPage(req);
wc.getPage(wc.addCrumb(req));
fail("Error code expected");
} catch (FailingHttpStatusCodeException e) {
assertEquals(SC_FORBIDDEN,e.getStatusCode());
assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, e.getStatusCode());
}
// the master computer object should be still here
......
......@@ -38,11 +38,9 @@ public class ManagementLinkTest extends HudsonTestCase {
*/
public void testLinks() throws Exception {
HtmlPage page = new WebClient().goTo("manage");
List<?> anchors = page.selectNodes("id('management-links')//*[@class='link']/a");
List<?> anchors = page.selectNodes("id('management-links')//*[@class='link']/a[not(@onclick)]");
assertTrue(anchors.size()>=8);
for(HtmlAnchor e : (List<HtmlAnchor>) anchors) {
if(e.getHrefAttribute().endsWith("reload"))
continue; // can't really click this
e.click();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册