net.sf.pipet.test
Class PipelineSimulator
java.lang.Object
net.sf.pipet.test.PipelineSimulator
public class PipelineSimulator
- extends Object
This class helps testing PipeT modules.
To use this class, define a test case. A test case consists of the following:
- a pipeline setup file, and the name of the pipeline within that setup which is the test subject;
- the input data for each input pipe;
- the expected output data for each output pipe;
- the expected success status of the pipeline (true or false).
The test case is successful if:
- the output matches the expected output; and
- the success status matches the expected success status.
A test case is declared in a file. An example test case is the following:
[general]
configuration = pipelines.cfg
pipeline = xslt
status = true
[attributes]
att1 = some value
att2 = another value
[input/xsl]
file = xslt.xsl
[input/input]
string = <?xml version="1.0"?><xml><input/></xml>
[output/output]
string = <?xml version="1.0" encoding="UTF-8"?><document><element/></document>
Use the run()
method to perform the test. If the test fails, it throws an exception.
A PipelineSimulator instance can be created from a test case declaration
using parseURL().
The following code examplifies the use of this class:
URL url = ClassLoader.getSystemResource("case.test");
if (url == null)
throw new Exception("Test file not found: "+file);
PipelineSimulator sim = PipelineSimulator.parseURL(url);
sim.run();
Constructor Summary |
PipelineSimulator(Configuration cfg,
String pipeline_name,
boolean status,
Map<String,byte[]> input,
Map<String,byte[]> output)
|
PipelineSimulator(Configuration cfg,
String pipeline_name,
boolean status,
Map<String,byte[]> input,
Map<String,byte[]> output,
ModuleAttributes atts)
|
DETECT_OPEN_FILE_LEAKS
public static boolean DETECT_OPEN_FILE_LEAKS
PipelineSimulator
public PipelineSimulator(Configuration cfg,
String pipeline_name,
boolean status,
Map<String,byte[]> input,
Map<String,byte[]> output,
ModuleAttributes atts)
PipelineSimulator
public PipelineSimulator(Configuration cfg,
String pipeline_name,
boolean status,
Map<String,byte[]> input,
Map<String,byte[]> output)
getPipelineConfiguration
public Configuration getPipelineConfiguration()
getPipelineName
public String getPipelineName()
getStatus
public boolean getStatus()
getModuleAttributes
public ModuleAttributes getModuleAttributes()
getInputPipes
public Map<String,byte[]> getInputPipes()
getOutputPipes
public Map<String,byte[]> getOutputPipes()
run
public void run()
throws Exception
- Throws:
Exception
run
public void run(net.sf.qxs.messenger.Messenger messenger)
throws Exception
- Throws:
Exception
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
equals
public boolean equals(Object object)
- Overrides:
equals
in class Object
parseURL
public static PipelineSimulator parseURL(URL url)
throws Exception
- Throws:
Exception
Copyright © 2011 VU University Amsterdam. All Rights Reserved.