Skip to content

Commit

Permalink
connect the iiif presentation file, rather than the collection (#2637)
Browse files Browse the repository at this point in the history
* add ebsco reindexer topic

* new pipeline

* connect the iiif presentation file, rather than the collection

* remove redundant test
  • Loading branch information
paul-butcher authored May 10, 2024
1 parent b02a321 commit 710cdfd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ object InvisibleMetsData {
modifiedTime: Instant
): Result[InvisibleMetsData] = {
val locationPrefix = filesRoot match {
case _: GoobiMetsXml => "v2"
case _: ArchivematicaMetsXML => "collections/archives"
case _: GoobiMetsXml => "v2/"
case _: ArchivematicaMetsXML => ""
}
for {
recordIdentifier <- root.recordIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object MetsLocation {
): DigitalLocation =
DigitalLocation(
url =
s"https://iiif.wellcomecollection.org/presentation/$locationPrefix/$recordIdentifier",
s"https://iiif.wellcomecollection.org/presentation/$locationPrefix$recordIdentifier",
locationType = LocationType.IIIFPresentationAPI,
license = license,
accessConditions = accessConditions(accessStatus, accessConditionUsage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ trait MetsDataGenerators extends SierraIdentifierGenerators {
thumbnailReference = thumbnailReference,
version = version,
modifiedTime = modifiedTime,
locationPrefix = "v2"
locationPrefix = "v2/"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ package weco.pipeline.transformer.mets.transformer
import org.scalatest.EitherValues
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
import weco.catalogue.internal_model.locations.{AccessStatus, License}
import weco.catalogue.internal_model.locations.{
AccessStatus,
DigitalLocation,
License
}
import weco.fixtures.LocalResources
import weco.pipeline.transformer.mets.generators.ArchivematicaMetsGenerators
import weco.pipeline.transformer.mets.transformers.MetsAccessConditions

import java.time.Instant

class ArchivematicaMetsXMLTest
extends AnyFunSpec
with Matchers
Expand Down Expand Up @@ -35,6 +41,21 @@ class ArchivematicaMetsXMLTest
"BA/AD/FO/OD"
}

it("uses the recordIdentifier to determine the location") {
val xml = ArchivematicaMetsXML(
archivematicaMetsWith(recordIdentifier = "BA/AD/FO/OD")
)
val metsWork = InvisibleMetsData(
root = xml,
filesRoot = xml,
version = 1,
modifiedTime = Instant.now()
).right.get.toWork
metsWork.data.items.head.locations.head
.asInstanceOf[DigitalLocation]
.url shouldBe "https://iiif.wellcomecollection.org/presentation/BA/AD/FO/OD"
}

}

describe("failure conditions") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MetsXmlTransformerTest
thumbnailReference = Some(thumbnailRef),
version = 1,
modifiedTime = now,
locationPrefix = "v2"
locationPrefix = "v2/"
)
)
}
Expand Down Expand Up @@ -90,7 +90,7 @@ class MetsXmlTransformerTest
thumbnailReference = Some(thumbnailRef),
version = 1,
modifiedTime = now,
locationPrefix = "v2"
locationPrefix = "v2/"
)
)
}
Expand Down Expand Up @@ -133,7 +133,7 @@ class MetsXmlTransformerTest
MetsAccessConditions(licence = Some(License.InCopyright)),
version = 1,
modifiedTime = now,
locationPrefix = "v2",
locationPrefix = "v2/",
fileReferences = createFileReferences(2, "b30246039"),
thumbnailReference = Some(thumbnailRef)
)
Expand Down

0 comments on commit 710cdfd

Please sign in to comment.