Monday, December 10, 2007

How to test my java mappings?

Here is a template for a Java Mapping class with a main method:



package sample;

import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map;

public class MyJavaMapping implements StreamTransformation {

public static void main(String[] args) {
try {
InputStream in = new FileInputStream(new File("in.xml"));
OutputStream out = new FileOutputStream(new File("out.xml"));
MyJavaMapping myMapping = new MyJavaMapping();
myMapping.execute(in, out);
} catch (Exception e) {
e.printStackTrace();
}
}

public void setParameter(Map map) {
}

public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// Add your code here
}
}

All you have to do is placing an xml file "in.xml" in the working directory of your Java program, set a break point and start the program.

Remark: For compiling you need the library aii_map_api.jar

No comments:

Blog Archive