jenkins.tasks.SimpleBuildWrapper Java Examples

The following examples show how to use jenkins.tasks.SimpleBuildWrapper. 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: VaultBuildWrapperTest.java    From hashicorp-vault-plugin with MIT License 6 votes vote down vote up
@Test
public void testWithNonExistingPath() throws IOException, InterruptedException {
    String path = "not/existing";
    TestWrapper wrapper = new TestWrapper(standardSecrets(path));
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream logger = new PrintStream(baos);
    SimpleBuildWrapper.Context context = null;
    Run<?, ?> build = mock(Build.class);
    when(build.getParent()).thenReturn(null);
    EnvVars envVars = mock(EnvVars.class);
    when(envVars.expand(path)).thenReturn(path);

    wrapper.run(context, build, envVars, logger);

    try { // now we expect the exception to raise
        wrapper.vaultConfig.setFailIfNotFound(true);
        wrapper.run(context, build, envVars, logger);
    } catch (VaultPluginException e) {
        assertThat(e.getMessage(), is("Vault credentials not found for 'not/existing'"));
    }

    wrapper.verifyCalls();
    assertThat(new String(baos.toByteArray(), StandardCharsets.UTF_8),
        containsString("Vault credentials not found for 'not/existing'"));
}
 
Example #2
Source File: PipelineMetadataService.java    From blueocean-plugin with MIT License 5 votes vote down vote up
private <T extends Describable<T>,D extends Descriptor<T>> void populateMetaSteps(List<Descriptor<?>> r, Class<T> c) {
    Jenkins j = Jenkins.getInstance();
    for (Descriptor<?> d : j.getDescriptorList(c)) {
        if (SimpleBuildStep.class.isAssignableFrom(d.clazz) && symbolForObject(d) != null) {
            r.add(d);
        } else if (SimpleBuildWrapper.class.isAssignableFrom(d.clazz) && symbolForObject(d) != null) {
            r.add(d);
        }
    }
}
 
Example #3
Source File: ExportedPipelineFunction.java    From blueocean-plugin with MIT License 4 votes vote down vote up
/**
 * Indicates this step wraps a block of other steps
 */
@Exported
public boolean getIsBlockContainer() {
    return SimpleBuildWrapper.class.isAssignableFrom(model.getType());
}