提交 404384ee 编写于 作者: A Alvaro Lobato 提交者: Daniel Beck

[JENKINS-36908] Make sure that the All view is created (#2472)

* [JENKINS-36908] Make sure that the All view is created

* Revert old All view behaviour

* Fix changed comment

* Tests

* Delete unwanted file.
上级 a8ee5752
......@@ -2868,15 +2868,12 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
// initialize views by inserting the default view if necessary
// this is both for clean Jenkins and for backward compatibility.
if(views.size()==0) {
if(views.size()==0 || primaryView==null) {
View v = new AllView(Messages.Hudson_ViewName());
setViewOwner(v);
views.add(0,v);
primaryView = v.getViewName();
}
if (primaryView==null) {
primaryView = views.get(0).getViewName();
}
if (useSecurity!=null && !useSecurity) {
// forced reset to the unsecure mode.
......
......@@ -64,6 +64,7 @@ import org.jvnet.hudson.test.JenkinsRule.WebClient;
import org.jvnet.hudson.test.MockAuthorizationStrategy;
import org.jvnet.hudson.test.MockFolder;
import org.jvnet.hudson.test.TestExtension;
import org.jvnet.hudson.test.recipes.LocalData;
import org.kohsuke.stapler.DataBoundConstructor;
/**
......@@ -505,5 +506,20 @@ public class ViewTest {
private void assertCheckJobName(ViewGroup context, String name, FormValidation.Kind expected) {
assertEquals(expected, context.getPrimaryView().doCheckJobName(name).kind);
}
@Test
@Issue("JENKINS-36908")
@LocalData
public void testAllViewCreatedIfNoPrimary() throws Exception {
assertNotNull(j.getInstance().getView("All"));
}
@Test
@Issue("JENKINS-36908")
@LocalData
public void testAllViewNotCreatedIfPrimary() throws Exception {
assertNull(j.getInstance().getView("All"));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册