Search in sources :

Example 1 with DublinCoreRecordImpl

use of cz.mzk.recordmanager.server.dc.DublinCoreRecordImpl in project RecordManager2 by moravianlibrary.

the class IdentifiersDublinCoreRecordFunctionsTest method getISBNs.

@Test
public void getISBNs() {
    DublinCoreRecord record = new DublinCoreRecordImpl();
    record.addIdentifier("ISBN:0385424728");
    DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(record);
    List<String> isbns = functions.getISBNs(dcContext);
    Assert.assertFalse(isbns.isEmpty());
    Assert.assertEquals(isbns.get(0), "0385424728");
}
Also used : DublinCoreRecord(cz.mzk.recordmanager.server.dc.DublinCoreRecord) DublinCoreFunctionContext(cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext) DublinCoreRecordImpl(cz.mzk.recordmanager.server.dc.DublinCoreRecordImpl) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 2 with DublinCoreRecordImpl

use of cz.mzk.recordmanager.server.dc.DublinCoreRecordImpl in project RecordManager2 by moravianlibrary.

the class DublinCoreScriptFactoryTest method test.

@Test
public void test() {
    InputStream is1 = getClass().getResourceAsStream("/groovy/BaseDublinCore.groovy");
    MappingScript<DublinCoreFunctionContext> script = factory.create(is1);
    DublinCoreRecord record = new DublinCoreRecordImpl();
    record.addTitle("test");
    DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(record);
    Map<String, Object> entries = script.parse(dcContext);
    Assert.assertEquals(entries.size(), 1);
    Assert.assertEquals(entries.get("title"), "test");
}
Also used : DublinCoreRecord(cz.mzk.recordmanager.server.dc.DublinCoreRecord) DublinCoreFunctionContext(cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext) DublinCoreRecordImpl(cz.mzk.recordmanager.server.dc.DublinCoreRecordImpl) InputStream(java.io.InputStream) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Aggregations

AbstractTest (cz.mzk.recordmanager.server.AbstractTest)2 DublinCoreRecord (cz.mzk.recordmanager.server.dc.DublinCoreRecord)2 DublinCoreRecordImpl (cz.mzk.recordmanager.server.dc.DublinCoreRecordImpl)2 DublinCoreFunctionContext (cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext)2 Test (org.testng.annotations.Test)2 InputStream (java.io.InputStream)1