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

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

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

Jenkins.getSystemMessage介绍

[英]Synonym for #getDescription.
[中]#getDescription的同义词。

代码示例

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Test
public void loadFromCASC_JENKINS_CONFIG() {
  Jenkins j = Jenkins.getInstance();
  assertEquals("configuration as code - JenkinsConfigTest", j.getSystemMessage());
  assertEquals(10, j.getQuietPeriod());
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Test
@ConfiguredWithCode(value = {"merge1.yml", "merge3.yml"}, expected = ConfiguratorException.class)
public void shouldMergeYamlConfig() {
  assertEquals("Configured by configuration-as-code-plugin", j.jenkins.getSystemMessage());
  assertEquals(0, j.jenkins.getNumExecutors());
  assertNotNull(j.jenkins.getNode("agent1"));
  assertNotNull(j.jenkins.getNode("agent3"));
}

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

@Test
public void traitsSandbox() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("trait T {void m() {Jenkins.instance.systemMessage = 'pwned'}}; class X implements T {}; new X().m()", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  /* TODO instead it fails in some cryptic spot while trying to translate the body of the trait
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
  */
  job.setDefinition(new CpsFlowDefinition("trait T {void m() {Jenkins.instance.systemMessage = 'pwned'}}; T t = new TreeSet() as T; t.m()", true));
  b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  // TODO this one fails with a NullPointerException
}

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

@Test
public void staticInitializerSandbox() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("class X {static {Jenkins.instance.systemMessage = 'pwned'}}; new X()", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
}

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

@Issue("SECURITY-566")
@Test public void typeCoercion() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("interface I {Object getInstance()}; println((Jenkins as I).instance)", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
  // Not really the same but just checking:
  job.setDefinition(new CpsFlowDefinition("interface I {Object getInstance()}; I i = {Jenkins.instance}; println(i.instance)", true));
  b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
}

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

@Issue("SECURITY-551")
@Test
public void initializerSandbox() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("class X {{Jenkins.instance.systemMessage = 'pwned'}}; new X()", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
}

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

@Issue("SECURITY-551")
@Test
public void constructorSandbox() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("class X {X() {Jenkins.instance.systemMessage = 'pwned'}}; new X()", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
}

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

@Issue("SECURITY-551")
@Test
public void fieldInitializerSandbox() throws Exception {
  logging.record(CpsTransformer.class, Level.FINEST);
  WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "p");
  job.setDefinition(new CpsFlowDefinition("class X {def x = {Jenkins.instance.systemMessage = 'pwned'}()}; new X()", true));
  WorkflowRun b = job.scheduleBuild2(0).get();
  assertNull(jenkins.jenkins.getSystemMessage());
  jenkins.assertBuildStatus(Result.FAILURE, b);
  jenkins.assertLogContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", b);
}

相关文章

Jenkins类方法