Revision 54784
Added by Alessia Bardi about 5 years ago
ResultEntryTest.java | ||
---|---|---|
148 | 148 |
|
149 | 149 |
} |
150 | 150 |
|
151 |
@Test |
|
152 |
public void testAsORP() throws Exception { |
|
153 |
final ResultEntry pub = new ResultEntry(); |
|
154 |
pub.setOriginalId("ORIG_ID_1234"); |
|
155 |
pub.setTitle("TEST TITLE <test>"); |
|
156 |
pub.getAuthors().add("Michele Artini"); |
|
157 |
pub.getAuthors().add("Claudio Atzori"); |
|
158 |
pub.getAuthors().add("Alessia Bardi"); |
|
159 |
pub.setPublisher("Test publisher"); |
|
160 |
pub.setDescription("DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION & DESCRIPTION "); |
|
161 |
pub.setLanguage("ita"); |
|
162 |
pub.setLicenseCode("CLOSED"); |
|
163 |
pub.setAccessRightCode("OPEN"); |
|
164 |
pub.setResourceType("0020"); |
|
165 |
pub.setType("other"); |
|
166 |
pub.setUrl("http://test.it/a=1&b=2"); |
|
167 |
pub.getPids().add(new PidEntry("doi", "10.000/xyz-123")); |
|
168 |
pub.getPids().add(new PidEntry("oai", "oai:1234")); |
|
169 |
pub.setCollectedFromId("test________::zenodo"); |
|
170 |
pub.setHostedById("test________::UNKNOWN"); |
|
171 |
pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus"); |
|
172 |
pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble"); |
|
173 |
pub.getContexts().add("egi::classification::natsc::math::pure"); |
|
174 |
pub.getContexts().add("egi::classification::natsc::math::stats"); |
|
175 |
final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd"); |
|
151 | 176 |
|
177 |
final Document doc = new SAXReader().read(new StringReader(xml)); |
|
178 |
|
|
179 |
final OutputFormat format = OutputFormat.createPrettyPrint(); |
|
180 |
|
|
181 |
final XMLWriter writer = new XMLWriter(System.out, format); |
|
182 |
|
|
183 |
writer.write(doc); |
|
184 |
|
|
185 |
/* writer.close(); */ |
|
186 |
|
|
187 |
} |
|
188 |
|
|
189 |
|
|
152 | 190 |
@Test |
153 | 191 |
public void testAsIndexRecord_json() throws Exception { |
154 | 192 |
testAsIndexRecord_json("test_record.json"); |
Also available in: Unified diff
test for ORPs