Search in sources :

Example 36 with MetadataRecord

use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.

the class MarcRecordImplTest method getCitationFormatElectronicPeriodical.

@Test
public void getCitationFormatElectronicPeriodical() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("000 0000000s");
    data.add("856 41$atest");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ELECTRONIC_PERIODICAL);
    data.clear();
}
Also used : ArrayList(java.util.ArrayList) MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 37 with MetadataRecord

use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.

the class DublinCoreRecordImplTest method getPublicationTitleTest.

@Test
public void getPublicationTitleTest() throws Exception {
    DublinCoreRecord dcr = new DublinCoreRecordImpl();
    MetadataRecord metadataRecord;
    String titleStr = "DesIgnatIo IConographICa OberLeVtensDorfenses PannarIas OffICInas" + " VVLgo FabrICas PenICILLI arbItrIo Representans";
    dcr.addTitle(titleStr);
    metadataRecord = metadataFactory.getMetadataRecord(dcr);
    Assert.assertTrue(metadataRecord.getTitle().contains(Title.create(titleStr, 1L, false)));
}
Also used : MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 38 with MetadataRecord

use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.

the class DublinCoreRecordImplTest method getEANsTest.

/**
 * no Ean in DublinCore
 */
@Test
public void getEANsTest() {
    DublinCoreRecord dcr = new DublinCoreRecordImpl();
    MetadataRecord metadataRecord;
    metadataRecord = metadataFactory.getMetadataRecord(dcr);
    List<Ean> eans = metadataRecord.getEANs();
    Assert.assertTrue(eans.size() == 0);
}
Also used : MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 39 with MetadataRecord

use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.

the class DublinCoreRecordImplTest method getCNBsTest.

@Test
public void getCNBsTest() throws Exception {
    DublinCoreRecord dcr = new DublinCoreRecordImpl();
    MetadataRecord metadataRecord;
    // from K4 NDK NK - uuid:2bc5f0f0-987e-11e2-9a08-005056827e52
    String cnb1str = "ccnb:cnb000121063";
    // from Kram MZK - uuid:b602bb03-da24-4724-893d-23f9f3344498
    String cnb2str = "ccnb: cnb000790921";
    String notCnbStr = "uuid:not:cnb:identifier";
    dcr.addIdentifier(cnb1str);
    dcr.addIdentifier(notCnbStr);
    dcr.addIdentifier(cnb2str);
    metadataRecord = metadataFactory.getMetadataRecord(dcr);
    List<Cnb> cnbs = metadataRecord.getCNBs();
    Cnb cnb1 = Cnb.create("cnb000121063");
    Assert.assertTrue(cnbs.contains(cnb1));
    Cnb cnbN = Cnb.create(notCnbStr);
    Assert.assertFalse(cnbs.contains(cnbN));
    Cnb cnb2 = Cnb.create("cnb000790921");
    Assert.assertTrue(cnbs.contains(cnb2));
}
Also used : MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 40 with MetadataRecord

use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.

the class DublinCoreRecordImplTest method getISBNsTest.

@Test
public void getISBNsTest() throws Exception {
    DublinCoreRecord dcr = new DublinCoreRecordImpl();
    MetadataRecord metadataRecord;
    String isbnstr = "isbn:80-214-1182-1";
    String isbn2str = "0-582-53020-2";
    String notIsbnStr = "uuid:not:cnb:identifier";
    String noValidIsbnStr = "0-582-53020-255555";
    dcr.addIdentifier(isbnstr);
    dcr.addIdentifier(notIsbnStr);
    dcr.addIdentifier(isbn2str);
    dcr.addIdentifier(noValidIsbnStr);
    metadataRecord = metadataFactory.getMetadataRecord(dcr);
    List<Isbn> isbns = metadataRecord.getISBNs();
    Isbn isbn1 = Isbn.create(9788021411821L, 1L, "");
    Assert.assertTrue(isbns.contains(isbn1));
    Isbn isbn2 = Isbn.create(9780582530201L, 2L, "");
    Assert.assertTrue(isbns.contains(isbn2));
    Assert.assertTrue(isbns.size() == 2);
}
Also used : MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Aggregations

MetadataRecord (cz.mzk.recordmanager.server.metadata.MetadataRecord)46 AbstractTest (cz.mzk.recordmanager.server.AbstractTest)42 Test (org.testng.annotations.Test)42 ArrayList (java.util.ArrayList)32 MarcRecord (cz.mzk.recordmanager.server.marc.MarcRecord)3 Title (cz.mzk.recordmanager.server.model.Title)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 InputStream (java.io.InputStream)3 MarcWriter (org.marc4j.MarcWriter)3 MarcXmlWriter (org.marc4j.MarcXmlWriter)3 Record (org.marc4j.marc.Record)3 MarcRecordImpl (cz.mzk.recordmanager.server.marc.MarcRecordImpl)2 MarcRecordInterceptor (cz.mzk.recordmanager.server.marc.intercepting.MarcRecordInterceptor)2 HarvestedRecordFormatEnum (cz.mzk.recordmanager.server.model.HarvestedRecordFormat.HarvestedRecordFormatEnum)2 Date (java.util.Date)2 MetadataRecordFactory (cz.mzk.recordmanager.server.metadata.MetadataRecordFactory)1 Cosmotron996 (cz.mzk.recordmanager.server.model.Cosmotron996)1 HarvestedRecord (cz.mzk.recordmanager.server.model.HarvestedRecord)1 HarvestedRecordUniqueId (cz.mzk.recordmanager.server.model.HarvestedRecord.HarvestedRecordUniqueId)1 TezaurusRecord (cz.mzk.recordmanager.server.model.TezaurusRecord)1