org.jenkinsci.plugins.workflow.steps.StepDescriptor Java Examples
The following examples show how to use
org.jenkinsci.plugins.workflow.steps.StepDescriptor.
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: PipelineMetadataService.java From blueocean-plugin with MIT License | 6 votes |
/** * Function to return all applicable step descriptors for the "wrappers" section. */ @GET @TreeResponse public ExportedPipelineStep[] doWrapperMetadata() { List<ExportedPipelineStep> wrappers = new ArrayList<>(); for (StepDescriptor d : StepDescriptor.all()) { if (isWrapper(d)) { ExportedPipelineStep step = getStepMetadata(d); if (step != null) { wrappers.add(step); } } } return wrappers.toArray(new ExportedPipelineStep[wrappers.size()]); }
Example #2
Source File: PipelineMetadataService.java From blueocean-plugin with MIT License | 6 votes |
private @CheckForNull ExportedPipelineStep getStepMetadata(StepDescriptor d) { try { DescribableModel<? extends Step> model = new DescribableModel<>(d.clazz); ExportedPipelineStep step = new ExportedPipelineStep(model, d.getFunctionName(), d); // Let any decorators adjust the step properties for (ExportedDescribableParameterDecorator decorator : ExtensionList.lookup(ExportedDescribableParameterDecorator.class)) { decorator.decorate(step, step.getParameters()); } return step; } catch (NoStaplerConstructorException e) { // not a normal step? return null; } }
Example #3
Source File: PipelineNodeUtil.java From blueocean-plugin with MIT License | 6 votes |
/** * Determine if the given {@link FlowNode} is the initial {@link StepStartNode} for an {@link org.jenkinsci.plugins.workflow.support.steps.ExecutorStep}. * * @param node a possibly null {@link FlowNode} * @return true if {@code node} is the non-body start of the agent execution. */ public static boolean isAgentStart(@Nullable FlowNode node) { if (node != null) { if (node instanceof StepStartNode) { StepStartNode stepStartNode = (StepStartNode) node; if (stepStartNode.getDescriptor() != null) { StepDescriptor sd = stepStartNode.getDescriptor(); return sd != null && ExecutorStep.DescriptorImpl.class.equals(sd.getClass()) && !stepStartNode.isBody(); } } } return false; }
Example #4
Source File: PipelineMetadataService.java From blueocean-plugin with MIT License | 5 votes |
private boolean includeStep(StepDescriptor d) { boolean include = true; if (BlockedStepsAndMethodCalls.blockedInSteps().containsKey(d.getFunctionName())) { include = false; } else if (d.isAdvanced() && !INCLUDED_ADVANCED_STEPS.contains(d.getFunctionName())) { include = false; } return include; }
Example #5
Source File: PipelineStepImpl.java From blueocean-plugin with MIT License | 5 votes |
@Override public String getStepType() { FlowNode flowNode = this.node.getNode(); if (flowNode instanceof StepNode && !(flowNode instanceof StepEndNode)) { StepNode stepNode = (StepNode) flowNode; StepDescriptor descriptor = stepNode.getDescriptor(); if (descriptor != null) return descriptor.getId(); } return "unknown"; }
Example #6
Source File: Office365ConnectorSendStepTest.java From office-365-connector-plugin with Apache License 2.0 | 5 votes |
@Test public void getRequiredContext_ReturnsContext() { // given StepDescriptor descriptor = new Office365ConnectorSendStep.DescriptorImpl(); // when Set<? extends Class<?>> context = descriptor.getRequiredContext(); // then assertThat(context).hasSize(2); }
Example #7
Source File: Office365ConnectorSendStepTest.java From office-365-connector-plugin with Apache License 2.0 | 5 votes |
@Test public void getFunctionName_ReturnsFunctionName() { // given StepDescriptor descriptor = new Office365ConnectorSendStep.DescriptorImpl(); // when String functionName = descriptor.getFunctionName(); // then assertThat(functionName).isEqualTo("office365ConnectorSend"); }
Example #8
Source File: Office365ConnectorSendStepTest.java From office-365-connector-plugin with Apache License 2.0 | 5 votes |
@Test public void getDisplayName_DoesNotReturnFunctionName() { // given StepDescriptor descriptor = new Office365ConnectorSendStep.DescriptorImpl(); // when String displayName = descriptor.getDisplayName(); String functionName = descriptor.getFunctionName(); // then assertThat(displayName).isNotBlank(); assertThat(displayName).isNotEqualTo(functionName); }
Example #9
Source File: JUnitResultsStepExecution.java From junit-plugin with MIT License | 5 votes |
private static boolean isStageNode(@Nonnull FlowNode node) { if (node instanceof StepNode) { StepDescriptor d = ((StepNode) node).getDescriptor(); return d != null && d.getFunctionName().equals("stage"); } else { return false; } }
Example #10
Source File: PipelineMetadataService.java From blueocean-plugin with MIT License | 4 votes |
private boolean isWrapper(StepDescriptor d) { return includeStep(d) && d.takesImplicitBlockArgument() && !d.getRequiredContext().contains(FilePath.class) && !d.getRequiredContext().contains(Launcher.class); }
Example #11
Source File: ExportedPipelineStep.java From blueocean-plugin with MIT License | 4 votes |
public ExportedPipelineStep(DescribableModel<? extends Step> model, String functionName, StepDescriptor descriptor) { super(model, functionName); this.descriptor = descriptor; }