Search in sources :

Example 26 with MetadataRecord

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

the class MarcRecordImplTest method getSourceInfoTest.

@Test
public void getSourceInfoTest() throws Exception {
    MarcRecordImpl mri;
    List<String> metadataList = new ArrayList<>();
    MetadataRecord metadataRecord;
    metadataList.add("773 $gg$tt$xx");
    mri = MarcRecordFactory.recordFactory(metadataList);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getSourceInfoG(), "g");
    Assert.assertEquals(metadataRecord.getSourceInfoT(), "t");
    Assert.assertEquals(metadataRecord.getSourceInfoX(), "x");
}
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 27 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatElectronicContribution.

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

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

the class MarcRecordImplTest method getTitleTest.

@Test
public void getTitleTest() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("245 $nn$aa$pp$bb");
    data.add("240 $aa$nn$bb$pp");
    data.add("240 $aDeutsche Bibliographie.$pWöchentliches Verzeichnis." + "$nReihe B,$pBeilage, Erscheinungen ausserhalb des Verlags" + "buchhandels :$bAmtsblatt der Deutschen Bibliothek.$kadasd");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Title expectedTitle1 = new Title();
    expectedTitle1.setTitleStr("napb");
    expectedTitle1.setOrderInRecord(1L);
    Title expectedTitle2 = new Title();
    expectedTitle2.setTitleStr("anbp");
    expectedTitle2.setOrderInRecord(2L);
    Title expectedTitle3 = new Title();
    expectedTitle3.setTitleStr("Deutsche Bibliographie.Wöchentliches Verzeichnis." + "Reihe B, Beilage, Erscheinungen ausserhalb des Verlags" + "buchhandels : Amtsblatt der Deutschen Bibliothek.");
    expectedTitle3.setOrderInRecord(3L);
    List<Title> titles = metadataRecord.getTitle();
    Assert.assertEquals(3, titles.size());
    Assert.assertEquals(titles.get(0), expectedTitle1);
    Assert.assertEquals(titles.get(1), expectedTitle2);
    Assert.assertEquals(titles.get(2), expectedTitle3);
    data.clear();
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(0, metadataRecord.getTitle().size());
    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 29 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatPeriodical.

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

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

the class MarcRecordImplTest method getCitationFormatOthers.

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