Search in sources :

Example 1 with WriteObjectTest

use of org.eclipse.persistence.testing.framework.WriteObjectTest in project eclipselink by eclipse-ee4j.

the class CollectionsTestModel method getWriteObjectTestSuite.

public static TestSuite getWriteObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("CollectionsWriteObjectTestSuite");
    suite.setDescription("This suite test the writing of each object in the mapping model.");
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new WriteObjectTest(manager.getObject(Restaurant.class, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Restaurant.class, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Restaurant.class, "example2")));
    return suite;
}
Also used : WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest)

Example 2 with WriteObjectTest

use of org.eclipse.persistence.testing.framework.WriteObjectTest in project eclipselink by eclipse-ee4j.

the class InsuranceObjectRelationalTestModel method getNullUpdatesTestSuite.

/**
 * For bug 2730536 try setting various object-relational fields to null.
 * Test difficulties: setting values to null effectively triggers deletes on
 * the database.  This triggers database constraints and also errors as all this
 * is done outside a unit of work.
 * It was not possible to set an existing Ref to null, without also deleting
 * what the ref pointed to.
 */
protected static TestSuite getNullUpdatesTestSuite() {
    TestSuite testSuite = new TestSuite();
    testSuite.setName("NullUpdatesTestSuite");
    testSuite.setDescription("Tests setting various object-relational fields to null.");
    // Do not use Population manager, as it does not return clones and we are
    // modifying the objects before the test.
    PolicyHolder policyHolder;
    Policy policy;
    Claim claim;
    WriteObjectTest test;
    // Test 1: Setting arrays, object arrays and Structs to null.
    policyHolder = PolicyHolder.example1();
    // Test setting an Array to null.
    policyHolder.setChildrenNames(null);
    // Test setting a Struct to null.
    policyHolder.setAddress(null);
    policyHolder.setOccupation(null);
    // Test seting an ObjectArray to null.
    policyHolder.setPhones(null);
    test = new WriteObjectTest(policyHolder);
    test.setShouldBindAllParameters(true);
    test.setMakesTrivialUpdate(false);
    test.setDescription("Tests setting null on Array, Structure, and ObjectArray mappings.");
    testSuite.addTest(test);
    // Test 2: Setting arrays and object arrays to empty vectors.
    policyHolder = PolicyHolder.example1();
    // Test setting an Array to null.
    policyHolder.setChildrenNames(new Vector());
    // Test seting an ObjectArray to null.
    policyHolder.setPhones(new Vector());
    test = new WriteObjectTest(policyHolder);
    test.setShouldBindAllParameters(true);
    test.setMakesTrivialUpdate(false);
    test.setDescription("Tests setting empty vectors on Array and NestedTable mappings.");
    testSuite.addTest(test);
    // Test 3: Setting nested tables and references to null.
    // This policy does not exist on database and has null values for Ref and NestedTables.
    policy = HousePolicy.example3();
    test = new WriteObjectTest(policy);
    test.setShouldBindAllParameters(true);
    test.setDescription("Tests setting null on Ref and NestedTable mappings.");
    testSuite.addTest(test);
    // Test 4: Setting a nested table to null, with non-trivial update.
    policyHolder = PolicyHolder.example1();
    policy = (Policy) policyHolder.getPolicies().firstElement();
    // Test setting a nested table to null.
    policy.setClaims(null);
    test = new WriteObjectTest(policy);
    test.setShouldBindAllParameters(true);
    test.setMakesTrivialUpdate(false);
    test.setDescription("Tests setting null on a Ref mapping.");
    testSuite.addTest(test);
    return testSuite;
}
Also used : Policy(org.eclipse.persistence.testing.models.insurance.Policy) HousePolicy(org.eclipse.persistence.testing.models.insurance.HousePolicy) PolicyHolder(org.eclipse.persistence.testing.models.insurance.PolicyHolder) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) Vector(java.util.Vector) Claim(org.eclipse.persistence.testing.models.insurance.Claim)

Example 3 with WriteObjectTest

use of org.eclipse.persistence.testing.framework.WriteObjectTest in project eclipselink by eclipse-ee4j.

the class EmployeeChangeFlagBasicTestModel method getUpdateObjectTestSuite.

