shadowItem = shadowRepository.retrieveItem(shadowRequest);
assertTrue("Shadow MUST return a link", StorageLinkItem.class.isAssignableFrom(shadowItem.getClass()));
// verify that shadow item lastRequested is updated, but master is still untouched
// the attribute load will give us items without UIDs!
Attributes shadowItem1 =
shadowRepository.getAttributesHandler().getAttributeStorage().getAttributes(
shadowRepository.createUid(shadowPath));
Assert.assertTrue("Shadow must have updated lastRequested field!",
shadowItem1.getLastRequested() > lastRequest);
// verify that shadow item lastRequested is updated, but master is still untouched
// the attribute load will give us items without UIDs!
Attributes masterItem1 =
masterRepository.getAttributesHandler().getAttributeStorage().getAttributes(
masterRepository.createUid(masterPath));
Assert.assertTrue("Master must have untouched lastRequested field!",
masterItem1.getLastRequested() == lastRequest);
// now dereference the link
masterItem = getRootRouter().dereferenceLink((StorageLinkItem) shadowItem);
assertTrue("Dereferenced item MUST NOT return a link", !StorageLinkItem.class.isAssignableFrom(masterItem
.getClass()));
// remember the lastRequests
long shadowLastRequested = shadowItem.getLastRequested();
long masterLastRequested = masterItem.getLastRequested();
// verify that lastRequested is maintained (is updated to now)
Assert.assertTrue("Shadow lastRequested have to be updated", shadowLastRequested > lastRequest);
Assert.assertTrue("Master lastRequested have to be updated", masterLastRequested > lastRequest);
// verify that master item, requested during resolution has lastRequested greater or equal then shadow link
Assert.assertTrue("Master have to be updated at least at same time or later then shadow",
masterLastRequested >= shadowLastRequested);
// check the shadow attributes programatically
Attributes shadowItemAttrs =
shadowRepository.getAttributesHandler().getAttributeStorage().getAttributes(
shadowRepository.createUid(shadowPath));
Assert.assertEquals("The attributes differ", shadowLastRequested, shadowItemAttrs.getLastRequested());
// check the master attributes programatically
Attributes masterItemAttrs =
masterRepository.getAttributesHandler().getAttributeStorage().getAttributes(
masterRepository.createUid(masterPath));
Assert.assertEquals("The attributes differ", masterLastRequested, masterItemAttrs.getLastRequested());
}