1
2
3
4
5
6
7
8
9
10
11 package org.mule.transformers.script;
12
13 import org.mule.tck.AbstractTransformerTestCase;
14 import org.mule.umo.transformer.UMOTransformer;
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19 public class GroovyScriptTransformerTestCase extends AbstractTransformerTestCase
20 {
21
22 public UMOTransformer getTransformer() throws Exception
23 {
24 ScriptTransformer transformer = new ScriptTransformer();
25 transformer.setScriptEngineName("groovy");
26 transformer.setName("StringToList");
27 transformer.setScriptFile("StringToList2.groovy");
28 transformer.initialise();
29 return transformer;
30 }
31
32 public UMOTransformer getRoundTripTransformer() throws Exception
33 {
34 ScriptTransformer transformer = new ScriptTransformer();
35 transformer.setName("ListToStringTransformer");
36 transformer.setScriptFile("ListToString2.groovy");
37 transformer.initialise();
38 return transformer;
39 }
40
41 public Object getTestData()
42 {
43 return "this is groovy!";
44 }
45
46 public Object getResultData()
47 {
48 List list = new ArrayList();
49 list.add("this");
50 list.add("is");
51 list.add("groovy!");
52 return list;
53 }
54
55
56 protected void doTestClone(UMOTransformer original, UMOTransformer clone) throws Exception
57 {
58 super.doTestClone(original, clone);
59
60 ScriptTransformer t1 = (ScriptTransformer) original;
61 ScriptTransformer t2 = (ScriptTransformer) clone;
62
63
64 assertNotSame(t1.scriptable, t2.scriptable);
65 }
66
67 }