Am I testing the wrong URLs?

Thomas Sødring thomas.sodring at hioa.no
Mon Jan 30 09:28:59 CET 2017


On 01/30/2017 12:04 AM, Petter Reinholdtsen wrote:
> [Thomas Sødring]
>> Thanks for the feedback.  Short answer, No.
>>
>> This version of the core now requires a JSON payload when creating Noark
>> entities (fonds, series, file etc.).
> What about just looking up, and not creating?  I expected to be able to
> GET the URLs listed as hrefs on <URL: http://localhost:8092/noark5v4/ >.
> Are my expectations wrong?
Your expectations aren't wrong! I haven't implemented that part as I'm
waiting for confirmation of what should be there. But I suppose there is
no reason to not implement it.  I will do that this evening and push it
to git.
>
>> These payload (request body) contains information that is specified as
>> mandatory by the standard. So missing information / payload will
>> result in a "404 Not found" with an exception description "malformed
>> payload", or something like that.
> Aha.  Should this be needed also when doing simple GETs?
> GET seem to work when visiting <URL: http://n5test.kxml.no/api/ >.
No, you don't need payloads for GET.  For GET there will be two types of
operations supported. findAll and findOne.

findAll
/hateoas-api/arkivstruktur/arkiv

findOne
/hateoas-api/arkivstruktur/arkiv/{systemID}

findOne should be working on all objects (fonds down to documentObject).

I took away the findAll option as this needs to be covered by OData
syntax. findAll on 100,000 rows of data is just silly so I either need
to switch on JPA-based pagination or wait until I figure out how to
handle OData syntax. I had a quick try implementing some of it in
SeriesController.

/hateoas-api/arkivstruktur/arkivdel?top=1&skip=5

But I see I need a generic approach to handling this. Currently I do not
have a clear strategy to implement OData for findAll with filtering.
There is no native support for it in Spring. OData is something that
came out of Microsoft and that may be why it will take time before it's
implemented decently. It's a discussion for another day, but I have
researched and seen that Elasticsearch supports OData and I have found a
library that converts a URL with OData syntax to a REST JSON query for
elasticsearch so I think search will be prioritised in release 0.2. 0.2
release should be a fully functional implementation of the REST
interface. This release has POST and GET for individual objects.

I will double check the GETs this afternoon to make sure they are working.

