use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getPublicationYearTest.
@Test
public void getPublicationYearTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
data.add("260 $c1977");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c[1977]");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $cc1977");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $cc[1977]");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $cp1977");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $cp[1977]");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c1977-2003");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c1977 printing, c1975");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c1977-");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c1977, c1978");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $cApril 15, 1977");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c1977[i.e. 1971]");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c<1977->");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("260 $c197-");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertNull(metadataRecord.getPublicationYear());
data.clear();
data.add("260 $casdba");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertNull(metadataRecord.getPublicationYear());
data.clear();
data.add("264 $c<1977->");
data.add("260 $c<1978->");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1977);
data.clear();
data.add("008 950928s1981----xr ||||e||||||||||||cze||");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPublicationYear().longValue(), 1981);
data.clear();
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getISMNsTest.
@Test
public void getISMNsTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
List<Ismn> ismnlist = new ArrayList<>();
// no ismn test
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getISMNs(), Collections.EMPTY_LIST);
data.clear();
// create ismn
data.add("024 2 $aM-2600-0224-1$q(brož.)");
ismnlist.add(Ismn.create(9790260002241L, 1L, "brož."));
data.add("024 2 $a979-0-2600-0125-1$q(sešity v obálce)");
ismnlist.add(Ismn.create(9790260001251L, 2L, "sešity v obálce"));
data.add("024 2 $aM-66056-061-7$q(Praha ;$qv hudebnině neuvedeno ;$qbrož.)");
ismnlist.add(Ismn.create(9790660560617L, 3L, "Praha v hudebnině neuvedeno ; brož."));
data.add("024 2 $aM-66056-061-7 (Brno)$q(Praha)");
ismnlist.add(Ismn.create(9790660560617L, 4L, "Brno Praha"));
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
List<Ismn> results = metadataRecord.getISMNs();
Assert.assertEquals(results.size(), ismnlist.size());
for (int i = 0; i < ismnlist.size(); i++) {
Assert.assertEquals(results.get(i), ismnlist.get(i), String.format("ISMN on position %d differs.", i));
}
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getOclcsTest.
@Test
public void getOclcsTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
final String oclc1 = "11608569";
final String oclc2 = "ocn123456789";
data.add("035 $a(OCoLC)" + oclc1);
data.add("035 $a(OCoLC)" + oclc2);
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getOclcs().size(), 2);
Assert.assertEquals(metadataRecord.getOclcs().get(0).getOclcStr(), oclc1);
Assert.assertEquals(metadataRecord.getOclcs().get(1).getOclcStr(), oclc2);
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method shortTitleTest.
@Test
public void shortTitleTest() 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("245 $aa$pp$nn");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
ShortTitle expectedST1 = ShortTitle.create("nap", 1L, false);
ShortTitle expectedST2 = ShortTitle.create("anp", 2L, false);
Assert.assertEquals(2, metadataRecord.getShortTitles().size());
Assert.assertEquals(metadataRecord.getShortTitles().get(0), expectedST1);
Assert.assertEquals(metadataRecord.getShortTitles().get(1), expectedST2);
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getCitationFormatElectronicArticles.
@Test
public void getCitationFormatElectronicArticles() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
data.add("000 0000000b");
data.add("856 41$atest");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ELECTRONIC_ARTICLE);
data.clear();
}
Aggregations