hudson.tasks.Builder Java Examples

The following examples show how to use hudson.tasks.Builder. 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: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at complete success builds instead of just looking at the eclipse result.
 * Should return an success result.
 */
@Test
public void shouldCreateSuccessResultWithOverAllMustBeSuccess() {
    // #1 SUCCESS
    FreeStyleProject project = createJob(JOB_NAME, "eclipse4Warnings.txt");
    IssuesRecorder issuesRecorder = enableWarnings(project, recorder -> {
        recorder.setIgnoreFailedBuilds(true);
        recorder.setEnabledForFailure(true);
    });
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(project, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.INACTIVE)).getOwner();

    // #2 FAILURE
    cleanAndCopy(project, "eclipse2Warnings.txt");
    issuesRecorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    Builder failureStep = addFailureStep(project);
    scheduleBuildAndAssertStatus(project, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED));

    // #3 UNSTABLE (Reference #1)
    cleanAndCopy(project, "eclipse6Warnings.txt");
    removeBuilder(project, failureStep);
    scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -> assertThat(analysisResult)
            .hasTotalSize(6)
            .hasNewSize(2)
            .hasQualityGateStatus(QualityGateStatus.PASSED)
            .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #2
Source File: BuildResultProcessorTest.java    From phabricator-jenkins-plugin with MIT License 5 votes vote down vote up
private Builder echoBuilder(final String fileName, final String content) {
    return new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws
                InterruptedException, IOException {
            build.getWorkspace().child(fileName).write(content, "UTF-8");
            return true;
        }
    };
}
 
Example #3
Source File: TestBuilder.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
public Descriptor<Builder> getDescriptor() {
    // throw new UnsupportedOperationException();
    return new BuildStepDescriptor<Builder>() {
        @Override
        public boolean isApplicable(Class<? extends AbstractProject> jobType) {
            return true;
        }
    };
}
 
Example #4
Source File: GroovyHudsonTestCase.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
/**
 * Wraps a closure as a {@link Builder}.
 */
public Builder builder(final Closure c) {
    return new TestBuilder() {
        public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            Object r = c.call(new Object[]{build,launcher,listener});
            if (r instanceof Boolean)   return (Boolean)r;
            return true;
        }
    };
}
 
Example #5
Source File: GroovyJenkinsRule.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
/**
 * Wraps a closure as a {@link Builder}.
 */
public Builder builder(final Closure c) {
    return new TestBuilder() {
        @Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            Object r = c.call(new Object[] {build, launcher, listener});
            if (r instanceof Boolean) {
                return (Boolean) r;
            }
            return true;
        }
    };
}
 
Example #6
Source File: HudsonTestCase.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
/**
 * Performs a configuration round-trip testing for a builder.
 */
@SuppressWarnings("unchecked")
protected <B extends Builder> B configRoundtrip(B before) throws Exception {
    FreeStyleProject p = createFreeStyleProject();
    p.getBuildersList().add(before);
    configRoundtrip((Item)p);
    return (B)p.getBuildersList().get(before.getClass());
}
 
Example #7
Source File: RemoteFileFetcherTest.java    From phabricator-jenkins-plugin with MIT License 5 votes vote down vote up
private Builder echoBuilder(final String fileName, final String content) {
    return new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws
                InterruptedException, IOException {
            build.getWorkspace().child(fileName).write(content, "UTF-8");
            return true;
        }
    };
}
 
Example #8
Source File: JenkinsRule.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
/**
 * Performs a configuration round-trip testing for a builder.
 */
public <B extends Builder> B configRoundtrip(B before) throws Exception {
    FreeStyleProject p = createFreeStyleProject();
    p.getBuildersList().add(before);
    configRoundtrip((Item)p);
    return (B)p.getBuildersList().get(before.getClass());
}
 
Example #9
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at complete success builds instead of just looking at the eclipse result.
 * Should return an unstable result.
 */
