当前位置: 首页>>代码示例>>Java>>正文


Java Symbol类代码示例

本文整理汇总了Java中org.jenkinsci.Symbol的典型用法代码示例。如果您正苦于以下问题:Java Symbol类的具体用法?Java Symbol怎么用?Java Symbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Symbol类属于org.jenkinsci包,在下文中一共展示了Symbol类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: maven_build_jar_project_on_master_with_globally_disabled_publisher_succeeds

import org.jenkinsci.Symbol; //导入依赖的package包/类
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);
        }
    }
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:39,代码来源:WithMavenStepGlobalConfigurationTest.java

示例2: loadMavenJarProjectInGitRepo

import org.jenkinsci.Symbol; //导入依赖的package包/类
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);
        }
    }
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:40,代码来源:WithMavenStepGlobalConfigurationTest.java

示例3: maven_build_jar_project_on_master_with_disabled_publisher_param_succeeds

import org.jenkinsci.Symbol; //导入依赖的package包/类
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);
        }
    }
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:36,代码来源:WithMavenStepOnMasterTest.java

示例4: maven_build_jar_project_on_master_with_open_task_scanner_config_succeeds

import org.jenkinsci.Symbol; //导入依赖的package包/类
@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);
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:31,代码来源:WithMavenStepOnMasterTest.java


注:本文中的org.jenkinsci.Symbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。