public void verify() { if (holders == null || holders.size() != 1) { throw new TestErrorException("Incorrect number of MapHolders was read."); } DirectDirectMapHolder holder = (DirectDirectMapHolder) holders.get(0); if (!((IndirectMap) holder.getDirectToDirectMap()).getValueHolder().isInstantiated() && fetchJoinRelationship > 0) { throw new TestErrorException("Relationship was not properly joined."); } if (holder.getDirectToDirectMap().size() != 2) { throw new TestErrorException("Incorrect Number of Map values was read."); } Integer value = (Integer) holder.getDirectToDirectMap().get(1); if (value.intValue() != 1) { throw new TestErrorException("Incorrect map value was read."); } }
public void setup() { mapping = (DirectCollectionMapping) getSession() .getProject() .getDescriptor(DirectDirectMapHolder.class) .getMappingForAttributeName("directToDirectMap"); oldFetchJoinValue = mapping.getJoinFetch(); mapping.setJoinFetch(fetchJoinRelationship); getSession() .getProject() .getDescriptor(DirectDirectMapHolder.class) .reInitializeJoinedAttributes(); UnitOfWork uow = getSession().acquireUnitOfWork(); DirectDirectMapHolder holder = new DirectDirectMapHolder(); holder.addDirectToDirectMapItem(new Integer(1), new Integer(1)); holder.addDirectToDirectMapItem(new Integer(2), new Integer(2)); uow.registerObject(holder); uow.commit(); holderExp = (new ExpressionBuilder()).get("id").equal(holder.getId()); getSession().getIdentityMapAccessor().initializeAllIdentityMaps(); }