@Test
public void shouldCreateUnstableResultWithOverAllMustBeSuccess() {
    // #1 SUCCESS
    FreeStyleProject project = createJob(JOB_NAME, "eclipse2Warnings.txt");
    enableWarnings(project, recorder -> {
        recorder.setIgnoreFailedBuilds(true);
        recorder.setEnabledForFailure(true);
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    });
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(project, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();

    // #2 FAILURE
    cleanAndCopy(project, "eclipse4Warnings.txt");
    Builder failureStep = addFailureStep(project);
    scheduleBuildAndAssertStatus(project, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(2)
                    .hasQualityGateStatus(QualityGateStatus.PASSED));

    // #3 UNSTABLE (Reference #1)
    removeBuilder(project, failureStep);
    cleanAndCopy(project, "eclipse6Warnings.txt");
    scheduleBuildAndAssertStatus(project, Result.UNSTABLE, analysisResult -> assertThat(analysisResult)
            .hasTotalSize(6)
            .hasNewSize(4)
            .hasQualityGateStatus(QualityGateStatus.WARNING)
            .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #10
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an
 * a success result. Uses a different freestyle project for the reference.
 */
@Test
public void shouldCreateSuccessResultWithOverAllMustNotBeSuccessWithReferenceBuild() {
    // #1 SUCCESS
    FreeStyleProject reference = createJob(REFERENCE_JOB_NAME, "eclipse2Warnings.txt");
    enableWarnings(reference, recorder -> {
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    });
    scheduleBuildAndAssertStatus(reference, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED));

    // #2 FAILURE
    cleanAndCopy(reference, "eclipse4Warnings.txt");

    Builder failureStep = addFailureStep(reference);
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(reference, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(2)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();
    removeBuilder(reference, failureStep);

    // #1 UNSTABLE (Reference #2)
    FreeStyleProject project = createJob(JOB_NAME, "eclipse6Warnings.txt");
    enableWarnings(project, recorder -> {
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
        recorder.setReferenceJobName(REFERENCE_JOB_NAME);
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
    });
    scheduleBuildAndAssertStatus(project, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(6)
                    .hasNewSize(2)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)
                    .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #11
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an
 * unstable result. Uses a different freestyle project for the reference.
 */
@Test
public void shouldCreateUnstableResultWithOverAllMustNotBeSuccessWithReferenceBuild() {
    // #1 SUCCESS
    FreeStyleProject reference = createJob(REFERENCE_JOB_NAME, "eclipse4Warnings.txt");
    IssuesRecorder issuesRecorder = enableWarnings(reference, recorder -> {
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
    });
    scheduleBuildAndAssertStatus(reference, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.INACTIVE));

    // #2 FAILURE
    cleanAndCopy(reference, "eclipse2Warnings.txt");
    issuesRecorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    Builder failureStep = addFailureStep(reference);
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(reference, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();
    removeBuilder(reference, failureStep);

    // #1 UNSTABLE (Reference #2)
    FreeStyleProject project = createJob(JOB_NAME, "eclipse6Warnings.txt");
    enableWarnings(project, recorder -> {
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
        recorder.setReferenceJobName(REFERENCE_JOB_NAME);
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
    });
    scheduleBuildAndAssertStatus(project, Result.UNSTABLE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(6)
                    .hasNewSize(4)
                    .hasQualityGateStatus(QualityGateStatus.WARNING)
                    .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #12
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at complete success builds instead of just looking at the eclipse result.
 * Should return an unstable result. Uses a different freestyle project for the reference.
 */
@Test
public void shouldCreateUnstableResultWithOverAllMustBeSuccessWithReferenceBuild() {
    // #1 SUCCESS
    FreeStyleProject reference = createJob(REFERENCE_JOB_NAME, "eclipse2Warnings.txt");
    enableWarnings(reference, recorder -> {
        recorder.setIgnoreFailedBuilds(true);
        recorder.setEnabledForFailure(true);
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    });
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(reference, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();

    // #2 FAILURE
    cleanAndCopy(reference, "eclipse4Warnings.txt");
    Builder failureStep = addFailureStep(reference);
    scheduleBuildAndAssertStatus(reference, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(2)
                    .hasQualityGateStatus(QualityGateStatus.PASSED));
    removeBuilder(reference, failureStep);

    // #1 SUCCESS (Reference #1)
    FreeStyleProject project = createJob(JOB_NAME, "eclipse6Warnings.txt");
    enableWarnings(project, recorder -> {
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
        recorder.setReferenceJobName(REFERENCE_JOB_NAME);
        recorder.setIgnoreFailedBuilds(true);
        recorder.setEnabledForFailure(true);
    });
    scheduleBuildAndAssertStatus(project, Result.UNSTABLE, analysisResult -> assertThat(analysisResult)
            .hasTotalSize(6)
            .hasNewSize(4)
            .hasQualityGateStatus(QualityGateStatus.WARNING)
            .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #13
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an
 * success result.
 */
@Test
public void shouldCreateSuccessResultWithOverAllMustNotBeSuccess() {
    // #1 SUCCESS
    FreeStyleProject project = createJob(JOB_NAME, "eclipse2Warnings.txt");
    enableWarnings(project, recorder -> {
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
        recorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    });
    scheduleBuildAndAssertStatus(project, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED));

    // #2 FAILURE
    cleanAndCopy(project, "eclipse4Warnings.txt");
    Builder failureStep = addFailureStep(project);
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(project, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(2)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();

    // #3 SUCCESS (Reference #2)
    cleanAndCopy(project, "eclipse6Warnings.txt");
    removeBuilder(project, failureStep);
    scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -> assertThat(analysisResult)
            .hasTotalSize(6)
            .hasNewSize(2)
            .hasQualityGateStatus(QualityGateStatus.PASSED)
            .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #14
Source File: ReferenceFinderITest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
/**
 * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an
 * unstable result.
 */
@Test
public void shouldCreateUnstableResultWithOverAllMustNotBeSuccess() {
    // #1 SUCCESS
    FreeStyleProject project = createJob(JOB_NAME, "eclipse4Warnings.txt");
    IssuesRecorder issuesRecorder = enableWarnings(project, recorder -> {
        recorder.setIgnoreFailedBuilds(false);
        recorder.setEnabledForFailure(true);
    });
    scheduleBuildAndAssertStatus(project, Result.SUCCESS,
            analysisResult -> assertThat(analysisResult).hasTotalSize(4)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.INACTIVE));

    // #2 FAILURE
    cleanAndCopy(project, "eclipse2Warnings.txt");
    issuesRecorder.addQualityGate(3, QualityGateType.NEW, QualityGateResult.UNSTABLE);
    Builder failureStep = addFailureStep(project);
    Run<?, ?> expectedReference = scheduleBuildAndAssertStatus(project, Result.FAILURE,
            analysisResult -> assertThat(analysisResult).hasTotalSize(2)
                    .hasNewSize(0)
                    .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner();

    cleanAndCopy(project, "eclipse6Warnings.txt");
    removeBuilder(project, failureStep);

    // #3 UNSTABLE (Reference #2)
    scheduleBuildAndAssertStatus(project, Result.UNSTABLE, analysisResult -> assertThat(analysisResult)
            .hasTotalSize(6)
            .hasNewSize(4)
            .hasQualityGateStatus(QualityGateStatus.WARNING)
            .hasReferenceBuild(Optional.of(expectedReference)));
}
 
Example #15
Source File: DynamicSubProject.java    From DotCi with MIT License 4 votes vote down vote up
@Override
public DescribableList<Builder, Descriptor<Builder>> getBuildersList() {
    return getParent().getBuildersList();
}
 
Example #16
Source File: DynamicSubProject.java    From DotCi with MIT License 4 votes vote down vote up
@Override
public List<Builder> getBuilders() {
    return getParent().getBuilders();
}
 
Example #17
Source File: DotCiExtensionsHelper.java    From DotCi with MIT License 4 votes vote down vote up
private ArrayList<Descriptor<?>> getDescriptors() {
    ArrayList<Descriptor<?>> r = new ArrayList<Descriptor<?>>();
    r.addAll(getClassList(Builder.class));
    r.addAll(getClassList(Publisher.class));
    return r;
}
 
Example #18
Source File: SemanticVersioningBuilder.java    From semantic-versioning-plugin with MIT License 4 votes vote down vote up
@Override
public Builder newInstance(StaplerRequest req, JSONObject formData) throws FormException {
    return super.newInstance(req, formData);
}
 
Example #19
Source File: DslIntegrationTest.java    From github-integration-plugin with MIT License 4 votes vote down vote up
@Test
public void shouldCreateJobWithExtendedDsl() throws Exception {
    FreeStyleProject job = jenkins.createFreeStyleProject();
    job.getBuildersList().add(
            new ExecuteDslScripts(
                    new ExecuteDslScripts.ScriptLocation(
                            null, null,
                            IOUtils.toString(this
                                    .getClass().getClassLoader().getResourceAsStream(JOB_DSL_GROOVY))
                    ),
                    false,
                    RemovedJobAction.DELETE,
                    RemovedViewAction.DELETE,
                    LookupStrategy.JENKINS_ROOT
            )
    );

    jenkins.buildAndAssertSuccess(job);

    assertThat(jenkins.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));

    FreeStyleProject generated = jenkins.getInstance()
            .getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);

    final DescribableList<Builder, Descriptor<Builder>> builders = generated.getBuildersList();

    assertThat("Should have builder", builders, hasSize(1));
    assertThat("Should add status builder", builders.get(0), instanceOf(GitHubPRStatusBuilder.class));
    assertThat("Should add message",
            ((GitHubPRStatusBuilder) builders.get(0)).getStatusMessage().getContent(),
            equalTo(JOB_DSL_BUILDER_TEXT_CONTENT));

    verifyPublishers(generated.getPublishersList());

    Collection<Trigger<?>> triggers = generated.getTriggers().values();
    assertThat("Should add trigger", triggers, hasSize(1));
    GitHubPRTrigger trigger = (GitHubPRTrigger) triggers.toArray()[0];
    assertThat("Should add trigger of GHPR class", trigger, instanceOf(GitHubPRTrigger.class));
    assertThat("Should have pre status", trigger.isPreStatus(), equalTo(true));
    assertThat("Should have cancel queued", trigger.isCancelQueued(), equalTo(true));
    assertThat("Should set mode", trigger.getTriggerMode(), equalTo(HEAVY_HOOKS_CRON));

    final List<GitHubRepoProvider> repoProviders = trigger.getRepoProviders();
    assertThat("Should contain repoProvider", repoProviders, notNullValue());
    assertThat("Should contain 1 repoProvider", repoProviders, hasSize(1));

    final GitHubRepoProvider repoProvider = repoProviders.get(0);
    assertThat(repoProvider, instanceOf(GitHubPluginRepoProvider.class));
    final GitHubPluginRepoProvider provider = (GitHubPluginRepoProvider) repoProvider;
    assertThat(provider.isCacheConnection(), is(false));
    assertThat(provider.isManageHooks(), is(false));
    assertThat(provider.getRepoPermission(), is(PUSH));

    final List<GitHubPREvent> events = trigger.getEvents();
    assertThat("Should add events", events, hasSize(17));


    GitHubPREvent event = events.get(15);
    assertThat(event, instanceOf(GitHubPRNumber.class));
    assertThat(((GitHubPRNumber) event).isSkip(), is(false));
    assertThat(((GitHubPRNumber) event).isMatch(), is(true));


    event = events.get(16);
    assertThat(event, instanceOf(GitHubPRNumber.class));
    assertThat(((GitHubPRNumber) event).isSkip(), is(true));
    assertThat(((GitHubPRNumber) event).isMatch(), is(true));
}
 
Example #20
Source File: DotCiExtensionsHelperTest.java    From DotCi with MIT License 4 votes vote down vote up
@Test
public void should_create_plugins_from_build_step_plugins() {
    Jenkins jenkins = mock(Jenkins.class);

    ExtensionList extensionList = mock(ExtensionList.class);
    when(extensionList.iterator()).thenReturn(Lists.newArrayList().iterator());
    when(jenkins.getExtensionList(any(Class.class))).thenReturn(extensionList);


    DescriptorExtensionList<Builder, Descriptor<Builder>> descriptors = mock(DescriptorExtensionList.class);
    when(jenkins.getDescriptorList(any(Class.class))).thenReturn(descriptors);
    Descriptor<Builder> buildStepDescriptor = new FakeBuildStepPlugin.FakeDescriptor();
    when(descriptors.iterator()).thenReturn(Lists.newArrayList(buildStepDescriptor).iterator());

    List<DotCiPluginAdapter> plugins = new DotCiExtensionsHelper(jenkins).createPlugins(Arrays.asList("FakeBuildStepPlugin"));

    Assert.assertNotNull(plugins);
    Assert.assertTrue(plugins.get(0) instanceof GenericSimpleBuildStepPlugin);


}
 
Example #21
Source File: WorkspaceCopyFileBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
@Override
public Builder newInstance(StaplerRequest req, JSONObject data) {
    throw new UnsupportedOperationException();
}
 
Example #22
Source File: WorkspaceCopyFileBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
@Override
public Descriptor<Builder> getDescriptor() {
    return new DescriptorImpl();
}
 
Example #23
Source File: CreateFileBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
@Override
public Builder newInstance(StaplerRequest req, JSONObject data) {
    throw new UnsupportedOperationException("This is a temporary test class, "
            + "which should not be configured from UI");
}
 
Example #24
Source File: CreateFileBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
@Override
public Descriptor<Builder> getDescriptor() {
    return new DescriptorImpl();
}
 
Example #25
Source File: CaptureEnvironmentBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
public Builder newInstance(StaplerRequest req, JSONObject data) {
    throw new UnsupportedOperationException();
}
 
Example #26
Source File: MockBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
public Builder newInstance(StaplerRequest req, JSONObject data) {
    throw new UnsupportedOperationException();
}
 
Example #27
Source File: MockBuilder.java    From jenkins-test-harness with MIT License 4 votes vote down vote up
@Override
public Descriptor<Builder> getDescriptor() {
    return new DescriptorImpl();
}
 
Example #28
Source File: IntegrationTest.java    From warnings-ng-plugin with MIT License 2 votes vote down vote up
/**
 * Removes the specified builder from the list of registered builders.
 *
 * @param project
 *         the job to add the step
 * @param builder
 *         the builder to remove
 */
protected void removeBuilder(final FreeStyleProject project, final Builder builder) {
    project.getBuildersList().remove(builder);
}
 
Example #29
Source File: IntegrationTest.java    From warnings-ng-plugin with MIT License 2 votes vote down vote up
/**
 * Add a build step that simply fails the build.
 *
 * @param project
 *         the job to add the step
 *
 * @return the created build step
 */
protected Builder addFailureStep(final FreeStyleProject project) {
    return addScriptStep(project, "exit 1");
}