use of org.eclipse.persistence.testing.models.aggregate.Builder in project eclipselink by eclipse-ee4j.
the class DistributedServersModel method addTests.
@Override
public void addTests() {
PopulationManager manager = PopulationManager.getDefaultManager();
Employee employee = (Employee) manager.getObject(Employee.class, "0001");
// Tests with using unit of work.
ComplexUpdateTest test = new UpdateToNullTest(employee);
addTest(test);
test = new UpdateChangeValueTest(employee);
addTest(test);
test = new UpdateChangeNothingTest(employee);
addTest(test);
test = new UpdateChangeObjectTest(employee);
addTest(test);
// bug 205939
addTest(new UpdateChangeObjectTestEmployee1((Employee1) manager.getObject(Employee1.class, "example1")));
// cr 4143
addTest(new UpdateCollectionWithNewValueTest(employee));
addTest(new VerifyDeletedObjectsTest());
addTest(new VerifyObjectsDeletedFromCacheTest());
addTest(new InsertNewCycleTest());
addTest(new InsertNewObjectIntoCycleTest());
// CR 4080
addTest(new VerifyAggregateCollectionObjectsDeletedFromCacheTest((Agent) manager.getObject(Agent.class, "example1")));
addTest(new VerifyAggregateCollectionObjectsDeletedFromCacheTest((Builder) manager.getObject(Builder.class, "example1")));
// cr 4143
addTest(new VerifyAggregateCollectionNewObjectTest((Agent) manager.getObject(Agent.class, "example1")));
addTest(new VerifyAggregateCollectionNewObjectTest((Builder) manager.getObject(Builder.class, "example1")));
// bug 3443422
addTest(new UpdateChangeObjectWithOptimisticLockTest(employee));
// bug 3485635
addTest(new StoredInObjectOptimisticLockTest((Client) manager.getObject(Client.class, "example1")));
}
use of org.eclipse.persistence.testing.models.aggregate.Builder in project eclipselink by eclipse-ee4j.
the class AggregateCollectionOuterJoinTest method setup.
@Override
public void setup() {
getSession().getIdentityMapAccessor().initializeIdentityMaps();
beginTransaction();
// insert two new agents. One will satisfy my expression with the outer join, one will not
Object bob, frank;
if (Agent.class.equals(cls)) {
bob = new Agent();
frank = new Agent();
} else {
bob = new Builder();
frank = new Builder();
}
AgentBuilderHelper.setFirstName(bob, "Bob");
AgentBuilderHelper.setLastName(bob, "Smith");
AgentBuilderHelper.setFirstName(frank, "Frank");
AgentBuilderHelper.setLastName(frank, "Jones");
House house = new House();
house.setLocation("50 O'Connor St.");
AgentBuilderHelper.addHouse(frank, house);
UnitOfWork uow = getSession().acquireUnitOfWork();
uow.registerObject(bob);
uow.registerObject(frank);
uow.commit();
}
use of org.eclipse.persistence.testing.models.aggregate.Builder in project eclipselink by eclipse-ee4j.
the class AggregateTestModel method getSRGUnitOfWorkTestSuite.
// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGUnitOfWorkTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("AggregateUnitOfWorkTestSuite");
suite.setDescription("This suite tests updating objects with UOW in the aggregate model.");
Class<Employee> employeeClass = Employee.class;
Class<Client> clientClass = Client.class;
PopulationManager manager = PopulationManager.getDefaultManager();
suite.addTest(new UnitOfWorkTest(manager.getObject(employeeClass, "example1")));
suite.addTest(new UnitOfWorkTest(manager.getObject(employeeClass, "example2")));
suite.addTest(new UnitOfWorkTest(manager.getObject(employeeClass, "example3")));
/* suite.addTest(new DeletionUnitOfWorkTest(manager.getObject(clientClass, "example1")));
suite.addTest(new DeleteObjectTest(manager.getObject(clientClass, "example2")));
suite.addTest(new DeleteObjectTest(manager.getObject(clientClass, "example3"))); */
// aggregate collection UoW test
suite.addTest(new AggregateCollectionUoWTest(manager.getObject(Agent.class, "example1")));
suite.addTest(new AggregateCollectionMultipleUoWTest(manager.getObject(Agent.class, "example1")));
// aggregate with transformation mapping test
suite.addTest(new TransformationMappingTest());
// For CR#2285, handle adding nulls to a collection.
suite.addTest(new AddNullToAggregateCollectionTest((Agent) manager.getObject(Agent.class, "example1")));
if (useNewAggregateCollection) {
suite.addTest(new AggregateCollectionUoWTest(manager.getObject(Builder.class, "example1")));
suite.addTest(new AggregateCollectionMultipleUoWTest(manager.getObject(Builder.class, "example1")));
suite.addTest(new AddNullToAggregateCollectionTest((Builder) manager.getObject(Builder.class, "example1")));
}
return suite;
}
use of org.eclipse.persistence.testing.models.aggregate.Builder in project eclipselink by eclipse-ee4j.
the class CacheHitAndInMemoryTestSuite method addUOWConformObjectTests.
public void addUOWConformObjectTests() {
PopulationManager manager = PopulationManager.getDefaultManager();
Employee example = (Employee) manager.getObject(Employee.class, "0001");
ExpressionBuilder builder = new ExpressionBuilder();
ReadObjectQuery query = new ReadObjectQuery(Employee.class, builder.get("id").greaterThan(example.getId().subtract(new BigDecimal(1))).and(builder.get("id").lessThanEqual(example.getId())));
query.conformResultsInUnitOfWork();
UnitOfWorkConformObjectTest test = new UnitOfWorkConformObjectTest(query, true);
test.setName("UnitOfWorkConformTest - hit");
addTest(test);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal("Sarah").or(builder.get("lastName").equal("")));
query.conformResultsInUnitOfWork();
test = new UnitOfWorkConformObjectTest(query, true);
test.setName("UnitOfWorkConformTest - dead-hit");
addTest(test);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal("Bobbyiop").and(builder.get("lastName").equal(null)));
query.conformResultsInUnitOfWork();
test = new UnitOfWorkConformObjectTest(query, false);
test.setName("UnitOfWorkConformTest - miss");
addTest(test);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal("Bob").and(builder.get("lastName").equal(null)));
query.conformResultsInUnitOfWork();
test = new UnitOfWorkConformObjectTest(query, true);
test.setName("UnitOfWorkConformTest - new");
addTest(test);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("lastName").equal("Bobo"));
query.conformResultsInUnitOfWork();
test = new UnitOfWorkConformObjectTest(query, true);
test.setName("UnitOfWorkConformTest - changed");
addTest(test);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal("Sarah"));
query.conformResultsInUnitOfWork();
test = new UnitOfWorkConformObjectTest(query, false);
test.setName("UnitOfWorkConformTest - deleted");
addTest(test);
addTest(new UnitOfWorkConformLikeTest());
addTest(new UnitOfWorkConformLikeSpecialCharacterTest());
addTest(new NamedQueryConformNullPointerException());
addTest(new MemoryQueryAcrossOneToOneMapping());
addTest(new MemoryQueryAcrossNestedOneToManyMapping());
addTest(new MemoryQueryAcrossOneToManyMapping());
addTest(new MemoryQueryForFunctionsAcrossOneToManyMapping());
addTest(new MemoryQueryForFunctionsAcrossOneToManyAcrossOneToOneMapping());
addTest(new MemoryQueryAcrossOneToManyMapping2());
addTest(new MemoryQueryAcrossOneToManyAcrossOneToOneMapping());
addTest(new MemoryQueryAcrossManyToManyMapping());
addTest(new MemoryQueryAcrossManyToManyAcrossOneToManyMapping());
addTest(new MemoryQueryAcrossDirectCollectionMapping());
addTest(new MemoryQueryAcrossAggregateCollectionMapping(Agent.class));
addTest(new MemoryQueryAcrossAggregateCollectionMapping(Builder.class));
addTest(new NamedQueryConformNullPointerException());
addTest(new MemoryQueryTriggerIndirection());
addTest(new MemoryQueryReturnConformedOnIndirection());
addTest(new MemoryQueryReturnNotConformedOnIndirection());
addTest(new MemoryQueryThrowExceptionOnIndirection());
// bug#2679958
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("lastName").equal(null));
DescriptorUnitOfWorkConformObjectTest test2 = new DescriptorUnitOfWorkConformObjectTest(query, true);
test2.setName("DescriptorUOWConformTest - hit");
addTest(test2);
builder = new ExpressionBuilder();
query = new ReadObjectQuery(Employee.class, builder.get("firstName").equal("Sarah"));
test2 = new DescriptorUnitOfWorkConformObjectTest(query, false);
test2.setName("DescriptorUOWConformTest - miss");
addTest(test2);
addTest(new MemoryQueryLike());
// Bug 320764
addTest(new UnitOfWorkConformReadObjectWithCriteriaTest());
}
Aggregations