use of org.geotoolkit.processing.chain.model.StringList in project geotoolkit by Geomatys.
the class ChainProcessTest method testXmlRW.
@Test
public void testXmlRW() throws ProcessException, JAXBException, IOException {
// test various problematic case
final Chain chain = new Chain("myChain");
// sting/string in user map
Parameter param = new Parameter("in1", String.class, "enumerated string", "none", 0, 12, "def", new String[] { "def", "undef" });
Map<String, Object> userMap = new HashMap<>();
userMap.put("test", "test");
param.setUserMap(userMap);
chain.getInputs().add(param);
Parameter param2 = new Parameter("in2", Character.class, "char", "none", 0, 12, 'c');
chain.getInputs().add(param2);
File f = File.createTempFile("chain", ".xml");
chain.write(f);
final Chain chainr = Chain.read(f);
Parameter p = chainr.getInput("in2");
// assertEquals('c', p.getDefaultValue()); problem here char are rw to integer...
// sting/double in user map
userMap = new HashMap<>();
userMap.put("test-double", 125d);
param.setUserMap(userMap);
f = File.createTempFile("chain", ".xml");
chain.write(f);
// sting/map in user map
userMap = new HashMap<>();
HashMap<String, String> typeMap = new HashMap<>();
typeMap.put("String", "String");
userMap.put("test-map", new StringMap(typeMap));
param.setUserMap(userMap);
f = File.createTempFile("chain", ".xml");
chain.write(f);
// sting/map/list in user map
userMap = new HashMap<>();
HashMap<String, StringList> typeMapList = new HashMap<>();
ArrayList a = new ArrayList<>();
a.add("String");
a.add("String2");
typeMapList.put("String", new StringList(a));
userMap.put("test-map", new StringMapList(typeMapList));
param.setUserMap(userMap);
f = File.createTempFile("chain", ".xml");
chain.write(f);
}
Aggregations