Aaron,

what is your repository you are testing against? Your problem could also 
indicate an issue on the server side.

Jens


-----Original Message-----
From: Aaron Korver [mailto:[email protected]] 
Sent: Freitag, 18. Juni 2010 00:20
To: [email protected]
Subject: Strange unexpected behavior with Version_Series_Checked_Out

I'm seeing something odd regarding the canceling and checking in of
Documents.

If I get a Document by its ID, then I check it out.  Now I have the working
Copy Object ID.  Step 2) Cancel or Checkin the working copy.  Step 3)
Retrieve the Document by the version Series ID.  Now here is the unexpected
part.  If I examine the value of the Version Series Checked Out property it
says TRUE!  Step 4) Do a refresh() on the document.  Now examine the value
of Version Series Checked Out and it will be FALSE!

Below is a unit test demonstrating this behavior.  I would think that the
expected behavior is that when I get the document after checking in or
canceling then the "Version Series Checked Out" property should be false,
and I shouldn't have to do a refresh().  My suspicion is that something is
getting cached somewhere that it shouldn't be.

ObjectId docID = session.createObjectId("PUT_DOC_ID_HERE");
Document doc = (Document) session.getObject(docID);

        if (doc == null) {
            fail();
        }
        ObjectId checkedoutObjID = doc.checkOut();
        assertFalse(doc.isVersionSeriesCheckedOut().booleanValue()); // This
is expected, since haven't pulled new properties
        doc.refresh();
        assertTrue(doc.isVersionSeriesCheckedOut().booleanValue()); // This
should now be updated.
        assertNotNull(checkedoutObjID);

        Document workingCopy = (Document)
session.getObject(checkedoutObjID);
        assertTrue(workingCopy.isVersionSeriesCheckedOut().booleanValue());
        workingCopy.cancelCheckOut(); //At this point, the
isVersionSeriesCheckedOut should be false.

        assertTrue(workingCopy.isVersionSeriesCheckedOut().booleanValue());
//Since we can't refresh, has old values
        assertEquals(workingCopy.getVersionSeriesId(), doc.getId()); //
version series is the same as the original docID

        doc = (Document)
session.getObject(session.createObjectId(workingCopy.getVersionSeriesId()));
// Re-pull the document (Suspect that something here is cached)
        System.out.println(doc.isVersionSeriesCheckedOut()); //Should be
FALSE but is TRUE
        assertFalse(doc.isVersionSeriesCheckedOut().booleanValue());  //This
fails, if comment out and do the refresh then the assert below succeeds.
        doc.refresh();
        System.out.println(doc.isVersionSeriesCheckedOut());
        assertFalse(doc.isVersionSeriesCheckedOut().booleanValue());



Thanks,
Aaron Korver

Reply via email to