Search in sources :

Example 31 with MetadataRecord

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

the class MarcRecordImplTest method getSeriesISSNtests.

@Test
public void getSeriesISSNtests() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("490 $aVědecké spisy Vysokého učení technického v Brně. PhD Thesis,$x1213-4198 ;$vsv. 744");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getISSNSeries(), "1213-4198 ;");
    Assert.assertEquals(metadataRecord.getISSNSeriesOrder(), "sv. 744");
    data.clear();
    data.add("490 $aEkonomika, právo, politika,$x1213-3299 ;$vč. 97/2012");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getISSNSeries(), "1213-3299 ;");
    Assert.assertEquals(metadataRecord.getISSNSeriesOrder(), "č. 97/2012");
    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 32 with MetadataRecord

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

the class MarcRecordImplTest method getDetectedFormatListTest.

@Test
public void getDetectedFormatListTest() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    List<HarvestedRecordFormatEnum> hrf = new ArrayList<>();
    // Books
    data.add("000 00000000");
    data.add("006 a");
    hrf.add(HarvestedRecordFormatEnum.BOOKS);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Periodicals
    data.add("000 0000000i");
    hrf.add(HarvestedRecordFormatEnum.PERIODICALS);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Articles
    data.add("000 0000000a");
    hrf.add(HarvestedRecordFormatEnum.ARTICLES);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Maps
    data.add("000 000000000");
    data.add("245 $hkartografický dokument");
    hrf.add(HarvestedRecordFormatEnum.MAPS);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Musical
    data.add("000 00000000");
    data.add("336 $bntv");
    hrf.add(HarvestedRecordFormatEnum.MUSICAL_SCORES);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Vusial documents
    data.add("000 00000000");
    data.add("338 $bgasd");
    hrf.add(HarvestedRecordFormatEnum.VISUAL_DOCUMENTS);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Microforms
    data.add("000 0000000");
    data.add("337 $bh");
    hrf.add(HarvestedRecordFormatEnum.OTHER_MICROFORMS);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Braill
    data.add("000 00000000");
    data.add("007 fb");
    data.add("245 $hhmatové písmo");
    hrf.add(HarvestedRecordFormatEnum.BLIND_BRAILLE);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Audio
    data.add("000 00000000");
    data.add("300 $fanaloaSg$amagnetofonová kazeta");
    hrf.add(HarvestedRecordFormatEnum.AUDIO_CASSETTE);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Video
    data.add("000 000000000");
    data.add("007 vlllv");
    hrf.add(HarvestedRecordFormatEnum.VIDEO_DVD);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Kit
    data.add("000 00000000");
    data.add("006 o");
    data.add("007 o");
    hrf.add(HarvestedRecordFormatEnum.OTHER_OTHER);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Object
    data.add("000 00000000");
    data.add("008 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzd");
    hrf.add(HarvestedRecordFormatEnum.OTHER_OTHER);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Mix document
    data.add("000 000000p");
    hrf.add(HarvestedRecordFormatEnum.OTHER_OTHER);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Unspecified
    data.add("000 00000000");
    data.add("337 $bx");
    hrf.add(HarvestedRecordFormatEnum.OTHER_OTHER);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
    // Nothing
    data.add("000 00000000");
    hrf.add(HarvestedRecordFormatEnum.OTHER_OTHER);
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertEquals(metadataRecord.getDetectedFormatList().toString(), hrf.toString());
    data.clear();
    hrf.clear();
}
Also used : ArrayList(java.util.ArrayList) HarvestedRecordFormatEnum(cz.mzk.recordmanager.server.model.HarvestedRecordFormat.HarvestedRecordFormatEnum) MetadataRecord(cz.mzk.recordmanager.server.metadata.MetadataRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 33 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatMap.

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

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

the class MarcRecordImplTest method getScaleTest.

@Test
public void getScaleTest() throws Exception {
    MarcRecordImpl mri;
    MetadataRecord metadataRecord;
    List<String> data = new ArrayList<>();
    data.add("255 $aMěřítko 1:250 000");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertTrue(metadataRecord.getScale().equals(250000L));
    data.clear();
    data.add("255 $aMěřítko 1:50^000");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertTrue(metadataRecord.getScale().equals(50000L));
    data.clear();
    data.add("255 $$$aMěřítko 1:30^000 (14°59'v.d.-15°33'v.d./50°40's.š.-50°25's.š.)");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertTrue(metadataRecord.getScale().equals(30000L));
    data.clear();
    data.add("255 $aMěřítko neuvedeno");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertNull(metadataRecord.getScale());
    data.clear();
    data.add("255 $aMěřítko 1:20^000 a 1:150^000");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertTrue(metadataRecord.getScale().equals(20000L));
    data.clear();
    data.add("255 $aMěřítko 1:150000");
    mri = MarcRecordFactory.recordFactory(data);
    metadataRecord = metadataFactory.getMetadataRecord(mri);
    Assert.assertTrue(metadataRecord.getScale().equals(150000L));
    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 35 with MetadataRecord

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

the class MarcRecordImplTest method getCitationFormatBook.

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