Search in sources :

Example 6 with Client

use of org.eclipse.persistence.testing.models.aggregate.Client in project eclipselink by eclipse-ee4j.

the class StoredInObjectOptimisticLockTest method verify.

/**
 * Verify if the objects match completely through allowing the session to use the descriptors.
 * This will compare the objects and all of their privately owned parts.
 */
@Override
protected void verify() {
    Session remoteServer = ((DistributedServer) DistributedServersModel.getDistributedServers().get(0)).getDistributedSession();
    // The main session is now in transaction (started in TransactionalTestCase.setup).
    // remoteServer was setup to share accessor (and therefore connection) with the main session (see DistributedServer constructor),
    // therefore remoteServer's connection is in transaction.
    // Because it seems there is no way to write object with version without transaction,
    // let's compare versions directly
    Client remoteClient = (Client) remoteServer.executeQuery(this.query);
    if (remoteClient.getVersion().getVersion() != ((Client) objectToBeWritten).getVersion().getVersion()) {
        throw new TestErrorException("Failed to copy the version number to the remote system");
    }
}
Also used : TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException) Client(org.eclipse.persistence.testing.models.aggregate.Client) Session(org.eclipse.persistence.sessions.Session)

Example 7 with Client

use of org.eclipse.persistence.testing.models.aggregate.Client in project eclipselink by eclipse-ee4j.

the class AggregateTestModel method getSRGCheckForNullUnitOfWorkTestSuite.

// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGCheckForNullUnitOfWorkTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("AggregateCheckForNullUnitOfWorkTestSuite");
    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 CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example1")));
    suite.addTest(new CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example2")));
    suite.addTest(new CheckForNullUnitOfWorkTest(manager.getObject(employeeClass, "example3")));
    return suite;
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) Client(org.eclipse.persistence.testing.models.aggregate.Client) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient)

Example 8 with Client

use of org.eclipse.persistence.testing.models.aggregate.Client in project eclipselink by eclipse-ee4j.

the class AggregateTestModel method getSRGUpdateObjectTestSuite.

// SRG test set is maintained by QA only, do NOT add any new tests into it.
public static TestSuite getSRGUpdateObjectTestSuite() {
    TestSuite suite = new TestSuite();
    suite.setName("AggregateUpdateObjectTestSuite");
    suite.setDescription("This suite tests the updating of each object in the aggregate model.");
    Class<Employee1> employee1Class = Employee1.class;
    Class<Employee> employeeClass = Employee.class;
    Class<Client> clientClass = Client.class;
    Class<EvaluationClient> evaluationClientClass = EvaluationClient.class;
    PopulationManager manager = PopulationManager.getDefaultManager();
    // =================================================================================
    suite.addTest(new WriteObjectTest(manager.getObject(employee1Class, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employee1Class, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employee1Class, "example2")));
    // =================================================================================
    suite.addTest(new WriteObjectTest(manager.getObject(employeeClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example2")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(employeeClass, "example3")));
    suite.addTest(new WriteObjectTest(manager.getObject(clientClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example2")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(clientClass, "example3")));
    suite.addTest(new WriteObjectTest(manager.getObject(evaluationClientClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example2")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(evaluationClientClass, "example3")));
    // update testing on aggregate collection mapping
    suite.addTest(new WriteObjectTest(manager.getObject(Agent.class, "example1")));
    suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Agent.class, "example1")));
    if (useNewAggregateCollection) {
        suite.addTest(new WriteObjectTest(manager.getObject(Builder.class, "example1")));
        suite.addTest(new UnitOfWorkBasicUpdateObjectTest(manager.getObject(Builder.class, "example1")));
    }
    return suite;
}
Also used : Employee(org.eclipse.persistence.testing.models.aggregate.Employee) UnitOfWorkBasicUpdateObjectTest(org.eclipse.persistence.testing.framework.UnitOfWorkBasicUpdateObjectTest) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) WriteObjectTest(org.eclipse.persistence.testing.framework.WriteObjectTest) PopulationManager(org.eclipse.persistence.tools.schemaframework.PopulationManager) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient) Client(org.eclipse.persistence.testing.models.aggregate.Client) EvaluationClient(org.eclipse.persistence.testing.models.aggregate.EvaluationClient) Employee1(org.eclipse.persistence.testing.models.aggregate.Employee1)

Aggregations

Client (org.eclipse.persistence.testing.models.aggregate.Client)8 PopulationManager (org.eclipse.persistence.tools.schemaframework.PopulationManager)6 TestSuite (org.eclipse.persistence.testing.framework.TestSuite)5 Employee (org.eclipse.persistence.testing.models.aggregate.Employee)5 EvaluationClient (org.eclipse.persistence.testing.models.aggregate.EvaluationClient)5 Agent (org.eclipse.persistence.testing.models.aggregate.Agent)3 Builder (org.eclipse.persistence.testing.models.aggregate.Builder)3 Employee1 (org.eclipse.persistence.testing.models.aggregate.Employee1)3 Session (org.eclipse.persistence.sessions.Session)1 DeleteObjectTest (org.eclipse.persistence.testing.framework.DeleteObjectTest)1 ReadObjectTest (org.eclipse.persistence.testing.framework.ReadObjectTest)1 TestErrorException (org.eclipse.persistence.testing.framework.TestErrorException)1 UnitOfWorkBasicUpdateObjectTest (org.eclipse.persistence.testing.framework.UnitOfWorkBasicUpdateObjectTest)1 WriteObjectTest (org.eclipse.persistence.testing.framework.WriteObjectTest)1 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)1