Search in sources :

Example 6 with MetadataRecord

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

the class MarcRecordImplTest method getAuthorAuthStringTest.

@Test
public void getAuthorAuthStringTest() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("100 $aEliska");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getAuthorString(), "Eliska");
    data.clear();
    data.add("700 $aEliska");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getAuthorString(), "Eliska");
    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 7 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatArticle.

@Test
public void getCitationFormatArticle() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("000 0000000a");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ARTICLE);
    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 8 with MetadataRecord

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

the class MarcRecordImplTest method getISBNsTest.

@Test
public void getISBNsTest() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    List<Isbn> isbnlist = new ArrayList<>();
    // no isbn test
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getISBNs(), Collections.EMPTY_LIST);
    // create isbns
    data.add("020 $a9788086026923 (váz)");
    isbnlist.add(Isbn.create(9788086026923L, 1L, "váz"));
    data.add("020 $a978-80-7250-482-4$q(váz)$q(q1)$qq2");
    isbnlist.add(Isbn.create(9788072504824L, 2L, "váz q1 q2"));
    data.add("020 $a80-200-0980-9");
    isbnlist.add(Isbn.create(9788020009807L, 3L, ""));
    // invalid isbn
    data.add("020 $a456");
    isbnlist.add(Isbn.create(9782011668554L, 4L, ""));
    data.add("020 $a2-01-16-6855-7");
    isbnlist.add(Isbn.create(9782980406003L, 5L, ""));
    data.add("020 $a2-9804060-07");
    isbnlist.add(Isbn.create(9783925967214L, 6L, ""));
    data.add("020 $a3-925 967-21-4");
    isbnlist.add(Isbn.create(9783925967214L, 7L, ""));
    data.add("020 $a  3-925 967-21-4");
    isbnlist.add(Isbn.create(9780521376679L, 8L, ""));
    data.add("020 $a052137667x");
    isbnlist.add(Isbn.create(9783596263936L, 9L, ""));
    data.add("020 $a3-596-26393-x");
    isbnlist.add(Isbn.create(9785268012866L, 10L, ""));
    data.add("020 $a5-268-01286-x");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    List<Isbn> results = metadataRecord.getISBNs();
    Assert.assertEquals(results.size(), isbnlist.size());
    for (int i = 0; i < isbnlist.size(); i++) {
        Assert.assertEquals(results.get(i), isbnlist.get(i), String.format("ISBN on position %d differs.", i));
    }
}
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 9 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatAcademicWork.

@Test
public void getCitationFormatAcademicWork() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("502 $atest");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ACADEMIC_WORK);
    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 10 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatElectronicBook.

@Test
public void getCitationFormatElectronicBook() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("000 000000td");
    data.add("856 41$atest");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ELECTRONIC_BOOK);
    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)

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