use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.
the class MarcScriptFactoryTest method test2.
@Test
public void test2() {
MarcRecord record = parser.parseRecord(this.getClass().getResourceAsStream("/records/marcxml/MZK01-000087310.xml"));
InputStream is1 = getClass().getResourceAsStream("/groovy/ExtendedMarc.groovy");
InputStream is2 = getClass().getResourceAsStream("/groovy/BaseMarc.groovy");
MappingScript<MarcFunctionContext> script = factory.create(is1, is2);
MarcFunctionContext ctx = new MarcFunctionContext(record, metadataRecordFactory.getMetadataRecord(record));
Map<String, Object> entries = script.parse(ctx);
Collection<?> author2Roles = (Collection<?>) entries.get("author2_role");
Assert.assertTrue(author2Roles.isEmpty());
}
use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.
the class BoundingBoxMarcFunctionsTest method testAustralia.
@Test
public void testAustralia() throws Exception {
List<String> data = new ArrayList<String>();
data.add("034 $aa $b6000000 $dE1023922 $eE1784848 $fN0023252 $gS0474141");
MarcRecord record = MarcRecordFactory.recordFactory(data);
String result = functions.getBoundingBox(new MarcFunctionContext(record, null, null));
Assert.assertEquals(result, "102.65611111111112 -47.69472222222222 178.81333333333333 2.5477777777777777");
}
use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.
the class BoundingBoxMarcFunctionsTest method testSantiago.
@Test
public void testSantiago() throws Exception {
List<String> data = new ArrayList<String>();
data.add("034 $aa $b5100000 $dW0720810 $eW0475023 $fS0135757 $gS0345432");
MarcRecord record = MarcRecordFactory.recordFactory(data);
String result = functions.getBoundingBox(new MarcFunctionContext(record, null, null));
Assert.assertEquals(result, "-72.13611111111112 -34.90888888888889 -47.83972222222222 -13.965833333333332");
}
use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.
the class MzkFormatFunctionsTest method photographyFormat.
public void photographyFormat() throws Exception {
List<String> data = new ArrayList<String>();
data.add("072 $a77 $xfotografie");
String format = formatFunctions.getMZKFormat(new MarcFunctionContext(MarcRecordFactory.recordFactory(data)));
Assert.assertEquals(format, "Photography");
}
use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.
the class MzkFormatFunctionsTest method lawsOrOthersFormat.
public void lawsOrOthersFormat() throws Exception {
List<String> data = new ArrayList<String>();
data.add("000 -----nai-a22-----2a-4500");
String format = formatFunctions.getMZKFormat(new MarcFunctionContext(MarcRecordFactory.recordFactory(data)));
Assert.assertEquals(format, "LawsOrOthers");
}
Aggregations