Suite Set Ups

Included page: .SuiteSetUp (edit)

Setup import and scripts

import
se.uu.ub.cora.fitnesseintegration
se.uu.ub.cora.fitnesseintegration.apptoken.script
se.uu.ub.cora.fitnesseintegration.authtoken.fixture
se.uu.ub.cora.fitnesseintegration.file
se.uu.ub.cora.fitnesseintegration.compare
se.uu.ub.cora.fitnesseintegration.script
se.uu.ub.cora.fitnesseintegration.waiter.fixture
se.uu.ub.cora.fitnesseintegration.server.compare.fixtures
se.uu.ub.cora.fitnesseintegration.binary
se.uu.ub.cora.fitnesseintegration.definitionwriter
se.uu.ub.cora.fitnesseintegration.authentication
se.uu.ub.diva.cora.fitnesse

script SystemUrl
setUrl http://diva:8080/diva/
setAppTokenVerifierUrl http://login:8080/login/
setIdpLoginUrl http://idplogin:8080/idplogin/
setGatekeeperServerUrl http://gatekeeper:8080/gatekeeperserver/

script DependencyProvider
setHttpHandlerFactoryClassName se.uu.ub.cora.httphandler.HttpHandlerFactoryImp
setChildComparerUsingClassName se.uu.ub.cora.fitnesseintegration.ChildComparerImp
setComparerFactoryUsingClassName se.uu.ub.cora.fitnesseintegration.compare.ComparerFactoryImp


Import classes through pom.xml

Maven classpath [file: ./pom.xml, scope: test]:

  • Unable to parse POM file: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors: 1) No implementation for org.apache.maven.repository.RepositorySystem was bound. while locating org.apache.maven.execution.DefaultMavenExecutionRequestPopulator at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] at ClassRealm[maven, parent: ClassRealm[maven-parent, parent: null]] while locating org.apache.maven.execution.MavenExecutionRequestPopulator 1 error role: org.apache.maven.execution.MavenExecutionRequestPopulator roleHint:

Included page: .TheDiVATests.DivaTests.SuiteSetUp (edit)


Setup login


Login for admin

AuthenticationFixture
appTokenLogin? loginId appToken getAuthToken? getStatusType?
divaFitnesseEverything@system.cora.uu.se 2714f1e8-77f7-4811-9b6f-683bbb0f2a76 $adminAuthToken= CREATED
systemAdmin@diva.cora.uu.se b5ec82bb-9492-4d9f-9069-c2fac3b49493 $divaSystemAdminAuthToken= CREATED
divaAdmin@cora.epc.ub.uu.se 49ce00fb-68b5-4089-a5f7-1c225d3cf156 $divaAdminAuthToken= CREATED

script AuthTokenHolder
setAdminAuthToken $adminAuthToken

Login for user

AuthenticationFixture
appTokenLogin? loginId appToken getAuthToken? getStatusType?
divaUser@cora.epc.ub.uu.se fa98bc21-830b-4dc7-b952-ebe4cf02e921 $divaUserAuthToken= CREATED
fitnesseUser@system.cora.uu.se $userAuthToken= CREATED

script AuthTokenHolder
setUserAuthToken $userAuthToken

Login for DiVA example users

Hämta authTokens från idpLogin server

AuthenticationFixture
idpLogin? EPPN getAuthToken? getStatusType?
fitnesseSystemAdmin@user.uu.se $systemAdminAuthToken= OK
fitnesseDomainAdminUU@user.uu.se $domainAdminUUAuthToken= OK
fitnesseDomainAdminKTH@user.uu.se $domainAdminKTHAuthToken= OK
userNotInDb@user.uu.se $guestToken= OK


Included page: .TheDiVATests.DivaTests.Metadata.Binary.SetUp (edit)

Setup for binary tests


