jenkins.model.Jenkins.reload()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中jenkins.model.Jenkins.reload()方法的一些代码示例,展示了Jenkins.reload()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.reload()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:reload

Jenkins.reload介绍

[英]Reloads the configuration synchronously. Beware that this calls neither ItemListener#onLoaded nor Initializers.
[中]同步重新加载配置。注意,这既不调用ItemListener#onload,也不调用初始值设定项。

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
  public void run() {
    try {
      ACL.impersonate(ACL.SYSTEM);
      reload();
    } catch (Exception e) {
      LOGGER.log(SEVERE,"Failed to reload Jenkins config",e);
      new JenkinsReloadFailed(e).publish(servletContext,root);
    }
  }
}.start();

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
  public void run() {
    try {
      ACL.impersonate(ACL.SYSTEM);
      reload();
    } catch (Exception e) {
      LOGGER.log(SEVERE,"Failed to reload Jenkins config",e);
      new JenkinsReloadFailed(e).publish(servletContext,root);
    }
  }
}.start();

代码示例来源:origin: jenkinsci/junit-plugin

private void reloadJenkins() throws Exception {
  j.jenkins.reload();
  project = (FreeStyleProject) j.jenkins.getItem("junit");
}

代码示例来源:origin: io.fabric8.jenkins.plugins/openshift-sync

@Override
 public Void call() throws Exception {
  job.delete();
  try {
   Jenkins jenkins = Jenkins.getInstance();
   if (jenkins != null) {
    jenkins.reload();
   }
  } catch (ReactorException e) {
   logger.log(Level.SEVERE, "Failed to reload jenkins job after deleting " + job.getName() + " from BuildConfig " + NamespaceName.create(buildConfig));
  }
  return null;
 }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    instance.doReload();
    checkComputedFolder(instance, 0);
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    instance.doReload();
    checkComputedFolder(instance, 0);
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
    instance.doReload();
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
    instance.doReload();
    checkComputedFolder(instance, 0, ChildNameGeneratorTest.this.inferNormalizerForm());
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    instance.doReload();
    checkComputedFolder(instance, 0);
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0);
    instance.doReload();
    checkComputedFolder(instance, 0);
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Override
  public void evaluate() throws Throwable {
    TopLevelItem i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    ComputedFolderImpl instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, Normalizer.Form.NFC);
    r.j.jenkins.reload();
    i = r.j.jenkins.getItem("instance");
    assertThat("Item loaded from disk", i, instanceOf(ComputedFolderImpl.class));
    instance = (ComputedFolderImpl) i;
    checkComputedFolder(instance, 0, Normalizer.Form.NFC);
    instance.doReload();
    checkComputedFolder(instance, 0, Normalizer.Form.NFC);
  }
});

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

r.jenkins.reload();
r.jenkins.reload();
Folder reloadedFolder = r.jenkins.getItemByFullName("myFolder", Folder.class);
assertThat("Folder has not been found after the reloading", reloadedFolder, notNullValue());

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Issue("JENKINS-32487")
@Test public void shouldAssignPropertyOwnerOnCreationAndReload() throws Exception {
  Folder folder = r.jenkins.createProject(Folder.class, "myFolder");
  ProjectMatrixAuthorizationStrategy as = new ProjectMatrixAuthorizationStrategy();
  // Need to do this to avoid JENKINS-9774
  as.add(Jenkins.ADMINISTER, "alice");
  r.jenkins.setAuthorizationStrategy(as);
  
  // We add a stub property to generate the persisted list
  // Then we ensure owner is being assigned properly.
  folder.addProperty(new FolderCredentialsProvider.FolderCredentialsProperty(new DomainCredentials[0]));
  assertPropertyOwner("After property add", folder, FolderCredentialsProvider.FolderCredentialsProperty.class);

  // Reload and ensure that the property owner is set
  r.jenkins.reload();
  Folder reloadedFolder = r.jenkins.getItemByFullName("myFolder", Folder.class);
  assertPropertyOwner("After reload", reloadedFolder, FolderCredentialsProvider.FolderCredentialsProperty.class);
}

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

@Test public void reloadJenkinsAndFindBuildInProgress() throws Exception {
  Folder f1 = r.jenkins.createProject(Folder.class, "f");
  FreeStyleProject p1 = f1.createProject(FreeStyleProject.class, "test1");
  FreeStyleBuild p1b1 = p1.scheduleBuild2(0).get();  // one completed build
  p1.getBuildersList().add(new SleepBuilder(99999999));
  p1.save();
  FreeStyleBuild p1b2 = p1.scheduleBuild2(0).waitForStart(); // another build in progress
  // trigger the full Jenkins reload
  r.jenkins.reload();
  Folder f2 = (Folder) r.jenkins.getItem("f");
  assertNotSame(f1,f2);
  FreeStyleProject p2 = (FreeStyleProject) f2.getItem("test1");
  /* Fails now. Why was this here?
  assertNotSame(p1,p2);
  */
  FreeStyleBuild p2b1 = p2.getBuildByNumber(1);
  FreeStyleBuild p2b2 = p2.getBuildByNumber(2);
  assertTrue(p2b2.isBuilding());
  assertSame(p2b2,p1b2);
  assertNotSame(p1b1,p2b1);
  p1b2.getExecutor().interrupt(); // kill the executor
}

相关文章

Jenkins类方法