StoreDataCorruptedException, ReferenceLinkGarbageException,
StoreTooBigForSerializationException {
/*
* creation of object graph
*/
BobContainer bobContainer = new BobContainer();
Bob1 bob1 = new Bob1();
bobContainer.setObject1(bob1);
Bob2 bob2 = new Bob2();
bob1.setBob2(bob2);
store.setRoot(bobContainer);
store.save(true, false);
logger.debug("initial save");
/*
* assert garbage information after initial creation
*/
logReferenceLink();
int numberOfLinkRecord = linkRecordManager.getNumberOfLinkRecord();
/* no link record created */
assertEquals("0 link record expected", 0, numberOfLinkRecord);
int numberToGarbage = toGarbageRecordManager.getNumberOfToGarbage();
assertEquals("must not have object to garbage", 0, numberToGarbage);
int numberOfGarbageCandidate = garbageCandidateRecordManager
.getNumberOfGarbageCandidate();
assertEquals(MUST_NOT_HAVE_OBJECT_MARKED_GARBAGE_CANDIDATE, 0,
numberOfGarbageCandidate);
logAllDataIdentifier();
final int initialNumberOfDataRecord = dataManager
.getNumberOfDataRecord();
/*
* read, check data record identifier, detach object, save
*/
bobContainer = (BobContainer) store.readAndGetRoot();
final DataRecordIdentifier idBobContainer = store
.getDataRecordIdentifierAssociatedToObject(bobContainer);
logger.debug("id bob container " + idBobContainer);
assertNotNull("bobContainer must have associated data record",
idBobContainer);
bob1 = (Bob1) bobContainer.getObject1();
final DataRecordIdentifier idBob1 = store
.getDataRecordIdentifierAssociatedToObject(bob1);
logger.debug("id bob1 " + idBob1);
assertNotNull("bob1 must have associated data record", idBob1);
bob2 = bob1.getBob2();
final DataRecordIdentifier idBob2 = store
.getDataRecordIdentifierAssociatedToObject(bob2);
logger.debug("id bob2 " + idBob2);
assertNotNull("bob2 must have associated data record", idBob2);
assertDataRecord(new DataRecordIdentifier[] {
/**/StoreForTest.IDENTIFIER_FOR_STORE_HEADER,/* store header */
/**/StoreForTest.IDENTIFIER_FOR_ROOT,/* root record */
/**/idBobContainer,/**/
/**/idBob1,/**/
/**/idBob2 /**/
}, new DataRecordIdentifier[] {});
/*
* bob1 should have been "to garbage" if the management of garbage was
* activated
*/
bobContainer.setObject1(null);
store.save(true, false);
logger.debug("bob1 detached");
/*
* assert no garbage information after detaching object