>
>> Can you cd into nikita-noark5-core/core-webapp/src/main/resources/curl
>> and run the ./run_curl.sh command to make sure everything is ok?
> This worked as it should.  I got this output:
>
> created Fonds 1             (68500e28-59bb-4a66-abe2-849fa7c546fb) 
> created  Series 1            (022ecd22-b427-4c41-acc4-ef603356537e) 
> created   File 1              (470ad9b4-5d11-4ecc-9f98-7ea730506ac4) 
> created    Record 1            (0562f72b-e248-4f43-821f-ca72e4b588e9) associated with (470ad9b4-5d11-4ecc-9f98-7ea730506ac4) 
> created     DocumentDescription (dadcaf02-513d-4ed4-bac1-495c7a2e9196) associated with (0562f72b-e248-4f43-821f-ca72e4b588e9) 
> created      DocumentObject      (96488345-ef57-4811-94e9-6d26072150fd) associated with (dadcaf02-513d-4ed4-bac1-495c7a2e9196) 
> created    BasicRecord 1            (4c04c389-5853-40b7-9a49-91cb6b7f44b7) associated with (470ad9b4-5d11-4ecc-9f98-7ea730506ac4) 
> created   CaseFile 1          (0e530c4d-9726-4346-b679-e137fda9c074) 
> created    RegistryEntry 1     (ee992570-9694-45ae-9166-256f07be68c1) associated with (0e530c4d-9726-4346-b679-e137fda9c074)
> created     DocumentDescription (b3e55753-705e-4ec2-9fbd-2757b46bdcdd) associated with (ee992570-9694-45ae-9166-256f07be68c1) 
> created      DocumentObject      (8c29ccda-5fae-411b-8f51-575f2f0e89ba) associated with (b3e55753-705e-4ec2-9fbd-2757b46bdcdd) 
> created    RegistryEntry 2     (a7bf05df-5d07-41c8-bddb-53e6d3c6d9d1) associated with (0e530c4d-9726-4346-b679-e137fda9c074)
> created     DocumentDescription (70d4f799-b1ba-42e7-8c4f-2c5d6800c8c2) associated with (a7bf05df-5d07-41c8-bddb-53e6d3c6d9d1) 
> created      DocumentObject      (529d5991-fc84-4ea9-ae32-d7d9cd5204b8) associated with (70d4f799-b1ba-42e7-8c4f-2c5d6800c8c2) 
> created   CaseFile 2          (2fabdac5-d443-4189-9f07-44d5bc5b6cec) 
> created    RegistryEntry 1     (7c42a93c-75db-4fd3-8cbd-2ef8f4d56f80) associated with (2fabdac5-d443-4189-9f07-44d5bc5b6cec)
> created     DocumentDescription (369f4a34-7779-4e35-a49f-8e3aefcadabf) associated with (7c42a93c-75db-4fd3-8cbd-2ef8f4d56f80) 
> created      DocumentObject      (f290ccec-8503-4b76-a089-b2400cc81ed6) associated with (369f4a34-7779-4e35-a49f-8e3aefcadabf) 
> created    RegistryEntry 2     (0cfd58dc-ebfb-40c6-aa5c-9f87209c67ea) associated with (2fabdac5-d443-4189-9f07-44d5bc5b6cec)
> created     DocumentDescription (e0240efc-ad20-47e5-987f-0cdae5155c7d) associated with (0cfd58dc-ebfb-40c6-aa5c-9f87209c67ea) 
> created      DocumentObject      (dce7c20c-860c-4283-80f0-0ad38faeadde) associated with (e0240efc-ad20-47e5-987f-0cdae5155c7d) 
> created   CaseFile 3          (b4478762-74f8-4dfa-a3f4-a140bb633952) 
> created    RegistryEntry 1     (6ffa62a4-23c0-41fc-bccf-d4ba5c4733b9) associated with (b4478762-74f8-4dfa-a3f4-a140bb633952)
> created     DocumentDescription (8330a740-2a3e-443a-9ce9-4745a0ec27e4) associated with (6ffa62a4-23c0-41fc-bccf-d4ba5c4733b9) 
> created      DocumentObject      (83438440-7c88-46ff-ae7b-1acceaef8d94) associated with (8330a740-2a3e-443a-9ce9-4745a0ec27e4) 
> created    RegistryEntry 2     (8ce8b793-3b89-4924-bfad-47e2b67f5038) associated with (b4478762-74f8-4dfa-a3f4-a140bb633952)
> created     DocumentDescription (0f8855ed-6b8f-4d9d-a722-a89dec8c13ae) associated with (8ce8b793-3b89-4924-bfad-47e2b67f5038) 
> created      DocumentObject      (e2c9547e-1729-4a0d-94a9-814170c7af3a) associated with (0f8855ed-6b8f-4d9d-a722-a89dec8c13ae) 
Good, that means it's working correctly. Glad to see it working on other
machines :)

>> I will update the project description to reflect this.
> Sound good.
>

I think one of the things I need to get into place is a proper testing
framework. I did some work on that before Christmas, but didn't land it
properly! The reason for that is that I had a lot of trouble logging
onto the core within the test framework. This release saw a lot of
changes that were committed at once. I know this is bad practice, but in
the last month I had to test and try different approaches to figuring
out the correct approach. Going forward I will commit small updates
solving particular issues.  The structure of the codebase should now be
reasonably stable. I will branch the existing master and work on the
branch for 0.2.

The next big change in the codebase will be Elasticsearch integration
and OData support. After that I will fully implement roles and
ownership/groups and at that point it the core should be usable, at
least for teaching purposes. I'm hoping to be finished with this mid to
end of march.

 - Tom



More information about the nikita-noark mailing list