Java Code Examples for org.jenkinsci.Symbol#value()
The following examples show how to use
org.jenkinsci.Symbol#value() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tool.java From warnings-ng-plugin with MIT License | 5 votes |
/** * Returns the {@link Symbol} name of this tool. * * @return the name of this tool, or "undefined" if no symbol has been defined */ public String getSymbolName() { Symbol annotation = getClass().getAnnotation(Symbol.class); if (annotation != null) { String[] symbols = annotation.value(); if (symbols.length > 0) { return symbols[0]; } } return "unknownSymbol"; }
Example 2
Source File: WithMavenStepGlobalConfigurationTest.java From pipeline-maven-plugin with MIT License | 5 votes |
private void maven_build_jar_project_on_master_with_globally_disabled_publisher_succeeds(MavenPublisher.DescriptorImpl descriptor) throws Exception { MavenPublisher publisher = descriptor.clazz.newInstance(); publisher.setDisabled(true); GlobalPipelineMavenConfig globalPipelineMavenConfig = GlobalPipelineMavenConfig.get(); globalPipelineMavenConfig.setPublisherOptions(Collections.singletonList(publisher)); Logger logger = Logger.getLogger(MavenSpyLogProcessor.class.getName()); Level level = logger.getLevel(); logger.setLevel(Level.FINE); try { Symbol symbolAnnotation = descriptor.getClass().getAnnotation(Symbol.class); String symbol = symbolAnnotation.value()[0]; String displayName = descriptor.getDisplayName(); loadMavenJarProjectInGitRepo(this.gitRepoRule); String pipelineScript = "node('master') {\n" + " git($/" + gitRepoRule.toString() + "/$)\n" + " withMaven() {\n" + " sh 'mvn package verify'\n" + " }\n" + "}"; WorkflowJob pipeline = jenkinsRule.createProject(WorkflowJob.class, "build-on-master-" + symbol + "-publisher-globally-disabled"); pipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true)); WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, pipeline.scheduleBuild2(0)); String message = "[withMaven] Skip '" + displayName + "' disabled by configuration"; jenkinsRule.assertLogContains(message, build); } finally { logger.setLevel(level); globalPipelineMavenConfig.setPublisherOptions((List<MavenPublisher>) null); } }
Example 3
Source File: WithMavenStepGlobalConfigurationTest.java From pipeline-maven-plugin with MIT License | 5 votes |
private void maven_build_jar_project_on_master_with_publisher_configured_both_globally_and_on_the_pipeline_succeeds(MavenPublisher.DescriptorImpl descriptor) throws Exception { MavenPublisher publisher = descriptor.clazz.newInstance(); publisher.setDisabled(true); GlobalPipelineMavenConfig globalPipelineMavenConfig = GlobalPipelineMavenConfig.get(); globalPipelineMavenConfig.setPublisherOptions(Collections.singletonList(publisher)); Logger logger = Logger.getLogger(MavenSpyLogProcessor.class.getName()); Level level = logger.getLevel(); logger.setLevel(Level.FINE); try { Symbol symbolAnnotation = descriptor.getClass().getAnnotation(Symbol.class); String symbol = symbolAnnotation.value()[0]; String displayName = descriptor.getDisplayName(); loadMavenJarProjectInGitRepo(this.gitRepoRule); String pipelineScript = "node('master') {\n" + " git($/" + gitRepoRule.toString() + "/$)\n" + " withMaven(options:[" + symbol + "(disabled: true)]) {\n" + " sh 'mvn package verify'\n" + " }\n" + "}"; WorkflowJob pipeline = jenkinsRule.createProject(WorkflowJob.class, "build-on-master-" + symbol + "-publisher-defined-globally-and-in-the-pipeline"); pipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true)); WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, pipeline.scheduleBuild2(0)); jenkinsRule.assertLogContains("[withMaven] WARNING merging publisher configuration defined in the 'Global Tool Configuration' and at the pipeline level is not yet supported. " + "Use pipeline level configuration for '" + displayName + "'", build); jenkinsRule.assertLogContains("[withMaven] Skip '" + displayName + "' disabled by configuration", build); } finally { logger.setLevel(level); globalPipelineMavenConfig.setPublisherOptions((List<MavenPublisher>) null); } }
Example 4
Source File: WithMavenStepOnMasterTest.java From pipeline-maven-plugin with MIT License | 5 votes |
private void maven_build_jar_project_on_master_with_disabled_publisher_param_succeeds(MavenPublisher.DescriptorImpl descriptor, String symbol, boolean disabled) throws Exception { Logger logger = Logger.getLogger(MavenSpyLogProcessor.class.getName()); Level level = logger.getLevel(); logger.setLevel(Level.FINE); try { String displayName = descriptor.getDisplayName(); Symbol symbolAnnotation = descriptor.getClass().getAnnotation(Symbol.class); String[] symbols = symbolAnnotation.value(); assertThat(new String[]{symbol}, is(symbols)); loadMavenJarProjectInGitRepo(this.gitRepoRule); String pipelineScript = "node('master') {\n" + " git($/" + gitRepoRule.toString() + "/$)\n" + " withMaven(options:[" + symbol + "(disabled:" + disabled + ")]) {\n" + " sh 'mvn package verify'\n" + " }\n" + "}"; WorkflowJob pipeline = jenkinsRule.createProject(WorkflowJob.class, "build-on-master-" + symbol + "-publisher-disabled-" + disabled); pipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true)); WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, pipeline.scheduleBuild2(0)); String message = "[withMaven] Skip '" + displayName + "' disabled by configuration"; if (disabled) { jenkinsRule.assertLogContains(message, build); } else { jenkinsRule.assertLogNotContains(message, build); } } finally { logger.setLevel(level); } }
Example 5
Source File: WithMavenStepOnMasterTest.java From pipeline-maven-plugin with MIT License | 5 votes |
@Test public void maven_build_jar_project_on_master_with_open_task_scanner_config_succeeds() throws Exception { MavenPublisher.DescriptorImpl descriptor = new TasksScannerPublisher.DescriptorImpl(); String displayName = descriptor.getDisplayName(); Symbol symbolAnnotation = descriptor.getClass().getAnnotation(Symbol.class); String[] symbols = symbolAnnotation.value(); assertThat(new String[]{"openTasksPublisher"}, is(symbols)); loadMavenJarProjectInGitRepo(this.gitRepoRule); String pipelineScript = "node('master') {\n" + " git($/" + gitRepoRule.toString() + "/$)\n" + " withMaven(options:[openTasksPublisher(" + " disabled:false, " + " pattern:'src/main/java', excludePattern:'a/path'," + " ignoreCase:true, asRegexp:false, " + " lowPriorityTaskIdentifiers:'minor', normalPriorityTaskIdentifiers:'todo', highPriorityTaskIdentifiers:'fixme')]) {\n" + " sh 'mvn package verify'\n" + " }\n" + "}"; WorkflowJob pipeline = jenkinsRule.createProject(WorkflowJob.class, "build-on-master-openTasksPublisher-publisher-config"); pipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true)); WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, pipeline.scheduleBuild2(0)); String message = "[withMaven] Skip '" + displayName + "' disabled by configuration"; jenkinsRule.assertLogNotContains(message, build); }