variable defined: expectedFileSize=316188
variable defined: publishedBinary=!-{"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"published"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage1.tiff"},{"name":"expectedFileSize","value":"-!${expectedFileSize}!-"}],"attributes":{"type":"generic"}}-!
variable defined: unpublishedBinary=!-{"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"unpublished"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage2.tiff"},{"name":"expectedFileSize","value":"-!${expectedFileSize}!-"}],"attributes":{"type":"generic"}}-!
variable defined: hiddenBinary=!-{"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"hidden"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage3.tiff"},{"name":"expectedFileSize","value":"-!${expectedFileSize}!-"}],"attributes":{"type":"generic"}}-!

Create binary records
RecordEndpointFixture
authToken type json testCreateRecord? getStatusType? getCreatedId?
$divaSystemAdminAuthToken binary {"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"published"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage1.tiff"},{"name":"expectedFileSize","value":"316188"}],"attributes":{"type":"generic"}} CREATED $publishedRecordId=
$divaSystemAdminAuthToken binary {"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"unpublished"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage2.tiff"},{"name":"expectedFileSize","value":"316188"}],"attributes":{"type":"generic"}} CREATED $unpublishedRecordId=
$divaSystemAdminAuthToken binary {"name":"binary","children":[{"name":"recordInfo","children":[{"name":"visibility","value":"hidden"},{"name":"dataDivider","children":[{"name":"linkedRecordType","value":"system"},{"name":"linkedRecordId","value":"divaData"}]},{"name":"validationType","children":[{"name":"linkedRecordType","value":"validationType"},{"name":"linkedRecordId","value":"genericBinary"}]}]},{"name":"originalFileName","value":"TiffImage3.tiff"},{"name":"expectedFileSize","value":"316188"}],"attributes":{"type":"generic"}} CREATED $hiddenRecordId=




variable defined: expectedUploadAnswer=
variable defined: expectedUploadResult=OK

Upload files

RecordEndpointFixture
authToken type id fileName testUpload? getStatusType?
$divaSystemAdminAuthToken binary $publishedRecordId aTiff.tiff OK
$divaSystemAdminAuthToken binary $unpublishedRecordId aTiff.tiff OK
$divaSystemAdminAuthToken binary $hiddenRecordId aTiff.tiff OK

WaitForRegExReadResultFixture
authToken recordType recordId sleepTime maxNumberOfCalls regEx waitUntilUntilRegExpFoundInReadRecord?
$divaSystemAdminAuthToken binary $publishedRecordId 250 50 \"name\":\"jp2\" Found
$divaSystemAdminAuthToken binary $unpublishedRecordId 250 50 \"name\":\"jp2\" Found
$divaSystemAdminAuthToken binary $hiddenRecordId 250 50 \"name\":\"jp2\" Found

Binary

The Binary record type is used to manage binary data files.

Binary record type

Metadata group for binary data



Read binary data tests


Admin tests

Setup admin test case

variable defined: currentAuthToken=$divaSystemAdminAuthToken

Case 1: An admin should be able to read binary data of any visibility

Read published

Setup defines

variable defined: recordId=$publishedRecordId
variable defined: expectedDownloadAnswer=
variable defined: expectedDownloadStatus=OK
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$divaSystemAdminAuthToken binary $publishedRecordId master OK
$divaSystemAdminAuthToken binary $publishedRecordId thumbnail OK
$divaSystemAdminAuthToken binary $publishedRecordId medium OK
$divaSystemAdminAuthToken binary $publishedRecordId large OK
$divaSystemAdminAuthToken binary $publishedRecordId jp2 OK

Read unpublished

Setup unpublished

variable defined: recordId=$unpublishedRecordId
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$divaSystemAdminAuthToken binary $unpublishedRecordId master OK
$divaSystemAdminAuthToken binary $unpublishedRecordId thumbnail OK
$divaSystemAdminAuthToken binary $unpublishedRecordId medium OK
$divaSystemAdminAuthToken binary $unpublishedRecordId large OK
$divaSystemAdminAuthToken binary $unpublishedRecordId jp2 OK

Read hidden

Setup hidden

