Revision 57679
Added by Alessia Bardi over 4 years ago
modules/dnet-openaireplus-workflows/trunk/src/test/java/eu/dnetlib/msro/openaireplus/workflows/nodes/contexts/ContextUtilsTest.java | ||
---|---|---|
146 | 146 |
} |
147 | 147 |
} |
148 | 148 |
|
149 |
@Test |
|
150 |
public void testCountry() throws DocumentException { |
|
151 |
|
|
152 |
Iterable<String> it = Lists.newArrayList( |
|
153 |
"\t\t<fundings>\n" |
|
154 |
+ "\t\t\t<fundingtree>\n" |
|
155 |
+ "\t\t\t\t<funder>\n" |
|
156 |
+ "\t\t\t\t\t<id>arc_________::ARC</id>\n" |
|
157 |
+ "\t\t\t\t\t<shortname>ARC</shortname>\n" |
|
158 |
+ "\t\t\t\t\t<name>Australian Research Council (ARC)</name>\n" |
|
159 |
+ "\t\t\t\t\t<jurisdiction>AU</jurisdiction>\n" |
|
160 |
+ "\t\t\t\t</funder>\n" |
|
161 |
+ "\t\t\t</fundingtree>\n" |
|
162 |
+ "\t\t</fundings>"); |
|
163 |
|
|
164 |
final ContextDesc context = ContextUtils.getContext(it, "ARC", "ARC", "funding", params, "hidden"); |
|
165 |
|
|
166 |
final Iterable<String> iter = Iterables.transform(context.getDbEntries().entrySet(), ContextUtils.getContextRowTransformer()); |
|
167 |
|
|
168 |
final SAXReader r = new SAXReader(); |
|
169 |
|
|
170 |
for (String f : iter) { |
|
171 |
System.out.println(f); |
|
172 |
|
|
173 |
final Document fd = r.read(new StringReader(f)); |
|
174 |
|
|
175 |
assertTrue(fd != null); |
|
176 |
assertTrue("AU".equals(fd.valueOf("//FIELD[@name='jurisdiction']"))); |
|
177 |
assertTrue("arc_________::ARC".equals(fd.valueOf("//FIELD[@name='funder']"))); |
|
178 |
} |
|
179 |
} |
|
180 |
|
|
149 | 181 |
} |
modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/contexts/ContextUtils.java | ||
---|---|---|
167 | 167 |
res.put("id", doc.valueOf("//funder/id")); |
168 | 168 |
res.put("legalshortname", doc.valueOf("//funder/shortname")); |
169 | 169 |
res.put("legalname", doc.valueOf("//funder/name")); |
170 |
res.put("country", doc.valueOf("//funder/jurisdiction")); |
|
170 | 171 |
return res; |
171 | 172 |
} |
172 | 173 |
|
Also available in: Unified diff
Add country to funders