Skip to content

Commit ba730c2

Browse files
committed
Update dependencies and remove test using LocalData
1 parent 7c72acd commit ba730c2

File tree

17 files changed

+8
-256
lines changed

17 files changed

+8
-256
lines changed

pom.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<parent>
2929
<groupId>org.jenkins-ci.plugins</groupId>
3030
<artifactId>plugin</artifactId>
31-
<version>3.24</version>
31+
<version>3.33</version>
3232
<relativePath />
3333
</parent>
3434
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -66,8 +66,8 @@
6666
<changelist>-SNAPSHOT</changelist>
6767
<jenkins.version>2.150.1</jenkins.version>
6868
<java.level>8</java.level>
69-
<workflow-step-api-plugin.version>2.16</workflow-step-api-plugin.version>
70-
<workflow-support-plugin.version>2.21</workflow-support-plugin.version>
69+
<workflow-step-api-plugin.version>2.18</workflow-step-api-plugin.version>
70+
<workflow-support-plugin.version>3.1</workflow-support-plugin.version>
7171
</properties>
7272
<dependencies>
7373
<dependency>
@@ -83,7 +83,7 @@
8383
<dependency>
8484
<groupId>org.jenkins-ci.plugins.workflow</groupId>
8585
<artifactId>workflow-api</artifactId>
86-
<version>2.31</version>
86+
<version>2.33</version>
8787
</dependency>
8888
<dependency>
8989
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -93,19 +93,19 @@
9393
<dependency>
9494
<groupId>org.jenkins-ci.plugins.workflow</groupId>
9595
<artifactId>workflow-cps</artifactId>
96-
<version>2.61</version>
96+
<version>2.62</version>
9797
<scope>test</scope>
9898
</dependency>
9999
<dependency>
100100
<groupId>org.jenkins-ci.plugins.workflow</groupId>
101101
<artifactId>workflow-job</artifactId>
102-
<version>2.26</version>
102+
<version>2.31</version>
103103
<scope>test</scope>
104104
</dependency>
105105
<dependency>
106106
<groupId>org.jenkins-ci.plugins.workflow</groupId>
107107
<artifactId>workflow-basic-steps</artifactId>
108-
<version>2.2</version>
108+
<version>2.14</version>
109109
<scope>test</scope>
110110
</dependency>
111111
<dependency>
@@ -143,7 +143,7 @@
143143
<dependency>
144144
<groupId>org.jenkins-ci.plugins</groupId>
145145
<artifactId>script-security</artifactId>
146-
<version>1.48</version>
146+
<version>1.50</version>
147147
</dependency>
148148
<dependency>
149149
<groupId>org.jenkins-ci.plugins</groupId>

src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java

-113
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import com.google.common.base.Predicate;
2929
import hudson.FilePath;
3030
import hudson.Functions;
31-
import hudson.init.InitMilestone;
32-
import hudson.init.Initializer;
3331
import hudson.model.Computer;
3432
import hudson.model.Executor;
3533
import hudson.model.Item;
@@ -57,13 +55,6 @@
5755
import java.io.FileOutputStream;
5856
import java.io.IOException;
5957
import java.io.StringWriter;
60-
import java.lang.reflect.Field;
61-
import java.nio.charset.StandardCharsets;
62-
import java.nio.file.FileVisitResult;
63-
import java.nio.file.Files;
64-
import java.nio.file.Path;
65-
import java.nio.file.SimpleFileVisitor;
66-
import java.nio.file.attribute.BasicFileAttributes;
6758
import java.util.ArrayList;
6859
import java.util.Arrays;
6960
import java.util.Collections;
@@ -79,19 +70,16 @@
7970
import java.util.regex.Pattern;
8071
import javax.annotation.Nullable;
8172

