RusticiSoftware / TinCanJava

Tin Can Java Library
http://rusticisoftware.github.io/TinCanJava/
Apache License 2.0
44 stars 46 forks source link

Etag related tests failing #46

Closed gomezgoiri closed 8 years ago

gomezgoiri commented 8 years ago

When I locally execute tests using mvn clean test against a LearningLocker LRS three of them fail:

After analysing them, they all have the following behaviour in common:

  1. They assign the Etag of another entity to a new object (a previous object is reused, but its ID and some other fields are changed)
  2. They try to create this object (using saveAgentProfile, saveState or saveActivityProfile methods).
  3. The test fails because the server answers HTTP 412 error with the content "Precondition (If-Match) failed."

The tests talk about overwriting/updating an object, but since the ID changes I don't think the LRS is considering that it is the same entity anymore. Therefore the Etag is not valid for that entity and IMHO it is correct that these tests fail.

gomezgoiri commented 8 years ago

I have rewritten these test to reuse the same ID and the only one which still fails is:

So apparently, what makes an entity for Learning Locker is not only the ID but also the activity associated to that object.

In fact, after reusing the same activity this test also passes successfully.

garemoko commented 8 years ago

@gomezgoiri there appears to be a bug in the latest version of learning locker (1.11.0) around the Agent Profile API (and maybe other document APIs - I've not tested). See https://github.com/garemoko/moodle-mod_tincanlaunch/issues/80#issuecomment-160328018

It may be worth running these tests against another LRS e.g. SCORM Cloud to confirm the problem.

gomezgoiri commented 8 years ago

Thanks for the clue.

Yes, all tests pass if I use SCORM Cloud.

brianjmiller commented 8 years ago

I'm gathering this is resolved, re-open if necessary.