Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private PipelineGraph createTree(PipelineGraphBuilderApi builder) {
stageToChildrenMap.put(stage.getId(), new ArrayList<>());
} else {
List<String> parentChildren =
stageToChildrenMap.getOrDefault(stage.getParents().get(0), new ArrayList<String>());
stageToChildrenMap.getOrDefault(stage.getParents().get(0), new ArrayList<>());
parentChildren.add(stage.getId());
childNodes.add(stage.getId());
stageToChildrenMap.put(stage.getParents().get(0), parentChildren);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public static boolean isStep(FlowNode node) {
if (node instanceof AtomNode) {
return true;
}
if (node instanceof StepStartNode) {
StepStartNode stepStartNode = (StepStartNode) node;
if (node instanceof StepStartNode stepStartNode) {
boolean takesImplicitBlockArgument = false;
StepDescriptor sd = stepStartNode.getDescriptor();
if (sd != null) {
Expand All @@ -73,8 +72,7 @@ public static boolean isStep(FlowNode node) {

public static boolean isStage(FlowNode node) {
if (node != null) {
if (node instanceof StepStartNode) {
StepStartNode stepStartNode = (StepStartNode) node;
if (node instanceof StepStartNode stepStartNode) {
if (stepStartNode.getDescriptor() != null) {
StepDescriptor sd = stepStartNode.getDescriptor();
return sd != null && StageStep.DescriptorImpl.class.equals(sd.getClass()) && stepStartNode.isBody();
Expand Down Expand Up @@ -124,8 +122,7 @@ public static boolean isSkippedStage(@Nullable FlowNode node) {
}

for (Action action : node.getActions()) {
if (action instanceof TagsAction && ((TagsAction) action).getTagValue(StageStatus.TAG_NAME) != null) {
TagsAction tagsAction = (TagsAction) action;
if (action instanceof TagsAction tagsAction && tagsAction.getTagValue(StageStatus.TAG_NAME) != null) {
String value = tagsAction.getTagValue(StageStatus.TAG_NAME);
return value != null
&& (value.equals(StageStatus.getSkippedForConditional())
Expand All @@ -150,8 +147,7 @@ public static boolean isPreSyntheticStage(@Nullable FlowNode node) {
}

public static boolean isParallelBranch(@Nullable FlowNode node) {
if (node != null && node instanceof StepStartNode) {
StepStartNode stepStartNode = (StepStartNode) node;
if (node instanceof StepStartNode stepStartNode) {
if (stepStartNode.getDescriptor() != null) {
StepDescriptor sd = stepStartNode.getDescriptor();
return sd != null && ParallelStep.DescriptorImpl.class.equals(sd.getClass()) && stepStartNode.isBody();
Expand Down Expand Up @@ -243,8 +239,7 @@ public static boolean isPaused(@NonNull FlowNode step) {
}

protected static boolean isParallelBlock(@NonNull FlowNode node) {
if (node != null && node instanceof StepStartNode) {
StepStartNode stepStartNode = (StepStartNode) node;
if (node instanceof StepStartNode stepStartNode) {
if (stepStartNode.getDescriptor() != null) {
StepDescriptor sd = stepStartNode.getDescriptor();
return sd != null && ParallelStep.DescriptorImpl.class.equals(sd.getClass()) && !stepStartNode.isBody();
Expand All @@ -262,8 +257,7 @@ protected static boolean isParallelBlock(@NonNull FlowNode node) {
* @return true if {@code node} is the non-body start of the agent execution.
*/
public static boolean isAgentStart(@Nullable FlowNode node) {
if (node != null && node instanceof StepStartNode) {
StepStartNode stepStartNode = (StepStartNode) node;
if (node instanceof StepStartNode stepStartNode) {
if (stepStartNode.getDescriptor() != null) {
StepDescriptor sd = stepStartNode.getDescriptor();
return sd != null && ExecutorStep.DescriptorImpl.class.equals(sd.getClass()) && !stepStartNode.isBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ void arrayValueSerialization() {
assertEquals("[\"running\",\"success\"]", serialized);
}

public static class TestBean {
private final PipelineState state;

public TestBean(PipelineState state) {
this.state = state;
}

public PipelineState getState() {
return state;
}
public record TestBean(PipelineState state) {
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.jenkins.plugins.pipelinegraphview.utils;

import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import hudson.model.Result;
import hudson.model.queue.QueueTaskFuture;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -60,7 +60,7 @@ public static WorkflowJob createJob(JenkinsRule jenkins, String jobName, String
WorkflowJob job = jenkins.createProject(WorkflowJob.class, jobName);

URL resource = Resources.getResource(TestUtils.class, jenkinsFileName);
String jenkinsFile = Resources.toString(resource, Charsets.UTF_8);
String jenkinsFile = Resources.toString(resource, StandardCharsets.UTF_8);
job.setDefinition(new CpsFlowDefinition(jenkinsFile, sandbox));
return job;
}
Expand Down
Loading