hudson.plugins.testng
Class BuildActionConverter

java.lang.Object
  extended by hudson.plugins.testng.BuildActionConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

public class BuildActionConverter
extends Object
implements com.thoughtworks.xstream.converters.Converter

Here for backward compatibility. Unmarshals the build action in a backward compatible manner and marshals it out as well.

(Note: Not sure if this is the best approach, but I couldn't find another that could deal nicely with AbstractTestResultAction.owner which is defined as final)

Author:
nullin

Constructor Summary
BuildActionConverter()
          Create the converter
 
Method Summary
 boolean canConvert(Class type)
           
 void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
          Marshals out the TestNGTestResultBuildAction object.
 Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
          Unmarshals the TestNG build action in a backward compatible way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildActionConverter

public BuildActionConverter()
Create the converter

Method Detail

canConvert

public boolean canConvert(Class type)
Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher

marshal

public void marshal(Object source,
                    com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                    com.thoughtworks.xstream.converters.MarshallingContext context)
Marshals out the TestNGTestResultBuildAction object.

We are only marshaling out the AbstractTestResultAction.owner of the action. We (currently) don't care about AbstractTestResultAction.descriptions

Specified by:
marshal in interface com.thoughtworks.xstream.converters.Converter
Parameters:
source - source
writer - writer
context - context

unmarshal

public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                        com.thoughtworks.xstream.converters.UnmarshallingContext context)
Unmarshals the TestNG build action in a backward compatible way.

It's needed so that we can deal with builds that have were run using (the now deleted) TestNGBuildAction class

Specified by:
unmarshal in interface com.thoughtworks.xstream.converters.Converter
Parameters:
reader - reader
context - context
Returns:
unmarshalled object


Copyright © 2004-2013. All Rights Reserved.