public static TestSuite getUpdateObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeUpdateObjectTestSuite");
    suite.setDescription("This suite tests the updating of each object in the employee demo.");
    Class<Employee> employeeClass = org.eclipse.persistence.testing.models.employee.domain.Employee.class;
    Class<LargeProject> largeProjectClass = org.eclipse.persistence.testing.models.employee.domain.LargeProject.class;
    Class<SmallProject> smallProjectClass = org.eclipse.persistence.testing.models.employee.domain.SmallProject.class;
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0003")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0004")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0005")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0003")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0003")));
    return suite;
}
Also used : SmallProject(org.eclipse.persistence.testing.models.employee.domain.SmallProject) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) LargeProject(org.eclipse.persistence.testing.models.employee.domain.LargeProject)

Example 4 with WriteObjectTest

use of org.eclipse.persistence.testing.framework.WriteObjectTest in project eclipselink by eclipse-ee4j.

the class BrokerTestModel method getUpdateObjectTestSuite.

public static TestSuite getUpdateObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("BrokerUpdateObjectTestSuite");
    suite.setDescription("This suite tests update sql.");
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new WriteObjectTest(manager.getObject(Employee.class, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(Employee.class, "0005")));
    suite.addTest(new WriteObjectTest(manager.getObject(SmallProject.class, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(LargeProject.class, "0005")));
    suite.addTest(new BatchWritingWithSessionBrokerTest());
    return suite;
}
Also used : TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager)

Example 5 with WriteObjectTest

use of org.eclipse.persistence.testing.framework.WriteObjectTest in project eclipselink by eclipse-ee4j.

the class SessionsXMLBasicTestModel method getUpdateObjectTestSuite.

public static TestSuite getUpdateObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("EmployeeUpdateObjectTestSuite");
    suite.setDescription("This suite tests the updating of each object in the employee demo.");
    Class<Employee> employeeClass = Employee.class;
    Class<LargeProject> largeProjectClass = LargeProject.class;
    Class<SmallProject> smallProjectClass = SmallProject.class;
    PopulationManager manager = PopulationManager.getDefaultManager();
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0003")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0004")));
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "0005")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(smallProjectClass, "0003")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0001")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0002")));
    suite.addTest(new WriteObjectTest(manager.getObject(largeProjectClass, "0003")));
    return suite;
}
Also used : SmallProject(org.eclipse.persistence.testing.models.employee.domain.SmallProject) Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) LargeProject(org.eclipse.persistence.testing.models.employee.domain.LargeProject)

Aggregations

WriteObjectTest (org.eclipse.persistence.testing.framework.WriteObjectTest)12 TestSuite (org.eclipse.persistence.testing.framework.TestSuite)8 PopulationManager (org.eclipse.persistence.tools.schemaframework.PopulationManager)8 UnitOfWorkBasicUpdateObjectTest (org.eclipse.persistence.testing.framework.UnitOfWorkBasicUpdateObjectTest)3 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)3 LargeProject (org.eclipse.persistence.testing.models.employee.domain.LargeProject)3 SmallProject (org.eclipse.persistence.testing.models.employee.domain.SmallProject)3 Vector (java.util.Vector)1 DeleteObjectTest (org.eclipse.persistence.testing.framework.DeleteObjectTest)1 InsertObjectTest (org.eclipse.persistence.testing.framework.InsertObjectTest)1 ReadObjectTest (org.eclipse.persistence.testing.framework.ReadObjectTest)1 Client (org.eclipse.persistence.testing.models.aggregate.Client)1 Employee (org.eclipse.persistence.testing.models.aggregate.Employee)1 Employee1 (org.eclipse.persistence.testing.models.aggregate.Employee1)1 EvaluationClient (org.eclipse.persistence.testing.models.aggregate.EvaluationClient)1 Claim (org.eclipse.persistence.testing.models.insurance.Claim)1 HousePolicy (org.eclipse.persistence.testing.models.insurance.HousePolicy)1 Policy (org.eclipse.persistence.testing.models.insurance.Policy)1 PolicyHolder (org.eclipse.persistence.testing.models.insurance.PolicyHolder)1 Employee (org.eclipse.persistence.testing.models.legacy.Employee)1