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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章

Jenkins类方法