82-
import hudson.util.VersionNumber;
8373
import jenkins.model.Jenkins;
8474
import jenkins.security.QueueItemAuthenticator;
8575
import jenkins.security.QueueItemAuthenticatorConfiguration;
8676
import net.sf.json.JSONArray;
8777
import net.sf.json.JSONObject;
8878
import net.sf.json.groovy.JsonSlurper;
8979
import org.acegisecurity.Authentication;
90-
import org.apache.commons.io.FileUtils;
9180
import org.apache.commons.io.IOUtils;
9281
import org.apache.tools.ant.util.JavaEnvUtils;
9382
import static org.hamcrest.Matchers.*;
94-
import org.jboss.marshalling.ObjectResolver;
9583
import org.jenkinsci.plugins.durabletask.FileMonitoringTask;
9684
import org.jenkinsci.plugins.workflow.actions.LogAction;
9785
import org.jenkinsci.plugins.workflow.actions.QueueItemAction;
@@ -109,7 +97,6 @@
10997
import org.jenkinsci.plugins.workflow.steps.EchoStep;
11098
import org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep;
11199
import org.jenkinsci.plugins.workflow.steps.durable_task.Messages;
112-
import org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader;
113100
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
114101
import org.junit.AfterClass;
115102
import static org.junit.Assert.*;
@@ -127,7 +114,6 @@
127114
import org.jvnet.hudson.test.MockAuthorizationStrategy;
128115
import org.jvnet.hudson.test.RestartableJenkinsRule;
129116
import org.jvnet.hudson.test.TestExtension;
130-
import org.jvnet.hudson.test.recipes.LocalData;
131117

132118
/** Tests pertaining to {@code node} and {@code sh} steps. */
133119
public class ExecutorStepTest {
@@ -1126,105 +1112,6 @@ List<String> currentLabels() {
11261112
});
11271113
}
11281114

