Revision 48139
Added by Alessia Bardi over 6 years ago
ContextUtilsTest.java | ||
---|---|---|
19 | 19 |
public class ContextUtilsTest { |
20 | 20 |
|
21 | 21 |
private static final Log log = LogFactory.getLog(ContextUtilsTest.class); |
22 |
private String params = "{param1:value1,param2:value2}"; |
|
22 | 23 |
|
23 | 24 |
@Test |
24 | 25 |
public void testContextFactory() throws DocumentException { |
... | ... | |
35 | 36 |
+ "\t\t\t</fundingtree>\n" |
36 | 37 |
+ "\t\t</fundings>"); |
37 | 38 |
|
38 |
final ContextDesc context = ContextUtils.getContext(it, "ARC", "Australian Research Council (ARC)", "funding"); |
|
39 |
final ContextDesc context = ContextUtils.getContext(it, "ARC", "Australian Research Council (ARC)", "funding", params);
|
|
39 | 40 |
|
40 | 41 |
final Iterable<String> iter = Iterables.transform(context.getDbEntries().entrySet(), ContextUtils.getContextRowTransformer()); |
41 | 42 |
|
42 | 43 |
final SAXReader r = new SAXReader(); |
43 | 44 |
|
44 |
for(String f : iter) { |
|
45 |
for (String f : iter) {
|
|
45 | 46 |
|
46 | 47 |
final Document fd = r.read(new StringReader(f)); |
47 | 48 |
|
... | ... | |
49 | 50 |
assertTrue("AU".equals(fd.valueOf("//FIELD[@name='jurisdiction']"))); |
50 | 51 |
assertTrue("arc_________::ARC".equals(fd.valueOf("//FIELD[@name='funder']"))); |
51 | 52 |
} |
53 |
System.out.println(context.asDomElement().asXML()); |
|
52 | 54 |
} |
53 | 55 |
|
54 | 56 |
@Test |
... | ... | |
59 | 61 |
+ "\t\t\t<fundingtree/>\n" |
60 | 62 |
+ "\t\t</fundings>"); |
61 | 63 |
|
62 |
final ContextDesc context = ContextUtils.getContext(it, "HRZZ", "HRZZ", "funding"); |
|
64 |
final ContextDesc context = ContextUtils.getContext(it, "HRZZ", "HRZZ", "funding", params);
|
|
63 | 65 |
|
64 | 66 |
final Iterable<String> iter = Iterables.transform(context.getDbEntries().entrySet(), ContextUtils.getContextRowTransformer()); |
65 | 67 |
|
66 | 68 |
final SAXReader r = new SAXReader(); |
67 | 69 |
|
68 |
for(String f : iter) { |
|
70 |
for (String f : iter) {
|
|
69 | 71 |
System.out.println(f); |
70 | 72 |
|
71 | 73 |
/*final Document fd = r.read(new StringReader(f)); |
Also available in: Unified diff
integrated (hopefully) all required changes from dnet40