use of org.eclipse.persistence.testing.framework.TestErrorException in project eclipselink by eclipse-ee4j.
the class TestUpdateAggregateEntityU1MMapMapping method test.
@Override
public void test() {
UnitOfWork uow = getSession().acquireUnitOfWork();
holders = uow.readAllObjects(AggregateEntityU1MMapHolder.class, holderExp);
changedHolder = (AggregateEntityU1MMapHolder) holders.get(0);
AggregateMapKey key = new AggregateMapKey();
key.setKey(11);
changedHolder.removeAggregateToEntityMapItem(key);
EntityMapValue mapValue = new EntityMapValue();
mapValue.setId(3);
mapValue = (EntityMapValue) uow.registerObject(mapValue);
key = new AggregateMapKey();
key.setKey(33);
changedHolder.addAggregateToEntityMapItem(key, mapValue);
uow.commit();
Object holderForComparison = uow.readObject(changedHolder);
if (!compareObjects(changedHolder, holderForComparison)) {
throw new TestErrorException("Objects do not match after write");
}
}
use of org.eclipse.persistence.testing.framework.TestErrorException in project eclipselink by eclipse-ee4j.
the class TestUpdateDirectAggregateMapMapping method verify.
@Override
public void verify() {
getSession().getIdentityMapAccessor().initializeIdentityMaps();
Object initialHolder = holders.get(0);
holders = getSession().readAllObjects(DirectAggregateMapHolder.class, holderExp);
DirectAggregateMapHolder holder = (DirectAggregateMapHolder) holders.get(0);
if (!compareObjects(holder, changedHolder)) {
throw new TestErrorException("Objects do not match reinitialize");
}
if (holder.getDirectToAggregateMap().containsKey(1)) {
throw new TestErrorException("Item that was removed is still present in map.");
}
AggregateMapValue value = (AggregateMapValue) holder.getDirectToAggregateMap().get(3);
if (value.getValue() != 3) {
throw new TestErrorException("Item was not correctly added to map");
}
}
use of org.eclipse.persistence.testing.framework.TestErrorException in project eclipselink by eclipse-ee4j.
the class TestUpdateDirectDirectMapMapping method verify.
@Override
public void verify() {
getSession().getIdentityMapAccessor().initializeIdentityMaps();
Object initialHolder = holders.get(0);
holders = getSession().readAllObjects(DirectDirectMapHolder.class, holderExp);
DirectDirectMapHolder holder = (DirectDirectMapHolder) holders.get(0);
if (!compareObjects(holder, changedHolder)) {
throw new TestErrorException("Objects do not match reinitialize");
}
if (holder.getDirectToDirectMap().containsKey(1)) {
throw new TestErrorException("Item that was removed is still present in map.");
}
Integer value = (Integer) holder.getDirectToDirectMap().get(3);
if (value != 3) {
throw new TestErrorException("Item was not correctly added to map");
}
}
use of org.eclipse.persistence.testing.framework.TestErrorException in project eclipselink by eclipse-ee4j.
the class TestUpdateDirectEntityMapMapping method verify.
@Override
public void verify() {
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
holder = (DirectEntityMapHolder) getSession().readObject(holder);
if (!compareObjects(holder, changedHolder)) {
throw new TestErrorException("Objects do not match reinitialize");
}
if (holder.getDirectToEntityMap().size() != 2) {
throw new TestErrorException("Incorrect Number of MapEntityValues was read.");
}
EntityMapValue value = (EntityMapValue) holder.getDirectToEntityMap().get(33);
if (value.getId() != 3) {
throw new TestErrorException("MapEntityValue was not added properly.");
}
value = (EntityMapValue) holder.getDirectToEntityMap().get(11);
if (value != null) {
throw new TestErrorException("Deleted EntityMapValue still around.");
}
if (mapping.isPrivateOwned()) {
ReadObjectQuery query = new ReadObjectQuery(EntityMapValue.class);
ExpressionBuilder values = new ExpressionBuilder();
Expression criteria = values.get("id").equal(1);
query.setSelectionCriteria(criteria);
value = (EntityMapValue) getSession().executeQuery(query);
if (value != null) {
throw new TestErrorException("PrivateOwned EntityMapValue was not deleted.");
}
}
}
use of org.eclipse.persistence.testing.framework.TestErrorException in project eclipselink by eclipse-ee4j.
the class TestReadAggregateEntityMapMapping method verify.
@Override
public void verify() {
if (holders == null || holders.size() != 1) {
throw new TestErrorException("Incorrect number of MapHolders was read.");
}
AggregateEntityMapHolder holder = (AggregateEntityMapHolder) holders.get(0);
if (!((IndirectMap) holder.getAggregateToEntityMap()).getValueHolder().isInstantiated() && fetchJoinRelationship > 0) {
throw new TestErrorException("Relationship was not properly joined.");
}
if (holder.getAggregateToEntityMap().size() != 2) {
throw new TestErrorException("Incorrect Number of MapEntityValues was read.");
}
AggregateMapKey mapKey = new AggregateMapKey();
mapKey.setKey(11);
EntityMapValue value = (EntityMapValue) holder.getAggregateToEntityMap().get(mapKey);
if (value.getId() != 1) {
throw new TestErrorException("Incorrect MapEntityValues was read.");
}
}
Aggregations