1129-
@Issue("JENKINS-39134")
1130-
@LocalData
1131-
@Test public void serialForm() {
1132-
story.addStep(new Statement() {
1133-
@Override public void evaluate() throws Throwable {
1134-
WorkflowJob p = story.j.jenkins.getItemByFullName("p", WorkflowJob.class);
1135-
WorkflowRun b = p.getBuildByNumber(1);
1136-
assertThat(patchedFiles, containsInAnyOrder(/* "program.dat", */"3.xml", "3.log", "log"));
1137-
/* TODO this seems to randomly not include the expected items:
1138-
assertThat(patchedFields, Matchers.containsInAnyOrder(
1139-
// But not FileMonitoringController.controlDir, since this old version is still using location-independent .id.
1140-
"private final java.lang.String org.jenkinsci.plugins.workflow.support.pickles.FilePathPickle.path",
1141-
"private final java.lang.String org.jenkinsci.plugins.workflow.support.pickles.WorkspaceListLeasePickle.path",
1142-
"private java.lang.String org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.remote"));
1143-
*/
1144-
story.j.assertLogContains("simulated later output", story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b)));
1145-
}
1146-
});
1147-
}
1148-
private static final List<String> patchedFiles = new ArrayList<>();
1149-
private static final List<String> patchedFields = new ArrayList<>();
1150-
// TODO @TestExtension("serialForm") ItemListener does not work since we need to run before FlowExecutionList.ItemListenerImpl yet TestExtension does not support ordinal
1151-
@Initializer(before = InitMilestone.JOB_LOADED) public static void replaceWorkspacePath() throws Exception {
1152-
final File prj = new File(Jenkins.getInstance().getRootDir(), "jobs/p");
1153-
final File workspace = new File(prj, "workspace");
1154-
final String ORIG_WS = "/space/tmp/AbstractStepExecutionImpl-upgrade/jobs/p/workspace";
1155-
final String newWs = workspace.getAbsolutePath();
1156-
File controlDir = new File(workspace, ".eb6272d3");
1157-
if (!controlDir.isDirectory()) {
1158-
return;
1159-
}
1160-
System.err.println("Patching " + controlDir);
1161-
RiverReader.customResolver = new ObjectResolver() {
1162-
@Override public Object readResolve(Object replacement) {
1163-
Class<?> c = replacement.getClass();
1164-
//System.err.println("replacing " + c.getName());
1165-
while (c != Object.class) {
1166-
for (Field f : c.getDeclaredFields()) {
1167-
if (f.getType() == String.class) {
1168-
try {
1169-
f.setAccessible(true);
1170-
Object v = f.get(replacement);
1171-
if (ORIG_WS.equals(v)) {
1172-
//System.err.println("patching " + f);
1173-
f.set(replacement, newWs);
1174-
patchedFields.add(f.toString());
1175-
} else if (newWs.equals(v)) {
1176-
//System.err.println(f + " was already patched, somehow?");
1177-
} else {
1178-
//System.err.println("some other value " + v + " for " + f);
1179-
}
1180-
} catch (Exception x) {
1181-
x.printStackTrace();
1182-
}
1183-
}
1184-
}
1185-
c = c.getSuperclass();
1186-
}
1187-
return replacement;
1188-
}
1189-
@Override public Object writeReplace(Object original) {
1190-
throw new IllegalStateException();
1191-
}
1192-
};
1193-
Files.walkFileTree(prj.toPath(), new SimpleFileVisitor<Path>() {
1194-
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
1195-
File f = file.toFile();
1196-
String name = f.getName();
1197-
if (name.equals("program.dat")) {
1198-
/* TODO could not get this to work; stream appeared corrupted:
1199-
patchedFiles.add(name);
1200-
String origContent = FileUtils.readFileToString(f, StandardCharsets.ISO_8859_1);
1201-
String toReplace = String.valueOf((char) Protocol.ID_STRING_SMALL) + String.valueOf((char) ORIG_WS.length()) + ORIG_WS;
1202-
int newLen = newWs.length();
1203-
String replacement = String.valueOf((char) Protocol.ID_STRING_MEDIUM) +
1204-
String.valueOf((char) (newLen & 0xff00) >> 8) +
1205-
String.valueOf((char) newLen & 0xff) +
1206-
newWs; // TODO breaks if not ASCII
1207-
String replacedContent = origContent.replace(toReplace, replacement);
1208-
assertNotEquals("failed to replace ‘" + toReplace + "’", replacedContent, origContent);
1209-
FileUtils.writeStringToFile(f, replacedContent, StandardCharsets.ISO_8859_1);
1210-
*/
1211-
} else {
1212-
String origContent = FileUtils.readFileToString(f, StandardCharsets.ISO_8859_1);
1213-
String replacedContent = origContent.replace(ORIG_WS, newWs);
1214-
if (!replacedContent.equals(origContent)) {
1215-
patchedFiles.add(name);
1216-
FileUtils.writeStringToFile(f, replacedContent, StandardCharsets.ISO_8859_1);
1217-
}
1218-
}
1219-
return super.visitFile(file, attrs);
1220-
}
1221-
});
1222-
FilePath controlDirFP = new FilePath(controlDir);
1223-
controlDirFP.child("jenkins-result.txt").write("0", null);
1224-
FilePath log = controlDirFP.child("jenkins-log.txt");
1225-
log.write(log.readToString() + "simulated later output\n", null);
1226-
}
1227-
12281115
@Issue("SECURITY-675")
12291116
@Test public void authentication() {
12301117
story.then(r -> {

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/3.log

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/5.log

-2
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/build.xml

-35
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/log

-7
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/2.xml

-7
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/3.xml

-23
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/4.xml

-16
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/5.xml

-18
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/config.xml

-14
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/nextBuildNumber

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/jenkins-log.txt

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/pid

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/script.sh

-2
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/org.jenkinsci.plugins.workflow.flow.FlowExecutionList.xml

-7
This file was deleted.

0 commit comments

Comments
 (0)