Skip to content

Commit

Permalink
fixes #25: Testresult serialized into build.xml+IntegrityResultData.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
S1artie committed Apr 1, 2022
1 parent 831b22b commit e3e8b48
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class IntegrityCompoundTestResult extends TabulatedResult {

static {
XSTREAM.alias("result", IntegrityCompoundTestResult.class);
XSTREAM.processAnnotations(IntegrityCompoundTestResult.class);
XSTREAM.registerConverter(new HeapSpaceStringConverter(), 100);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2022 Rene Schneider, GEBIT Solutions GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package de.gebit.integrity;

import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.Run;

/**
*
*
* @author Rene Schneider - initial API and implementation
*
*/
public class IntegrityPluginInitializer {

@Initializer(before = InitMilestone.JOB_LOADED)
public static void init() {
// This is important to fix issue #25 (Testresult data serialized into build.xml and integrityResultData.xml)
// Due to JEP-228 (https://github.com/jenkinsci/jep/blob/master/jep/228/README.adoc) the XStream annotations
// used on IntegrityCompoundTestResult do not work automatically anymore and must be manually parsed.
Run.XSTREAM.processAnnotations(IntegrityCompoundTestResult.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.export.Exported;

import com.thoughtworks.xstream.XStream;

import hudson.model.Action;
import hudson.model.HealthReport;
import hudson.model.Job;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.util.HeapSpaceStringConverter;
import hudson.util.XStream2;
import jenkins.tasks.SimpleBuildStep;

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

/**
* The XStream instance used for result persistence.
*/
private static final XStream XSTREAM = new XStream2();

static {
XSTREAM.alias("result", IntegrityCompoundTestResult.class);
XSTREAM.registerConverter(new HeapSpaceStringConverter(), 100);
}

/**
* The action URL part.
*/
Expand Down

0 comments on commit e3e8b48

Please sign in to comment.