Updated version 0.1 of Nikita - interface update

Thomas Sødring thomas.sodring at hioa.no
Thu Feb 2 11:11:22 CET 2017


Hi Petter,

Great - thanks!

I pushed a few updates, on master, that hopefully solves these issues. I
see you found four issues with your script!

*Issue 1. Mime types*
Some controllers were not set to produce

 application/vnd.noark5-v4+json

All controllers now both produce and *assume* 
application/vnd.noark5-v4+json

*Issue 2. arkivskaper controller*
The controller for arkivskaper was missing. Has been added. This
introduced a number of new classes.

(http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkivskaper)

*Issue 3. ny-arkiv*

It's working for me. When I look at the JSON below, there seems to be a
mistake with an extra comma before the closing parenthesis.

 fondsdata = {
            "title"           : "Title of the test fonds",
            "description"     : "Description of the test fonds",
            "oppbevaringsted" : [ "location 1", "location2", "location3" ],
            "documentMedium"  : "Elektronisk arkiv",
        }

Can you double check this?

*Issue 4. GET on arkiv/*
This is failing:

http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv/

It's not failing for me, can you dig deeper and see what's returning as
an error?

Other issues.
I had to change the serialisers a little bit to deal with a null pointer
issue that was introduced yesterday, when dealing with empty lists.

I also opened up the sakarkiv interface by moving saksmappe and
journalpost from arkivstruktur to sakarkiv. I will study the standard
document and see if I can figure out the rest. Currently they should
just be returning empty arrays, unless you populate with some data.

Thanks for testing! It will be good to know the interface is
independently verified correct when we're done! Part of me thinks I
should use your script, but I think at the moment it's better if we do
the testing independently. We are more likely to discover various
problems this way, as you have shown already! If I become dependent on
your script, I might miss some stuff!

 - Tom


On 02/01/2017 11:09 PM, Petter Reinholdtsen wrote:
> [Thomas Sødring]
>> Hmmm, Sorry I made a mistake here.  This:
>>
>>  http://localhost:8092/noark5v4/
>>
>>
>> is equvialent to:
>>  
>>
>>  http://n5test.kxml.no/api/
>>
>>
>> "api" is a contextpath, equivalent to my "noark5v4"
> Right.  Then I was alrady testing the correct URL.
>
>> Now I'm wondering if everything is actually OK. Can you check the
>> following steps?
> This look better, but archive creation was broken.  This is the output
> from my test script:
>
> success: able to log in
> success: found base
> success: correct content-type for base
> success: found _links in json response
> recursively discovering URLs from the root
> success: MIME type application/vnd.noark5-v4+json;charset=UTF-8 should be application/vnd.noark5-v4+json for url .
> success: MIME type application/vnd.noark5-v4+json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/
> failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/sakarkiv/
> failure: unable to fetch http://localhost:8092/noark5v4/gui/
> failure: unable to fetch http://localhost:8092/noark5v4/import-api/
> failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv/
> failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkivskaper/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/klassifikasjon/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/mappe/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/basisregistrering/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/registrering/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/dokumentobjekt/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/klasse/
> failure: MIME type application/json;charset=UTF-8 should be application/vnd.noark5-v4+json for url http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/dokumentbeskrivelse/
> failure: unable to fetch http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/ny-arkiv
> success: found .
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/basisregistrering/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/dokumentbeskrivelse/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/dokumentobjekt/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/klasse/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/klassifikasjon/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/mappe/
> success: found http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/registrering/
> 15 successes, 13 failures
> Traceback (most recent call last):
>   File "./runtest", line 223, in <module>
>     main()
>   File "./runtest", line 220, in main
>     t.runtests()
>   File "./runtest", line 211, in runtests
>     self.testNewDocument()
>   File "./runtest", line 135, in testNewDocument
>     (c, res) = self.json_post(createfondsurl, fondsdata)
>   File "./runtest", line 45, in json_post
>     response = self._browser.open(request)
>   File "/usr/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 203, in open
>     return self._mech_open(url, data, timeout=timeout)
>   File "/usr/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 255, in _mech_open
>     raise response
> mechanize._response.httperror_seek_wrapper: HTTP Error 500: Internal Server Error
>
> At the end here it is running this code:
>
>         fondsdata = {
>             "title"           : "Title of the test fonds",
>             "description"     : "Description of the test fonds",
>             "oppbevaringsted" : [ "location 1", "location2", "location3" ],
>             "documentMedium"  : "Elektronisk arkiv",
>         }
>         createfondsurl = 'hateoas-api/arkivstruktur/ny-arkiv'
>         (c, res) = self.json_post(createfondsurl, fondsdata)
>         fondinfo = json.loads(c)
>         fondid = fondinfo['systemID']
>         self.verify(fondid is not None, "created fond")
>
> and this fail in the HTTP request (aka json_post).
>
>> curl -v --header "Accept:application/vnd.noark5-v4+json" -X GET
>> http://localhost:8092/noark5v4/
>>
>> is giving me:
> Me too.
>
>> curl -v --header "Accept:application/vnd.noark5-v4+json" -X GET -b
>> cookie.txt http://localhost:8092/noarkv4/hateoas-api/arkivstruktur/
>>
>> is giving me
> I assume the noarkv4 URL is a typo for
> <URL: http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/ >, and I
> get the same result you get.
>
>>  curl -v --header "Accept:application/vnd.noark5-v4+json" -X GET -b
>> cookie.txt http://localhost:8092/noark5v4/hateoas-api/arkivstruktur/arkiv/
>>
>> is giving me:
> I get a 500 server error. :(



More information about the nikita-noark mailing list