use of org.eclipse.persistence.testing.models.interfaces.Actor in project eclipselink by eclipse-ee4j.
the class VariableOneToOneMappingIsNotDefinedProperlyTest method setup.
@Override
protected void setup() {
descriptor = getSession().getDescriptor(Actor.class);
mapping = (VariableOneToOneMapping) descriptor.getMappingForAttributeName("program");
sourceField = new DatabaseField("ACTOR.PROGRAM_ID");
targetQueryKeyName = (String) mapping.getSourceToTargetQueryKeyNames().get(sourceField);
mapping.addForeignQueryKeyName("ACTOR.PROGRAM_ID", "name2");
mapping.getForeignKeyFields().removeElement(sourceField);
actor = Actor.example4();
databaseRow = new DatabaseRecord();
if (testMode == 0) {
// nothing extra needed
} else if (testMode == 1) {
ObjectChangeSet changeSet = new ObjectChangeSet(new Vector(), descriptor, actor, new UnitOfWorkChangeSet(), true);
changeRecord = new ObjectReferenceChangeRecord(changeSet);
changeRecord.setNewValue(changeSet);
} else if (testMode == 2) {
deleteObjectQuery = new DeleteObjectQuery(actor);
deleteObjectQuery.setSession((AbstractSession) getSession());
}
expectedException = DescriptorException.variableOneToOneMappingIsNotDefinedProperly(mapping, descriptor, targetQueryKeyName);
}
Aggregations