Skip to content

Commit e3e8b48

Browse files
committed
fixes #25: Testresult serialized into build.xml+IntegrityResultData.xml
1 parent 831b22b commit e3e8b48

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

de.gebit.integrity.jenkins/src/main/java/de/gebit/integrity/IntegrityCompoundTestResult.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class IntegrityCompoundTestResult extends TabulatedResult {
5252

5353
static {
5454
XSTREAM.alias("result", IntegrityCompoundTestResult.class);
55+
XSTREAM.processAnnotations(IntegrityCompoundTestResult.class);
5556
XSTREAM.registerConverter(new HeapSpaceStringConverter(), 100);
5657
}
5758

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2022 Rene Schneider, GEBIT Solutions GmbH and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*******************************************************************************/
8+
package de.gebit.integrity;
9+
10+
import hudson.init.InitMilestone;
11+
import hudson.init.Initializer;
12+
import hudson.model.Run;
13+
14+
/**
15+
*
16+
*
17+
* @author Rene Schneider - initial API and implementation
18+
*
19+
*/
20+
public class IntegrityPluginInitializer {
21+
22+
@Initializer(before = InitMilestone.JOB_LOADED)
23+
public static void init() {
24+
// This is important to fix issue #25 (Testresult data serialized into build.xml and integrityResultData.xml)
25+
// Due to JEP-228 (https://github.com/jenkinsci/jep/blob/master/jep/228/README.adoc) the XStream annotations
26+
// used on IntegrityCompoundTestResult do not work automatically anymore and must be manually parsed.
27+
Run.XSTREAM.processAnnotations(IntegrityCompoundTestResult.class);
28+
}
29+
30+
}

de.gebit.integrity.jenkins/src/main/java/de/gebit/integrity/IntegrityTestResultAction.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
import org.kohsuke.stapler.StaplerProxy;
1616
import org.kohsuke.stapler.export.Exported;
1717

18-
import com.thoughtworks.xstream.XStream;
19-
2018
import hudson.model.Action;
2119
import hudson.model.HealthReport;
2220
import hudson.model.Job;
2321
import hudson.model.Run;
2422
import hudson.model.TaskListener;
2523
import hudson.tasks.test.AbstractTestResultAction;
26-
import hudson.util.HeapSpaceStringConverter;
27-
import hudson.util.XStream2;
2824
import jenkins.tasks.SimpleBuildStep;
2925

3026
/**
@@ -45,16 +41,6 @@ public class IntegrityTestResultAction extends AbstractTestResultAction<Integrit
4541
*/
4642
private transient List<IntegrityProjectAction> projectActions;
4743

48-
/**
49-
* The XStream instance used for result persistence.
50-
*/
51-
private static final XStream XSTREAM = new XStream2();
52-
53-
static {
54-
XSTREAM.alias("result", IntegrityCompoundTestResult.class);
55-
XSTREAM.registerConverter(new HeapSpaceStringConverter(), 100);
56-
}
57-
5844
/**
5945
* The action URL part.
6046
*/

0 commit comments

Comments
 (0)