variable defined: recordId=$hiddenRecordId
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$divaSystemAdminAuthToken binary $hiddenRecordId master OK
$divaSystemAdminAuthToken binary $hiddenRecordId thumbnail OK
$divaSystemAdminAuthToken binary $hiddenRecordId medium OK
$divaSystemAdminAuthToken binary $hiddenRecordId large OK
$divaSystemAdminAuthToken binary $hiddenRecordId jp2 OK

Guest tests

Setup guest test case

variable defined: currentAuthToken=$guestToken

Case 1: A guest should be only able to read published binary data

Read published

Setup published

variable defined: recordId=$publishedRecordId
variable defined: expectedDownloadStatus=OK
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$guestToken binary $publishedRecordId master OK
$guestToken binary $publishedRecordId thumbnail OK
$guestToken binary $publishedRecordId medium OK
$guestToken binary $publishedRecordId large OK
$guestToken binary $publishedRecordId jp2 OK

Read unpublished

Setup unpublished

variable defined: recordId=$unpublishedRecordId
variable defined: expectedDownloadStatus=FORBIDDEN
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$guestToken binary $unpublishedRecordId master FORBIDDEN
$guestToken binary $unpublishedRecordId thumbnail FORBIDDEN
$guestToken binary $unpublishedRecordId medium FORBIDDEN
$guestToken binary $unpublishedRecordId large FORBIDDEN
$guestToken binary $unpublishedRecordId jp2 FORBIDDEN

Read hidden

Setup hidden

variable defined: recordId=$hiddenRecordId
variable defined: expectedDownloadStatus=FORBIDDEN
DownloadFixture
authToken recordType recordId representation testDownload? getStatusType?
$guestToken binary $hiddenRecordId master FORBIDDEN
$guestToken binary $hiddenRecordId thumbnail FORBIDDEN
$guestToken binary $hiddenRecordId medium FORBIDDEN
$guestToken binary $hiddenRecordId large FORBIDDEN
$guestToken binary $hiddenRecordId jp2 FORBIDDEN


Iiif tests


Admin tests

Setup admin test case

variable defined: currentAuthToken=$divaSystemAdminAuthToken

Case 1: IIF protocol information must be present for all visibilities as an admin. Information must contain a server and identifier properties.

ChildComparerFixture
authToken type id testReadAndStoreRecord?
$divaSystemAdminAuthToken binary $publishedRecordId =~/"otherProtocols":\{"iiif":\{"server":"http://diva:8080/diva/iiif\/","identifier":"binary:\d*"/
$divaSystemAdminAuthToken binary $unpublishedRecordId =~/"otherProtocols":\{"iiif":\{"server":"http://diva:8080/diva/iiif\/","identifier":"binary:\d*"/
$divaSystemAdminAuthToken binary $hiddenRecordId =~/"otherProtocols":\{"iiif":\{"server":"http://diva:8080/diva/iiif\/","identifier":"binary:\d*"/

Guest tests

Setup guest test case

variable defined: currentAuthToken=$guestToken

Case 1: IIF protocol information must only be present for published binaries as a guest

ChildComparerFixture
authToken type id testReadAndStoreRecord?
$guestToken binary $publishedRecordId =~/"otherProtocols":\{"iiif":\{"server":"http://diva:8080/diva/iiif\/","identifier":"binary:\d*"/
$guestToken binary $unpublishedRecordId =~/^(?!.*(iiif).*).+$/
$guestToken binary $hiddenRecordId =~/^(?!.*(iiif).*).+$/

Included page: .TheDiVATests.DivaTests.Metadata.Binary.TearDown (edit)


Clean up binary records

RecordEndpointFixture
authToken type id testDeleteRecord? getStatusType?
$divaSystemAdminAuthToken binary $publishedRecordId OK
$divaSystemAdminAuthToken binary $unpublishedRecordId OK
$divaSystemAdminAuthToken binary $hiddenRecordId OK

Reset headers for smartrics fixture
Table:smartrics.rest.fitnesse.fixture.RestFixtureConfig
restfixture.default.headers