From 04b749bbd8c80829994482b39d6bbe1628517267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6hr?= Date: Fri, 28 Apr 2023 18:06:04 +0200 Subject: [PATCH] Add tests for DataHandler --- Tests/Fixtures/Hooks/documents.solr.json | 1036 ++++++++++++++++++++ Tests/Fixtures/Hooks/documents.xml | 222 +++++ Tests/Fixtures/Hooks/metadata.xml | 113 +++ Tests/Fixtures/Hooks/solrcores.xml | 13 + Tests/Functional/Hooks/DataHandlerTest.php | 212 ++++ 5 files changed, 1596 insertions(+) create mode 100644 Tests/Fixtures/Hooks/documents.solr.json create mode 100644 Tests/Fixtures/Hooks/documents.xml create mode 100644 Tests/Fixtures/Hooks/metadata.xml create mode 100644 Tests/Fixtures/Hooks/solrcores.xml create mode 100644 Tests/Functional/Hooks/DataHandlerTest.php diff --git a/Tests/Fixtures/Hooks/documents.solr.json b/Tests/Fixtures/Hooks/documents.solr.json new file mode 100644 index 0000000000..b3e3aae716 --- /dev/null +++ b/Tests/Fixtures/Hooks/documents.solr.json @@ -0,0 +1,1036 @@ +[ + { + "id": "1001LOG_0000", + "uid": 1001, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000003.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0000", + "toplevel": true, + "type": "manuscript", + "title": "Old title", + "record_id": "oai:de:slub-dresden:db:id-476251419", + "purl": "http://digital.slub-dresden.de/id476251419", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "urn": "urn:nbn:de:bsz:14-db-id4762514197", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig", + "collection-with-single-document" + ], + "fulltext": "", + "title_usi": ["Old title"], + "title_sorting": "Old title", + "place_usi": ["[S.l.]"], + "year_usi": ["[1759-1800]"], + "type_usi": ["manuscript"], + "owner_usi": ["default"], + "serial_usi": [""], + "serial_sorting": "", + "useandreproduction_usi": ["CC BY-SA 4.0"], + "shelfmark_usi": ["Go. S. 658"], + "shelfmark_sorting": "Go. S. 658", + "volume": "", + "timestamp": "2021-12-03T09:42:55.867Z" + }, + { + "id": "1001LOG_0001", + "uid": 1001, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000001.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0001", + "toplevel": false, + "type": "other", + "title": "Beigefügte Quellenbeschreibung", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["Beigefügte Quellenbeschreibung"], + "title_sorting": "Beigefügte Quellenbeschreibung", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.960Z" + }, + { + "id": "1001LOG_0002", + "uid": 1001, + "page": 2, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000002.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0002", + "toplevel": false, + "type": "other", + "title": "Beigefügtes Inhaltsverzeichnis", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["Beigefügtes Inhaltsverzeichnis"], + "title_sorting": "Beigefügtes Inhaltsverzeichnis", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.967Z" + }, + { + "id": "1001LOG_0003", + "uid": 1001, + "page": 4, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000004.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0003", + "toplevel": false, + "type": "other", + "title": "[Diverse]: 6 Airs Variés et tirés du Journal die Grazienbibliothek 1791. [Klavier]", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Diverse]: 6 Airs Variés et tirés du Journal die Grazienbibliothek 1791. [Klavier]" + ], + "title_sorting": "[Diverse]: 6 Airs Variés et tirés du Journal die Grazienbibliothek 1791. [Klavier]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.972Z" + }, + { + "id": "1001LOG_0005", + "uid": 1001, + "page": 3, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000003.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0005", + "toplevel": false, + "type": "other", + "title": "[Dussek, Jan Ladislav]: 4 Variationen über L'Amour est un enfant Trompeur. [CraD 44]", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Dussek, Jan Ladislav]: 4 Variationen über L'Amour est un enfant Trompeur. [CraD 44]" + ], + "title_sorting": "[Dussek, Jan Ladislav]: 4 Variationen über L'Amour est un enfant Trompeur. [CraD 44]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.978Z" + }, + { + "id": "1001LOG_0006", + "uid": 1001, + "page": 8, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000008.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0006", + "toplevel": false, + "type": "other", + "title": "[Paisiello, Giovanni]: La molinara. (Thema) [RobP 1.76/15]", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Paisiello, Giovanni]: La molinara. (Thema) [RobP 1.76/15]" + ], + "title_sorting": "[Paisiello, Giovanni]: La molinara. (Thema) [RobP 1.76/15]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.983Z" + }, + { + "id": "1001LOG_0007", + "uid": 1001, + "page": 8, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000008.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0007", + "toplevel": false, + "type": "other", + "title": "[Auernhammer, Josepha Barbara von]: 6 Variationen", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Auernhammer, Josepha Barbara von]: 6 Variationen"], + "title_sorting": "[Auernhammer, Josepha Barbara von]: 6 Variationen", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.989Z" + }, + { + "id": "1001LOG_0008", + "uid": 1001, + "page": 18, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000018.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0008", + "toplevel": false, + "type": "other", + "title": "[Gelinek, Josef]: 6 Variationen", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Gelinek, Josef]: 6 Variationen"], + "title_sorting": "[Gelinek, Josef]: 6 Variationen", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.994Z" + }, + { + "id": "1001LOG_0009", + "uid": 1001, + "page": 28, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000028.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0009", + "toplevel": false, + "type": "other", + "title": "[Dalayrac, Nicolas-Marie]: Nina. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 45]", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Dalayrac, Nicolas-Marie]: Nina. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 45]" + ], + "title_sorting": "[Dalayrac, Nicolas-Marie]: Nina. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 45]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:55.998Z" + }, + { + "id": "1001LOG_0010", + "uid": 1001, + "page": 35, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000035.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0010", + "toplevel": false, + "type": "other", + "title": "[Dezède, Nicolas]: Blaise et Babet. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 46]", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Dezède, Nicolas]: Blaise et Babet. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 46]" + ], + "title_sorting": "[Dezède, Nicolas]: Blaise et Babet. (Thema) ; [Dussek, Jan Ladislav]: 4 Variationen [CraD 46]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.002Z" + }, + { + "id": "1001LOG_0011", + "uid": 1001, + "page": 40, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000040.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0011", + "toplevel": false, + "type": "other", + "title": "[Christmann, Johann Friedrich]: Rondo mit 6 Variationen", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Christmann, Johann Friedrich]: Rondo mit 6 Variationen" + ], + "title_sorting": "[Christmann, Johann Friedrich]: Rondo mit 6 Variationen", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.006Z" + }, + { + "id": "1001LOG_0012", + "uid": 1001, + "page": 49, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000049.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0012", + "toplevel": false, + "type": "other", + "title": "[Anonymus]: Allegretto Con 12 Variazioni", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Anonymus]: Allegretto Con 12 Variazioni"], + "title_sorting": "[Anonymus]: Allegretto Con 12 Variazioni", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.010Z" + }, + { + "id": "1001LOG_0013", + "uid": 1001, + "page": 62, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000062.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0013", + "toplevel": false, + "type": "other", + "title": "[Anonymus]: Allegro molto Con 9 Variazione", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Anonymus]: Allegro molto Con 9 Variazione"], + "title_sorting": "[Anonymus]: Allegro molto Con 9 Variazione", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.013Z" + }, + { + "id": "1001LOG_0014", + "uid": 1001, + "page": 68, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000068.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0014", + "toplevel": false, + "type": "other", + "title": "[Anonymus]: Andante Con 3 Variazioni", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Anonymus]: Andante Con 3 Variazioni"], + "title_sorting": "[Anonymus]: Andante Con 3 Variazioni", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.017Z" + }, + { + "id": "1001LOG_0015", + "uid": 1001, + "page": 71, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000071.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0015", + "toplevel": false, + "type": "other", + "title": "[Anonymus]: Andante Con 4 Var:", + "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[Anonymus]: Andante Con 4 Var:"], + "title_sorting": "[Anonymus]: Andante Con 4 Var:", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:42:56.021Z" + }, + + { + "id": "1002LOG_0000", + "uid": 1002, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000001.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0000", + "toplevel": true, + "type": "manuscript", + "title": "6 Sacred songs - Go. S. 591", + "record_id": "oai:de:slub-dresden:db:id-476248086", + "purl": "http://digital.slub-dresden.de/id476248086", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "urn": "urn:nbn:de:bsz:14-db-id4762480864", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["6 Sacred songs - Go. S. 591"], + "title_sorting": "6 Sacred songs - Go. S. 591", + "place_usi": ["[S.l.]"], + "year_usi": ["[1840-1860]"], + "type_usi": ["manuscript"], + "owner_usi": ["default"], + "serial_usi": [""], + "serial_sorting": "", + "useandreproduction_usi": ["CC BY-SA 4.0"], + "shelfmark_usi": ["Go. S. 591"], + "shelfmark_sorting": "Go. S. 591", + "volume": "", + "timestamp": "2021-12-03T09:44:20.209Z" + }, + { + "id": "1002LOG_0002", + "uid": 1002, + "page": 3, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000003.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0002", + "toplevel": false, + "type": "other", + "title": "[Schütz, Heinrich; Cannicciari, Pompeo]: V (+1) Motetten [Partitur]", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Schütz, Heinrich; Cannicciari, Pompeo]: V (+1) Motetten [Partitur]" + ], + "title_sorting": "[Schütz, Heinrich; Cannicciari, Pompeo]: V (+1) Motetten [Partitur]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.213Z" + }, + { + "id": "1002LOG_0003", + "uid": 1002, + "page": 3, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000003.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0003", + "toplevel": false, + "type": "other", + "title": "[1] [Schütz, Heinrich]: Herr nu lässest du deinen Diener im Frieden fahren [SWV 432-433]", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[1] [Schütz, Heinrich]: Herr nu lässest du deinen Diener im Frieden fahren [SWV 432-433]" + ], + "title_sorting": "[1] [Schütz, Heinrich]: Herr nu lässest du deinen Diener im Frieden fahren [SWV 432-433]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.214Z" + }, + { + "id": "1002LOG_0004", + "uid": 1002, + "page": 11, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000011.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0004", + "toplevel": false, + "type": "other", + "title": "[2] [Schütz, Heinrich]: Wer will uns scheiden von der Liebe Gottes [SWV 330]", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[2] [Schütz, Heinrich]: Wer will uns scheiden von der Liebe Gottes [SWV 330]" + ], + "title_sorting": "[2] [Schütz, Heinrich]: Wer will uns scheiden von der Liebe Gottes [SWV 330]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.216Z" + }, + { + "id": "1002LOG_0005", + "uid": 1002, + "page": 13, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000013.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0005", + "toplevel": false, + "type": "other", + "title": "[3] [Schütz, Heinrich]: Selig sind die Todten [SWV 391]", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[3] [Schütz, Heinrich]: Selig sind die Todten [SWV 391]" + ], + "title_sorting": "[3] [Schütz, Heinrich]: Selig sind die Todten [SWV 391]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.217Z" + }, + { + "id": "1002LOG_0006", + "uid": 1002, + "page": 17, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000017.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0006", + "toplevel": false, + "type": "other", + "title": "[4] [Schütz, Heinrich]: Dank sei unserm Herrn Jesus Christus (aus der Markus-Passion)", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[4] [Schütz, Heinrich]: Dank sei unserm Herrn Jesus Christus (aus der Markus-Passion)" + ], + "title_sorting": "[4] [Schütz, Heinrich]: Dank sei unserm Herrn Jesus Christus (aus der Markus-Passion)", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.220Z" + }, + { + "id": "1002LOG_0007", + "uid": 1002, + "page": 17, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000017.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0007", + "toplevel": false, + "type": "other", + "title": "[5] [Cannicciari, Pompeo]: Regina caeli laetare", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[5] [Cannicciari, Pompeo]: Regina caeli laetare"], + "title_sorting": "[5] [Cannicciari, Pompeo]: Regina caeli laetare", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.221Z" + }, + { + "id": "1002LOG_0008", + "uid": 1002, + "page": 18, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000018.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0008", + "toplevel": false, + "type": "other", + "title": "[6] [Schütz, Heinrich]: Ehre sei dir Christe (aus der Matthäus-Passion) [SWV 479/137]", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[6] [Schütz, Heinrich]: Ehre sei dir Christe (aus der Matthäus-Passion) [SWV 479/137]" + ], + "title_sorting": "[6] [Schütz, Heinrich]: Ehre sei dir Christe (aus der Matthäus-Passion) [SWV 479/137]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.223Z" + }, + { + "id": "1002LOG_0009", + "uid": 1002, + "page": 19, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000019.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0009", + "toplevel": false, + "type": "jacket", + "title": "Originalumschlag", + "location": "https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["Originalumschlag"], + "title_sorting": "Originalumschlag", + "type_usi": ["jacket"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:20.224Z" + }, + + { + "id": "1003LOG_0000", + "uid": 1003, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000001.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0000", + "toplevel": true, + "type": "manuscript", + "title": "6 Fugues - Go. S. 317", + "record_id": "oai:de:slub-dresden:db:id-476251729", + "purl": "http://digital.slub-dresden.de/id476251729", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "urn": "urn:nbn:de:bsz:14-db-id4762517292", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["6 Fugues - Go. S. 317"], + "title_sorting": "6 Fugues - Go. S. 317", + "place_usi": ["[S.l.]"], + "year_usi": ["[um 1820]"], + "type_usi": ["manuscript"], + "owner_usi": ["default"], + "serial_usi": [""], + "serial_sorting": "", + "useandreproduction_usi": ["CC BY-SA 4.0"], + "shelfmark_usi": ["Go. S. 317"], + "shelfmark_sorting": "Go. S. 317", + "volume": "", + "timestamp": "2021-12-03T09:44:22.159Z" + }, + { + "id": "1003LOG_0001", + "uid": 1003, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000001.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0001", + "toplevel": false, + "type": "other", + "title": "[Händel, Georg Friedrich; Mozart, Wolfgang Amadeus; Bach, Johann Sebastian]: (6 Klavierfugen von Händel, W. A. Mozart und J. S. Bach)", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": [ + "[Händel, Georg Friedrich; Mozart, Wolfgang Amadeus; Bach, Johann Sebastian]: (6 Klavierfugen von Händel, W. A. Mozart und J. S. Bach)" + ], + "title_sorting": "[Händel, Georg Friedrich; Mozart, Wolfgang Amadeus; Bach, Johann Sebastian]: (6 Klavierfugen von Händel, W. A. Mozart und J. S. Bach)", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.162Z" + }, + { + "id": "1003LOG_0002", + "uid": 1003, + "page": 1, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000001.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0002", + "toplevel": false, + "type": "other", + "title": "[1 unbenannt] - F. Händel", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[1 unbenannt] - F. Händel"], + "title_sorting": "[1 unbenannt] - F. Händel", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.164Z" + }, + { + "id": "1003LOG_0003", + "uid": 1003, + "page": 4, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000004.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0003", + "toplevel": false, + "type": "other", + "title": "[2 unbenannt] - Mozart. [aus KV 399]", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[2 unbenannt] - Mozart. [aus KV 399]"], + "title_sorting": "[2 unbenannt] - Mozart. [aus KV 399]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.167Z" + }, + { + "id": "1003LOG_0004", + "uid": 1003, + "page": 7, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000007.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0004", + "toplevel": false, + "type": "other", + "title": "[3 unbenannt] - Händel.", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[3 unbenannt] - Händel."], + "title_sorting": "[3 unbenannt] - Händel.", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.172Z" + }, + { + "id": "1003LOG_0005", + "uid": 1003, + "page": 9, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000009.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0005", + "toplevel": false, + "type": "other", + "title": "[4 unbenannt]", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[4 unbenannt]"], + "title_sorting": "[4 unbenannt]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.174Z" + }, + { + "id": "1003LOG_0006", + "uid": 1003, + "page": 12, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000012.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0006", + "toplevel": false, + "type": "other", + "title": "[5] Fuga de Seb. Bach. [BWV 873/2]", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[5] Fuga de Seb. Bach. [BWV 873/2]"], + "title_sorting": "[5] Fuga de Seb. Bach. [BWV 873/2]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.177Z" + }, + { + "id": "1003LOG_0007", + "uid": 1003, + "page": 15, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000015.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0007", + "toplevel": false, + "type": "other", + "title": "[6 unbenannt] - Bach. [BWV 846/2]", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["[6 unbenannt] - Bach. [BWV 846/2]"], + "title_sorting": "[6 unbenannt] - Bach. [BWV 846/2]", + "type_usi": ["other"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.180Z" + }, + { + "id": "1003LOG_0008", + "uid": 1003, + "page": 17, + "thumbnail": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000017.tif.thumbnail.jpg", + "partof": 0, + "root": 0, + "sid": "LOG_0008", + "toplevel": false, + "type": "jacket", + "title": "Originalumschlag", + "location": "https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml", + "collection": [ + "LDP: Bach-Archiv Leipzig - Sammlung Manfred Gorke", + "Musik", + "Projekt: Bestände im Bach-Archiv Leipzig" + ], + "fulltext": "", + "title_usi": ["Originalumschlag"], + "title_sorting": "Originalumschlag", + "type_usi": ["jacket"], + "owner_usi": ["SLUB Dresden"], + "serial_usi": [""], + "serial_sorting": "", + "purl": "", + "urn": "", + "volume": "", + "record_id": "", + "timestamp": "2021-12-03T09:44:22.182Z" + } +] diff --git a/Tests/Fixtures/Hooks/documents.xml b/Tests/Fixtures/Hooks/documents.xml new file mode 100644 index 0000000000..562da64cea --- /dev/null +++ b/Tests/Fixtures/Hooks/documents.xml @@ -0,0 +1,222 @@ + + + + 1001 + 20000 + 1631775000 + 1631775000 + 2 + 0 + 0 + 0 + 0 + + + https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml + oai:de:slub-dresden:db:id-476251419 + 476251419 + 476251419 + + http://digital.slub-dresden.de/id476251419 + 10 Keyboard pieces - Go. S. 658 + 10 Keyboard pieces - Go. S. 658 + + [1759-1800] + [S.l.] + https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000003.tif.thumbnail.jpg + 59 + 0 + + + + + + + + + 10 Keyboard pieces - Go. S. 658 + 10 Keyboard pieces - Go. S. 658 + 10001 + 1 + 0 + METS + + + + 1002 + 20000 + 1631774000 + 1631774000 + 2 + 0 + 0 + 0 + 0 + + + https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml + oai:de:slub-dresden:db:id-476248086 + 476248086 + 476248086 + urn:nbn:de:bsz:14-db-id4762480864 + http://digital.slub-dresden.de/id476248086 + 6 Sacred songs - Go. S. 591 + 6 Sacred songs - Go. S. 591 + + [1840-1860] + [S.l.] + https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000001.tif.thumbnail.jpg + 59 + 0 + + + + + + + + + 6 Sacred songs - Go. S. 591 + 6 Sacred songs - Go. S. 591 + 10001 + 1 + 0 + METS + + + + 1003 + 20000 + 1631776000 + 1631776000 + 2 + 0 + 0 + 0 + 0 + + + https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml + oai:de:slub-dresden:db:id-476251729 + 476251729 + 476251729 + urn:nbn:de:bsz:14-db-id4762517292 + http://digital.slub-dresden.de/id476251729 + 6 Fugues - Go. S. 317 + 6 Fugues - Go. S. 317 + + [um 1820] + [S.l.] + https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000001.tif.thumbnail.jpg + 59 + 0 + + + + + + + + 3 + 6 Fugues - Go. S. 317 + 6 Fugues - Go. S. 317 + 10001 + 1 + 0 + METS + + + + 1101 + 20000 + 1631279509 + 1631279509 + 2 + 0 + 0 + 0 + a:8:{s:5:"label";N;s:10:"index_name";N;s:8:"oai_name";N;s:11:"description";N;s:9:"documents";N;s:5:"owner";N;s:6:"status";N;s:16:"sys_language_uid";N;} + 0 + + + 0 + 0 + + Musik + + music + + + 3 + 0 + 0 + 0 + + + + 1102 + 20000 + 1631279509 + 1631279509 + 2 + 0 + 0 + 0 + a:8:{s:5:"label";N;s:10:"index_name";N;s:8:"oai_name";N;s:11:"description";N;s:9:"documents";N;s:5:"owner";N;s:6:"status";N;s:16:"sys_language_uid";N;} + 0 + + + 0 + 0 + + collection-with-single-document + + collection-with-single-document + + + 4 + 0 + 0 + 0 + + + + 1201 + 1001 + 1101 + + + + docs_colls + + + + 1202 + 1002 + 1101 + + + + docs_colls + + + + 1203 + 1003 + 1101 + + + + docs_colls + + + + 1204 + 1001 + 1102 + + + + docs_colls + + diff --git a/Tests/Fixtures/Hooks/metadata.xml b/Tests/Fixtures/Hooks/metadata.xml new file mode 100644 index 0000000000..16467ed252 --- /dev/null +++ b/Tests/Fixtures/Hooks/metadata.xml @@ -0,0 +1,113 @@ + + + + 5001 + 20000 + 1638557803 + 1631532810 + 1 + 0 + 0 + 0 + + 0 + 32 + + + title + 1 + + + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + + + + 5002 + 20000 + 1638557803 + 1631532810 + 1 + 0 + 0 + 0 + + 0 + 32 + + + collection + 1 + + + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + + + + 5101 + 20000 + 1638557803 + 1631532810 + 1 + 0 + 5001 + 5202 + concat(./mods:titleInfo/mods:nonSort," ",./mods:titleInfo/mods:title) + ./mods:titleInfo/mods:title + 0 + + + + 5102 + 20000 + 1638557803 + 1631532810 + 1 + 0 + 5002 + 5202 + ./mods:relatedItem[@type="series"]/mods:titleInfo/mods:title[@lang="ger"] + + 0 + + + + 5201 + 0 + 1638557803 + 1631532810 + 1 + 0 + ALTO + alto + http://www.loc.gov/standards/alto/ns-v2# + Kitodo\Dlf\Format\Alto + + + 5202 + 0 + 1638557803 + 1631532810 + 1 + 0 + MODS + mods + http://www.loc.gov/mods/v3 + Kitodo\Dlf\Format\Mods + + diff --git a/Tests/Fixtures/Hooks/solrcores.xml b/Tests/Fixtures/Hooks/solrcores.xml new file mode 100644 index 0000000000..28d3ce9736 --- /dev/null +++ b/Tests/Fixtures/Hooks/solrcores.xml @@ -0,0 +1,13 @@ + + + + 1 + 20000 + 1631254345 + 1631186030 + 1 + 0 + + + + diff --git a/Tests/Functional/Hooks/DataHandlerTest.php b/Tests/Functional/Hooks/DataHandlerTest.php new file mode 100644 index 0000000000..e155bc138a --- /dev/null +++ b/Tests/Functional/Hooks/DataHandlerTest.php @@ -0,0 +1,212 @@ + + * + * This file is part of the Kitodo and TYPO3 projects. + * + * @license GNU General Public License version 3 or later. + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + */ + +namespace Kitodo\Dlf\Tests\Functional\Hooks; + +use Kitodo\Dlf\Common\Solr; +use Kitodo\Dlf\Domain\Repository\DocumentRepository; +use Kitodo\Dlf\Domain\Repository\SolrCoreRepository; +use Kitodo\Dlf\Hooks\DataHandler; +use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; +use TYPO3\CMS\Core\Localization\LanguageService; +use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; + +class DataHandlerTest extends FunctionalTestCase +{ + public function setUp(): void + { + parent::setUp(); + + $this->importDataSet(__DIR__ . '/../../Fixtures/Hooks/documents.xml'); + $this->importDataSet(__DIR__ . '/../../Fixtures/Hooks/metadata.xml'); + $this->importDataSet(__DIR__ . '/../../Fixtures/Hooks/solrcores.xml'); + $this->persistenceManager = $this->objectManager->get(PersistenceManager::class); + $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 0); + + $this->setUpSolr(1, 20000, __DIR__ . '/../../Fixtures/Hooks/documents.solr.json'); + } + + /** + * @test + */ + public function canProcessDatamap_postProcessFieldArray() + { + $id = 0; + $dataHandler = new DataHandler(); + + // status 'new' + $fieldArray = ['title' => 'Example']; + $expected = ['title' => 'Example', 'title_sorting' => 'Example']; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_documents', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['is_listed' => 1]; + $expected = ['is_listed' => 1, 'index_stored' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_metadata', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_autocomplete' => 1]; + $expected = ['index_autocomplete' => 1, 'index_indexed' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_metadata', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = []; + $expected = []; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_metadata', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['label' => 'Example label']; + $expected = ['label' => 'Example label', 'index_name' => 'Example label']; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_collections', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_name' => 'Example label']; + $expected = ['index_name' => 'Example label', 'label' => 'Example label']; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_libraries', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_name' => 'Example_sorting']; + $expected = ['index_name' => 'Example_sorting0', 'label' => 'Example_sorting']; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_structures', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_name' => 'new_core_name']; + $expected = ['index_name' => 'new_core_name']; + $dataHandler->processDatamap_postProcessFieldArray('new', 'tx_dlf_solrcores', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + // status 'update' + $fieldArray = ['is_listed' => 1]; + $expected = ['is_listed' => 1, 'index_stored' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('update', 'tx_dlf_metadata', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_stored' => 0]; + $expected = ['index_stored' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('update', 'tx_dlf_metadata', 5001, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_autocomplete' => 1]; + $expected = ['index_autocomplete' => 1, 'index_indexed' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('update', 'tx_dlf_metadata', $id, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_indexed' => 0]; + $expected = ['index_indexed' => 1]; + $dataHandler->processDatamap_postProcessFieldArray('update', 'tx_dlf_metadata', 5001, $fieldArray); + $this->assertEquals($expected, $fieldArray); + + $fieldArray = ['index_indexed' => 0]; + $expected = ['index_indexed' => 0]; + $dataHandler->processDatamap_postProcessFieldArray('update', 'tx_dlf_metadata', 5002, $fieldArray); + $this->assertEquals($expected, $fieldArray); + } + + /** + * @test + */ + public function canProcessDatamap_afterDatabaseOperations() + { + $GLOBALS['LANG'] = LanguageService::create('default'); + $solrSettings = [ + 'solrcore' => 1, + 'storagePid' => 20000, + ]; + $id = 1001; + $dataHandler = new DataHandler(); + + // check doc title in index + $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '*']); + $solrSearch->getQuery()->execute(); + $elementFound = false; + foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) { + if ($solrDoc['toplevel'] && $solrDoc['uid'] === $id) { + $this->assertEquals('Old title', $solrDoc['title']); + $elementFound = true; + break; + } + } + $this->assertTrue($elementFound); + + // doc title in index should not change + $fieldArray = []; + $dataHandler->processDatamap_afterDatabaseOperations('update', 'tx_dlf_documents', $id, $fieldArray); + $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '*']); + $solrSearch->getQuery()->execute(); + $elementFound = false; + foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) { + if ($solrDoc['toplevel'] && $solrDoc['uid'] === $id) { + $this->assertEquals('Old title', $solrDoc['title']); + $elementFound = true; + break; + } + } + $this->assertTrue($elementFound); + + // doc title in index should be updated + $fieldArray = ['hidden' => 1]; + $dataHandler->processDatamap_afterDatabaseOperations('update', 'tx_dlf_documents', $id, $fieldArray); + $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '10 Keyboard pieces']); + $solrSearch->getQuery()->execute(); + $elementFound = false; + foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) { + if ($solrDoc['toplevel'] && $solrDoc['uid'] === $id) { + $this->assertEquals('10 Keyboard pieces - Go. S. 658', $solrDoc['title']); + $elementFound = true; + break; + } + } + $this->assertTrue($elementFound); + } + + /** + * @test + */ + public function canProcessCmdmap_postProcess() + { + $GLOBALS['LANG'] = LanguageService::create('default'); + $solrSettings = [ + 'solrcore' => 1, + 'storagePid' => 20000, + ]; + $dataHandler = new DataHandler(); + + $dataHandler->processCmdmap_postProcess('delete', 'tx_dlf_documents', 1002); + $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '6 Sacred songs - Go. S. 591']); + $solrSearch->getQuery()->execute(); + $this->assertEquals(0, $solrSearch->getNumFound(), 'Document should have been removed from index'); + + $dataHandler->processCmdmap_postProcess('undelete', 'tx_dlf_documents', 1002); + $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '6 Sacred songs - Go. S.']); + $solrSearch->getQuery()->execute(); + $this->assertEquals(1, $solrSearch->getNumFound(), 'Document should have been reindexed'); + } + + protected function setUpSolr($uid, $storagePid, $solrFixture) + { + $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid); + + // Setup Solr only once for all tests in this suite + static $solr = null; + + if ($solr === null) { + $coreName = Solr::createCore(); + $solr = Solr::getInstance($coreName); + $this->importSolrDocuments($solr, $solrFixture); + } + + $coreModel = $this->solrCoreRepository->findByUid($uid); + $coreModel->setIndexName($solr->core); + $this->solrCoreRepository->update($coreModel); + $this->persistenceManager->persistAll(); + } +}