Java 类hudson.model.ListView 实例源码

项目:yaml-project-plugin    文件:BinderTest.java   
@Test
public void testBindView_simpleWithJob() throws Exception {
  JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_LIST_VIEW);
  json.put("name", NAME);

  // Add our job to the list view
  json.put(project.getName(), true);

  View view = underTest.bindView(viewGroupMixIn, NAME, json);

  assertNotNull(view);
  assertThat(view, instanceOf(ListView.class));
  assertEquals(NAME, view.getViewName());
  assertTrue(views.contains(view));

  ListView listView = (ListView) view;
  assertTrue(listView.jobNamesContains(project));
}
项目:yaml-project-plugin    文件:BinderTest.java   
@Test
public void testBindView_simpleWithJobAndColumns() throws Exception {
  JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_LIST_VIEW);
  json.put("name", NAME);

  // Add our job to the list view
  json.put(project.getName(), true);

  // Add some columns to the view.
  JSONArray columns = (JSONArray) JSONSerializer.toJSON(COLUMNS_JSON);
  json.put("columns", columns);

  View view = underTest.bindView(viewGroupMixIn, NAME, json);

  assertNotNull(view);
  assertThat(view, instanceOf(ListView.class));
  assertEquals(NAME, view.getViewName());
  assertTrue(views.contains(view));

  ListView listView = (ListView) view;
  assertTrue(listView.jobNamesContains(project));
  assertEquals(2, listView.getColumns().size());
}
项目:jenkins-config-cloner    文件:RecipeTest.java   
@Test
public void runRecipe() throws Exception {

    j.jenkins.createProject(FreeStyleProject.class, "src_job");
    j.jenkins.addView(new ListView("src_view"));
    j.createSlave("src_slave", "label", null);

    run("-p", "url=" + j.jenkins.getRootUrl(), recipe(
            "def url = properties.url\n" +
            "clone.job url+'job/src_job', url+'job/dst_job'\n" +
            "clone.view url+'view/src_view', url+'view/dst_view'\n" +
            "clone.node url+'computer/src_slave', url+'computer/dst_slave'\n"
    ));

    assertThat(rsp, succeeded());
    assertThat(j.jenkins.getItem("dst_job"), notNullValue());
    assertThat(j.jenkins.getView("dst_view"), notNullValue());
    assertThat(j.jenkins.getNode("dst_slave"), notNullValue());
}
项目:jenkins-config-cloner    文件:RecipeTest.java   
@Test
public void useDoubleColonNotation() throws Exception {

    j.jenkins.createProject(FreeStyleProject.class, "src_job");
    j.jenkins.addView(new ListView("src_view"));
    j.createSlave("src_slave", "label", null);

    String url = j.jenkins.getRootUrl();
    run(recipe(
            "clone.job '" + url + "::src_job', '" + url + "::dst_job'\n" +
            "clone.view '" + url + "::src_view', '" + url + "::dst_view'\n" +
            "clone.node '" + url + "::src_slave', '" + url + "::dst_slave'\n"
    ));

    assertThat(rsp, succeeded());
    assertThat(j.jenkins.getItem("dst_job"), notNullValue());
    assertThat(j.jenkins.getView("dst_view"), notNullValue());
    assertThat(j.jenkins.getNode("dst_slave"), notNullValue());
}
项目:jenkins-config-cloner    文件:RecipeTest.java   
@Test
public void doNotModifyWehnUsingDryRun() throws Exception {

    j.jenkins.createProject(FreeStyleProject.class, "src_job");
    j.jenkins.addView(new ListView("src_view"));
    j.createSlave("src_slave", "label", null);

    String url = j.jenkins.getRootUrl();
    run("--dry-run", recipe(
            "clone.job '" + url + "job/src_job', '" + url + "job/dst_job'\n" +
            "clone.view '" + url + "view/src_view', '" + url + "view/dst_view'\n" +
            "clone.node '" + url + "computer/src_slave', '" + url + "computer/dst_slave'\n"
    ));

    assertThat(rsp, succeeded());
    assertThat(j.jenkins.getItem("dst_job"), nullValue());
    assertThat(j.jenkins.getView("dst_view"), nullValue());
    assertThat(j.jenkins.getNode("dst_slave"), nullValue());
}
项目:yaml-project-plugin    文件:BinderTest.java   
@Test
public void testBindView_simple() throws Exception {
  JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_LIST_VIEW);

  json.put("name", NAME);

  View view = underTest.bindView(viewGroupMixIn, NAME, json);

  assertNotNull(view);
  assertThat(view, instanceOf(ListView.class));
  assertEquals(NAME, view.getViewName());
  assertTrue(views.contains(view));
}
项目:jenkins-config-cloner    文件:CloneViewIntegrationTest.java   
@Test
@Ignore(value="TODO: Update CreateViewCommand to create view in arbitrary ViewGroup")
public void cloneNestedView() throws IOException {

    NestedView group = viewGroup("group");
    ListView srcView = view("SrcView", group);
    srcView.add(project);

    assertThat(command.invoke("view/group/view/SrcView", "view/TopLevelView", "view/group/view/NestedView"), succeeded());

    View topLevelView = j.jenkins.getView("TopLevelView");
    assertTrue(topLevelView.contains(project));
    View nestedView = ((NestedView) j.jenkins.getView("group")).getView("NostedView");
    assertTrue(nestedView.contains(project));
}
项目:jenkins-config-cloner    文件:CloneViewIntegrationTest.java   
@Test
public void performTransformation() throws Exception {

    ListView view = view("SrcView");
    view.setIncludeRegex("originalRegex");
    view.add(project);

    assertThat(command.opts("-e", "s/original/replaced/").invoke("view/SrcView", "view/DstView"), succeeded());

    View dstView = j.jenkins.getView("DstView");
    assertTrue(dstView.contains(project));
}