-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...nked-data/src/main/resources/citation/mod-linked-data/features/util/crud-settings.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: CRUD operations on settings | ||
Background: | ||
* url baseUrl | ||
|
||
@getSettings | ||
Scenario: Get settings | ||
Given path 'settings/entries' | ||
And param query = query | ||
When method GET | ||
Then status 200 | ||
* def response = $ | ||
|
||
@putSetting | ||
Scenario: Put a setting | ||
Given path 'settings/entries/' + id | ||
And request settingRequest | ||
When method PUT | ||
Then status 200 | ||
* def response = $ |
11 changes: 11 additions & 0 deletions
11
...ata/src/main/resources/citation/mod-linked-data/features/util/validation-resource.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Resource validation | ||
Background: | ||
* url baseUrl | ||
|
||
@validationErrorWithCodeOnResourceCreation | ||
Scenario: Get a resource | ||
Given path 'linked-data/resource' | ||
And request resource | ||
When method POST | ||
Then status 400 | ||
And match $.errors[0].code == code |
42 changes: 42 additions & 0 deletions
42
...itation/mod-linked-data/features/validation/lccn/deduplication/lccn-deduplication.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Feature: LCCN validation for duplicates. | ||
|
||
Background: | ||
* url baseUrl | ||
* call login testUser | ||
* def testUserHeaders = { 'Content-Type': 'application/json', 'x-okapi-token': '#(okapitoken)', 'Accept': '*/*' } | ||
* configure headers = testUserHeaders | ||
|
||
Scenario: Create a new resource in Linked Data, enable LCCN deduplication and try to create a resource with same LCCN. | ||
# Step 1: Enable LCCN deduplication | ||
* def settingsResponse = call getSettings { query: '(scope==ui-quick-marc.lccn-duplicate-check.manage and key==lccn-duplicate-check)'} | ||
* def setting = postInstanceCall.response.items[0] | ||
* karate.log('##setting##', setting) | ||
* eval setting.value.duplicateLccnCheckingEnabled = true | ||
* call putSetting { id : '#(setting.id)', settingRequest : '#(setting)'} | ||
|
||
# Step 2: Create work and instance | ||
* def workRequest = read('samples/work-request.json') | ||
* def workResponse = call postResource { resourceRequest: '#(workRequest)' } | ||
* def workId = workResponse.response.resource['http://bibfra.me/vocab/lite/Work'].id | ||
|
||
* def instanceRequest = read('samples/instance-request.json') | ||
* def instanceResponse = call postResource { resourceRequest: '#(instanceRequest)' } | ||
|
||
# Step 3: Update the instance with same LCCN (here we check linked-data -> mod-search interaction and id exclusion) | ||
* def instanceId = instanceResponse.response.resource['http://bibfra.me/vocab/lite/Instance'].id | ||
* call putResource { id: '#(instanceId)' , resourceRequest: '#(instanceRequest)' } | ||
|
||
# Step 4: Create new instance with existing LCCN, verify bad request | ||
* eval workRequest.resource['http://bibfra.me/vocab/lite/Work']['http://bibfra.me/vocab/marc/title'][0]['http://bibfra.me/vocab/marc/Title']['http://bibfra.me/vocab/marc/mainTitle'] = ['new_title'] | ||
* def newWorkResponse = call postResource { resourceRequest: '#(workRequest)' } | ||
* eval workId = newWorkResponse.response.resource['http://bibfra.me/vocab/lite/Work'].id | ||
* def newInstanceRequest = read('samples/instance-request.json') | ||
* eval newInstanceRequest.resource['http://bibfra.me/vocab/lite/Instance']['http://bibfra.me/vocab/marc/title'][0]['http://bibfra.me/vocab/marc/Title']['http://bibfra.me/vocab/marc/mainTitle'] = ['new_title'] | ||
* call validationErrorWithCodeOnResourceCreation { resource: '#(newInstanceRequest)', code: 'lccn_not_unique'} | ||
|
||
# Step 5: Disable LCCN deduplication setting | ||
* eval setting.value.duplicateLccnCheckingEnabled = false | ||
* call putSetting { id : '#(setting.id)', settingRequest : '#(setting)'} | ||
|
||
# Step 6: Create new instance with existing LCCN, verify success | ||
* call postResource { resourceRequest: '#(newInstanceRequest)' } |
42 changes: 42 additions & 0 deletions
42
...tion/mod-linked-data/features/validation/lccn/deduplication/samples/instance-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"resource":{ | ||
"http://bibfra.me/vocab/lite/Instance":{ | ||
"http://bibfra.me/vocab/marc/title":[ | ||
{ | ||
"http://bibfra.me/vocab/marc/Title":{ | ||
"http://bibfra.me/vocab/bflc/nonSortNum":[ | ||
"1" | ||
], | ||
"http://bibfra.me/vocab/marc/mainTitle":[ | ||
"deduplication_main_title" | ||
] | ||
} | ||
} | ||
], | ||
"http://library.link/vocab/map":[ | ||
{ | ||
"http://library.link/identifier/LCCN":{ | ||
"http://bibfra.me/vocab/lite/name":[ | ||
"nn0987654321" | ||
], | ||
"http://bibfra.me/vocab/marc/status":[ | ||
{ | ||
"http://bibfra.me/vocab/lite/label":[ | ||
"current" | ||
], | ||
"http://bibfra.me/vocab/lite/link":[ | ||
"http://id.loc.gov/vocabulary/mstatus/current" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"_workReference":[ | ||
{ | ||
"id":"#(workId)" | ||
} | ||
] | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...citation/mod-linked-data/features/validation/lccn/deduplication/samples/work-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"resource":{ | ||
"http://bibfra.me/vocab/lite/Work":{ | ||
"http://bibfra.me/vocab/marc/title":[ | ||
{ | ||
"http://bibfra.me/vocab/marc/Title":{ | ||
"http://bibfra.me/vocab/bflc/nonSortNum":[ | ||
"1" | ||
], | ||
"http://bibfra.me/vocab/marc/mainTitle":[ | ||
"deduplication_main_title" | ||
], | ||
"http://bibfra.me/vocab/marc/partNumber":[ | ||
"1" | ||
], | ||
"http://bibfra.me/vocab/marc/partName":[ | ||
"part 1" | ||
] | ||
} | ||
} | ||
], | ||
"http://bibfra.me/vocab/marc/content":[ | ||
{ | ||
"http://bibfra.me/vocab/marc/term":[ | ||
"cartographic image" | ||
], | ||
"http://bibfra.me/vocab/lite/link":[ | ||
"http://id.loc.gov/vocabulary/contentTypes/cri" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters